@univerjs/sheets-formula-ui 0.16.1 → 0.17.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.
Files changed (61) hide show
  1. package/lib/cjs/index.js +5 -5
  2. package/lib/cjs/locale/ca-ES.js +1 -1
  3. package/lib/cjs/locale/en-US.js +1 -1
  4. package/lib/cjs/locale/es-ES.js +1 -1
  5. package/lib/cjs/locale/fa-IR.js +1 -1
  6. package/lib/cjs/locale/fr-FR.js +1 -1
  7. package/lib/cjs/locale/ja-JP.js +1 -1
  8. package/lib/cjs/locale/ko-KR.js +1 -1
  9. package/lib/cjs/locale/ru-RU.js +1 -1
  10. package/lib/cjs/locale/sk-SK.js +1 -1
  11. package/lib/cjs/locale/vi-VN.js +1 -1
  12. package/lib/cjs/locale/zh-CN.js +1 -1
  13. package/lib/cjs/locale/zh-TW.js +1 -1
  14. package/lib/es/index.js +1518 -1559
  15. package/lib/es/locale/ca-ES.js +1 -6
  16. package/lib/es/locale/en-US.js +1 -6
  17. package/lib/es/locale/es-ES.js +1 -6
  18. package/lib/es/locale/fa-IR.js +1 -6
  19. package/lib/es/locale/fr-FR.js +1 -6
  20. package/lib/es/locale/ja-JP.js +1 -6
  21. package/lib/es/locale/ko-KR.js +1 -6
  22. package/lib/es/locale/ru-RU.js +1 -6
  23. package/lib/es/locale/sk-SK.js +1 -6
  24. package/lib/es/locale/vi-VN.js +1 -6
  25. package/lib/es/locale/zh-CN.js +1 -6
  26. package/lib/es/locale/zh-TW.js +1 -6
  27. package/lib/index.js +1518 -1559
  28. package/lib/locale/ca-ES.js +1 -6
  29. package/lib/locale/en-US.js +1 -6
  30. package/lib/locale/es-ES.js +1 -6
  31. package/lib/locale/fa-IR.js +1 -6
  32. package/lib/locale/fr-FR.js +1 -6
  33. package/lib/locale/ja-JP.js +1 -6
  34. package/lib/locale/ko-KR.js +1 -6
  35. package/lib/locale/ru-RU.js +1 -6
  36. package/lib/locale/sk-SK.js +1 -6
  37. package/lib/locale/vi-VN.js +1 -6
  38. package/lib/locale/zh-CN.js +1 -6
  39. package/lib/locale/zh-TW.js +1 -6
  40. package/lib/types/index.d.ts +1 -1
  41. package/lib/types/locale/en-US.d.ts +1 -6
  42. package/lib/types/menu/menu.d.ts +16 -0
  43. package/lib/types/plugin.d.ts +3 -1
  44. package/lib/umd/index.js +5 -5
  45. package/lib/umd/locale/ca-ES.js +1 -1
  46. package/lib/umd/locale/en-US.js +1 -1
  47. package/lib/umd/locale/es-ES.js +1 -1
  48. package/lib/umd/locale/fa-IR.js +1 -1
  49. package/lib/umd/locale/fr-FR.js +1 -1
  50. package/lib/umd/locale/ja-JP.js +1 -1
  51. package/lib/umd/locale/ko-KR.js +1 -1
  52. package/lib/umd/locale/ru-RU.js +1 -1
  53. package/lib/umd/locale/sk-SK.js +1 -1
  54. package/lib/umd/locale/vi-VN.js +1 -1
  55. package/lib/umd/locale/zh-CN.js +1 -1
  56. package/lib/umd/locale/zh-TW.js +1 -1
  57. package/package.json +13 -13
  58. package/lib/types/controllers/formula-auto-fill.controller.d.ts +0 -10
  59. package/lib/types/controllers/menu.d.ts +0 -12
  60. /package/lib/types/{controllers/config.schema.d.ts → config/config.d.ts} +0 -0
  61. /package/lib/types/{controllers/menu.schema.d.ts → menu/schema.d.ts} +0 -0
package/lib/es/index.js CHANGED
@@ -1,50 +1,50 @@
1
- var Xr = Object.defineProperty;
2
- var Qr = (e, t, n) => t in e ? Xr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var j = (e, t, n) => Qr(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { CommandType as be, ICommandService as pe, createIdentifier as Jr, IContextService as hn, IUniverInstanceService as ne, Rectangle as fn, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as gn, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as ir, DEFAULT_EMPTY_DOCUMENT_VALUE as cr, isRealNum as eo, CellValueType as $n, getCellValueType as to, Inject as q, Disposable as ze, ObjectMatrix as Fe, Range as no, Tools as mn, LocaleService as dt, isICellData as ro, isFormulaString as Ce, isFormulaId as De, generateRandomId as Yt, Direction as de, Injector as It, getEmptyCell as mt, UniverInstanceType as W, ThemeService as Et, ILogService as oo, toDisposable as lr, ColorKit as pn, RxDisposable as so, InterceptorEffectEnum as io, IConfigService as Sn, FOCUSING_DOC as co, FOCUSING_UNIVER_EDITOR as lo, DisposableCollection as Ye, RANGE_TYPE as Ie, getBodySlice as Pn, EDITOR_ACTIVATED as Un, createInternalEditorID as ao, BuildTextUtils as uo, RichTextBuilder as ho, DependentOn as fo, Plugin as go, merge as mo, registerDependencies as po, touchDependencies as So } from "@univerjs/core";
5
- import { ISheetClipboardService as ar, PREDEFINED_HOOK_NAME_COPY as ur, SheetPasteCommand as vo, PREDEFINED_HOOK_NAME_PASTE as lt, IEditorBridgeService as vn, SetCellEditVisibleOperation as dr, HoverManagerService as Co, CellAlertManagerService as _o, CellAlertType as Ro, COPY_TYPE as hr, SheetSkeletonManagerService as bt, attachSelectionWithCoord as sn, SelectionControl as fr, SELECTION_SHAPE_DEPTH as Io, useActiveWorkbook as Eo, menuClipboardDisabledObservable as bo, getCurrentRangeDisable$ as $e, PASTE_SPECIAL_MENU_ID as yo, COPY_SPECIAL_MENU_ID as To, whenFormulaEditorActivated as yt, whenSheetEditorFocused as Oo, SheetsUIPart as No, BaseSelectionRenderService as Mo, getCoordByOffset as Vn, checkInHeaderRanges as Wn, getAllSelection as xo, genNormalSelectionStyle as gr, getSheetObject as wo, MoveSelectionCommand as Hn, JumpOver as Bn, ExpandSelectionCommand as qn, EMBEDDING_FORMULA_EDITOR as ko, IMarkSelectionService as Ao, RANGE_SELECTOR_COMPONENT_KEY as Fo, EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY as Do } from "@univerjs/sheets-ui";
6
- import { sequenceNodeType as Q, serializeRange as Ee, FormulaDataModel as Tt, LexerTreeBuilder as ye, ErrorType as ue, extractFormulaError as mr, SetFormulaCalculationResultMutation as Lo, SetArrayFormulaDataMutation as $o, SetFormulaCalculationStopMutation as Po, FunctionType as cn, matchToken as Ge, deserializeRangeWithSheetWithCache as Uo, matchRefDrawToken as Vo, isFormulaLexerToken as Wo, deserializeRangeWithSheet as ht, serializeRangeToRefString as Ho, serializeRangeWithSheet as _t, serializeRangeWithSpreadsheet as Bo, generateStringWithSequence as qo, operatorToken as pr } from "@univerjs/engine-formula";
7
- import { Subject as pt, debounceTime as Cn, combineLatestWith as jo, map as Sr, BehaviorSubject as vr, throttleTime as Ko, filter as Cr, distinctUntilChanged as Yo, merge as Go } from "rxjs";
8
- import { IEditorService as Ze, DocSelectionRenderService as _r, ReplaceTextRunsCommand as jn, MoveSelectionOperation as zo, MoveCursorOperation as Zo, useKeyboardEvent as Xo, useResize as Qo, DocBackScrollRenderController as Jo, RichTextEditor as es } 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 _n, getSheetCommandTarget as Rr, getCellAtRowCol as ts, SetSelectionsOperation as Rn, SheetInterceptorService as In, ReorderRangeCommand as ns, SetRangeValuesMutation as Lt, IAutoFillService as rs, AUTO_FILL_APPLY_TYPE as os, AUTO_FILL_DATA_TYPE as Gn, SetRangeValuesUndoMutationFactory as ss, BEFORE_CELL_EDIT as is, SetWorksheetRowAutoHeightMutation as cs, INTERCEPTOR_POINT as ls, WorksheetSetCellValuePermission as Xe, WorksheetEditPermission as Qe, RangeProtectionPermissionEditPoint as Je, WorkbookEditablePermission as et, RangeProtectionPermissionViewPoint as as, WorksheetCopyPermission as us, WorkbookCopyPermission as ds, IRefSelectionsService as Gt, SelectionMoveType as tn, convertSelectionDataToRange as hs, setEndForRange as fs, REF_SELECTIONS_ENABLED as zn, SetWorksheetActiveOperation as Zn } from "@univerjs/sheets";
11
- import { InsertFunctionCommand as gs, TriggerCalculationController as ms, PLUGIN_CONFIG_KEY_BASE as ps, IDescriptionService as zt, QuickSumCommand as Ss, ImageFormulaCellInterceptorController as vs, UniverSheetsFormulaPlugin as Cs } from "@univerjs/sheets-formula";
12
- import { ISidebarService as En, IZenZoneService as _s, useDependency as y, useObservable as _e, ProgressBar as Rs, getMenuHiddenObservable as Pe, MenuItemType as Ue, RibbonFormulasGroup as Xn, KeyCode as L, MetaKeys as V, IMenuManagerService as Is, IShortcutService as Zt, IUIPartsService as Ir, ComponentManager as Er, connectInjector as br, useEvent as ee, RectPopup as ln, IContextMenuService as Es, useUpdateEffect as bs, BuiltInUIPart as ys } from "@univerjs/ui";
13
- import { jsx as x, jsxs as B, Fragment as Ts } from "react/jsx-runtime";
14
- import { useCallback as $t, useState as H, useRef as X, createElement as tt, forwardRef as Ve, useEffect as P, useMemo as le, useLayoutEffect as Pt, useImperativeHandle as Os } from "react";
15
- import { clsx as se, scrollbarClassName as ut, borderLeftClassName as Ns, Select as Ms, Input as yr, borderClassName as bn, Button as at, borderTopClassName as xs, Tooltip as ws, Dialog as ks } from "@univerjs/design";
16
- import { DocSelectionManagerService as Tr } from "@univerjs/docs";
17
- import { debounceTime as As } from "rxjs/operators";
18
- const yn = {
1
+ var Zr = Object.defineProperty;
2
+ var Xr = (e, t, n) => t in e ? Zr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var j = (e, t, n) => Xr(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { CommandType as ye, ICommandService as ve, createIdentifier as Qr, IContextService as ln, IUniverInstanceService as re, Rectangle as un, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as dn, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as er, DEFAULT_EMPTY_DOCUMENT_VALUE as tr, isRealNum as Jr, CellValueType as An, getCellValueType as eo, Inject as q, Disposable as at, ObjectMatrix as Pe, Range as to, Tools as nr, LocaleService as lt, isICellData as no, Injector as Rt, getEmptyCell as gt, isFormulaString as Fe, isFormulaId as st, UniverInstanceType as B, generateRandomId as hn, ThemeService as It, ILogService as ro, toDisposable as rr, ColorKit as fn, RxDisposable as oo, InterceptorEffectEnum as so, IConfigService as gn, FOCUSING_DOC as io, FOCUSING_UNIVER_EDITOR as co, DisposableCollection as Ye, RANGE_TYPE as Ee, getBodySlice as Dn, Direction as xe, EDITOR_ACTIVATED as Ln, createInternalEditorID as ao, BuildTextUtils as lo, RichTextBuilder as uo, DependentOn as ho, Plugin as fo, merge as go, registerDependencies as mo, touchDependencies as po } from "@univerjs/core";
5
+ import { ISheetClipboardService as or, PREDEFINED_HOOK_NAME_COPY as sr, SheetPasteCommand as So, PREDEFINED_HOOK_NAME_PASTE as rt, IEditorBridgeService as mn, SetCellEditVisibleOperation as ir, HoverManagerService as vo, CellAlertManagerService as Co, CellAlertType as _o, COPY_TYPE as cr, SheetSkeletonManagerService as Et, attachSelectionWithCoord as rn, SelectionControl as ar, SELECTION_SHAPE_DEPTH as Ro, menuClipboardDisabledObservable as Io, getCurrentRangeDisable$ as pn, PASTE_SPECIAL_MENU_ID as Eo, COPY_SPECIAL_MENU_ID as bo, useActiveWorkbook as yo, whenFormulaEditorActivated as bt, whenSheetEditorFocused as To, SheetsUIPart as Oo, BaseSelectionRenderService as No, getCoordByOffset as $n, checkInHeaderRanges as Pn, getAllSelection as Mo, genNormalSelectionStyle as lr, getSheetObject as xo, MoveSelectionCommand as Un, JumpOver as Wn, ExpandSelectionCommand as Vn, EMBEDDING_FORMULA_EDITOR as wo, IMarkSelectionService as Fo, RANGE_SELECTOR_COMPONENT_KEY as ko, EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY as Ao } from "@univerjs/sheets-ui";
6
+ import { sequenceNodeType as Q, serializeRange as be, FormulaDataModel as yt, LexerTreeBuilder as ke, ErrorType as de, extractFormulaError as ur, SetFormulaCalculationResultMutation as Do, SetArrayFormulaDataMutation as Lo, FunctionType as fe, SetFormulaCalculationStopMutation as $o, matchToken as Ge, deserializeRangeWithSheetWithCache as Po, matchRefDrawToken as Uo, isFormulaLexerToken as Wo, deserializeRangeWithSheet as ut, serializeRangeToRefString as Vo, serializeRangeWithSheet as Ct, serializeRangeWithSpreadsheet as Ho, generateStringWithSequence as Bo, operatorToken as dr } from "@univerjs/engine-formula";
7
+ import { Subject as mt, debounceTime as Sn, combineLatestWith as qo, map as hr, BehaviorSubject as fr, throttleTime as jo, filter as gr, distinctUntilChanged as Ko, merge as Yo } from "rxjs";
8
+ import { IEditorService as ze, DocSelectionRenderService as mr, ReplaceTextRunsCommand as Hn, MoveSelectionOperation as Go, MoveCursorOperation as zo, useKeyboardEvent as Zo, useResize as Xo, DocBackScrollRenderController as Qo, RichTextEditor as Jo } from "@univerjs/docs-ui";
9
+ import { DeviceInputEventType as Ae, IRenderManagerService as Te, ScrollTimerType as Qt, SHEET_VIEWPORT_KEY as Bn, Vector2 as qn } from "@univerjs/engine-render";
10
+ import { SheetsSelectionsService as vn, getSheetCommandTarget as pr, getCellAtRowCol as es, SetSelectionsOperation as Cn, SheetInterceptorService as _n, ReorderRangeCommand as ts, SetRangeValuesMutation as $t, SetRangeValuesUndoMutationFactory as ns, BEFORE_CELL_EDIT as rs, SetWorksheetRowAutoHeightMutation as os, INTERCEPTOR_POINT as ss, WorksheetSetCellValuePermission as Sr, WorksheetEditPermission as vr, RangeProtectionPermissionEditPoint as Cr, WorkbookEditablePermission as _r, RangeProtectionPermissionViewPoint as is, WorksheetCopyPermission as cs, WorkbookCopyPermission as as, IRefSelectionsService as Kt, SelectionMoveType as Jt, convertSelectionDataToRange as ls, setEndForRange as us, REF_SELECTIONS_ENABLED as jn, SetWorksheetActiveOperation as Kn } from "@univerjs/sheets";
11
+ import { InsertFunctionCommand as ds, IDescriptionService as dt, TriggerCalculationController as hs, PLUGIN_CONFIG_KEY_BASE as fs, QuickSumCommand as gs, ImageFormulaCellInterceptorController as ms, UniverSheetsFormulaPlugin as ps } from "@univerjs/sheets-formula";
12
+ import { ISidebarService as Rn, IZenZoneService as Ss, getMenuHiddenObservable as Tt, MenuItemType as Ot, RibbonFormulasGroup as vs, useDependency as b, useObservable as Re, ProgressBar as Cs, KeyCode as L, MetaKeys as W, IMenuManagerService as _s, IShortcutService as Yt, IUIPartsService as Rr, ComponentManager as Ir, connectInjector as Er, useEvent as ee, RectPopup as on, IContextMenuService as Rs, useUpdateEffect as Is, BuiltInUIPart as Es } from "@univerjs/ui";
13
+ import { jsx as x, jsxs as H, Fragment as bs } from "react/jsx-runtime";
14
+ import { useCallback as Pt, useState as V, useRef as X, createElement as Ze, forwardRef as We, useEffect as P, useMemo as le, useLayoutEffect as Ut, useImperativeHandle as ys } from "react";
15
+ import { clsx as ie, scrollbarClassName as it, borderLeftClassName as Ts, Select as Os, Input as br, borderClassName as In, Button as ot, borderTopClassName as Ns, Tooltip as Ms, Dialog as xs } from "@univerjs/design";
16
+ import { DocSelectionManagerService as yr } from "@univerjs/docs";
17
+ import { debounceTime as ws } from "rxjs/operators";
18
+ const En = {
19
19
  id: "sheet.command.copy-formula-only",
20
- type: be.COMMAND,
21
- handler: async (e) => e.get(ar).copy({
22
- copyHookType: ur.SPECIAL_COPY_FORMULA_ONLY
20
+ type: ye.COMMAND,
21
+ handler: async (e) => e.get(or).copy({
22
+ copyHookType: sr.SPECIAL_COPY_FORMULA_ONLY
23
23
  })
24
- }, Tn = {
24
+ }, bn = {
25
25
  id: "sheet.command.paste-formula",
26
- type: be.COMMAND,
27
- handler: async (e) => e.get(pe).executeCommand(vo.id, {
28
- value: lt.SPECIAL_PASTE_FORMULA
26
+ type: ye.COMMAND,
27
+ handler: async (e) => e.get(ve).executeCommand(So.id, {
28
+ value: rt.SPECIAL_PASTE_FORMULA
29
29
  })
30
- }, ft = {
30
+ }, ht = {
31
31
  id: "formula-ui.operation.select-editor-formula",
32
- type: be.OPERATION,
32
+ type: ye.OPERATION,
33
33
  handler: (e, t) => !0
34
34
  };
35
- var Fs = Object.getOwnPropertyDescriptor, Ds = (e, t, n, o) => {
35
+ var Fs = Object.getOwnPropertyDescriptor, ks = (e, t, n, o) => {
36
36
  for (var r = o > 1 ? void 0 : o ? Fs(t, n) : t, s = e.length - 1, i; s >= 0; s--)
37
37
  (i = e[s]) && (r = i(r) || r);
38
38
  return r;
39
- }, Ls = (e, t) => (n, o) => t(n, o, e);
40
- const $s = "FORMULA_PROMPT_ACTIVATED", Xt = Jr("formula-ui.prompt-service");
41
- let an = class {
39
+ }, As = (e, t) => (n, o) => t(n, o, e);
40
+ const Ds = "FORMULA_PROMPT_ACTIVATED", Gt = Qr("formula-ui.prompt-service");
41
+ let sn = class {
42
42
  constructor(e) {
43
- j(this, "_search$", new pt());
44
- j(this, "_help$", new pt());
45
- j(this, "_navigate$", new pt());
46
- j(this, "_accept$", new pt());
47
- j(this, "_acceptFormulaName$", new pt());
43
+ j(this, "_search$", new mt());
44
+ j(this, "_help$", new mt());
45
+ j(this, "_navigate$", new mt());
46
+ j(this, "_accept$", new mt());
47
+ j(this, "_acceptFormulaName$", new mt());
48
48
  j(this, "search$", this._search$.asObservable());
49
49
  j(this, "help$", this._help$.asObservable());
50
50
  j(this, "navigate$", this._navigate$.asObservable());
@@ -61,7 +61,7 @@ let an = class {
61
61
  this._search$.complete(), this._help$.complete(), this._navigate$.complete(), this._accept$.complete(), this._acceptFormulaName$.complete(), this._sequenceNodes = [];
62
62
  }
63
63
  search(e) {
64
- this._contextService.setContextValue($s, e.visible), this._searching = e.visible, this._search$.next(e);
64
+ this._contextService.setContextValue(Ds, e.visible), this._searching = e.visible, this._search$.next(e);
65
65
  }
66
66
  isSearching() {
67
67
  return this._searching;
@@ -193,86 +193,86 @@ let an = class {
193
193
  return this._isLockedOnSelectionInsertRefString;
194
194
  }
195
195
  };
196
- an = Ds([
197
- Ls(0, hn)
198
- ], an);
199
- const Ps = {
196
+ sn = ks([
197
+ As(0, ln)
198
+ ], sn);
199
+ const Ls = {
200
200
  id: "formula-ui.operation.help-function",
201
- type: be.OPERATION,
202
- handler: async (e, t) => (e.get(Xt).help(t), !0)
203
- }, ve = {
201
+ type: ye.OPERATION,
202
+ handler: async (e, t) => (e.get(Gt).help(t), !0)
203
+ }, ne = {
204
204
  id: "formula-ui.operation.insert-function",
205
- type: be.OPERATION,
205
+ type: ye.OPERATION,
206
206
  // eslint-disable-next-line
207
207
  handler: async (e, t) => {
208
- var C, R;
209
- const n = e.get(_n), o = e.get(Ze), r = n.getCurrentSelections();
208
+ var C, I;
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 = Rr(e.get(ne));
212
+ const s = pr(e.get(re));
213
213
  if (!s) return !1;
214
- const { worksheet: i, unitId: c, subUnitId: a } = s, d = i.getCellMatrix(), { value: f } = t, m = e.get(pe);
215
- e.get(vn);
216
- const u = [], h = [];
217
- let l = null, S = 0, v = 0, g = "";
218
- if (r.length === 1 && (Ws(r[0].range) || Hs(r[0].range) && Jn(d, r[0].range))) {
219
- const { range: E, primary: p } = r[0], b = (C = p == null ? void 0 : p.actualRow) != null ? C : E.startRow, T = (R = p == null ? void 0 : p.actualColumn) != null ? R : E.startColumn;
220
- l = E, S = b, v = T;
221
- const F = Qn(d, b, T);
222
- F && (g = Ee(F));
214
+ const { worksheet: i, unitId: c, subUnitId: a } = s, h = i.getCellMatrix(), { value: g } = t, p = e.get(ve);
215
+ e.get(mn);
216
+ const u = [], d = [];
217
+ let l = null, S = 0, v = 0, f = "";
218
+ if (r.length === 1 && (Us(r[0].range) || Ws(r[0].range) && Gn(h, r[0].range))) {
219
+ const { range: E, primary: m } = r[0], y = (C = m == null ? void 0 : m.actualRow) != null ? C : E.startRow, T = (I = m == null ? void 0 : m.actualColumn) != null ? I : E.startColumn;
220
+ l = E, S = y, v = T;
221
+ const A = Yn(h, y, T);
222
+ A && (f = be(A));
223
223
  } else
224
224
  r.some((E) => {
225
- var T, F;
226
- const { range: p, primary: b } = E;
227
- if (Jn(d, p)) {
228
- const A = (T = b == null ? void 0 : b.actualRow) != null ? T : p.startRow, N = (F = b == null ? void 0 : b.actualColumn) != null ? F : p.startColumn, M = Qn(d, A, N);
225
+ var T, A;
226
+ const { range: m, primary: y } = E;
227
+ if (Gn(h, m)) {
228
+ const k = (T = y == null ? void 0 : y.actualRow) != null ? T : m.startRow, N = (A = y == null ? void 0 : y.actualColumn) != null ? A : m.startColumn, M = Yn(h, k, N);
229
229
  if (!M)
230
- return l = p, S = A, v = N, !0;
231
- const w = Ee(M), k = `=${f}(${w})`;
230
+ return l = m, S = k, v = N, !0;
231
+ const w = be(M), F = `=${g}(${w})`;
232
232
  u.push({
233
- range: p,
233
+ range: m,
234
234
  primary: {
235
- row: A,
235
+ row: k,
236
236
  column: N
237
237
  },
238
- formula: k
238
+ formula: F
239
239
  });
240
240
  } else {
241
- const { startRow: A, startColumn: N, endRow: M, endColumn: w } = p;
242
- if (A === M) {
243
- const k = Bs(d, A, w, i.getColumnCount() - 1), $ = k === w ? w - 1 : w, I = Ee({
244
- startRow: A,
241
+ const { startRow: k, startColumn: N, endRow: M, endColumn: w } = m;
242
+ if (k === M) {
243
+ const F = Vs(h, k, w, i.getColumnCount() - 1), $ = F === w ? w - 1 : w, R = be({
244
+ startRow: k,
245
245
  endRow: M,
246
246
  startColumn: N,
247
247
  endColumn: $
248
- }), _ = `=${f}(${I})`;
249
- h.push({
250
- range: p,
248
+ }), _ = `=${g}(${R})`;
249
+ d.push({
250
+ range: m,
251
251
  primary: {
252
- row: A,
253
- column: k
252
+ row: k,
253
+ column: F
254
254
  },
255
255
  formula: _
256
256
  });
257
257
  } else {
258
- let k = -1;
259
- for (let I = N; I <= w; I++) {
260
- const _ = qs(d, I, M, i.getRowCount() - 1);
261
- k = Math.max(k, _);
258
+ let F = -1;
259
+ for (let R = N; R <= w; R++) {
260
+ const _ = Hs(h, R, M, i.getRowCount() - 1);
261
+ F = Math.max(F, _);
262
262
  }
263
- const $ = k === M ? M - 1 : M;
264
- for (let I = N; I <= w; I++) {
265
- const _ = Ee({
266
- startRow: A,
263
+ const $ = F === M ? M - 1 : M;
264
+ for (let R = N; R <= w; R++) {
265
+ const _ = be({
266
+ startRow: k,
267
267
  endRow: $,
268
- startColumn: I,
269
- endColumn: I
270
- }), O = `=${f}(${_})`;
271
- h.push({
272
- range: p,
268
+ startColumn: R,
269
+ endColumn: R
270
+ }), O = `=${g}(${_})`;
271
+ d.push({
272
+ range: m,
273
273
  primary: {
274
- row: k,
275
- column: I
274
+ row: F,
275
+ column: R
276
276
  },
277
277
  formula: O
278
278
  });
@@ -282,8 +282,8 @@ const Ps = {
282
282
  return !1;
283
283
  });
284
284
  if (l) {
285
- const E = ts(S, v, i), p = {
286
- range: fn.clone(l),
285
+ const E = es(S, v, i), m = {
286
+ range: un.clone(l),
287
287
  primary: {
288
288
  startRow: E.startRow,
289
289
  startColumn: E.startColumn,
@@ -294,29 +294,29 @@ const Ps = {
294
294
  isMerged: E.isMerged,
295
295
  isMergedMainCell: E.startRow === S && E.startColumn === v
296
296
  }
297
- }, b = {
297
+ }, y = {
298
298
  unitId: c,
299
299
  subUnitId: a,
300
- selections: [p]
300
+ selections: [m]
301
301
  };
302
- await m.executeCommand(Rn.id, b);
303
- const T = o.getEditor(gn), F = o.getEditor(ir);
304
- m.syncExecuteCommand(dr.id, {
302
+ await p.executeCommand(Cn.id, y);
303
+ const T = o.getEditor(dn), A = o.getEditor(er);
304
+ p.syncExecuteCommand(ir.id, {
305
305
  visible: !0,
306
306
  unitId: c,
307
- eventType: xe.Dblclick
307
+ eventType: Ae.Dblclick
308
308
  });
309
- const A = `=${f}(${g}`;
310
- T == null || T.replaceText(A), F == null || F.replaceText(A, !1);
309
+ const k = `=${g}(${f}`;
310
+ T == null || T.replaceText(k), A == null || A.replaceText(k, !1);
311
311
  }
312
- return u.length === 0 && h.length === 0 ? !1 : m.executeCommand(gs.id, {
312
+ return u.length === 0 && d.length === 0 ? !1 : p.executeCommand(ds.id, {
313
313
  list: u,
314
- listOfRangeHasNumber: h
314
+ listOfRangeHasNumber: d
315
315
  });
316
316
  }
317
317
  };
318
- function Qn(e, t, n) {
319
- const o = Us(e, t, n);
318
+ function Yn(e, t, n) {
319
+ const o = $s(e, t, n);
320
320
  if (o !== t)
321
321
  return {
322
322
  startRow: o,
@@ -324,7 +324,7 @@ function Qn(e, t, n) {
324
324
  startColumn: n,
325
325
  endColumn: n
326
326
  };
327
- const r = Vs(e, t, n);
327
+ const r = Ps(e, t, n);
328
328
  return r !== n ? {
329
329
  startRow: t,
330
330
  endRow: t,
@@ -332,16 +332,16 @@ function Qn(e, t, n) {
332
332
  endColumn: n - 1
333
333
  } : null;
334
334
  }
335
- function Us(e, t, n) {
335
+ function $s(e, t, n) {
336
336
  let o = !1;
337
337
  if (t === 0) return t;
338
338
  for (let r = t - 1; r >= 0; r--) {
339
339
  const s = e.getValue(r, n);
340
- if (Rt(s) && !o) {
340
+ if (_t(s) && !o) {
341
341
  if (r === 0) return 0;
342
342
  o = !0;
343
343
  } else {
344
- if (o && !Rt(s))
344
+ if (o && !_t(s))
345
345
  return r + 1;
346
346
  if (o && r === 0)
347
347
  return 0;
@@ -349,16 +349,16 @@ function Us(e, t, n) {
349
349
  }
350
350
  return t;
351
351
  }
352
- function Vs(e, t, n) {
352
+ function Ps(e, t, n) {
353
353
  let o = !1;
354
354
  if (n === 0) return n;
355
355
  for (let r = n - 1; r >= 0; r--) {
356
356
  const s = e.getValue(t, r);
357
- if (Rt(s) && !o) {
357
+ if (_t(s) && !o) {
358
358
  if (r === 0) return 0;
359
359
  o = !0;
360
360
  } else {
361
- if (o && !Rt(s))
361
+ if (o && !_t(s))
362
362
  return r + 1;
363
363
  if (o && r === 0)
364
364
  return 0;
@@ -366,69 +366,69 @@ function Vs(e, t, n) {
366
366
  }
367
367
  return n;
368
368
  }
369
- function Rt(e) {
369
+ function _t(e) {
370
370
  if (e != null && e.p) {
371
371
  const t = e == null ? void 0 : e.p.body;
372
372
  if (t == null)
373
373
  return !1;
374
- const n = t.dataStream, r = n.substring(n.length - 2, n.length) === cr ? n.substring(0, n.length - 2) : n;
375
- return eo(r);
374
+ const n = t.dataStream, r = n.substring(n.length - 2, n.length) === tr ? n.substring(0, n.length - 2) : n;
375
+ return Jr(r);
376
376
  }
377
- return e && (e.t === $n.NUMBER || to(e) === $n.NUMBER);
377
+ return e && (e.t === An.NUMBER || eo(e) === An.NUMBER);
378
378
  }
379
- function Ws(e) {
379
+ function Us(e) {
380
380
  return e.startRow === e.endRow && e.startColumn === e.endColumn;
381
381
  }
382
- function Hs(e) {
382
+ function Ws(e) {
383
383
  return e.startRow !== e.endRow && e.startColumn !== e.endColumn;
384
384
  }
385
- function Jn(e, t) {
385
+ function Gn(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
- if (Rt(e.getValue(n, o)))
388
+ if (_t(e.getValue(n, o)))
389
389
  return !1;
390
390
  return !0;
391
391
  }
392
- function Bs(e, t, n, o) {
392
+ function Vs(e, t, n, o) {
393
393
  for (let r = n; r <= o; r++)
394
394
  if (!e.getValue(t, r))
395
395
  return r;
396
396
  return o;
397
397
  }
398
- function qs(e, t, n, o) {
398
+ function Hs(e, t, n, o) {
399
399
  for (let r = n; r <= o; r++)
400
400
  if (!e.getValue(r, t))
401
401
  return r;
402
402
  return o;
403
403
  }
404
- const Or = "SHEET_FORMULA_UI_PLUGIN", Nr = `${Or}_MORE_FUNCTIONS_COMPONENT`, On = {
404
+ const Tr = "SHEET_FORMULA_UI_PLUGIN", Or = `${Tr}_MORE_FUNCTIONS_COMPONENT`, he = {
405
405
  id: "formula-ui.operation.more-functions",
406
- type: be.OPERATION,
407
- handler: async (e) => (e.get(En).open({
406
+ type: ye.OPERATION,
407
+ handler: async (e) => (e.get(Rn).open({
408
408
  header: { title: "formula.insert.tooltip" },
409
- children: { label: Nr }
409
+ children: { label: Or }
410
410
  }), !0)
411
- }, Mr = {
411
+ }, Nr = {
412
412
  id: "formula-ui.operation.change-ref-to-absolute",
413
- type: be.OPERATION,
413
+ type: ye.OPERATION,
414
414
  handler: async (e) => !0
415
- }, js = {
415
+ }, Bs = {
416
416
  id: "formula-ui.operation.search-function",
417
- type: be.OPERATION,
418
- handler: async (e, t) => (e.get(Xt).search(t), !0)
417
+ type: ye.OPERATION,
418
+ handler: async (e, t) => (e.get(Gt).search(t), !0)
419
419
  };
420
- var Ks = Object.getOwnPropertyDescriptor, Ys = (e, t, n, o) => {
421
- for (var r = o > 1 ? void 0 : o ? Ks(t, n) : t, s = e.length - 1, i; s >= 0; s--)
420
+ var qs = Object.getOwnPropertyDescriptor, js = (e, t, n, o) => {
421
+ for (var r = o > 1 ? void 0 : o ? qs(t, n) : t, s = e.length - 1, i; s >= 0; s--)
422
422
  (i = e[s]) && (r = i(r) || r);
423
423
  return r;
424
424
  }, At = (e, t) => (n, o) => t(n, o, e);
425
- let Ut = class extends ze {
425
+ let Wt = class extends at {
426
426
  constructor(e, t, n, o) {
427
427
  super(), this._sheetInterceptorService = e, this._univerInstanceService = t, this._formulaDataModel = n, this._lexerTreeBuilder = o, this._initialize();
428
428
  }
429
429
  _initialize() {
430
430
  this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
431
- getMutations: (e) => e.id === ns.id ? this._reorderFormula(e.params) : {
431
+ getMutations: (e) => e.id === ts.id ? this._reorderFormula(e.params) : {
432
432
  redos: [],
433
433
  undos: []
434
434
  }
@@ -441,36 +441,36 @@ let Ut = class extends ze {
441
441
  redos: t,
442
442
  undos: n
443
443
  };
444
- const d = a.getCellMatrix(), f = new Fe(), m = new Fe();
444
+ const h = a.getCellMatrix(), g = new Pe(), p = new Pe();
445
445
  let u = !1;
446
- return no.foreach(s, (h, l) => {
447
- let S = h;
448
- i.hasOwnProperty(h) && (S = i[h]);
449
- const v = d.getValue(S, l);
446
+ return to.foreach(s, (d, l) => {
447
+ let S = d;
448
+ i.hasOwnProperty(d) && (S = i[d]);
449
+ const v = h.getValue(S, l);
450
450
  if (v != null && v.f || v != null && v.si) {
451
451
  u = !0;
452
- const g = this._formulaDataModel.getFormulaStringByCell(S, l, r, o), C = this._lexerTreeBuilder.moveFormulaRefOffset(
453
- g,
452
+ const f = this._formulaDataModel.getFormulaStringByCell(S, l, r, o), C = this._lexerTreeBuilder.moveFormulaRefOffset(
453
+ f,
454
454
  0,
455
- h - S
456
- ), R = mn.deepClone(v);
457
- R.f = C, R.si = null, f.setValue(h, l, R);
455
+ d - S
456
+ ), I = nr.deepClone(v);
457
+ I.f = C, I.si = null, g.setValue(d, l, I);
458
458
  } else
459
- f.setValue(h, l, v);
460
- m.setValue(h, l, d.getValue(h, l));
459
+ g.setValue(d, l, v);
460
+ p.setValue(d, l, h.getValue(d, l));
461
461
  }), u ? (t.push({
462
- id: Lt.id,
462
+ id: $t.id,
463
463
  params: {
464
464
  unitId: o,
465
465
  subUnitId: r,
466
- cellValue: f.getMatrix()
466
+ cellValue: g.getMatrix()
467
467
  }
468
468
  }), n.push({
469
- id: Lt.id,
469
+ id: $t.id,
470
470
  params: {
471
471
  unitId: o,
472
472
  subUnitId: r,
473
- cellValue: m.getMatrix()
473
+ cellValue: p.getMatrix()
474
474
  }
475
475
  }), {
476
476
  redos: t,
@@ -481,33 +481,36 @@ let Ut = class extends ze {
481
481
  };
482
482
  }
483
483
  };
484
- Ut = Ys([
485
- At(0, q(In)),
486
- At(1, q(ne)),
487
- At(2, q(Tt)),
488
- At(3, q(ye))
489
- ], Ut);
490
- const xr = "sheets-formula-ui.base.config", er = {};
484
+ Wt = js([
485
+ At(0, q(_n)),
486
+ At(1, q(re)),
487
+ At(2, q(yt)),
488
+ At(3, q(ke))
489
+ ], Wt);
490
+ const Ks = "@univerjs/sheets-formula-ui", Ys = "0.17.0", Mr = {
491
+ name: Ks,
492
+ version: Ys
493
+ }, xr = "sheets-formula-ui.base.config", zn = {};
491
494
  var Gs = Object.getOwnPropertyDescriptor, zs = (e, t, n, o) => {
492
495
  for (var r = o > 1 ? void 0 : o ? Gs(t, n) : t, s = e.length - 1, i; s >= 0; s--)
493
496
  (i = e[s]) && (r = i(r) || r);
494
497
  return r;
495
- }, St = (e, t) => (n, o) => t(n, o, e);
496
- const nn = "SHEET_FORMULA_ALERT", Zs = {
497
- [ue.DIV_BY_ZERO]: "divByZero",
498
- [ue.NAME]: "name",
499
- [ue.VALUE]: "value",
500
- [ue.NUM]: "num",
501
- [ue.NA]: "na",
502
- [ue.CYCLE]: "cycle",
503
- [ue.REF]: "ref",
504
- [ue.SPILL]: "spill",
505
- [ue.CALC]: "calc",
506
- [ue.ERROR]: "error",
507
- [ue.CONNECT]: "connect",
508
- [ue.NULL]: "null"
498
+ }, pt = (e, t) => (n, o) => t(n, o, e);
499
+ const en = "SHEET_FORMULA_ALERT", Zs = {
500
+ [de.DIV_BY_ZERO]: "divByZero",
501
+ [de.NAME]: "name",
502
+ [de.VALUE]: "value",
503
+ [de.NUM]: "num",
504
+ [de.NA]: "na",
505
+ [de.CYCLE]: "cycle",
506
+ [de.REF]: "ref",
507
+ [de.SPILL]: "spill",
508
+ [de.CALC]: "calc",
509
+ [de.ERROR]: "error",
510
+ [de.CONNECT]: "connect",
511
+ [de.NULL]: "null"
509
512
  };
510
- let un = class extends ze {
513
+ let cn = class extends at {
511
514
  constructor(e, t, n, o, r, s) {
512
515
  super(), this._context = e, this._hoverManagerService = t, this._cellAlertManagerService = n, this._localeService = o, this._formulaDataModel = r, this._zenZoneService = s, this._init();
513
516
  }
@@ -515,31 +518,31 @@ let un = class extends ze {
515
518
  this._initCellAlertPopup(), this._initZenService();
516
519
  }
517
520
  _initCellAlertPopup() {
518
- this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(Cn(100)).subscribe((e) => {
521
+ this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(Sn(100)).subscribe((e) => {
519
522
  var t, n, o, r, s;
520
523
  if (e) {
521
524
  const c = this._context.unit.getActiveSheet();
522
525
  if (!c) return this._hideAlert();
523
- const a = c.getCell(e.location.row, e.location.col), d = (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];
524
- if (ro(a)) {
525
- const f = mr(a, !!d);
526
- if (!f) {
526
+ const a = c.getCell(e.location.row, e.location.col), h = (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];
527
+ if (no(a)) {
528
+ const g = ur(a, !!h);
529
+ if (!g) {
527
530
  this._hideAlert();
528
531
  return;
529
532
  }
530
- const m = this._cellAlertManagerService.currentAlert.get(nn), u = (s = m == null ? void 0 : m.alert) == null ? void 0 : s.location;
533
+ const p = this._cellAlertManagerService.currentAlert.get(en), u = (s = p == null ? void 0 : p.alert) == null ? void 0 : s.location;
531
534
  if (u && u.row === e.location.row && u.col === e.location.col && u.subUnitId === e.location.subUnitId && u.unitId === e.location.unitId) {
532
535
  this._hideAlert();
533
536
  return;
534
537
  }
535
538
  this._cellAlertManagerService.showAlert({
536
- type: Ro.ERROR,
539
+ type: _o.ERROR,
537
540
  title: this._localeService.t("formula.error.title"),
538
- message: this._localeService.t(`formula.error.${Zs[f]}`),
541
+ message: this._localeService.t(`formula.error.${Zs[g]}`),
539
542
  location: e.location,
540
543
  width: 200,
541
544
  height: 74,
542
- key: nn
545
+ key: en
543
546
  });
544
547
  return;
545
548
  }
@@ -553,107 +556,23 @@ let un = class extends ze {
553
556
  }));
554
557
  }
555
558
  _hideAlert() {
556
- this._cellAlertManagerService.removeAlert(nn);
559
+ this._cellAlertManagerService.removeAlert(en);
557
560
  }
558
561
  };
559
- un = zs([
560
- St(1, q(Co)),
561
- St(2, q(_o)),
562
- St(3, q(dt)),
563
- St(4, q(Tt)),
564
- St(5, _s)
565
- ], un);
562
+ cn = zs([
563
+ pt(1, q(vo)),
564
+ pt(2, q(Co)),
565
+ pt(3, q(lt)),
566
+ pt(4, q(yt)),
567
+ pt(5, Ss)
568
+ ], cn);
566
569
  var Xs = Object.getOwnPropertyDescriptor, Qs = (e, t, n, o) => {
567
570
  for (var r = o > 1 ? void 0 : o ? Xs(t, n) : t, s = e.length - 1, i; s >= 0; s--)
568
571
  (i = e[s]) && (r = i(r) || r);
569
572
  return r;
570
- }, tr = (e, t) => (n, o) => t(n, o, e);
571
- let Vt = class extends ze {
572
- constructor(e, t) {
573
- super(), this._autoFillService = e, this._lexerTreeBuilder = t, this._registerAutoFill();
574
- }
575
- _registerAutoFill() {
576
- const e = {
577
- type: Gn.FORMULA,
578
- priority: 1001,
579
- match: (t) => Ce(t == null ? void 0 : t.f) || De(t == null ? void 0 : t.si),
580
- isContinue: (t, n) => t.type === Gn.FORMULA,
581
- applyFunctions: {
582
- [os.COPY]: (t, n, o, r, s) => {
583
- const { data: i, index: c } = t;
584
- return this._fillCopyFormula(i, n, o, c, r, s);
585
- }
586
- }
587
- };
588
- this._autoFillService.registerRule(e);
589
- }
590
- _fillCopyFormula(e, t, n, o, r, s) {
591
- var d, f;
592
- const i = ei(r), c = [], a = /* @__PURE__ */ new Map();
593
- for (let m = 1; m <= t; m++) {
594
- const u = (m - 1) % e.length, h = o[u], l = mn.deepClone(e[u]);
595
- if (l) {
596
- const S = ((d = e[u]) == null ? void 0 : d.f) || "", v = ((f = e[u]) == null ? void 0 : f.si) || "", g = Ce(S);
597
- if (De(v))
598
- l.si = v, l.f = null, l.v = null, l.p = null, l.t = null, c.push(l);
599
- else if (g) {
600
- let R = a.get(u);
601
- if (R)
602
- l.si = R, l.f = null, l.v = null, l.p = null, l.t = null;
603
- else {
604
- R = Yt(6), a.set(u, R);
605
- const { offsetX: E, offsetY: p } = Js(i, t, n, s, h), b = this._lexerTreeBuilder.moveFormulaRefOffset(
606
- S,
607
- E,
608
- p
609
- );
610
- l.si = R, l.f = b, l.v = null, l.p = null, l.t = null;
611
- }
612
- c.push(l);
613
- }
614
- }
615
- }
616
- return c;
617
- }
618
- };
619
- Vt = Qs([
620
- tr(0, rs),
621
- tr(1, q(ye))
622
- ], Vt);
623
- function Js(e, t, n, o, r) {
624
- const { source: s, target: i } = o, { rows: c } = i, { rows: a } = s;
625
- let d = 0, f = 0;
626
- switch (n) {
627
- case de.UP:
628
- f = c[r] - a[r];
629
- break;
630
- case de.RIGHT:
631
- d = e;
632
- break;
633
- case de.DOWN:
634
- f = c[r] - a[r];
635
- break;
636
- case de.LEFT:
637
- d = -e * t;
638
- break;
639
- }
640
- return { offsetX: d, offsetY: f };
641
- }
642
- function ei(e) {
643
- let t = 0;
644
- for (const n in e)
645
- e[n].forEach((o) => {
646
- t += o.data.length;
647
- });
648
- return t;
649
- }
650
- var ti = Object.getOwnPropertyDescriptor, ni = (e, t, n, o) => {
651
- for (var r = o > 1 ? void 0 : o ? ti(t, n) : t, s = e.length - 1, i; s >= 0; s--)
652
- (i = e[s]) && (r = i(r) || r);
653
- return r;
654
- }, vt = (e, t) => (n, o) => t(n, o, e);
655
- const ri = "default-paste-formula";
656
- let Wt = class extends ze {
573
+ }, St = (e, t) => (n, o) => t(n, o, e);
574
+ const Js = "default-paste-formula";
575
+ let Vt = class extends at {
657
576
  constructor(e, t, n, o, r) {
658
577
  super(), this._univerInstanceService = e, this._lexerTreeBuilder = t, this._sheetClipboardService = n, this._injector = o, this._formulaDataModel = r, this._initialize();
659
578
  }
@@ -667,7 +586,7 @@ let Wt = class extends ze {
667
586
  const e = this;
668
587
  let t = null;
669
588
  return {
670
- id: ur.SPECIAL_COPY_FORMULA_ONLY,
589
+ id: sr.SPECIAL_COPY_FORMULA_ONLY,
671
590
  priority: 10,
672
591
  onBeforeCopy(n, o) {
673
592
  t = e._getWorksheet(n, o);
@@ -675,7 +594,7 @@ let Wt = class extends ze {
675
594
  onCopyCellContent(n, o) {
676
595
  if (!t) return "";
677
596
  const r = t.getCellRaw(n, o);
678
- return r ? Ce(r.f) ? r.f : De(r.si) && e._formulaDataModel.getFormulaStringByCell(n, o, t.getSheetId(), t.getUnitId()) || "" : "";
597
+ return r ? Fe(r.f) ? r.f : st(r.si) && e._formulaDataModel.getFormulaStringByCell(n, o, t.getSheetId(), t.getUnitId()) || "" : "";
679
598
  },
680
599
  onAfterCopy() {
681
600
  t = null;
@@ -684,30 +603,30 @@ let Wt = class extends ze {
684
603
  const s = e._getWorksheet(n, o);
685
604
  if (!s) return [];
686
605
  const { startRow: i, endRow: c } = r, a = [];
687
- for (let d = i; d <= c; d++)
688
- s.getRowFiltered(d) && a.push(d);
606
+ for (let h = i; h <= c; h++)
607
+ s.getRowFiltered(h) && a.push(h);
689
608
  return a;
690
609
  },
691
610
  handleMatrixOnCell(n, o, r, s, i, c, a) {
692
- const d = i.getValue(n, o);
693
- if (t && d && (Ce(d.f) || De(d.si))) {
694
- const f = Ce(d.f) ? d.f : e._formulaDataModel.getFormulaStringByCell(n, o, t.getSheetId(), t.getUnitId());
611
+ const h = i.getValue(n, o);
612
+ if (t && h && (Fe(h.f) || st(h.si))) {
613
+ const g = Fe(h.f) ? h.f : e._formulaDataModel.getFormulaStringByCell(n, o, t.getSheetId(), t.getUnitId());
695
614
  c.setValue(r, s, {
696
- ...mt(),
697
- f
615
+ ...gt(),
616
+ f: g
698
617
  }), a.setValue(r, s, {
699
- ...mt(),
700
- f,
701
- displayV: f
618
+ ...gt(),
619
+ f: g,
620
+ displayV: g
702
621
  });
703
622
  } else
704
- i.setValue(n, o, mt()), c.setValue(r, s, mt()), a.setValue(r, s, mt());
623
+ i.setValue(n, o, gt()), c.setValue(r, s, gt()), a.setValue(r, s, gt());
705
624
  }
706
625
  };
707
626
  }
708
627
  _pasteFormulaHook() {
709
628
  return {
710
- id: lt.SPECIAL_PASTE_FORMULA,
629
+ id: rt.SPECIAL_PASTE_FORMULA,
711
630
  priority: 10,
712
631
  specialPasteInfo: { label: "specialPaste.formula" },
713
632
  onPasteCells: (e, t, n, o) => this._onPasteCells(e, t, n, o, !0)
@@ -715,13 +634,13 @@ let Wt = class extends ze {
715
634
  }
716
635
  _pasteWithFormulaHook() {
717
636
  return {
718
- id: ri,
637
+ id: Js,
719
638
  priority: 10,
720
639
  onPasteCells: (e, t, n, o) => this._onPasteCells(e, t, n, o, !1)
721
640
  };
722
641
  }
723
642
  _getWorkbook(e) {
724
- return e ? this._univerInstanceService.getUnit(e, W.UNIVER_SHEET) : this._univerInstanceService.getCurrentUnitOfType(W.UNIVER_SHEET);
643
+ return e ? this._univerInstanceService.getUnit(e, B.UNIVER_SHEET) : this._univerInstanceService.getCurrentUnitOfType(B.UNIVER_SHEET);
725
644
  }
726
645
  _getWorksheet(e, t) {
727
646
  const n = this._getWorkbook(e);
@@ -730,8 +649,8 @@ let Wt = class extends ze {
730
649
  _onPasteCells(e, t, n, o, r) {
731
650
  var u;
732
651
  if ([
733
- lt.SPECIAL_PASTE_FORMAT,
734
- lt.SPECIAL_PASTE_COL_WIDTH
652
+ rt.SPECIAL_PASTE_FORMAT,
653
+ rt.SPECIAL_PASTE_COL_WIDTH
735
654
  ].includes(o.pasteType))
736
655
  return {
737
656
  undos: [],
@@ -743,18 +662,18 @@ let Wt = class extends ze {
743
662
  undos: [],
744
663
  redos: []
745
664
  };
746
- const d = t.range, f = n, m = {
747
- copyType: o.copyType || hr.COPY,
665
+ const h = t.range, g = n, p = {
666
+ copyType: o.copyType || cr.COPY,
748
667
  copyRange: e == null ? void 0 : e.range,
749
668
  pasteType: o.pasteType
750
669
  };
751
- return this._injector.invoke((h) => oi(
670
+ return this._injector.invoke((d) => ei(
752
671
  c,
753
672
  a,
754
- d,
755
- f,
756
673
  h,
757
- m,
674
+ g,
675
+ d,
676
+ p,
758
677
  this._lexerTreeBuilder,
759
678
  this._formulaDataModel,
760
679
  r,
@@ -762,164 +681,164 @@ let Wt = class extends ze {
762
681
  ));
763
682
  }
764
683
  };
765
- Wt = ni([
766
- vt(0, ne),
767
- vt(1, q(ye)),
768
- vt(2, ar),
769
- vt(3, q(It)),
770
- vt(4, q(Tt))
771
- ], Wt);
772
- function oi(e, t, n, o, r, s, i, c, a = !1, d) {
773
- const f = [], m = [], u = si(e, t, n, o, s, i, c, d);
684
+ Vt = Qs([
685
+ St(0, re),
686
+ St(1, q(ke)),
687
+ St(2, or),
688
+ St(3, q(Rt)),
689
+ St(4, q(yt))
690
+ ], Vt);
691
+ function ei(e, t, n, o, r, s, i, c, a = !1, h) {
692
+ const g = [], p = [], u = ti(e, t, n, o, s, i, c, h);
774
693
  if (!u.hasValue())
775
694
  return {
776
695
  undos: [],
777
696
  redos: []
778
697
  };
779
- const h = {
698
+ const d = {
780
699
  unitId: e,
781
700
  subUnitId: t,
782
701
  cellValue: u.getData()
783
702
  };
784
- f.push({
785
- id: Lt.id,
786
- params: h
703
+ g.push({
704
+ id: $t.id,
705
+ params: d
787
706
  });
788
- const l = ss(
707
+ const l = ns(
789
708
  r,
790
- h
709
+ d
791
710
  );
792
- return m.push({
793
- id: Lt.id,
711
+ return p.push({
712
+ id: $t.id,
794
713
  params: l
795
714
  }), {
796
- undos: m,
797
- redos: f
715
+ undos: p,
716
+ redos: g
798
717
  };
799
718
  }
800
- function si(e, t, n, o, r, s, i, c) {
801
- return c ? r.pasteType === lt.SPECIAL_PASTE_VALUE ? ci(e, t, n, o, i, c) : r.pasteType === lt.SPECIAL_PASTE_FORMULA ? li(e, t, n, o, s, i, c) : ai(e, t, n, o, r.copyType, s, i, c) : ii(e, t, n, o, i);
719
+ function ti(e, t, n, o, r, s, i, c) {
720
+ return c ? r.pasteType === rt.SPECIAL_PASTE_VALUE ? ri(e, t, n, o, i, c) : r.pasteType === rt.SPECIAL_PASTE_FORMULA ? oi(e, t, n, o, s, i, c) : si(e, t, n, o, r.copyType, s, i, c) : ni(e, t, n, o, i);
802
721
  }
803
- function ii(e, t, n, o, r) {
804
- const s = new Fe(), i = r.getSheetFormulaData(e, t);
805
- return o.forValue((c, a, d) => {
806
- var h;
807
- const f = n.rows[c], m = n.cols[a], u = {};
808
- Ce(d.v) ? (u.v = null, u.f = `${d.v}`, u.si = null, u.p = null, s.setValue(f, m, u)) : (h = i == null ? void 0 : i[f]) != null && h[m] && (u.v = d.v, u.f = null, u.si = null, u.p = null, s.setValue(f, m, u));
722
+ function ni(e, t, n, o, r) {
723
+ const s = new Pe(), i = r.getSheetFormulaData(e, t);
724
+ return o.forValue((c, a, h) => {
725
+ var d;
726
+ const g = n.rows[c], p = n.cols[a], u = {};
727
+ Fe(h.v) ? (u.v = null, u.f = `${h.v}`, u.si = null, u.p = null, s.setValue(g, p, u)) : (d = i == null ? void 0 : i[g]) != null && d[p] && (u.v = h.v, u.f = null, u.si = null, u.p = null, s.setValue(g, p, u));
809
728
  }), s;
810
729
  }
811
- function ci(e, t, n, o, r, s) {
812
- var d, f;
813
- const i = new Fe(), c = (f = (d = r.getArrayFormulaCellData()) == null ? void 0 : d[s.unitId]) == null ? void 0 : f[s.subUnitId], a = r.getSheetFormulaData(e, t);
814
- return o.forValue((m, u, h) => {
815
- var R, E;
816
- const l = s.range.rows[m % s.range.rows.length], S = s.range.cols[u % s.range.cols.length], v = n.rows[m], g = n.cols[u], C = {};
817
- if (Ce(h.f) || De(h.si))
818
- C.v = h.v, C.f = null, C.si = null, C.p = null, i.setValue(v, g, C);
819
- else if ((R = c == null ? void 0 : c[l]) != null && R[S]) {
820
- const p = c[l][S];
821
- C.v = p.v, C.f = null, C.si = null, C.p = null, i.setValue(v, g, C);
822
- } else if ((E = a == null ? void 0 : a[v]) != null && E[g]) {
823
- if (C.v = h.v, C.f = null, C.si = null, C.p = null, h.p) {
824
- const p = wr(h);
825
- p && (C.v = p);
826
- }
827
- i.setValue(v, g, C);
730
+ function ri(e, t, n, o, r, s) {
731
+ var h, g;
732
+ const i = new Pe(), c = (g = (h = r.getArrayFormulaCellData()) == null ? void 0 : h[s.unitId]) == null ? void 0 : g[s.subUnitId], a = r.getSheetFormulaData(e, t);
733
+ return o.forValue((p, u, d) => {
734
+ var I, E;
735
+ const l = s.range.rows[p % s.range.rows.length], S = s.range.cols[u % s.range.cols.length], v = n.rows[p], f = n.cols[u], C = {};
736
+ if (Fe(d.f) || st(d.si))
737
+ C.v = d.v, C.f = null, C.si = null, C.p = null, i.setValue(v, f, C);
738
+ else if ((I = c == null ? void 0 : c[l]) != null && I[S]) {
739
+ const m = c[l][S];
740
+ C.v = m.v, C.f = null, C.si = null, C.p = null, i.setValue(v, f, C);
741
+ } else if ((E = a == null ? void 0 : a[v]) != null && E[f]) {
742
+ if (C.v = d.v, C.f = null, C.si = null, C.p = null, d.p) {
743
+ const m = wr(d);
744
+ m && (C.v = m);
745
+ }
746
+ i.setValue(v, f, C);
828
747
  }
829
748
  }), i;
830
749
  }
831
- function li(e, t, n, o, r, s, i) {
832
- const c = new Fe(), a = /* @__PURE__ */ new Map();
833
- return o.forValue((d, f, m) => {
834
- const u = n.rows[d], h = n.cols[f], l = {};
835
- if (De(m.si)) {
750
+ function oi(e, t, n, o, r, s, i) {
751
+ const c = new Pe(), a = /* @__PURE__ */ new Map();
752
+ return o.forValue((h, g, p) => {
753
+ const u = n.rows[h], d = n.cols[g], l = {};
754
+ if (st(p.si)) {
836
755
  if (i.unitId !== e || i.subUnitId !== t) {
837
756
  const S = s.getFormulaStringByCell(
838
- i.range.rows[d % i.range.rows.length],
839
- i.range.cols[f % i.range.cols.length],
757
+ i.range.rows[h % i.range.rows.length],
758
+ i.range.cols[g % i.range.cols.length],
840
759
  i.subUnitId,
841
760
  i.unitId
842
- ), v = n.cols[f] - i.range.cols[f % i.range.cols.length], g = n.rows[d] - i.range.rows[d % i.range.rows.length], C = r.moveFormulaRefOffset(S || "", v, g);
761
+ ), v = n.cols[g] - i.range.cols[g % i.range.cols.length], f = n.rows[h] - i.range.rows[h % i.range.rows.length], C = r.moveFormulaRefOffset(S || "", v, f);
843
762
  l.si = null, l.f = C;
844
763
  } else
845
- l.si = m.si, l.f = null;
846
- l.v = null, l.p = null, c.setValue(u, h, l);
847
- } else if (Ce(m.f)) {
848
- const S = `${d % i.range.rows.length}_${f % i.range.cols.length}`;
764
+ l.si = p.si, l.f = null;
765
+ l.v = null, l.p = null, c.setValue(u, d, l);
766
+ } else if (Fe(p.f)) {
767
+ const S = `${h % i.range.rows.length}_${g % i.range.cols.length}`;
849
768
  let v = a.get(S);
850
769
  if (v)
851
770
  l.si = v, l.f = null;
852
771
  else {
853
- v = Yt(6), a.set(S, v);
854
- const g = n.cols[f] - i.range.cols[f % i.range.cols.length], C = n.rows[d] - i.range.rows[d % i.range.rows.length], R = r.moveFormulaRefOffset(m.f || "", g, C);
855
- l.si = v, l.f = R;
772
+ v = hn(6), a.set(S, v);
773
+ const f = n.cols[g] - i.range.cols[g % i.range.cols.length], C = n.rows[h] - i.range.rows[h % i.range.rows.length], I = r.moveFormulaRefOffset(p.f || "", f, C);
774
+ l.si = v, l.f = I;
856
775
  }
857
- l.v = null, l.p = null, c.setValue(u, h, l);
776
+ l.v = null, l.p = null, c.setValue(u, d, l);
858
777
  } else {
859
- if (l.v = m.v, l.f = null, l.si = null, l.p = null, m.p) {
860
- const S = wr(m);
778
+ if (l.v = p.v, l.f = null, l.si = null, l.p = null, p.p) {
779
+ const S = wr(p);
861
780
  S && (l.v = S);
862
781
  }
863
- c.setValue(u, h, l);
782
+ c.setValue(u, d, l);
864
783
  }
865
784
  }), c;
866
785
  }
867
- function ai(e, t, n, o, r, s, i, c) {
868
- const a = new Fe(), d = /* @__PURE__ */ new Map(), f = i.getSheetFormulaData(e, t), m = [];
869
- return r === hr.CUT ? o.forValue((u, h, l) => {
870
- const S = n.rows[u], v = n.cols[h], g = {};
871
- if (De(l.si)) {
872
- if (Ce(l.f))
873
- m.push(l.si), g.f = l.f, g.si = l.si;
874
- else if (m.includes(l.si))
875
- g.f = null, g.si = l.si;
786
+ function si(e, t, n, o, r, s, i, c) {
787
+ const a = new Pe(), h = /* @__PURE__ */ new Map(), g = i.getSheetFormulaData(e, t), p = [];
788
+ return r === cr.CUT ? o.forValue((u, d, l) => {
789
+ const S = n.rows[u], v = n.cols[d], f = {};
790
+ if (st(l.si)) {
791
+ if (Fe(l.f))
792
+ p.push(l.si), f.f = l.f, f.si = l.si;
793
+ else if (p.includes(l.si))
794
+ f.f = null, f.si = l.si;
876
795
  else {
877
796
  const C = i.getFormulaStringByCell(
878
797
  c.range.rows[u % c.range.rows.length],
879
- c.range.cols[h % c.range.cols.length],
798
+ c.range.cols[d % c.range.cols.length],
880
799
  c.subUnitId,
881
800
  c.unitId
882
801
  );
883
- g.f = C, g.si = null;
802
+ f.f = C, f.si = null;
884
803
  }
885
- g.v = null, g.p = null, a.setValue(S, v, g);
886
- } else Ce(l.f) && (g.f = l.f, g.si = null, g.v = null, g.p = null, a.setValue(S, v, g));
887
- }) : o.forValue((u, h, l) => {
804
+ f.v = null, f.p = null, a.setValue(S, v, f);
805
+ } else Fe(l.f) && (f.f = l.f, f.si = null, f.v = null, f.p = null, a.setValue(S, v, f));
806
+ }) : o.forValue((u, d, l) => {
888
807
  var C;
889
- const S = n.rows[u], v = n.cols[h], g = {};
890
- if (De(l.si)) {
808
+ const S = n.rows[u], v = n.cols[d], f = {};
809
+ if (st(l.si)) {
891
810
  if (c.unitId !== e || c.subUnitId !== t) {
892
- const R = i.getFormulaStringByCell(
811
+ const I = i.getFormulaStringByCell(
893
812
  c.range.rows[u % c.range.rows.length],
894
- c.range.cols[h % c.range.cols.length],
813
+ c.range.cols[d % c.range.cols.length],
895
814
  c.subUnitId,
896
815
  c.unitId
897
- ), E = n.cols[h] - c.range.cols[h % c.range.cols.length], p = n.rows[u] - c.range.rows[u % c.range.rows.length], b = s.moveFormulaRefOffset(R || "", E, p);
898
- g.si = null, g.f = b;
816
+ ), E = n.cols[d] - c.range.cols[d % c.range.cols.length], m = n.rows[u] - c.range.rows[u % c.range.rows.length], y = s.moveFormulaRefOffset(I || "", E, m);
817
+ f.si = null, f.f = y;
899
818
  } else
900
- g.si = l.si, g.f = null;
901
- g.v = null, g.p = null, a.setValue(S, v, g);
902
- } else if (Ce(l.f)) {
903
- const R = `${u % c.range.rows.length}_${h % c.range.cols.length}`;
904
- let E = d.get(R);
819
+ f.si = l.si, f.f = null;
820
+ f.v = null, f.p = null, a.setValue(S, v, f);
821
+ } else if (Fe(l.f)) {
822
+ const I = `${u % c.range.rows.length}_${d % c.range.cols.length}`;
823
+ let E = h.get(I);
905
824
  if (E)
906
- g.si = E, g.f = null;
825
+ f.si = E, f.f = null;
907
826
  else {
908
- E = Yt(6), d.set(R, E);
909
- const p = n.cols[h] - c.range.cols[h % c.range.cols.length], b = n.rows[u] - c.range.rows[u % c.range.rows.length], T = s.moveFormulaRefOffset(l.f || "", p, b);
910
- g.si = E, g.f = T;
911
- }
912
- g.v = null, g.p = null, a.setValue(S, v, g);
913
- } else (C = f == null ? void 0 : f[S]) != null && C[v] && (g.v = l.v, g.f = null, g.si = null, g.p = l.p, a.setValue(S, v, g));
914
- }), m.length > 0 && new Fe(f).forValue((u, h, l) => {
915
- if (!(c.range.rows.includes(u) && c.range.cols.includes(h)) && !(n.rows.includes(u) && n.cols.includes(h)) && m.includes(l == null ? void 0 : l.si)) {
827
+ E = hn(6), h.set(I, E);
828
+ const m = n.cols[d] - c.range.cols[d % c.range.cols.length], y = n.rows[u] - c.range.rows[u % c.range.rows.length], T = s.moveFormulaRefOffset(l.f || "", m, y);
829
+ f.si = E, f.f = T;
830
+ }
831
+ f.v = null, f.p = null, a.setValue(S, v, f);
832
+ } else (C = g == null ? void 0 : g[S]) != null && C[v] && (f.v = l.v, f.f = null, f.si = null, f.p = l.p, a.setValue(S, v, f));
833
+ }), p.length > 0 && new Pe(g).forValue((u, d, l) => {
834
+ if (!(c.range.rows.includes(u) && c.range.cols.includes(d)) && !(n.rows.includes(u) && n.cols.includes(d)) && p.includes(l == null ? void 0 : l.si)) {
916
835
  const S = i.getFormulaStringByCell(
917
836
  u,
918
- h,
837
+ d,
919
838
  c.subUnitId,
920
839
  c.unitId
921
840
  );
922
- a.setValue(u, h, {
841
+ a.setValue(u, d, {
923
842
  f: S,
924
843
  si: null,
925
844
  v: null,
@@ -934,15 +853,15 @@ function wr(e) {
934
853
  if (t == null)
935
854
  return;
936
855
  const n = t.dataStream;
937
- return n.substring(n.length - 2, n.length) === cr ? n.substring(0, n.length - 2) : n;
856
+ return n.substring(n.length - 2, n.length) === tr ? n.substring(0, n.length - 2) : n;
938
857
  }
939
858
  }
940
- var ui = Object.getOwnPropertyDescriptor, di = (e, t, n, o) => {
941
- for (var r = o > 1 ? void 0 : o ? ui(t, n) : t, s = e.length - 1, i; s >= 0; s--)
859
+ var ii = Object.getOwnPropertyDescriptor, ci = (e, t, n, o) => {
860
+ for (var r = o > 1 ? void 0 : o ? ii(t, n) : t, s = e.length - 1, i; s >= 0; s--)
942
861
  (i = e[s]) && (r = i(r) || r);
943
862
  return r;
944
863
  }, je = (e, t) => (n, o) => t(n, o, e);
945
- let Ht = class extends ze {
864
+ let Ht = class extends at {
946
865
  constructor(t, n, o, r, s, i, c, a) {
947
866
  super();
948
867
  j(this, "_previousShape");
@@ -972,19 +891,19 @@ let Ht = class extends ze {
972
891
  }
973
892
  _initInterceptorEditorStart() {
974
893
  this.disposeWithMe(
975
- lr(
976
- this._sheetInterceptorService.writeCellInterceptor.intercept(is, {
894
+ rr(
895
+ this._sheetInterceptorService.writeCellInterceptor.intercept(rs, {
977
896
  handler: (t, n, o) => {
978
- var l, S, v, g;
979
- const { row: r, col: s, unitId: i, subUnitId: c, worksheet: a } = n, d = this._formulaDataModel.getArrayFormulaRange(), f = this._formulaDataModel.getArrayFormulaCellData();
897
+ var l, S, v, f;
898
+ const { row: r, col: s, unitId: i, subUnitId: c, worksheet: a } = n, h = this._formulaDataModel.getArrayFormulaRange(), g = this._formulaDataModel.getArrayFormulaCellData();
980
899
  if (this._removeArrayFormulaRangeShape(), t == null)
981
900
  return o(t);
982
- let m = null;
901
+ let p = null;
983
902
  const u = this._formulaDataModel.getFormulaStringByCell(r, s, c, i);
984
- if (u !== null && (m = { f: u }), t.v != null && t.v !== "" && ((v = (S = (l = f[i]) == null ? void 0 : l[c]) == null ? void 0 : S[r]) == null ? void 0 : v[s]) == null)
985
- return m ? { ...t, ...m } : o(t);
986
- const h = (g = d == null ? void 0 : d[i]) == null ? void 0 : g[c];
987
- return h != null && (m = this._displayArrayFormulaRangeShape(h, r, s, i, c, a, m)), m ? { ...t, ...m } : o(t);
903
+ if (u !== null && (p = { f: u }), t.v != null && t.v !== "" && ((v = (S = (l = g[i]) == null ? void 0 : l[c]) == null ? void 0 : S[r]) == null ? void 0 : v[s]) == null)
904
+ return p ? { ...t, ...p } : o(t);
905
+ const d = (f = h == null ? void 0 : h[i]) == null ? void 0 : f[c];
906
+ return d != null && (p = this._displayArrayFormulaRangeShape(d, r, s, i, c, a, p)), p ? { ...t, ...p } : o(t);
988
907
  }
989
908
  })
990
909
  )
@@ -992,10 +911,10 @@ let Ht = class extends ze {
992
911
  }
993
912
  _commandExecutedListener() {
994
913
  this.disposeWithMe(this._commandService.onCommandExecuted((t, n) => {
995
- (t.id === Lo.id || t.id === $o.id && n && n.remove) && this._removeArrayFormulaRangeShape();
914
+ (t.id === Do.id || t.id === Lo.id && n && n.remove) && this._removeArrayFormulaRangeShape();
996
915
  })), this.disposeWithMe(
997
916
  this._commandService.beforeCommandExecuted((t) => {
998
- cs.id === t.id && requestIdleCallback(() => {
917
+ os.id === t.id && requestIdleCallback(() => {
999
918
  const n = t.params, { unitId: o, subUnitId: r, rowsAutoHeightInfo: s } = n;
1000
919
  this._refreshArrayFormulaRangeShapeByRow(o, r, s);
1001
920
  });
@@ -1003,18 +922,18 @@ let Ht = class extends ze {
1003
922
  );
1004
923
  }
1005
924
  _displayArrayFormulaRangeShape(t, n, o, r, s, i, c) {
1006
- return new Fe(t).forValue((a, d, f) => {
1007
- if (f == null)
925
+ return new Pe(t).forValue((a, h, g) => {
926
+ if (g == null)
1008
927
  return !0;
1009
- const { startRow: m, startColumn: u, endRow: h, endColumn: l } = f;
1010
- if (a === n && d === o)
1011
- return this._createArrayFormulaRangeShape(f, r), !1;
1012
- if (n >= m && n <= h && o >= u && o <= l) {
1013
- const S = i.getCell(m, u);
1014
- return (S == null ? void 0 : S.v) === ue.SPILL || (S == null ? void 0 : S.f) == null ? void 0 : (c == null && (c = {
928
+ const { startRow: p, startColumn: u, endRow: d, endColumn: l } = g;
929
+ if (a === n && h === o)
930
+ return this._createArrayFormulaRangeShape(g, r), !1;
931
+ if (n >= p && n <= d && o >= u && o <= l) {
932
+ const S = i.getCell(p, u);
933
+ return (S == null ? void 0 : S.v) === de.SPILL || (S == null ? void 0 : S.f) == null ? void 0 : (c == null && (c = {
1015
934
  f: S.f,
1016
935
  isInArrayFormulaRange: !0
1017
- }), this._createArrayFormulaRangeShape(f, r), !1);
936
+ }), this._createArrayFormulaRangeShape(g, r), !1);
1018
937
  }
1019
938
  }), c;
1020
939
  }
@@ -1029,15 +948,15 @@ let Ht = class extends ze {
1029
948
  style: {
1030
949
  strokeWidth: 1,
1031
950
  stroke: this._themeService.getColorFromTheme("primary.600"),
1032
- fill: new pn(this._themeService.getColorFromTheme("white")).setAlpha(0).toString(),
951
+ fill: new fn(this._themeService.getColorFromTheme("white")).setAlpha(0).toString(),
1033
952
  widgets: {}
1034
953
  }
1035
- }, c = sn(i, r), { rowHeaderWidth: a, columnHeaderHeight: d } = r, f = new fr(s, Io.FORMULA_EDITOR_SHOW, this._themeService, {
954
+ }, c = rn(i, r), { rowHeaderWidth: a, columnHeaderHeight: h } = r, g = new ar(s, Ro.FORMULA_EDITOR_SHOW, this._themeService, {
1036
955
  highlightHeader: !1,
1037
956
  rowHeaderWidth: a,
1038
- columnHeaderHeight: d
957
+ columnHeaderHeight: h
1039
958
  });
1040
- f.updateRangeBySelectionWithCoord(c), f.setEvent(!1), this._previousShape = f;
959
+ g.updateRangeBySelectionWithCoord(c), g.setEvent(!1), this._previousShape = g;
1041
960
  }
1042
961
  _removeArrayFormulaRangeShape() {
1043
962
  this._previousShape != null && (this._previousShape.dispose(), this._previousShape = null);
@@ -1061,52 +980,52 @@ let Ht = class extends ze {
1061
980
  if (!this._checkCurrentSheet(t, n) || !this._previousShape) return;
1062
981
  const { startRow: r, endRow: s, startColumn: i, endColumn: c } = this._previousShape.getRange();
1063
982
  for (let a = 0; a < o.length; a++) {
1064
- const { row: d } = o[a];
1065
- if (r >= d) {
1066
- const f = {
983
+ const { row: h } = o[a];
984
+ if (r >= h) {
985
+ const g = {
1067
986
  startRow: r,
1068
987
  endRow: s,
1069
988
  startColumn: i,
1070
989
  endColumn: c
1071
990
  };
1072
- this._refreshArrayFormulaRangeShape(t, f);
991
+ this._refreshArrayFormulaRangeShape(t, g);
1073
992
  break;
1074
993
  }
1075
994
  }
1076
995
  }
1077
996
  };
1078
- Ht = di([
1079
- je(1, q(In)),
1080
- je(2, q(Tt)),
1081
- je(3, q(Et)),
997
+ Ht = ci([
998
+ je(1, q(_n)),
999
+ je(2, q(yt)),
1000
+ je(3, q(It)),
1082
1001
  je(4, Te),
1083
- je(5, q(bt)),
1084
- je(6, pe),
1085
- je(7, oo)
1002
+ je(5, q(Et)),
1003
+ je(6, ve),
1004
+ je(7, ro)
1086
1005
  ], Ht);
1087
- var hi = Object.getOwnPropertyDescriptor, fi = (e, t, n, o) => {
1088
- for (var r = o > 1 ? void 0 : o ? hi(t, n) : t, s = e.length - 1, i; s >= 0; s--)
1006
+ var ai = Object.getOwnPropertyDescriptor, li = (e, t, n, o) => {
1007
+ for (var r = o > 1 ? void 0 : o ? ai(t, n) : t, s = e.length - 1, i; s >= 0; s--)
1089
1008
  (i = e[s]) && (r = i(r) || r);
1090
1009
  return r;
1091
- }, nr = (e, t) => (n, o) => t(n, o, e);
1092
- const gi = {
1010
+ }, Zn = (e, t) => (n, o) => t(n, o, e);
1011
+ const ui = {
1093
1012
  tl: {
1094
1013
  size: 6,
1095
1014
  color: "#409f11"
1096
1015
  }
1097
1016
  };
1098
- let Bt = class extends so {
1017
+ let Bt = class extends oo {
1099
1018
  constructor(e, t) {
1100
1019
  super(), this._sheetInterceptorService = e, this._formulaDataModel = t, this.disposeWithMe(this._sheetInterceptorService.intercept(
1101
- ls.CELL_CONTENT,
1020
+ ss.CELL_CONTENT,
1102
1021
  {
1103
- effect: io.Style,
1022
+ effect: so.Style,
1104
1023
  handler: (n, o, r) => {
1105
- var c, a, d, f;
1106
- const s = (f = (d = (a = (c = this._formulaDataModel.getArrayFormulaCellData()) == null ? void 0 : c[o.unitId]) == null ? void 0 : a[o.subUnitId]) == null ? void 0 : d[o.row]) == null ? void 0 : f[o.col];
1107
- return !mr(n, !!s) || !n || (n === o.rawData && (n = { ...o.rawData }), n.markers = {
1024
+ var c, a, h, g;
1025
+ const s = (g = (h = (a = (c = this._formulaDataModel.getArrayFormulaCellData()) == null ? void 0 : c[o.unitId]) == null ? void 0 : a[o.subUnitId]) == null ? void 0 : h[o.row]) == null ? void 0 : g[o.col];
1026
+ return !ur(n, !!s) || !n || (n === o.rawData && (n = { ...o.rawData }), n.markers = {
1108
1027
  ...n == null ? void 0 : n.markers,
1109
- ...gi
1028
+ ...ui
1110
1029
  }), r(n);
1111
1030
  },
1112
1031
  priority: 10
@@ -1114,25 +1033,230 @@ let Bt = class extends so {
1114
1033
  ));
1115
1034
  }
1116
1035
  };
1117
- Bt = fi([
1118
- nr(0, q(In)),
1119
- nr(1, q(Tt))
1036
+ Bt = li([
1037
+ Zn(0, q(_n)),
1038
+ Zn(1, q(yt))
1120
1039
  ], Bt);
1121
- function mi() {
1122
- const e = y(ms), t = y(pe), n = _e(e.progress$), o = $t(() => {
1123
- t.executeCommand(Po.id);
1124
- }, [t]), r = $t(() => {
1040
+ function di(e) {
1041
+ const t = ["SUMIF", "SUM", "AVERAGE", "IF", "COUNT", "SIN", "MAX"];
1042
+ let n = t.map((o) => ({
1043
+ label: {
1044
+ name: o,
1045
+ selectable: !1
1046
+ },
1047
+ value: o
1048
+ }));
1049
+ try {
1050
+ const o = e.get(dt), r = t.filter((s) => !!o.getFunctionInfo(s));
1051
+ r.length > 0 && (n = r.map((s) => ({
1052
+ label: {
1053
+ name: s,
1054
+ selectable: !1
1055
+ },
1056
+ value: s
1057
+ })));
1058
+ } catch {
1059
+ }
1060
+ return {
1061
+ id: `${ne.id}.common`,
1062
+ commandId: ne.id,
1063
+ title: "formula.insert.common",
1064
+ tooltip: "formula.insert.tooltip",
1065
+ icon: "FunctionIcon",
1066
+ type: Ot.SELECTOR,
1067
+ selections: n,
1068
+ hidden$: Tt(e, B.UNIVER_SHEET)
1069
+ };
1070
+ }
1071
+ function Oe(e, t, n) {
1072
+ return function(r) {
1073
+ let s = [];
1074
+ try {
1075
+ s = r.get(dt).getSearchListByType(e).map(({ name: c }) => ({
1076
+ label: {
1077
+ name: c,
1078
+ selectable: !1
1079
+ },
1080
+ value: c
1081
+ }));
1082
+ } catch {
1083
+ s = [];
1084
+ }
1085
+ return {
1086
+ id: `${ne.id}.${t}`,
1087
+ commandId: ne.id,
1088
+ title: `formula.functionType.${t}`,
1089
+ tooltip: "formula.insert.tooltip",
1090
+ icon: n,
1091
+ type: Ot.SELECTOR,
1092
+ selections: s,
1093
+ hidden$: Tt(r, B.UNIVER_SHEET)
1094
+ };
1095
+ };
1096
+ }
1097
+ const hi = Oe(fe.Financial, "financial"), fi = Oe(fe.Logical, "logical"), gi = Oe(fe.Text, "text"), mi = Oe(fe.Date, "date"), pi = Oe(fe.Lookup, "lookup"), Si = Oe(fe.Math, "math"), vi = Oe(fe.Statistical, "statistical"), Ci = Oe(fe.Engineering, "engineering"), _i = Oe(fe.Information, "information"), Ri = Oe(fe.Database, "database");
1098
+ function _e(e) {
1099
+ return {
1100
+ id: he.id,
1101
+ title: "formula.moreFunctions.allFunctions",
1102
+ tooltip: "formula.insert.tooltip",
1103
+ type: Ot.BUTTON,
1104
+ hidden$: Tt(e, B.UNIVER_SHEET),
1105
+ disabled$: pn(e, {
1106
+ workbookTypes: [_r],
1107
+ worksheetTypes: [vr, Sr],
1108
+ rangeTypes: [Cr]
1109
+ })
1110
+ };
1111
+ }
1112
+ function Ii(e) {
1113
+ return {
1114
+ id: En.id,
1115
+ type: Ot.BUTTON,
1116
+ title: "formula.operation.copyFormulaOnly",
1117
+ disabled$: pn(e, {
1118
+ workbookTypes: [as],
1119
+ worksheetTypes: [cs],
1120
+ rangeTypes: [is]
1121
+ }),
1122
+ hidden$: Tt(e, B.UNIVER_SHEET)
1123
+ };
1124
+ }
1125
+ function Ei(e) {
1126
+ return {
1127
+ id: bn.id,
1128
+ type: Ot.BUTTON,
1129
+ title: "formula.operation.pasteFormula",
1130
+ disabled$: Io(e).pipe(
1131
+ qo(pn(e, {
1132
+ workbookTypes: [_r],
1133
+ rangeTypes: [Cr],
1134
+ worksheetTypes: [Sr, vr]
1135
+ })),
1136
+ hr(([t, n]) => t || n)
1137
+ ),
1138
+ hidden$: Tt(e, B.UNIVER_SHEET)
1139
+ };
1140
+ }
1141
+ const bi = {
1142
+ [vs.BASIC]: {
1143
+ [`${ne.id}.common`]: {
1144
+ order: 0,
1145
+ menuItemFactory: di,
1146
+ [he.id]: {
1147
+ order: 0,
1148
+ menuItemFactory: _e
1149
+ }
1150
+ },
1151
+ [`${ne.id}.financial`]: {
1152
+ order: 1,
1153
+ menuItemFactory: hi,
1154
+ [he.id]: {
1155
+ order: 0,
1156
+ menuItemFactory: _e
1157
+ }
1158
+ },
1159
+ [`${ne.id}.logical`]: {
1160
+ order: 2,
1161
+ menuItemFactory: fi,
1162
+ [he.id]: {
1163
+ order: 0,
1164
+ menuItemFactory: _e
1165
+ }
1166
+ },
1167
+ [`${ne.id}.text`]: {
1168
+ order: 3,
1169
+ menuItemFactory: gi,
1170
+ [he.id]: {
1171
+ order: 0,
1172
+ menuItemFactory: _e
1173
+ }
1174
+ },
1175
+ [`${ne.id}.date`]: {
1176
+ order: 4,
1177
+ menuItemFactory: mi,
1178
+ [he.id]: {
1179
+ order: 0,
1180
+ menuItemFactory: _e
1181
+ }
1182
+ },
1183
+ [`${ne.id}.lookup`]: {
1184
+ order: 5,
1185
+ menuItemFactory: pi,
1186
+ [he.id]: {
1187
+ order: 0,
1188
+ menuItemFactory: _e
1189
+ }
1190
+ },
1191
+ [`${ne.id}.math`]: {
1192
+ order: 6,
1193
+ menuItemFactory: Si,
1194
+ [he.id]: {
1195
+ order: 0,
1196
+ menuItemFactory: _e
1197
+ }
1198
+ },
1199
+ [`${ne.id}.statistical`]: {
1200
+ order: 7,
1201
+ menuItemFactory: vi,
1202
+ [he.id]: {
1203
+ order: 0,
1204
+ menuItemFactory: _e
1205
+ }
1206
+ },
1207
+ [`${ne.id}.engineering`]: {
1208
+ order: 8,
1209
+ menuItemFactory: Ci,
1210
+ [he.id]: {
1211
+ order: 0,
1212
+ menuItemFactory: _e
1213
+ }
1214
+ },
1215
+ [`${ne.id}.information`]: {
1216
+ order: 9,
1217
+ menuItemFactory: _i,
1218
+ [he.id]: {
1219
+ order: 0,
1220
+ menuItemFactory: _e
1221
+ }
1222
+ },
1223
+ [`${ne.id}.database`]: {
1224
+ order: 10,
1225
+ menuItemFactory: Ri,
1226
+ [he.id]: {
1227
+ order: 0,
1228
+ menuItemFactory: _e
1229
+ }
1230
+ }
1231
+ },
1232
+ [bo]: {
1233
+ [En.id]: {
1234
+ order: 0,
1235
+ menuItemFactory: Ii
1236
+ }
1237
+ },
1238
+ [Eo]: {
1239
+ [bn.id]: {
1240
+ order: 4,
1241
+ menuItemFactory: Ei
1242
+ }
1243
+ }
1244
+ };
1245
+ function yi() {
1246
+ const e = b(hs), t = b(ve), n = Re(e.progress$), o = Pt(() => {
1247
+ t.executeCommand($o.id);
1248
+ }, [t]), r = Pt(() => {
1125
1249
  e.clearProgress();
1126
1250
  }, [e]);
1127
- return /* @__PURE__ */ x(Rs, { progress: n, onTerminate: o, onClearProgress: r });
1251
+ return /* @__PURE__ */ x(Cs, { progress: n, onTerminate: o, onClearProgress: r });
1128
1252
  }
1129
- function pi(e, t) {
1130
- return Object.keys(cn).filter((n) => isNaN(Number(n)) && n !== "DefinedName" && n !== "Table" && (t || n !== "User")).map((n) => ({
1253
+ function Ti(e, t) {
1254
+ return Object.keys(fe).filter((n) => isNaN(Number(n)) && n !== "DefinedName" && n !== "Table" && (t || n !== "User")).map((n) => ({
1131
1255
  label: e.t(`formula.functionType.${n.toLocaleLowerCase()}`),
1132
- value: `${cn[n]}`
1256
+ value: `${fe[n]}`
1133
1257
  }));
1134
1258
  }
1135
- function kr(e) {
1259
+ function Fr(e) {
1136
1260
  if (!e.require && !e.repeat)
1137
1261
  return `[${e.name}]`;
1138
1262
  if (e.require && !e.repeat)
@@ -1142,27 +1266,27 @@ function kr(e) {
1142
1266
  if (e.require && e.repeat)
1143
1267
  return `${e.name},...`;
1144
1268
  }
1145
- function Ar(e) {
1269
+ function kr(e) {
1146
1270
  const { prefix: t, value: n } = e;
1147
- return /* @__PURE__ */ B("div", { children: [
1148
- /* @__PURE__ */ B("span", { children: [
1271
+ return /* @__PURE__ */ H("div", { children: [
1272
+ /* @__PURE__ */ H("span", { children: [
1149
1273
  t,
1150
1274
  "("
1151
1275
  ] }),
1152
- n && n.map((o, r) => /* @__PURE__ */ B("span", { children: [
1153
- /* @__PURE__ */ x("span", { children: kr(o) }),
1276
+ n && n.map((o, r) => /* @__PURE__ */ H("span", { children: [
1277
+ /* @__PURE__ */ x("span", { children: Fr(o) }),
1154
1278
  r === n.length - 1 ? "" : ","
1155
1279
  ] }, r)),
1156
1280
  ")"
1157
1281
  ] });
1158
1282
  }
1159
- function Ct(e) {
1283
+ function vt(e) {
1160
1284
  const { className: t, value: n, title: o } = e;
1161
- return /* @__PURE__ */ B("div", { className: "univer-mb-2 univer-text-xs", children: [
1285
+ return /* @__PURE__ */ H("div", { className: "univer-mb-2 univer-text-xs", children: [
1162
1286
  /* @__PURE__ */ x(
1163
1287
  "div",
1164
1288
  {
1165
- className: se("univer-mb-2 univer-font-medium univer-text-gray-500 dark:!univer-text-gray-300", t),
1289
+ className: ie("univer-mb-2 univer-font-medium univer-text-gray-500 dark:!univer-text-gray-300", t),
1166
1290
  children: o
1167
1291
  }
1168
1292
  ),
@@ -1175,27 +1299,27 @@ function Ct(e) {
1175
1299
  )
1176
1300
  ] });
1177
1301
  }
1178
- function Si(e) {
1302
+ function Oi(e) {
1179
1303
  const { functionInfo: t, onChange: n } = e;
1180
1304
  if (!t) return null;
1181
- const [o, r] = H([]), [s, i] = H(t.functionParameter), [c, a] = H(-1);
1182
- return /* @__PURE__ */ B("div", { children: [
1183
- /* @__PURE__ */ x("div", { className: se("univer-h-[364px] univer-overflow-y-auto", ut), children: s.map((d, f) => /* @__PURE__ */ B("div", { children: [
1184
- /* @__PURE__ */ x("div", { className: "univer-text-sm", children: d.name }),
1305
+ const [o, r] = V([]), [s, i] = V(t.functionParameter), [c, a] = V(-1);
1306
+ return /* @__PURE__ */ H("div", { children: [
1307
+ /* @__PURE__ */ x("div", { className: ie("univer-h-[364px] univer-overflow-y-auto", it), children: s.map((h, g) => /* @__PURE__ */ H("div", { children: [
1308
+ /* @__PURE__ */ x("div", { className: "univer-text-sm", children: h.name }),
1185
1309
  /* @__PURE__ */ x("div", { className: "univer-mb-2 univer-mt-1" })
1186
- ] }, f)) }),
1187
- /* @__PURE__ */ x("div", { className: se("univer-flex-1 univer-p-3", Ns), children: /* @__PURE__ */ x(
1188
- Ct,
1310
+ ] }, g)) }),
1311
+ /* @__PURE__ */ x("div", { className: ie("univer-flex-1 univer-p-3", Ts), children: /* @__PURE__ */ x(
1312
+ vt,
1189
1313
  {
1190
- title: c === -1 ? /* @__PURE__ */ x(Ar, { prefix: t.functionName, value: s }) : s[c].name,
1314
+ title: c === -1 ? /* @__PURE__ */ x(kr, { prefix: t.functionName, value: s }) : s[c].name,
1191
1315
  value: c === -1 ? t.description : s[c].detail
1192
1316
  }
1193
1317
  ) })
1194
1318
  ] });
1195
1319
  }
1196
- function nt({ ref: e, ...t }) {
1197
- const { icon: n, id: o, className: r, extend: s, ...i } = t, c = `univerjs-icon univerjs-icon-${o} ${r || ""}`.trim(), a = X(`_${_i()}`);
1198
- return Fr(n, `${o}`, {
1320
+ function Xe({ ref: e, ...t }) {
1321
+ const { icon: n, id: o, className: r, extend: s, ...i } = t, c = `univerjs-icon univerjs-icon-${o} ${r || ""}`.trim(), a = X(`_${xi()}`);
1322
+ return Ar(n, `${o}`, {
1199
1323
  defIds: n.defIds,
1200
1324
  idSuffix: a.current
1201
1325
  }, {
@@ -1204,14 +1328,14 @@ function nt({ ref: e, ...t }) {
1204
1328
  ...i
1205
1329
  }, s);
1206
1330
  }
1207
- function Fr(e, t, n, o, r) {
1208
- return tt(e.tag, {
1331
+ function Ar(e, t, n, o, r) {
1332
+ return Ze(e.tag, {
1209
1333
  key: t,
1210
- ...vi(e, n, r),
1334
+ ...Ni(e, n, r),
1211
1335
  ...o
1212
- }, (Ci(e, n).children || []).map((s, i) => Fr(s, `${t}-${e.tag}-${i}`, n, void 0, r)));
1336
+ }, (Mi(e, n).children || []).map((s, i) => Ar(s, `${t}-${e.tag}-${i}`, n, void 0, r)));
1213
1337
  }
1214
- function vi(e, t, n) {
1338
+ function Ni(e, t, n) {
1215
1339
  const o = { ...e.attrs };
1216
1340
  n != null && n.colorChannel1 && o.fill === "colorChannel1" && (o.fill = n.colorChannel1), e.tag === "mask" && o.id && (o.id = o.id + t.idSuffix), Object.entries(o).forEach(([s, i]) => {
1217
1341
  s === "mask" && typeof i == "string" && (o[s] = i.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
@@ -1221,7 +1345,7 @@ function vi(e, t, n) {
1221
1345
  typeof i == "string" && (o[s] = i.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
1222
1346
  })), o;
1223
1347
  }
1224
- function Ci(e, t) {
1348
+ function Mi(e, t) {
1225
1349
  var o;
1226
1350
  const { defIds: n } = t;
1227
1351
  return !n || n.length === 0 ? e : e.tag === "defs" && ((o = e.children) != null && o.length) ? {
@@ -1235,11 +1359,11 @@ function Ci(e, t) {
1235
1359
  } : r)
1236
1360
  } : e;
1237
1361
  }
1238
- function _i() {
1362
+ function xi() {
1239
1363
  return Math.random().toString(36).substring(2, 8);
1240
1364
  }
1241
- nt.displayName = "UniverIcon";
1242
- const Ri = {
1365
+ Xe.displayName = "UniverIcon";
1366
+ const wi = {
1243
1367
  tag: "svg",
1244
1368
  attrs: {
1245
1369
  xmlns: "http://www.w3.org/2000/svg",
@@ -1257,15 +1381,15 @@ const Ri = {
1257
1381
  clipRule: "evenodd"
1258
1382
  }
1259
1383
  }]
1260
- }, Dr = Ve(function(t, n) {
1261
- return tt(nt, Object.assign({}, t, {
1384
+ }, Dr = We(function(t, n) {
1385
+ return Ze(Xe, Object.assign({}, t, {
1262
1386
  id: "check-mark-icon",
1263
1387
  ref: n,
1264
- icon: Ri
1388
+ icon: wi
1265
1389
  }));
1266
1390
  });
1267
1391
  Dr.displayName = "CheckMarkIcon";
1268
- const Ii = {
1392
+ const Fi = {
1269
1393
  tag: "svg",
1270
1394
  attrs: {
1271
1395
  xmlns: "http://www.w3.org/2000/svg",
@@ -1281,15 +1405,15 @@ const Ii = {
1281
1405
  d: "M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z"
1282
1406
  }
1283
1407
  }]
1284
- }, Lr = Ve(function(t, n) {
1285
- return tt(nt, Object.assign({}, t, {
1408
+ }, Lr = We(function(t, n) {
1409
+ return Ze(Xe, Object.assign({}, t, {
1286
1410
  id: "close-icon",
1287
1411
  ref: n,
1288
- icon: Ii
1412
+ icon: Fi
1289
1413
  }));
1290
1414
  });
1291
1415
  Lr.displayName = "CloseIcon";
1292
- const Ei = {
1416
+ const ki = {
1293
1417
  tag: "svg",
1294
1418
  attrs: {
1295
1419
  xmlns: "http://www.w3.org/2000/svg",
@@ -1330,15 +1454,15 @@ const Ei = {
1330
1454
  }
1331
1455
  }
1332
1456
  ]
1333
- }, $r = Ve(function(t, n) {
1334
- return tt(nt, Object.assign({}, t, {
1457
+ }, $r = We(function(t, n) {
1458
+ return Ze(Xe, Object.assign({}, t, {
1335
1459
  id: "delete-icon",
1336
1460
  ref: n,
1337
- icon: Ei
1461
+ icon: ki
1338
1462
  }));
1339
1463
  });
1340
1464
  $r.displayName = "DeleteIcon";
1341
- const bi = {
1465
+ const Ai = {
1342
1466
  tag: "svg",
1343
1467
  attrs: {
1344
1468
  xmlns: "http://www.w3.org/2000/svg",
@@ -1354,15 +1478,15 @@ const bi = {
1354
1478
  d: "M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"
1355
1479
  }
1356
1480
  }]
1357
- }, Pr = Ve(function(t, n) {
1358
- return tt(nt, Object.assign({}, t, {
1481
+ }, Pr = We(function(t, n) {
1482
+ return Ze(Xe, Object.assign({}, t, {
1359
1483
  id: "increase-icon",
1360
1484
  ref: n,
1361
- icon: bi
1485
+ icon: Ai
1362
1486
  }));
1363
1487
  });
1364
1488
  Pr.displayName = "IncreaseIcon";
1365
- const yi = {
1489
+ const Di = {
1366
1490
  tag: "svg",
1367
1491
  attrs: {
1368
1492
  xmlns: "http://www.w3.org/2000/svg",
@@ -1380,15 +1504,15 @@ const yi = {
1380
1504
  clipRule: "evenodd"
1381
1505
  }
1382
1506
  }]
1383
- }, Ur = Ve(function(t, n) {
1384
- return tt(nt, Object.assign({}, t, {
1507
+ }, Ur = We(function(t, n) {
1508
+ return Ze(Xe, Object.assign({}, t, {
1385
1509
  id: "more-icon",
1386
1510
  ref: n,
1387
- icon: yi
1511
+ icon: Di
1388
1512
  }));
1389
1513
  });
1390
1514
  Ur.displayName = "MoreIcon";
1391
- const Ti = {
1515
+ const Li = {
1392
1516
  tag: "svg",
1393
1517
  attrs: {
1394
1518
  xmlns: "http://www.w3.org/2000/svg",
@@ -1412,42 +1536,42 @@ const Ti = {
1412
1536
  clipRule: "evenodd"
1413
1537
  }
1414
1538
  }]
1415
- }, Vr = Ve(function(t, n) {
1416
- return tt(nt, Object.assign({}, t, {
1539
+ }, Wr = We(function(t, n) {
1540
+ return Ze(Xe, Object.assign({}, t, {
1417
1541
  id: "select-range-icon",
1418
1542
  ref: n,
1419
- icon: Ti
1543
+ icon: Li
1420
1544
  }));
1421
1545
  });
1422
- Vr.displayName = "SelectRangeIcon";
1423
- function Oi(e) {
1424
- var I;
1425
- const n = (I = y(Sn).getConfig(ps)) == null ? void 0 : I.function, { onChange: o } = e, r = "-1", [s, i] = H(""), [c, a] = H([]), [d, f] = H(0), [m, u] = H(r), [h, l] = H(0), [S, v] = H(null), g = y(zt), C = y(dt), R = y(En), E = _e(R.sidebarOptions$), p = pi(C, !!n).filter(
1426
- (_) => g.getSearchListByType(Number(_.value)).length > 0
1546
+ Wr.displayName = "SelectRangeIcon";
1547
+ function $i(e) {
1548
+ var R;
1549
+ const n = (R = b(gn).getConfig(fs)) == null ? void 0 : R.function, { onChange: o } = e, r = "-1", [s, i] = V(""), [c, a] = V([]), [h, g] = V(0), [p, u] = V(r), [d, l] = V(0), [S, v] = V(null), f = b(dt), C = b(lt), I = b(Rn), E = Re(I.sidebarOptions$), m = Ti(C, !!n).filter(
1550
+ (_) => f.getSearchListByType(Number(_.value)).length > 0
1427
1551
  );
1428
- p.unshift({
1552
+ m.unshift({
1429
1553
  label: C.t("formula.moreFunctions.allFunctions"),
1430
1554
  value: r
1431
1555
  });
1432
- const b = C.t("formula.prompt.required"), T = C.t("formula.prompt.optional");
1556
+ const y = C.t("formula.prompt.required"), T = C.t("formula.prompt.optional");
1433
1557
  P(() => {
1434
1558
  N(r);
1435
1559
  }, []), P(() => {
1436
- A(0);
1560
+ k(0);
1437
1561
  }, [c]), P(() => {
1438
- E != null && E.visible && (i(""), a([]), f(0), u(r), l(0), v(null), N(r));
1562
+ E != null && E.visible && (i(""), a([]), g(0), u(r), l(0), v(null), N(r));
1439
1563
  }, [E]);
1440
- const F = (_) => {
1564
+ const A = (_) => {
1441
1565
  if (s.trim() === "") return _;
1442
1566
  const O = new RegExp(`(${s.toLocaleUpperCase()})`);
1443
1567
  return _.split(O).filter(Boolean).map((U, Y) => U.match(O) ? /* @__PURE__ */ x("span", { className: "univer-text-red-500", children: U }, Y) : U);
1444
- }, A = (_) => {
1568
+ }, k = (_) => {
1445
1569
  if (c.length === 0) {
1446
1570
  v(null), o(null);
1447
1571
  return;
1448
1572
  }
1449
1573
  l(_);
1450
- const O = g.getFunctionInfo(c[_].name);
1574
+ const O = f.getFunctionInfo(c[_].name);
1451
1575
  if (!O) {
1452
1576
  v(null), o(null);
1453
1577
  return;
@@ -1456,33 +1580,33 @@ function Oi(e) {
1456
1580
  };
1457
1581
  function N(_) {
1458
1582
  u(_);
1459
- const O = g.getSearchListByType(+_);
1583
+ const O = f.getSearchListByType(+_);
1460
1584
  a(O);
1461
1585
  }
1462
1586
  function M(_) {
1463
1587
  i(_);
1464
- const O = g.getSearchListByName(_);
1588
+ const O = f.getSearchListByName(_);
1465
1589
  a(O);
1466
1590
  }
1467
1591
  function w(_) {
1468
1592
  if (_.stopPropagation(), _.key === "ArrowDown") {
1469
- const O = d + 1;
1470
- f(O === c.length ? 0 : O);
1593
+ const O = h + 1;
1594
+ g(O === c.length ? 0 : O);
1471
1595
  } else if (_.key === "ArrowUp") {
1472
- const O = d - 1;
1473
- f(O === -1 ? c.length - 1 : O);
1474
- } else _.key === "Enter" && A(d);
1596
+ const O = h - 1;
1597
+ g(O === -1 ? c.length - 1 : O);
1598
+ } else _.key === "Enter" && k(h);
1475
1599
  }
1476
- const k = (_) => {
1477
- f(_);
1600
+ const F = (_) => {
1601
+ g(_);
1478
1602
  }, $ = () => {
1479
- f(-1);
1603
+ g(-1);
1480
1604
  };
1481
- return /* @__PURE__ */ B("div", { children: [
1482
- /* @__PURE__ */ B("div", { className: "univer-flex univer-items-center univer-justify-between univer-gap-2", children: [
1483
- /* @__PURE__ */ x(Ms, { value: m, options: p, onChange: N }),
1605
+ return /* @__PURE__ */ H("div", { children: [
1606
+ /* @__PURE__ */ H("div", { className: "univer-flex univer-items-center univer-justify-between univer-gap-2", children: [
1607
+ /* @__PURE__ */ x(Os, { value: p, options: m, onChange: N }),
1484
1608
  /* @__PURE__ */ x(
1485
- yr,
1609
+ br,
1486
1610
  {
1487
1611
  placeholder: C.t("formula.moreFunctions.searchFunctionPlaceholder"),
1488
1612
  onKeyDown: w,
@@ -1496,99 +1620,99 @@ function Oi(e) {
1496
1620
  c.length > 0 && /* @__PURE__ */ x(
1497
1621
  "ul",
1498
1622
  {
1499
- 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", bn, ut),
1623
+ className: ie("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, it),
1500
1624
  onKeyDown: w,
1501
1625
  tabIndex: -1,
1502
- children: c.map(({ name: _ }, O) => /* @__PURE__ */ B(
1626
+ children: c.map(({ name: _ }, O) => /* @__PURE__ */ H(
1503
1627
  "li",
1504
1628
  {
1505
- 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", {
1506
- "univer-bg-gray-200 dark:!univer-bg-gray-600": d === O
1629
+ className: ie("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", {
1630
+ "univer-bg-gray-200 dark:!univer-bg-gray-600": h === O
1507
1631
  }),
1508
- onMouseEnter: () => k(O),
1632
+ onMouseEnter: () => F(O),
1509
1633
  onMouseLeave: $,
1510
- onClick: () => A(O),
1634
+ onClick: () => k(O),
1511
1635
  children: [
1512
- h === O && /* @__PURE__ */ x(
1636
+ d === O && /* @__PURE__ */ x(
1513
1637
  Dr,
1514
1638
  {
1515
1639
  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"
1516
1640
  }
1517
1641
  ),
1518
- /* @__PURE__ */ x("span", { className: "univer-block", children: F(_) })
1642
+ /* @__PURE__ */ x("span", { className: "univer-block", children: A(_) })
1519
1643
  ]
1520
1644
  },
1521
1645
  O
1522
1646
  ))
1523
1647
  }
1524
1648
  ),
1525
- S && /* @__PURE__ */ B("div", { className: se("univer-mx-0 univer-my-2 univer-overflow-y-auto", ut), children: [
1526
- /* @__PURE__ */ x(Ct, { title: S.functionName, value: S.description }),
1649
+ S && /* @__PURE__ */ H("div", { className: ie("univer-mx-0 univer-my-2 univer-overflow-y-auto", it), children: [
1650
+ /* @__PURE__ */ x(vt, { title: S.functionName, value: S.description }),
1527
1651
  /* @__PURE__ */ x(
1528
- Ct,
1652
+ vt,
1529
1653
  {
1530
1654
  title: C.t("formula.moreFunctions.syntax"),
1531
- value: /* @__PURE__ */ x(Ar, { prefix: S.functionName, value: S.functionParameter })
1655
+ value: /* @__PURE__ */ x(kr, { prefix: S.functionName, value: S.functionParameter })
1532
1656
  }
1533
1657
  ),
1534
1658
  /* @__PURE__ */ x(
1535
- Ct,
1659
+ vt,
1536
1660
  {
1537
1661
  title: C.t("formula.prompt.helpExample"),
1538
1662
  value: `${S.functionName}(${S.functionParameter.map((_) => _.example).join(",")})`
1539
1663
  }
1540
1664
  ),
1541
1665
  S.functionParameter && S.functionParameter.map((_) => /* @__PURE__ */ x(
1542
- Ct,
1666
+ vt,
1543
1667
  {
1544
1668
  title: _.name,
1545
- value: `${_.require ? b : T} ${_.detail}`
1669
+ value: `${_.require ? y : T} ${_.detail}`
1546
1670
  },
1547
1671
  _.name
1548
1672
  ))
1549
1673
  ] })
1550
1674
  ] });
1551
1675
  }
1552
- function Ni() {
1553
- const e = Eo(), [t, n] = H(!0), [o, r] = H(!1), [s, i] = H(null);
1554
- y(vn);
1555
- const c = y(dt), a = y(Ze), d = y(ne), f = y(pe);
1556
- function m() {
1676
+ function Pi() {
1677
+ const e = yo(), [t, n] = V(!0), [o, r] = V(!1), [s, i] = V(null);
1678
+ b(mn);
1679
+ const c = b(lt), a = b(ze), h = b(re), g = b(ve);
1680
+ function p() {
1557
1681
  n(!t), r(!o);
1558
1682
  }
1559
1683
  function u() {
1560
- const h = Rr(d);
1561
- if (!h) return;
1562
- f.executeCommand(dr.id, {
1684
+ const d = pr(h);
1685
+ if (!d) return;
1686
+ g.executeCommand(ir.id, {
1563
1687
  visible: !0,
1564
- unitId: h.unitId,
1565
- eventType: xe.Dblclick
1688
+ unitId: d.unitId,
1689
+ eventType: Ae.Dblclick
1566
1690
  });
1567
- const l = a.getEditor(gn), S = a.getEditor(ir), v = `=${s == null ? void 0 : s.functionName}(`;
1691
+ const l = a.getEditor(dn), S = a.getEditor(er), v = `=${s == null ? void 0 : s.functionName}(`;
1568
1692
  l == null || l.replaceText(v), S == null || S.replaceText(v, !1);
1569
1693
  }
1570
- return /* @__PURE__ */ B(
1694
+ return /* @__PURE__ */ H(
1571
1695
  "div",
1572
1696
  {
1573
1697
  "data-u-comp": "sheets-formula-functions-panel",
1574
1698
  className: "univer-box-border univer-flex univer-h-full univer-flex-col univer-justify-between univer-py-2",
1575
1699
  children: [
1576
- t && /* @__PURE__ */ x(Oi, { onChange: i }),
1577
- o && /* @__PURE__ */ x(Si, { functionInfo: s, onChange: () => {
1700
+ t && /* @__PURE__ */ x($i, { onChange: i }),
1701
+ o && /* @__PURE__ */ x(Oi, { functionInfo: s, onChange: () => {
1578
1702
  } }),
1579
- /* @__PURE__ */ B("div", { className: "univer-flex univer-justify-end", children: [
1703
+ /* @__PURE__ */ H("div", { className: "univer-flex univer-justify-end", children: [
1580
1704
  o && /* @__PURE__ */ x(
1581
- at,
1705
+ ot,
1582
1706
  {
1583
1707
  variant: "primary",
1584
- onClick: m,
1708
+ onClick: p,
1585
1709
  className: "univer-mb-5 univer-ml-4 univer-mr-0 univer-mt-0",
1586
1710
  children: c.t("formula.moreFunctions.next")
1587
1711
  }
1588
1712
  ),
1589
- o && /* @__PURE__ */ x(at, { onClick: m, className: "univer-mb-5 univer-ml-4 univer-mr-0 univer-mt-0", children: c.t("formula.moreFunctions.prev") }),
1713
+ o && /* @__PURE__ */ x(ot, { onClick: p, className: "univer-mb-5 univer-ml-4 univer-mr-0 univer-mt-0", children: c.t("formula.moreFunctions.prev") }),
1590
1714
  t && !!e && /* @__PURE__ */ x(
1591
- at,
1715
+ ot,
1592
1716
  {
1593
1717
  disabled: !s,
1594
1718
  variant: "primary",
@@ -1602,278 +1726,109 @@ function Ni() {
1602
1726
  }
1603
1727
  );
1604
1728
  }
1605
- function Mi(e) {
1606
- return {
1607
- id: ve.id,
1608
- title: "SUM",
1609
- icon: "SumIcon",
1610
- type: Ue.BUTTON,
1611
- params: {
1612
- value: "SUM"
1613
- },
1614
- hidden$: Pe(e, W.UNIVER_SHEET),
1615
- disabled$: $e(e, {
1616
- workbookTypes: [et],
1617
- worksheetTypes: [Qe, Xe],
1618
- rangeTypes: [Je]
1619
- })
1620
- };
1621
- }
1622
- function xi(e) {
1623
- return {
1624
- id: ve.id,
1625
- title: "COUNT",
1626
- icon: "CntIcon",
1627
- type: Ue.BUTTON,
1628
- params: {
1629
- value: "COUNT"
1630
- },
1631
- hidden$: Pe(e, W.UNIVER_SHEET),
1632
- disabled$: $e(e, {
1633
- workbookTypes: [et],
1634
- worksheetTypes: [Qe, Xe],
1635
- rangeTypes: [Je]
1636
- })
1637
- };
1638
- }
1639
- function wi(e) {
1640
- return {
1641
- id: ve.id,
1642
- title: "AVERAGE",
1643
- icon: "AvgIcon",
1644
- type: Ue.BUTTON,
1645
- params: {
1646
- value: "AVERAGE"
1647
- },
1648
- hidden$: Pe(e, W.UNIVER_SHEET),
1649
- disabled$: $e(e, {
1650
- workbookTypes: [et],
1651
- worksheetTypes: [Qe, Xe],
1652
- rangeTypes: [Je]
1653
- })
1654
- };
1655
- }
1656
- function ki(e) {
1657
- return {
1658
- id: ve.id,
1659
- title: "MAX",
1660
- icon: "MaxIcon",
1661
- type: Ue.BUTTON,
1662
- params: {
1663
- value: "MAX"
1664
- },
1665
- hidden$: Pe(e, W.UNIVER_SHEET),
1666
- disabled$: $e(e, {
1667
- workbookTypes: [et],
1668
- worksheetTypes: [Qe, Xe],
1669
- rangeTypes: [Je]
1670
- })
1671
- };
1672
- }
1673
- function Ai(e) {
1674
- return {
1675
- id: ve.id,
1676
- title: "MIN",
1677
- icon: "MinIcon",
1678
- type: Ue.BUTTON,
1679
- params: {
1680
- value: "MIN"
1681
- },
1682
- hidden$: Pe(e, W.UNIVER_SHEET),
1683
- disabled$: $e(e, {
1684
- workbookTypes: [et],
1685
- worksheetTypes: [Qe, Xe],
1686
- rangeTypes: [Je]
1687
- })
1688
- };
1689
- }
1690
- function Fi(e) {
1691
- return {
1692
- id: On.id,
1693
- title: "formula.insert.more",
1694
- tooltip: "formula.insert.tooltip",
1695
- type: Ue.BUTTON,
1696
- hidden$: Pe(e, W.UNIVER_SHEET),
1697
- disabled$: $e(e, {
1698
- workbookTypes: [et],
1699
- worksheetTypes: [Qe, Xe],
1700
- rangeTypes: [Je]
1701
- })
1702
- };
1703
- }
1704
- function Di(e) {
1705
- return {
1706
- id: yn.id,
1707
- type: Ue.BUTTON,
1708
- title: "formula.operation.copyFormulaOnly",
1709
- disabled$: $e(e, {
1710
- workbookTypes: [ds],
1711
- worksheetTypes: [us],
1712
- rangeTypes: [as]
1713
- }),
1714
- hidden$: Pe(e, W.UNIVER_SHEET)
1715
- };
1716
- }
1717
- function Li(e) {
1718
- return {
1719
- id: Tn.id,
1720
- type: Ue.BUTTON,
1721
- title: "formula.operation.pasteFormula",
1722
- disabled$: bo(e).pipe(
1723
- jo($e(e, {
1724
- workbookTypes: [et],
1725
- rangeTypes: [Je],
1726
- worksheetTypes: [Xe, Qe]
1727
- })),
1728
- Sr(([t, n]) => t || n)
1729
- ),
1730
- hidden$: Pe(e, W.UNIVER_SHEET)
1731
- };
1732
- }
1733
- const $i = {
1734
- [Xn.BASIC]: {
1735
- [`${ve.id}.sum`]: {
1736
- order: 0,
1737
- menuItemFactory: Mi
1738
- },
1739
- [`${ve.id}.count`]: {
1740
- order: 1,
1741
- menuItemFactory: xi
1742
- },
1743
- [`${ve.id}.average`]: {
1744
- order: 2,
1745
- menuItemFactory: wi
1746
- },
1747
- [`${ve.id}.max`]: {
1748
- order: 3,
1749
- menuItemFactory: ki
1750
- },
1751
- [`${ve.id}.min`]: {
1752
- order: 4,
1753
- menuItemFactory: Ai
1754
- }
1755
- },
1756
- [Xn.OTHERS]: {
1757
- [On.id]: {
1758
- order: 0,
1759
- menuItemFactory: Fi
1760
- }
1761
- },
1762
- [To]: {
1763
- [yn.id]: {
1764
- order: 0,
1765
- menuItemFactory: Di
1766
- }
1767
- },
1768
- [yo]: {
1769
- [Tn.id]: {
1770
- order: 4,
1771
- menuItemFactory: Li
1772
- }
1773
- }
1774
- }, Pi = "meta_key_ctrl_And_Shift";
1775
- function Ui(e) {
1776
- return e.getContextValue(co) && e.getContextValue(lo);
1729
+ const Ui = "meta_key_ctrl_And_Shift";
1730
+ function Wi(e) {
1731
+ return e.getContextValue(io) && e.getContextValue(co);
1777
1732
  }
1778
- const Qt = [
1733
+ const zt = [
1779
1734
  L.ARROW_DOWN,
1780
1735
  L.ARROW_UP,
1781
1736
  L.ARROW_LEFT,
1782
1737
  L.ARROW_RIGHT
1783
- ], Vi = [...Qt, L.ENTER, L.TAB, L.ESC];
1784
- function Wi() {
1738
+ ], Vi = [...zt, L.ENTER, L.TAB, L.ESC];
1739
+ function Hi() {
1785
1740
  const e = [];
1786
1741
  for (const t of Vi)
1787
1742
  e.push({
1788
- id: ft.id,
1743
+ id: ht.id,
1789
1744
  binding: t,
1790
- preconditions: (n) => yt(n),
1745
+ preconditions: (n) => bt(n),
1791
1746
  staticParameters: {
1792
- eventType: xe.Keyboard,
1747
+ eventType: Ae.Keyboard,
1793
1748
  keycode: t
1794
1749
  }
1795
1750
  });
1796
1751
  return e;
1797
1752
  }
1798
- function Hi() {
1753
+ function Bi() {
1799
1754
  const e = [];
1800
- for (const t of Qt)
1755
+ for (const t of zt)
1801
1756
  e.push({
1802
- id: ft.id,
1803
- binding: t | V.SHIFT,
1804
- preconditions: (n) => yt(n),
1757
+ id: ht.id,
1758
+ binding: t | W.SHIFT,
1759
+ preconditions: (n) => bt(n),
1805
1760
  staticParameters: {
1806
- eventType: xe.Keyboard,
1761
+ eventType: Ae.Keyboard,
1807
1762
  keycode: t,
1808
- metaKey: V.SHIFT
1763
+ metaKey: W.SHIFT
1809
1764
  }
1810
1765
  });
1811
1766
  return e;
1812
1767
  }
1813
- function Bi() {
1768
+ function qi() {
1814
1769
  const e = [];
1815
- for (const t of Qt)
1770
+ for (const t of zt)
1816
1771
  e.push({
1817
- id: ft.id,
1818
- binding: t | V.CTRL_COMMAND,
1819
- preconditions: (n) => yt(n),
1772
+ id: ht.id,
1773
+ binding: t | W.CTRL_COMMAND,
1774
+ preconditions: (n) => bt(n),
1820
1775
  staticParameters: {
1821
- eventType: xe.Keyboard,
1776
+ eventType: Ae.Keyboard,
1822
1777
  keycode: t,
1823
- metaKey: V.CTRL_COMMAND
1778
+ metaKey: W.CTRL_COMMAND
1824
1779
  }
1825
1780
  });
1826
1781
  return e;
1827
1782
  }
1828
- function qi() {
1783
+ function ji() {
1829
1784
  const e = [];
1830
- for (const t of Qt)
1785
+ for (const t of zt)
1831
1786
  e.push({
1832
- id: ft.id,
1833
- binding: t | V.SHIFT | V.CTRL_COMMAND,
1834
- preconditions: (n) => yt(n),
1787
+ id: ht.id,
1788
+ binding: t | W.SHIFT | W.CTRL_COMMAND,
1789
+ preconditions: (n) => bt(n),
1835
1790
  staticParameters: {
1836
- eventType: xe.Keyboard,
1791
+ eventType: Ae.Keyboard,
1837
1792
  keycode: t,
1838
- metaKey: Pi
1793
+ metaKey: Ui
1839
1794
  }
1840
1795
  });
1841
1796
  return e;
1842
1797
  }
1843
- const ji = {
1844
- id: Mr.id,
1798
+ const Ki = {
1799
+ id: Nr.id,
1845
1800
  binding: L.F4,
1846
- preconditions: (e) => yt(e)
1801
+ preconditions: (e) => bt(e)
1847
1802
  };
1848
- function Ki() {
1803
+ function Yi() {
1849
1804
  const e = [];
1850
1805
  for (const t of [L.ENTER, L.TAB, L.ARROW_DOWN, L.ARROW_UP])
1851
1806
  e.push({
1852
- id: ft.id,
1807
+ id: ht.id,
1853
1808
  binding: t,
1854
- preconditions: (n) => Ui(n),
1809
+ preconditions: (n) => Wi(n),
1855
1810
  staticParameters: {
1856
- eventType: xe.Keyboard,
1811
+ eventType: Ae.Keyboard,
1857
1812
  keycode: t,
1858
1813
  isSingleEditor: !0
1859
1814
  }
1860
1815
  });
1861
1816
  return e;
1862
1817
  }
1863
- const Yi = {
1864
- id: Ss.id,
1865
- binding: V.ALT | L.EQUAL,
1866
- preconditions: Oo,
1867
- mac: V.CTRL_COMMAND | V.ALT | L.EQUAL,
1818
+ const Gi = {
1819
+ id: gs.id,
1820
+ binding: W.ALT | L.EQUAL,
1821
+ preconditions: To,
1822
+ mac: W.CTRL_COMMAND | W.ALT | L.EQUAL,
1868
1823
  description: "shortcut.sheets-formula-ui.quick-sum",
1869
1824
  group: "4_sheet-edit"
1870
1825
  };
1871
- var Gi = Object.getOwnPropertyDescriptor, zi = (e, t, n, o) => {
1872
- for (var r = o > 1 ? void 0 : o ? Gi(t, n) : t, s = e.length - 1, i; s >= 0; s--)
1826
+ var zi = Object.getOwnPropertyDescriptor, Zi = (e, t, n, o) => {
1827
+ for (var r = o > 1 ? void 0 : o ? zi(t, n) : t, s = e.length - 1, i; s >= 0; s--)
1873
1828
  (i = e[s]) && (r = i(r) || r);
1874
1829
  return r;
1875
1830
  }, Ke = (e, t) => (n, o) => t(n, o, e);
1876
- let qt = class extends ze {
1831
+ let qt = class extends at {
1877
1832
  constructor(e, t, n, o, r, s, i) {
1878
1833
  super(), this._injector = e, this._menuManagerService = t, this._commandService = n, this._shortcutService = o, this._uiPartsService = r, this._renderManagerService = s, this._componentManager = i, this._initialize();
1879
1834
  }
@@ -1881,75 +1836,75 @@ let qt = class extends ze {
1881
1836
  this._registerCommands(), this._registerMenus(), this._registerShortcuts(), this._registerComponents(), this._registerRenderModules();
1882
1837
  }
1883
1838
  _registerMenus() {
1884
- this._menuManagerService.mergeMenu($i);
1839
+ this._menuManagerService.mergeMenu(bi);
1885
1840
  }
1886
1841
  _registerCommands() {
1887
1842
  [
1888
- yn,
1889
- Tn,
1890
- ve,
1891
- On,
1892
- js,
1893
- Ps,
1894
- ft,
1895
- Mr
1843
+ En,
1844
+ bn,
1845
+ ne,
1846
+ he,
1847
+ Bs,
1848
+ Ls,
1849
+ ht,
1850
+ Nr
1896
1851
  ].forEach((e) => this.disposeWithMe(this._commandService.registerCommand(e)));
1897
1852
  }
1898
1853
  _registerShortcuts() {
1899
1854
  [
1900
- ...Wi(),
1901
1855
  ...Hi(),
1902
1856
  ...Bi(),
1903
1857
  ...qi(),
1904
- ...Ki(),
1905
- Yi,
1906
- ji
1858
+ ...ji(),
1859
+ ...Yi(),
1860
+ Gi,
1861
+ Ki
1907
1862
  ].forEach((e) => {
1908
1863
  this.disposeWithMe(this._shortcutService.registerShortcut(e));
1909
1864
  });
1910
1865
  }
1911
1866
  _registerComponents() {
1912
- this.disposeWithMe(this._uiPartsService.registerComponent(No.FORMULA_AUX, () => br(mi, this._injector))), this._componentManager.register(Nr, Ni);
1867
+ this.disposeWithMe(this._uiPartsService.registerComponent(Oo.FORMULA_AUX, () => Er(yi, this._injector))), this._componentManager.register(Or, Pi);
1913
1868
  }
1914
1869
  _registerRenderModules() {
1915
- this.disposeWithMe(this._renderManagerService.registerRenderModule(W.UNIVER_SHEET, [Ht]));
1870
+ this.disposeWithMe(this._renderManagerService.registerRenderModule(B.UNIVER_SHEET, [Ht]));
1916
1871
  }
1917
1872
  };
1918
- qt = zi([
1919
- Ke(0, q(It)),
1920
- Ke(1, Is),
1921
- Ke(2, pe),
1922
- Ke(3, Zt),
1923
- Ke(4, Ir),
1873
+ qt = Zi([
1874
+ Ke(0, q(Rt)),
1875
+ Ke(1, _s),
1876
+ Ke(2, ve),
1877
+ Ke(3, Yt),
1878
+ Ke(4, Rr),
1924
1879
  Ke(5, Te),
1925
- Ke(6, q(Er))
1880
+ Ke(6, q(Ir))
1926
1881
  ], qt);
1927
- var Zi = Object.getOwnPropertyDescriptor, Xi = (e, t, n, o) => {
1928
- for (var r = o > 1 ? void 0 : o ? Zi(t, n) : t, s = e.length - 1, i; s >= 0; s--)
1882
+ var Xi = Object.getOwnPropertyDescriptor, Qi = (e, t, n, o) => {
1883
+ for (var r = o > 1 ? void 0 : o ? Xi(t, n) : t, s = e.length - 1, i; s >= 0; s--)
1929
1884
  (i = e[s]) && (r = i(r) || r);
1930
1885
  return r;
1931
- }, rn = (e, t) => (n, o) => t(n, o, e);
1932
- let jt = class extends ze {
1886
+ }, tn = (e, t) => (n, o) => t(n, o, e);
1887
+ let jt = class extends at {
1933
1888
  constructor(e, t, n) {
1934
1889
  super(), this._imageFormulaCellInterceptorController = e, this._renderManagerService = t, this._univerInstanceService = n, this._imageFormulaCellInterceptorController.registerRefreshRenderFunction(() => {
1935
- const o = this._univerInstanceService.getCurrentUnitOfType(W.UNIVER_SHEET);
1890
+ const o = this._univerInstanceService.getCurrentUnitOfType(B.UNIVER_SHEET);
1936
1891
  if (!o) return;
1937
1892
  const r = this._renderManagerService.getRenderById(o.getUnitId());
1938
1893
  if (!r) return;
1939
- r.with(bt).reCalculate();
1894
+ r.with(Et).reCalculate();
1940
1895
  const s = r.mainComponent;
1941
1896
  s && s.makeDirty();
1942
1897
  });
1943
1898
  }
1944
1899
  };
1945
- jt = Xi([
1946
- rn(0, q(vs)),
1947
- rn(1, Te),
1948
- rn(2, ne)
1900
+ jt = Qi([
1901
+ tn(0, q(ms)),
1902
+ tn(1, Te),
1903
+ tn(2, re)
1949
1904
  ], jt);
1950
- class Wr {
1905
+ class Vr {
1951
1906
  constructor() {
1952
- j(this, "_currentSelector$", new vr(null));
1907
+ j(this, "_currentSelector$", new fr(null));
1953
1908
  j(this, "currentSelector$", this._currentSelector$.asObservable());
1954
1909
  }
1955
1910
  showRangeSelectorDialog(t) {
@@ -1961,12 +1916,12 @@ class Wr {
1961
1916
  return this._currentSelector$.next(t), o;
1962
1917
  }
1963
1918
  }
1964
- var Qi = Object.getOwnPropertyDescriptor, Ji = (e, t, n, o) => {
1965
- for (var r = o > 1 ? void 0 : o ? Qi(t, n) : t, s = e.length - 1, i; s >= 0; s--)
1919
+ var Ji = Object.getOwnPropertyDescriptor, ec = (e, t, n, o) => {
1920
+ for (var r = o > 1 ? void 0 : o ? Ji(t, n) : t, s = e.length - 1, i; s >= 0; s--)
1966
1921
  (i = e[s]) && (r = i(r) || r);
1967
1922
  return r;
1968
- }, ct = (e, t) => (n, o) => t(n, o, e);
1969
- let Le = class extends Mo {
1923
+ }, nt = (e, t) => (n, o) => t(n, o, e);
1924
+ let Ue = class extends No {
1970
1925
  constructor(t, n, o, r, s, i, c) {
1971
1926
  super(
1972
1927
  n,
@@ -1977,7 +1932,7 @@ let Le = class extends Mo {
1977
1932
  );
1978
1933
  j(this, "_workbookSelections");
1979
1934
  j(this, "_eventDisposables");
1980
- this._context = t, this._contextService = i, this._refSelectionsService = c, this._workbookSelections = this._refSelectionsService.getWorkbookSelections(this._context.unitId), this._initSelectionChangeListener(), this._initSkeletonChangeListener(), this._initUserActionSyncListener(), this._setSelectionStyle(ec(this._themeService)), this._remainLastEnabled = !0, this._highlightHeader = !1;
1935
+ this._context = t, this._contextService = i, this._refSelectionsService = c, this._workbookSelections = this._refSelectionsService.getWorkbookSelections(this._context.unitId), this._initSelectionChangeListener(), this._initSkeletonChangeListener(), this._initUserActionSyncListener(), this._setSelectionStyle(tc(this._themeService)), this._remainLastEnabled = !0, this._highlightHeader = !1;
1981
1936
  }
1982
1937
  getLocation() {
1983
1938
  return this._skeleton.getLocation();
@@ -2001,7 +1956,7 @@ let Le = class extends Mo {
2001
1956
  * Call this method and user will be able to select on the canvas to update selections.
2002
1957
  */
2003
1958
  enableSelectionChanging() {
2004
- return this._disableSelectionChanging(), this._eventDisposables = this._initCanvasEventListeners(), lr(() => this._disableSelectionChanging());
1959
+ return this._disableSelectionChanging(), this._eventDisposables = this._initCanvasEventListeners(), rr(() => this._disableSelectionChanging());
2005
1960
  }
2006
1961
  _disableSelectionChanging() {
2007
1962
  var t;
@@ -2012,26 +1967,26 @@ let Le = class extends Mo {
2012
1967
  }
2013
1968
  _initCanvasEventListeners() {
2014
1969
  const t = this._getSheetObject(), { spreadsheetRowHeader: n, spreadsheetColumnHeader: o, spreadsheet: r, spreadsheetLeftTopPlaceholder: s } = t, { scene: i } = this._context, c = new Ye();
2015
- return c.add(r == null ? void 0 : r.onPointerDown$.subscribeEvent((a, d) => {
2016
- this.inRefSelectionMode() && (this._onPointerDown(a, r.zIndex + 1, Ie.NORMAL, this._getActiveViewport(a)), a.button !== 2 && d.stopPropagation());
1970
+ return c.add(r == null ? void 0 : r.onPointerDown$.subscribeEvent((a, h) => {
1971
+ this.inRefSelectionMode() && (this._onPointerDown(a, r.zIndex + 1, Ee.NORMAL, this._getActiveViewport(a)), a.button !== 2 && h.stopPropagation());
2017
1972
  })), c.add(
2018
- n == null ? void 0 : n.onPointerDown$.subscribeEvent((a, d) => {
1973
+ n == null ? void 0 : n.onPointerDown$.subscribeEvent((a, h) => {
2019
1974
  if (!this.inRefSelectionMode()) return;
2020
- const f = this._sheetSkeletonManagerService.getCurrent().skeleton, { row: m } = Vn(a.offsetX, a.offsetY, i, f);
2021
- Wn(this._workbookSelections.getCurrentSelections(), m, Ie.ROW) || (this._onPointerDown(a, (r.zIndex || 1) + 1, Ie.ROW, this._getActiveViewport(a), en.Y), a.button !== 2 && d.stopPropagation());
1975
+ const g = this._sheetSkeletonManagerService.getCurrent().skeleton, { row: p } = $n(a.offsetX, a.offsetY, i, g);
1976
+ Pn(this._workbookSelections.getCurrentSelections(), p, Ee.ROW) || (this._onPointerDown(a, (r.zIndex || 1) + 1, Ee.ROW, this._getActiveViewport(a), Qt.Y), a.button !== 2 && h.stopPropagation());
2022
1977
  })
2023
- ), c.add(o == null ? void 0 : o.onPointerDown$.subscribeEvent((a, d) => {
1978
+ ), c.add(o == null ? void 0 : o.onPointerDown$.subscribeEvent((a, h) => {
2024
1979
  if (!this.inRefSelectionMode()) return;
2025
- const f = this._sheetSkeletonManagerService.getCurrent().skeleton, { column: m } = Vn(a.offsetX, a.offsetY, i, f);
2026
- Wn(this._workbookSelections.getCurrentSelections(), m, Ie.COLUMN) || (this._onPointerDown(a, (r.zIndex || 1) + 1, Ie.COLUMN, this._getActiveViewport(a), en.X), a.button !== 2 && d.stopPropagation());
2027
- })), c.add(s == null ? void 0 : s.onPointerDown$.subscribeEvent((a, d) => {
1980
+ const g = this._sheetSkeletonManagerService.getCurrent().skeleton, { column: p } = $n(a.offsetX, a.offsetY, i, g);
1981
+ Pn(this._workbookSelections.getCurrentSelections(), p, Ee.COLUMN) || (this._onPointerDown(a, (r.zIndex || 1) + 1, Ee.COLUMN, this._getActiveViewport(a), Qt.X), a.button !== 2 && h.stopPropagation());
1982
+ })), c.add(s == null ? void 0 : s.onPointerDown$.subscribeEvent((a, h) => {
2028
1983
  if (this._reset(), !this.inRefSelectionMode()) return;
2029
- const f = this._sheetSkeletonManagerService.getCurrent().skeleton, m = xo(f);
2030
- this._addSelectionControlByModelData(m), this._selectionMoveStart$.next(this.getSelectionDataWithStyle());
1984
+ const g = this._sheetSkeletonManagerService.getCurrent().skeleton, p = Mo(g);
1985
+ this._addSelectionControlByModelData(p), this._selectionMoveStart$.next(this.getSelectionDataWithStyle());
2031
1986
  const u = i.onPointerUp$.subscribeEvent(() => {
2032
1987
  u.unsubscribe(), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle());
2033
1988
  });
2034
- a.button !== 2 && d.stopPropagation();
1989
+ a.button !== 2 && h.stopPropagation();
2035
1990
  })), c;
2036
1991
  }
2037
1992
  /**
@@ -2041,7 +1996,7 @@ let Le = class extends Mo {
2041
1996
  */
2042
1997
  _addSelectionControlByModelData(t) {
2043
1998
  var i;
2044
- const n = this._skeleton, o = (i = t.style) != null ? i : gr(this._themeService), r = this._scene;
1999
+ const n = this._skeleton, o = (i = t.style) != null ? i : lr(this._themeService), r = this._scene;
2045
2000
  return t.style = o, this.newSelectionControl(r, n, t);
2046
2001
  }
2047
2002
  _initSelectionChangeListener() {
@@ -2054,18 +2009,18 @@ let Le = class extends Mo {
2054
2009
  */
2055
2010
  _initUserActionSyncListener() {
2056
2011
  this.disposeWithMe(this.selectionMoveStart$.subscribe((t) => {
2057
- this._updateSelections(t, tn.MOVE_START);
2012
+ this._updateSelections(t, Jt.MOVE_START);
2058
2013
  })), this.disposeWithMe(this.selectionMoving$.subscribe((t) => {
2059
- this._updateSelections(t, tn.MOVING);
2014
+ this._updateSelections(t, Jt.MOVING);
2060
2015
  })), this.disposeWithMe(this.selectionMoveEnd$.subscribe((t) => {
2061
- this._updateSelections(t, tn.MOVE_END);
2016
+ this._updateSelections(t, Jt.MOVE_END);
2062
2017
  }));
2063
2018
  }
2064
2019
  _updateSelections(t, n) {
2065
2020
  const r = this._context.unit.getActiveSheet().getSheetId();
2066
2021
  t.length !== 0 && this._workbookSelections.setSelections(
2067
2022
  r,
2068
- t.map((s) => hs(s)),
2023
+ t.map((s) => ls(s)),
2069
2024
  n
2070
2025
  );
2071
2026
  }
@@ -2074,7 +2029,7 @@ let Le = class extends Mo {
2074
2029
  var i;
2075
2030
  if (!t)
2076
2031
  return;
2077
- const { skeleton: n } = t, { scene: o } = this._context, r = o.getViewport(Kn.VIEW_MAIN);
2032
+ const { skeleton: n } = t, { scene: o } = this._context, r = o.getViewport(Bn.VIEW_MAIN);
2078
2033
  this._skeleton && ((i = this._skeleton.worksheet) == null ? void 0 : i.getSheetId()) !== n.worksheet.getSheetId() && this._reset(), this._changeRuntime(n, o, r);
2079
2034
  const s = this._workbookSelections.getCurrentSelections();
2080
2035
  this.resetSelectionsByModelData(s);
@@ -2082,10 +2037,10 @@ let Le = class extends Mo {
2082
2037
  }
2083
2038
  _getActiveViewport(t) {
2084
2039
  const n = this._getSheetObject();
2085
- return n == null ? void 0 : n.scene.getActiveViewportByCoord(Yn.FromArray([t.offsetX, t.offsetY]));
2040
+ return n == null ? void 0 : n.scene.getActiveViewportByCoord(qn.FromArray([t.offsetX, t.offsetY]));
2086
2041
  }
2087
2042
  _getSheetObject() {
2088
- return wo(this._context.unit, this._context);
2043
+ return xo(this._context.unit, this._context);
2089
2044
  }
2090
2045
  /**
2091
2046
  * Handle pointer down event, bind pointermove & pointerup handler.
@@ -2098,79 +2053,79 @@ let Le = class extends Mo {
2098
2053
  * @param scrollTimerType
2099
2054
  */
2100
2055
  // eslint-disable-next-line complexity, max-lines-per-function
2101
- _onPointerDown(t, n = 0, o = Ie.NORMAL, r, s = en.ALL) {
2056
+ _onPointerDown(t, n = 0, o = Ee.NORMAL, r, s = Qt.ALL) {
2102
2057
  var N;
2103
2058
  this._rangeType = o;
2104
2059
  const i = this._skeleton, c = this._scene;
2105
2060
  if (!c || !i)
2106
2061
  return;
2107
2062
  r && (this._activeViewport = r);
2108
- const { offsetX: a, offsetY: d } = t, f = c.getViewport(Kn.VIEW_MAIN);
2109
- if (!f) return;
2110
- const m = c.getCoordRelativeToViewport(Yn.FromArray([a, d])), { x: u, y: h } = m;
2111
- this._startViewportPosX = u, this._startViewportPosY = h;
2112
- const l = c.getScrollXYInfoByViewport(m), { scaleX: S, scaleY: v } = c.getAncestorScale(), g = this._skeleton.getCellByOffset(u, h, S, v, l);
2063
+ const { offsetX: a, offsetY: h } = t, g = c.getViewport(Bn.VIEW_MAIN);
2113
2064
  if (!g) return;
2065
+ const p = c.getCoordRelativeToViewport(qn.FromArray([a, h])), { x: u, y: d } = p;
2066
+ this._startViewportPosX = u, this._startViewportPosY = d;
2067
+ const l = c.getScrollXYInfoByViewport(p), { scaleX: S, scaleY: v } = c.getAncestorScale(), f = this._skeleton.getCellByOffset(u, d, S, v, l);
2068
+ if (!f) return;
2114
2069
  switch (o) {
2115
- case Ie.NORMAL:
2070
+ case Ee.NORMAL:
2116
2071
  break;
2117
- case Ie.ROW:
2118
- g.startColumn = 0, g.endColumn = this._skeleton.getColumnCount() - 1;
2072
+ case Ee.ROW:
2073
+ f.startColumn = 0, f.endColumn = this._skeleton.getColumnCount() - 1;
2119
2074
  break;
2120
- case Ie.COLUMN:
2121
- g.startRow = 0, g.endRow = this._skeleton.getRowCount() - 1;
2075
+ case Ee.COLUMN:
2076
+ f.startRow = 0, f.endRow = this._skeleton.getRowCount() - 1;
2122
2077
  break;
2123
- case Ie.ALL:
2124
- g.startRow = 0, g.startColumn = 0, g.endRow = this._skeleton.getRowCount() - 1, g.endColumn = this._skeleton.getColumnCount() - 1;
2078
+ case Ee.ALL:
2079
+ f.startRow = 0, f.startColumn = 0, f.endRow = this._skeleton.getRowCount() - 1, f.endColumn = this._skeleton.getColumnCount() - 1;
2125
2080
  }
2126
- let C = { range: g, primary: g, style: null };
2127
- (g.isMerged || g.isMergedMainCell) && (C = {
2081
+ let C = { range: f, primary: f, style: null };
2082
+ (f.isMerged || f.isMergedMainCell) && (C = {
2128
2083
  range: {
2129
- ...g,
2130
- startRow: g.startRow,
2131
- endRow: g.startRow,
2132
- startColumn: g.startColumn,
2133
- endColumn: g.startColumn
2084
+ ...f,
2085
+ startRow: f.startRow,
2086
+ endRow: f.startRow,
2087
+ startColumn: f.startColumn,
2088
+ endColumn: f.startColumn
2134
2089
  },
2135
2090
  primary: {
2136
- ...g,
2137
- actualRow: g.startRow,
2138
- actualColumn: g.startColumn,
2139
- startRow: g.startRow,
2140
- endRow: g.startRow,
2141
- startColumn: g.startColumn,
2142
- endColumn: g.startColumn
2091
+ ...f,
2092
+ actualRow: f.startRow,
2093
+ actualColumn: f.startColumn,
2094
+ startRow: f.startRow,
2095
+ endRow: f.startRow,
2096
+ startColumn: f.startColumn,
2097
+ endColumn: f.startColumn
2143
2098
  },
2144
2099
  style: null
2145
2100
  }), C.range.rangeType = o;
2146
- const R = sn(C, this._skeleton);
2147
- this._startRangeWhenPointerDown = { ...R.rangeWithCoord };
2148
- const E = { ...R.rangeWithCoord, rangeType: o };
2149
- let p = this.getActiveSelectionControl();
2150
- const b = this.getSelectionControls();
2151
- for (const M of b) {
2152
- if (t.button === 2 && fn.contains(M.model, E)) {
2153
- p = M;
2101
+ const I = rn(C, this._skeleton);
2102
+ this._startRangeWhenPointerDown = { ...I.rangeWithCoord };
2103
+ const E = { ...I.rangeWithCoord, rangeType: o };
2104
+ let m = this.getActiveSelectionControl();
2105
+ const y = this.getSelectionControls();
2106
+ for (const M of y) {
2107
+ if (t.button === 2 && un.contains(M.model, E)) {
2108
+ m = M;
2154
2109
  return;
2155
2110
  }
2156
2111
  if (M.model.isEqual(E)) {
2157
- p = M;
2112
+ m = M;
2158
2113
  break;
2159
2114
  }
2160
2115
  }
2161
2116
  this._checkClearPreviousControls(t);
2162
- const T = p == null ? void 0 : p.model.currentCell, F = t.shiftKey && T, A = this._remainLastEnabled && !t.ctrlKey && !t.shiftKey && !this._skipLastEnabled && !this._singleSelectionEnabled;
2163
- F && T ? this._makeSelectionByTwoCells(
2117
+ const T = m == null ? void 0 : m.model.currentCell, A = t.shiftKey && T, k = this._remainLastEnabled && !t.ctrlKey && !t.shiftKey && !this._skipLastEnabled && !this._singleSelectionEnabled;
2118
+ A && T ? this._makeSelectionByTwoCells(
2164
2119
  T,
2165
2120
  E,
2166
2121
  i,
2167
2122
  o,
2168
- p
2123
+ m
2169
2124
  // Get updated in this method
2170
- ) : A && p ? p.updateRangeBySelectionWithCoord(R) : p = this.newSelectionControl(c, i, C);
2125
+ ) : k && m ? m.updateRangeBySelectionWithCoord(I) : m = this.newSelectionControl(c, i, C);
2171
2126
  for (let M = 0; M < this.getSelectionControls().length - 1; M++)
2172
2127
  this.getSelectionControls()[M].clearHighlight();
2173
- this._selectionMoveStart$.next(this.getSelectionDataWithStyle()), c.disableObjectsEvent(), this._clearUpdatingListeners(), this._addEndingListeners(), (N = c.getTransformer()) == null || N.clearSelectedObjects(), this._setupPointerMoveListener(f, p, o, s, u, h), this._escapeShortcutDisposable = this._shortcutService.forceEscape(), this._scenePointerUpSub = c.onPointerUp$.subscribeEvent(() => {
2128
+ this._selectionMoveStart$.next(this.getSelectionDataWithStyle()), c.disableObjectsEvent(), this._clearUpdatingListeners(), this._addEndingListeners(), (N = c.getTransformer()) == null || N.clearSelectedObjects(), this._setupPointerMoveListener(g, m, o, s, u, d), this._escapeShortcutDisposable = this._shortcutService.forceEscape(), this._scenePointerUpSub = c.onPointerUp$.subscribeEvent(() => {
2174
2129
  var M;
2175
2130
  this._clearUpdatingListeners(), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle()), (M = this._escapeShortcutDisposable) == null || M.dispose(), this._escapeShortcutDisposable = null;
2176
2131
  });
@@ -2183,12 +2138,12 @@ let Le = class extends Mo {
2183
2138
  * @returns {SelectionControl} selectionControl just created
2184
2139
  */
2185
2140
  newSelectionControl(t, n, o) {
2186
- const r = this.getSelectionControls().length, { rowHeaderWidth: s, columnHeaderHeight: i } = n, c = new fr(t, r, this._themeService, {
2141
+ const r = this.getSelectionControls().length, { rowHeaderWidth: s, columnHeaderHeight: i } = n, c = new ar(t, r, this._themeService, {
2187
2142
  highlightHeader: this._highlightHeader,
2188
2143
  enableAutoFill: !1,
2189
2144
  rowHeaderWidth: s,
2190
2145
  columnHeaderHeight: i
2191
- }), a = sn(o, n);
2146
+ }), a = rn(o, n);
2192
2147
  return c.updateRangeBySelectionWithCoord(a), this._selectionControls.push(c), c.setControlExtension({
2193
2148
  skeleton: n,
2194
2149
  scene: t,
@@ -2202,19 +2157,19 @@ let Le = class extends Mo {
2202
2157
  }), c;
2203
2158
  }
2204
2159
  };
2205
- Le = Ji([
2206
- ct(1, q(It)),
2207
- ct(2, q(Et)),
2208
- ct(3, Zt),
2209
- ct(4, q(bt)),
2210
- ct(5, hn),
2211
- ct(6, Gt)
2212
- ], Le);
2213
- function ec(e) {
2214
- const t = gr(e);
2160
+ Ue = ec([
2161
+ nt(1, q(Rt)),
2162
+ nt(2, q(It)),
2163
+ nt(3, Yt),
2164
+ nt(4, q(Et)),
2165
+ nt(5, ln),
2166
+ nt(6, Kt)
2167
+ ], Ue);
2168
+ function tc(e) {
2169
+ const t = lr(e);
2215
2170
  return t.widgets = { tl: !0, tc: !0, tr: !0, ml: !0, mr: !0, bl: !0, bc: !0, br: !0 }, t;
2216
2171
  }
2217
- const Nn = (e, t, n = !0) => {
2172
+ const yn = (e, t, n = !0) => {
2218
2173
  let o = -1;
2219
2174
  return e.reduce((r, s, i) => {
2220
2175
  if (r.isFinish)
@@ -2237,7 +2192,7 @@ const Nn = (e, t, n = !0) => {
2237
2192
  typeof s != "string" && s.nodeType === Q.REFERENCE && o++;
2238
2193
  }
2239
2194
  return o;
2240
- }, tc = (e, t = 100) => {
2195
+ }, nc = (e, t = 100) => {
2241
2196
  P(() => {
2242
2197
  let n = null;
2243
2198
  const o = () => {
@@ -2251,70 +2206,70 @@ const Nn = (e, t, n = !0) => {
2251
2206
  }, [e, t]);
2252
2207
  };
2253
2208
  function Br(e, t, n) {
2254
- const o = y(Ze), r = le(() => new vr({ left: -999, top: -999, right: -999, bottom: -999 }), []), s = y(En), i = y(ne), c = ee(() => {
2255
- var R;
2209
+ const o = b(ze), r = le(() => new fr({ left: -999, top: -999, right: -999, bottom: -999 }), []), s = b(Rn), i = b(re), c = ee(() => {
2210
+ var I;
2256
2211
  const a = o.getEditor(e);
2257
2212
  if (!a)
2258
2213
  return;
2259
- const d = a.getBoundingClientRect(), { marginTop: f = 0, marginBottom: m = 0 } = a.getDocumentData().documentStyle, u = a.getSkeleton();
2214
+ const h = a.getBoundingClientRect(), { marginTop: g = 0, marginBottom: p = 0 } = a.getDocumentData().documentStyle, u = a.getSkeleton();
2260
2215
  if (!u) return;
2261
- const h = (R = u.getSkeletonData()) == null ? void 0 : R.pages[0].height;
2262
- let { left: l, top: S, right: v, bottom: g } = d;
2263
- S = S + f, g = h ? S + h : g - m;
2216
+ const d = (I = u.getSkeletonData()) == null ? void 0 : I.pages[0].height;
2217
+ let { left: l, top: S, right: v, bottom: f } = h;
2218
+ S = S + g, f = d ? S + d : f - p;
2264
2219
  const C = r.getValue();
2265
- if (!(C.left === l && C.top === S && C.right === v && C.bottom === g))
2266
- return r.next({ left: l - 1, right: v + 1, top: S - 1, bottom: g + 1 }), d;
2220
+ if (!(C.left === l && C.top === S && C.right === v && C.bottom === f))
2221
+ return r.next({ left: l - 1, right: v + 1, top: S - 1, bottom: f + 1 }), h;
2267
2222
  });
2268
2223
  return P(() => {
2269
2224
  t && c();
2270
- }, [e, o, i.unitAdded$, c, t, ...n != null ? n : []]), tc(c), P(() => {
2271
- const a = s.scrollEvent$.pipe(Ko(100)).subscribe(c);
2225
+ }, [e, o, i.unitAdded$, c, t, ...n != null ? n : []]), nc(c), P(() => {
2226
+ const a = s.scrollEvent$.pipe(jo(100)).subscribe(c);
2272
2227
  return () => {
2273
2228
  a.unsubscribe();
2274
2229
  };
2275
2230
  }, []), [r, c];
2276
2231
  }
2277
- const rt = (e) => {
2232
+ const Qe = (e) => {
2278
2233
  const t = X(e);
2279
2234
  return t.current = e, t;
2280
- }, nc = (e, t, n) => {
2281
- const o = y(Xt), r = y(zt), s = y(ye), [i, c] = H(), [a, d] = H(-1), [f, m] = H(!0), u = rt(f), h = X(t);
2282
- h.current = t;
2235
+ }, rc = (e, t, n) => {
2236
+ const o = b(Gt), r = b(dt), s = b(ke), [i, c] = V(), [a, h] = V(-1), [g, p] = V(!0), u = Qe(g), d = X(t);
2237
+ d.current = t;
2283
2238
  const l = () => {
2284
- c(void 0), d(-1), m(!1);
2239
+ c(void 0), h(-1), p(!1);
2285
2240
  };
2286
2241
  return P(() => {
2287
2242
  const S = s.sequenceNodesBuilder(t.slice(1));
2288
2243
  o.setSequenceNodes(S != null ? S : []);
2289
2244
  }, [t]), P(() => {
2290
2245
  if (n && e) {
2291
- const S = n.selectionChange$.pipe(Cn(50)).subscribe((g) => {
2292
- if (g.textRanges.length === 1) {
2293
- const [C] = g.textRanges;
2246
+ const S = n.selectionChange$.pipe(Sn(50)).subscribe((f) => {
2247
+ if (f.textRanges.length === 1) {
2248
+ const [C] = f.textRanges;
2294
2249
  if (C.collapsed && u.current) {
2295
- const { startOffset: R } = C, E = o.getCurrentSequenceNodeIndex(R - 2), p = o.getCurrentSequenceNodeByIndex(E), b = o.getCurrentSequenceNodeByIndex(E + 1);
2296
- if (p)
2297
- if (typeof p != "string" && p.nodeType === 3 && !r.hasDefinedNameDescription(p.token.trim()) && b === Ge.OPEN_BRACKET) {
2298
- const T = r.getFunctionInfo(p.token);
2299
- c(T), d(-1);
2250
+ const { startOffset: I } = C, E = o.getCurrentSequenceNodeIndex(I - 2), m = o.getCurrentSequenceNodeByIndex(E), y = o.getCurrentSequenceNodeByIndex(E + 1);
2251
+ if (m)
2252
+ if (typeof m != "string" && m.nodeType === 3 && !r.hasDefinedNameDescription(m.token.trim()) && y === Ge.OPEN_BRACKET) {
2253
+ const T = r.getFunctionInfo(m.token);
2254
+ c(T), h(-1);
2300
2255
  return;
2301
2256
  } else {
2302
- const T = s.getFunctionAndParameter(`${h.current}A`, R - 1);
2257
+ const T = s.getFunctionAndParameter(`${d.current}A`, I - 1);
2303
2258
  if (T) {
2304
- const { functionName: F, paramIndex: A } = T, N = r.getFunctionInfo(F);
2305
- c(N), d(A);
2259
+ const { functionName: A, paramIndex: k } = T, N = r.getFunctionInfo(A);
2260
+ c(N), h(k);
2306
2261
  return;
2307
2262
  }
2308
2263
  }
2309
2264
  }
2310
2265
  }
2311
- c(void 0), d(-1);
2266
+ c(void 0), h(-1);
2312
2267
  }), v = n.selectionChange$.pipe(
2313
- Cr((g) => g.textRanges.length === 1),
2314
- Sr((g) => g.textRanges[0].startOffset),
2315
- Yo()
2268
+ gr((f) => f.textRanges.length === 1),
2269
+ hr((f) => f.textRanges[0].startOffset),
2270
+ Ko()
2316
2271
  ).subscribe(() => {
2317
- m(!0);
2272
+ p(!0);
2318
2273
  });
2319
2274
  return () => {
2320
2275
  S.unsubscribe(), v.unsubscribe();
@@ -2327,18 +2282,18 @@ const rt = (e) => {
2327
2282
  paramIndex: a,
2328
2283
  reset: l
2329
2284
  };
2330
- }, rc = ({ onClick: e }) => /* @__PURE__ */ x(
2285
+ }, oc = ({ onClick: e }) => /* @__PURE__ */ x(
2331
2286
  "div",
2332
2287
  {
2333
2288
  className: "univer-z-[15] univer-box-border univer-h-[18px] univer-cursor-pointer univer-overflow-visible univer-whitespace-nowrap univer-rounded-l univer-border univer-border-r-0 univer-border-gray-600 univer-bg-primary-600 univer-p-0.5 univer-text-xs univer-font-bold univer-leading-[13px] univer-text-white",
2334
2289
  onClick: e,
2335
2290
  children: "?"
2336
2291
  }
2337
- ), on = ({ className: e, title: t, value: n }) => /* @__PURE__ */ B("div", { className: "univer-my-2", children: [
2292
+ ), nn = ({ className: e, title: t, value: n }) => /* @__PURE__ */ H("div", { className: "univer-my-2", children: [
2338
2293
  /* @__PURE__ */ x(
2339
2294
  "div",
2340
2295
  {
2341
- className: se("univer-mb-2 univer-text-sm univer-font-medium univer-text-gray-900 dark:!univer-text-white", e),
2296
+ className: ie("univer-mb-2 univer-text-sm univer-font-medium univer-text-gray-900 dark:!univer-text-white", e),
2342
2297
  children: t
2343
2298
  }
2344
2299
  ),
@@ -2349,50 +2304,53 @@ const rt = (e) => {
2349
2304
  children: n
2350
2305
  }
2351
2306
  )
2352
- ] }), oc = (e) => {
2307
+ ] }), sc = (e) => {
2353
2308
  const { prefix: t, value: n, active: o, onClick: r } = e;
2354
- return /* @__PURE__ */ B("div", { children: [
2355
- /* @__PURE__ */ B("span", { children: [
2309
+ return /* @__PURE__ */ H("div", { children: [
2310
+ /* @__PURE__ */ H("span", { children: [
2356
2311
  t,
2357
2312
  "("
2358
2313
  ] }),
2359
- n && n.map((s, i) => /* @__PURE__ */ B("span", { children: [
2314
+ n && n.map((s, i) => /* @__PURE__ */ H("span", { children: [
2360
2315
  /* @__PURE__ */ x(
2361
2316
  "span",
2362
2317
  {
2363
2318
  className: o === i ? "univer-text-primary-500" : "",
2364
2319
  onClick: () => r(i),
2365
- children: kr(s)
2320
+ children: Fr(s)
2366
2321
  }
2367
2322
  ),
2368
2323
  i === n.length - 1 ? "" : ","
2369
2324
  ] }, s.name)),
2370
2325
  ")"
2371
2326
  ] });
2372
- }, rr = () => {
2327
+ }, Xn = () => {
2373
2328
  };
2374
- function sc(e) {
2375
- const { onParamsSwitch: t = rr, onClose: n = rr, isFocus: o, editor: r, formulaText: s } = e, { functionInfo: i, paramIndex: c, reset: a } = nc(o, s, r), d = y(vn), f = !_e(d.helpFunctionVisible$), [m, u] = H(!1), h = y(dt), l = h.t("formula.prompt.required"), S = h.t("formula.prompt.optional"), v = r.getEditorId(), [g] = Br(v, !!i, [i, c]);
2376
- function C(p) {
2377
- t && t(p);
2329
+ function ic(e) {
2330
+ const { onParamsSwitch: t = Xn, onClose: n = Xn, isFocus: o, editor: r, formulaText: s } = e, { functionInfo: i, paramIndex: c, reset: a } = rc(o, s, r), h = b(mn), g = !Re(h.helpFunctionVisible$), [p, u] = V(!1), d = b(lt), l = d.t("formula.prompt.required"), S = d.t("formula.prompt.optional"), v = r.getEditorId(), [f] = Br(v, !!i, [i, c]);
2331
+ function C(m) {
2332
+ t && t(m);
2378
2333
  }
2379
- const R = ee((p) => {
2380
- d.helpFunctionVisible$.next(!p);
2334
+ const I = ee((m) => {
2335
+ h.helpFunctionVisible$.next(!m);
2381
2336
  }), E = () => {
2382
- R(!0), n();
2337
+ I(!0), n();
2383
2338
  };
2384
- return i ? f ? /* @__PURE__ */ x(ln, { portal: !0, anchorRect$: g, direction: "left-center", children: /* @__PURE__ */ x(rc, { onClick: () => R(!1) }) }, "hidden") : /* @__PURE__ */ x(ln, { portal: !0, onClickOutside: () => a(), anchorRect$: g, direction: "vertical", children: /* @__PURE__ */ B(
2339
+ return i ? g ? /* @__PURE__ */ x(on, { portal: !0, anchorRect$: f, direction: "left-center", children: /* @__PURE__ */ x(oc, { onClick: () => I(!1) }) }, "hidden") : /* @__PURE__ */ x(on, { portal: !0, onClickOutside: () => a(), anchorRect$: f, direction: "vertical", children: /* @__PURE__ */ H(
2385
2340
  "div",
2386
2341
  {
2387
- 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", bn),
2342
+ className: ie("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),
2388
2343
  children: [
2389
- /* @__PURE__ */ B(
2344
+ /* @__PURE__ */ H(
2390
2345
  "div",
2391
2346
  {
2392
- 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", xs),
2347
+ className: ie("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", Ns),
2348
+ style: {
2349
+ overflowWrap: "anywhere"
2350
+ },
2393
2351
  children: [
2394
2352
  /* @__PURE__ */ x(
2395
- oc,
2353
+ sc,
2396
2354
  {
2397
2355
  prefix: i.functionName,
2398
2356
  value: i.functionParameter,
@@ -2400,13 +2358,13 @@ function sc(e) {
2400
2358
  onClick: C
2401
2359
  }
2402
2360
  ),
2403
- /* @__PURE__ */ B("div", { className: "univer-flex", children: [
2361
+ /* @__PURE__ */ H("div", { className: "univer-flex", children: [
2404
2362
  /* @__PURE__ */ x(
2405
2363
  "div",
2406
2364
  {
2407
2365
  className: "univer-ml-2 univer-flex univer-size-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",
2408
- style: { transform: m ? "rotateZ(-90deg)" : "rotateZ(90deg)" },
2409
- onClick: () => u(!m),
2366
+ style: { transform: p ? "rotateZ(-90deg)" : "rotateZ(90deg)" },
2367
+ onClick: () => u(!p),
2410
2368
  children: /* @__PURE__ */ x(Ur, {})
2411
2369
  }
2412
2370
  ),
@@ -2425,34 +2383,34 @@ function sc(e) {
2425
2383
  /* @__PURE__ */ x(
2426
2384
  "div",
2427
2385
  {
2428
- className: se("univer-box-border univer-max-h-[350px] univer-overflow-y-auto univer-px-4 univer-pb-3 univer-pt-0", ut),
2386
+ className: ie("univer-box-border univer-max-h-[350px] univer-overflow-y-auto univer-px-4 univer-pb-3 univer-pt-0", it),
2429
2387
  style: {
2430
- height: m ? "unset" : 0,
2431
- padding: m ? "revert-layer" : 0
2388
+ height: p ? "unset" : 0,
2389
+ padding: p ? "revert-layer" : 0
2432
2390
  },
2433
- children: /* @__PURE__ */ B("div", { className: "univer-mt-3", children: [
2391
+ children: /* @__PURE__ */ H("div", { className: "univer-mt-3", children: [
2434
2392
  /* @__PURE__ */ x(
2435
- on,
2393
+ nn,
2436
2394
  {
2437
- title: h.t("formula.prompt.helpExample"),
2438
- value: `${i.functionName}(${i.functionParameter.map((p) => p.example).join(",")})`
2395
+ title: d.t("formula.prompt.helpExample"),
2396
+ value: `${i.functionName}(${i.functionParameter.map((m) => m.example).join(",")})`
2439
2397
  }
2440
2398
  ),
2441
2399
  /* @__PURE__ */ x(
2442
- on,
2400
+ nn,
2443
2401
  {
2444
- title: h.t("formula.prompt.helpAbstract"),
2402
+ title: d.t("formula.prompt.helpAbstract"),
2445
2403
  value: i.description
2446
2404
  }
2447
2405
  ),
2448
- i && i.functionParameter && i.functionParameter.map((p, b) => /* @__PURE__ */ x(
2449
- on,
2406
+ i && i.functionParameter && i.functionParameter.map((m, y) => /* @__PURE__ */ x(
2407
+ nn,
2450
2408
  {
2451
- className: c === b ? "univer-text-primary-500" : "",
2452
- title: p.name,
2453
- value: `${p.require ? l : S} ${p.detail}`
2409
+ className: c === y ? "univer-text-primary-500" : "",
2410
+ title: m.name,
2411
+ value: `${m.require ? l : S} ${m.detail}`
2454
2412
  },
2455
- b
2413
+ y
2456
2414
  ))
2457
2415
  ] })
2458
2416
  }
@@ -2461,14 +2419,14 @@ function sc(e) {
2461
2419
  }
2462
2420
  ) }, "show") : null;
2463
2421
  }
2464
- const ic = (e) => {
2465
- const t = y(Ze);
2422
+ const cc = (e) => {
2423
+ const t = b(ze);
2466
2424
  return ee((o) => {
2467
2425
  var r, s;
2468
2426
  if (e) {
2469
2427
  t.focus(e.getEditorId());
2470
2428
  const i = [...e.getSelectionRanges()];
2471
- if (mn.isDefine(o))
2429
+ if (nr.isDefine(o))
2472
2430
  e.setSelectionRanges([{ startOffset: o, endOffset: o }]);
2473
2431
  else if (!i.length && !e.docSelectionRenderService.isOnPointerEvent) {
2474
2432
  const c = (s = (r = e.getDocumentData().body) == null ? void 0 : r.dataStream) != null ? s : `\r
@@ -2479,99 +2437,99 @@ const ic = (e) => {
2479
2437
  }
2480
2438
  });
2481
2439
  };
2482
- function cc(e) {
2440
+ function ac(e) {
2483
2441
  var r, s;
2484
- const n = e.get(ne).getCurrentUniverDocInstance();
2442
+ const n = e.get(re).getCurrentUniverDocInstance();
2485
2443
  return n != null && n.getBody() ? { dataStream: (s = (r = n.getBody()) == null ? void 0 : r.dataStream) != null ? s : "", offset: 0 } : void 0;
2486
2444
  }
2487
- 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 || {});
2445
+ var we = /* @__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))(we || {});
2488
2446
  function lc(e) {
2489
2447
  var T;
2490
- const { editorId: t, isFocus: n, disableOnClick: o, unitId: r, subUnitId: s } = e, i = y(Te), c = y(ne), a = i.getRenderById(r), d = i.getRenderById(t), f = d == null ? void 0 : d.with(_r), m = y(Tr), u = y(It), [h, l] = H(
2448
+ const { editorId: t, isFocus: n, disableOnClick: o, unitId: r, subUnitId: s } = e, i = b(Te), c = b(re), a = i.getRenderById(r), h = i.getRenderById(t), g = h == null ? void 0 : h.with(mr), p = b(yr), u = b(Rt), [d, l] = V(
2491
2449
  0
2492
2450
  /* NOT_SELECT */
2493
- ), S = y(ye), v = X(!0), g = a == null ? void 0 : a.with(Le), C = rt(h), R = c.getUnit(r, W.UNIVER_SHEET), E = R == null ? void 0 : R.getSheetBySheetId(s), p = ee((F) => {
2494
- g && g.setSkipLastEnabled(
2495
- F === 1 || F === 3 || F === 4
2451
+ ), S = b(ke), v = X(!0), f = a == null ? void 0 : a.with(Ue), C = Qe(d), I = c.getUnit(r, B.UNIVER_SHEET), E = I == null ? void 0 : I.getSheetBySheetId(s), m = ee((A) => {
2452
+ f && f.setSkipLastEnabled(
2453
+ A === 1 || A === 3 || A === 4
2496
2454
  /* EDIT_OTHER_WORKBOOK_REFERENCE */
2497
- ), C.current = F, l(F);
2498
- }), b = ee(() => {
2499
- var Y, re, he;
2500
- const F = c.getCurrentUnitOfType(W.UNIVER_SHEET);
2501
- if (!F) return;
2502
- const A = F.getActiveSheet(), N = f == null ? void 0 : f.getActiveTextRange(), M = N != null && N.collapsed ? N.startOffset : -1, w = cc(u);
2455
+ ), C.current = A, l(A);
2456
+ }), y = ee(() => {
2457
+ var Y, oe, ge;
2458
+ const A = c.getCurrentUnitOfType(B.UNIVER_SHEET);
2459
+ if (!A) return;
2460
+ const k = A.getActiveSheet(), N = g == null ? void 0 : g.getActiveTextRange(), M = N != null && N.collapsed ? N.startOffset : -1, w = ac(u);
2503
2461
  if (!w) return;
2504
- const k = (Y = w == null ? void 0 : w.dataStream) == null ? void 0 : Y.slice(0, -2), $ = ((re = S.sequenceNodesBuilder(k)) != null ? re : []).map((G) => typeof G == "object" ? G.nodeType === Q.REFERENCE ? {
2462
+ const F = (Y = w == null ? void 0 : w.dataStream) == null ? void 0 : Y.slice(0, -2), $ = ((oe = S.sequenceNodesBuilder(F)) != null ? oe : []).map((G) => typeof G == "object" ? G.nodeType === Q.REFERENCE ? {
2505
2463
  ...G,
2506
- range: Uo(G.token)
2464
+ range: Po(G.token)
2507
2465
  } : {
2508
2466
  ...G,
2509
2467
  range: void 0
2510
- } : G), I = k[M - 1], _ = k[M], O = $.find((G) => typeof G == "object" && G.nodeType === Q.REFERENCE && M === G.endIndex + 2), D = I && Vo(I) && (!_ || Wo(_) && _ !== Ge.OPEN_BRACKET), U = !!O;
2511
- if ((k == null ? void 0 : k.substring(0, 1)) === "=" && (D || U))
2468
+ } : G), R = F[M - 1], _ = F[M], O = $.find((G) => typeof G == "object" && G.nodeType === Q.REFERENCE && M === G.endIndex + 2), D = R && Uo(R) && (!_ || Wo(_) && _ !== Ge.OPEN_BRACKET), U = !!O;
2469
+ if ((F == null ? void 0 : F.substring(0, 1)) === "=" && (D || U))
2512
2470
  if (U) {
2513
2471
  if (v.current)
2514
2472
  return;
2515
- const { sheetName: G, unitId: J } = O.range, ot = (he = c.getCurrentUnitOfType(W.UNIVER_SHEET)) == null ? void 0 : he.getUnitId();
2516
- J && J !== ot ? p(
2473
+ const { sheetName: G, unitId: J } = O.range, Je = (ge = c.getCurrentUnitOfType(B.UNIVER_SHEET)) == null ? void 0 : ge.getUnitId();
2474
+ J && J !== Je ? m(
2517
2475
  4
2518
2476
  /* EDIT_OTHER_WORKBOOK_REFERENCE */
2519
- ) : !G && A.getSheetId() === (E == null ? void 0 : E.getSheetId()) || G === A.getName() ? p(
2477
+ ) : !G && k.getSheetId() === (E == null ? void 0 : E.getSheetId()) || G === k.getName() ? m(
2520
2478
  2
2521
2479
  /* CAN_EDIT */
2522
- ) : p(
2480
+ ) : m(
2523
2481
  3
2524
2482
  /* EDIT_OTHER_SHEET_REFERENCE */
2525
2483
  );
2526
2484
  } else
2527
- v.current = !1, p(
2485
+ v.current = !1, m(
2528
2486
  1
2529
2487
  /* NEED_ADD */
2530
2488
  );
2531
2489
  else
2532
- p(
2490
+ m(
2533
2491
  0
2534
2492
  /* NOT_SELECT */
2535
2493
  );
2536
2494
  });
2537
2495
  return P(() => {
2538
- const F = m.textSelection$.pipe(Cr((A) => A.unitId === t)).subscribe(() => {
2539
- b();
2496
+ const A = p.textSelection$.pipe(gr((k) => k.unitId === t)).subscribe(() => {
2497
+ y();
2540
2498
  });
2541
- return () => F.unsubscribe();
2542
- }, [b, m.textSelection$, t]), P(() => {
2543
- n || (p(
2499
+ return () => A.unsubscribe();
2500
+ }, [y, p.textSelection$, t]), P(() => {
2501
+ n || (m(
2544
2502
  0
2545
2503
  /* NOT_SELECT */
2546
2504
  ), v.current = !0);
2547
- }, [n, p]), P(() => {
2548
- var A;
2505
+ }, [n, m]), P(() => {
2506
+ var k;
2549
2507
  if (!o) return;
2550
- const F = (A = d == null ? void 0 : d.mainComponent) == null ? void 0 : A.onPointerDown$.subscribeEvent(() => {
2551
- p(
2508
+ const A = (k = h == null ? void 0 : h.mainComponent) == null ? void 0 : k.onPointerDown$.subscribeEvent(() => {
2509
+ m(
2552
2510
  0
2553
2511
  /* NOT_SELECT */
2554
2512
  ), v.current = !0;
2555
2513
  });
2556
- return () => F == null ? void 0 : F.unsubscribe();
2557
- }, [o, (T = d == null ? void 0 : d.mainComponent) == null ? void 0 : T.onPointerDown$, p]), P(() => {
2514
+ return () => A == null ? void 0 : A.unsubscribe();
2515
+ }, [o, (T = h == null ? void 0 : h.mainComponent) == null ? void 0 : T.onPointerDown$, m]), P(() => {
2558
2516
  if (!n) return;
2559
- const F = R == null ? void 0 : R.activeSheet$.subscribe(() => {
2560
- b();
2561
- }), A = c.getCurrentTypeOfUnit$(W.UNIVER_SHEET).subscribe(() => {
2562
- b();
2517
+ const A = I == null ? void 0 : I.activeSheet$.subscribe(() => {
2518
+ y();
2519
+ }), k = c.getCurrentTypeOfUnit$(B.UNIVER_SHEET).subscribe(() => {
2520
+ y();
2563
2521
  });
2564
2522
  return () => {
2565
- F == null || F.unsubscribe(), A == null || A.unsubscribe();
2523
+ A == null || A.unsubscribe(), k == null || k.unsubscribe();
2566
2524
  };
2567
- }, [b, n, R == null ? void 0 : R.activeSheet$, c.getCurrentTypeOfUnit$]), { isSelecting: h, isSelectingRef: C };
2525
+ }, [y, n, I == null ? void 0 : I.activeSheet$, c.getCurrentTypeOfUnit$]), { isSelecting: d, isSelectingRef: C };
2568
2526
  }
2569
- const ac = () => {
2570
- const e = y(ye);
2571
- return $t((n) => e.sequenceNodesBuilder(n) || [], [e]);
2527
+ const uc = () => {
2528
+ const e = b(ke);
2529
+ return Pt((n) => e.sequenceNodesBuilder(n) || [], [e]);
2572
2530
  };
2573
- function uc(e, t, n) {
2574
- const o = new pn(t).setAlpha(0.05).toRgbString();
2531
+ function dc(e, t, n) {
2532
+ const o = new fn(t).setAlpha(0.05).toRgbString();
2575
2533
  return {
2576
2534
  id: n,
2577
2535
  strokeWidth: 1,
@@ -2584,7 +2542,7 @@ function uc(e, t, n) {
2584
2542
  };
2585
2543
  }
2586
2544
  function qr(e) {
2587
- var R, E, p;
2545
+ var I, E, m;
2588
2546
  const {
2589
2547
  unitId: t,
2590
2548
  subUnitId: n,
@@ -2594,49 +2552,49 @@ function qr(e) {
2594
2552
  refSelectionsService: i,
2595
2553
  refSelectionsRenderService: c,
2596
2554
  sheetSkeletonManagerService: a,
2597
- themeService: d,
2598
- univerInstanceService: f
2599
- } = e, m = o.getUnitId(), u = f.getUnit(t, W.UNIVER_SHEET), h = u == null ? void 0 : u.getActiveSheet(), l = [];
2600
- if (!u || !h) {
2555
+ themeService: h,
2556
+ univerInstanceService: g
2557
+ } = e, p = o.getUnitId(), u = g.getUnit(t, B.UNIVER_SHEET), d = u == null ? void 0 : u.getActiveSheet(), l = [];
2558
+ if (!u || !d) {
2601
2559
  i.setSelections(l);
2602
2560
  return;
2603
2561
  }
2604
- const S = h.getSheetId(), v = (b) => {
2562
+ const S = d.getSheetId(), v = (y) => {
2605
2563
  var T;
2606
- return (T = u == null ? void 0 : u.getSheetBySheetName(b)) == null ? void 0 : T.getSheetId();
2564
+ return (T = u == null ? void 0 : u.getSheetBySheetName(y)) == null ? void 0 : T.getSheetId();
2607
2565
  };
2608
- if (!((R = a == null ? void 0 : a.getWorksheetSkeleton(S)) == null ? void 0 : R.skeleton)) return;
2566
+ if (!((I = a == null ? void 0 : a.getWorksheetSkeleton(S)) == null ? void 0 : I.skeleton)) return;
2609
2567
  const C = [];
2610
- for (let b = 0, T = r.length; b < T; b++) {
2611
- const F = r[b], { themeColor: A, token: N, refIndex: M, endIndex: w } = F, k = ht(N), { unitId: $, sheetName: I, range: _ } = k, O = v(I);
2612
- if (!O && I || m !== t && $ !== m || $ && $ !== m || O && O !== S || !O && S !== n)
2568
+ for (let y = 0, T = r.length; y < T; y++) {
2569
+ const A = r[y], { themeColor: k, token: N, refIndex: M, endIndex: w } = A, F = ut(N), { unitId: $, sheetName: R, range: _ } = F, O = v(R);
2570
+ if (!O && R || p !== t && $ !== p || $ && $ !== p || O && O !== S || !O && S !== n)
2613
2571
  continue;
2614
- const D = fs(_, h.getRowCount(), h.getColumnCount());
2572
+ const D = us(_, d.getRowCount(), d.getColumnCount());
2615
2573
  D.unitId = t, D.sheetId = S, l.push({
2616
2574
  range: D,
2617
2575
  primary: null,
2618
- style: uc(d, A, M.toString())
2576
+ style: dc(h, k, M.toString())
2619
2577
  }), C.push(w);
2620
2578
  }
2621
2579
  if (s) {
2622
- const b = (p = (E = s.getSelectionRanges()) == null ? void 0 : E[0]) == null ? void 0 : p.startOffset, T = C.findIndex((F) => F + 2 === b);
2580
+ const y = (m = (E = s.getSelectionRanges()) == null ? void 0 : E[0]) == null ? void 0 : m.startOffset, T = C.findIndex((A) => A + 2 === y);
2623
2581
  T !== -1 ? c == null || c.setActiveSelectionIndex(T) : c == null || c.resetActiveSelectionIndex();
2624
2582
  }
2625
2583
  return l;
2626
2584
  }
2627
- function dc(e, t) {
2628
- const n = y(ne), o = y(Et), r = y(Gt), s = y(Te), i = _e(le(() => n.getCurrentTypeOfUnit$(W.UNIVER_SHEET), [n])), c = i ? s.getRenderById(i.getUnitId()) : null, a = c == null ? void 0 : c.with(Le), d = c == null ? void 0 : c.with(bt), f = ee((m, u) => {
2629
- const h = n.getCurrentUnitOfType(W.UNIVER_SHEET);
2630
- if (!h || a != null && a.selectionMoving) return;
2585
+ function hc(e, t) {
2586
+ const n = b(re), o = b(It), r = b(Kt), s = b(Te), i = Re(le(() => n.getCurrentTypeOfUnit$(B.UNIVER_SHEET), [n])), c = i ? s.getRenderById(i.getUnitId()) : null, a = c == null ? void 0 : c.with(Ue), h = c == null ? void 0 : c.with(Et), g = ee((p, u) => {
2587
+ const d = n.getCurrentUnitOfType(B.UNIVER_SHEET);
2588
+ if (!d || a != null && a.selectionMoving) return;
2631
2589
  const l = qr({
2632
2590
  unitId: e,
2633
2591
  subUnitId: t,
2634
- currentWorkbook: h,
2635
- refSelections: m,
2592
+ currentWorkbook: d,
2593
+ refSelections: p,
2636
2594
  editor: u,
2637
2595
  refSelectionsService: r,
2638
2596
  refSelectionsRenderService: a,
2639
- sheetSkeletonManagerService: d,
2597
+ sheetSkeletonManagerService: h,
2640
2598
  themeService: o,
2641
2599
  univerInstanceService: n
2642
2600
  });
@@ -2645,50 +2603,50 @@ function dc(e, t) {
2645
2603
  });
2646
2604
  return P(() => () => {
2647
2605
  a == null || a.resetActiveSelectionIndex();
2648
- }, [a]), f;
2606
+ }, [a]), g;
2649
2607
  }
2650
2608
  function jr(e = "") {
2651
- const t = y(zt), n = hc(), o = y(pe), r = le(() => e.length, [e]);
2652
- return ee((i, c, a = !0, d) => {
2653
- const f = i.getDocumentData(), m = i.getEditorId();
2654
- if (!f)
2609
+ const t = b(dt), n = fc(), o = b(ve), r = le(() => e.length, [e]);
2610
+ return ee((i, c, a = !0, h) => {
2611
+ const g = i.getDocumentData(), p = i.getEditorId();
2612
+ if (!g)
2655
2613
  return [];
2656
- const u = f.body;
2614
+ const u = g.body;
2657
2615
  if (!u)
2658
2616
  return [];
2659
- const h = u.dataStream.slice(0, u.dataStream.length - 2), l = { dataStream: "", ...f.body };
2660
- if (!h.startsWith(e)) return [];
2617
+ const d = u.dataStream.slice(0, u.dataStream.length - 2), l = { dataStream: "", ...g.body };
2618
+ if (!d.startsWith(e)) return [];
2661
2619
  if (c == null || c.length === 0)
2662
- return l.textRuns = [], o.syncExecuteCommand(jn.id, {
2663
- unitId: m,
2664
- body: Pn(l, 0, l.dataStream.length - 2)
2620
+ return l.textRuns = [], o.syncExecuteCommand(Hn.id, {
2621
+ unitId: p,
2622
+ body: Dn(l, 0, l.dataStream.length - 2)
2665
2623
  }), [];
2666
2624
  {
2667
- const { textRuns: S, refSelections: v } = fc(t, n, c);
2668
- r && S.forEach((R) => {
2669
- R.ed = R.ed + r, R.st = R.st + r;
2625
+ const { textRuns: S, refSelections: v } = gc(t, n, c);
2626
+ r && S.forEach((I) => {
2627
+ I.ed = I.ed + r, I.st = I.st + r;
2670
2628
  }), l.textRuns = [{ st: 0, ed: 1, ts: { fs: 11 } }, ...S];
2671
- const g = c.reduce((R, E) => typeof E == "string" ? `${R}${E}` : `${R}${E.token}`, "");
2672
- l.dataStream = `${e}${g}\r
2629
+ const f = c.reduce((I, E) => typeof E == "string" ? `${I}${E}` : `${I}${E.token}`, "");
2630
+ l.dataStream = `${e}${f}\r
2673
2631
  `;
2674
2632
  let C;
2675
2633
  if (a) {
2676
2634
  C = i.getSelectionRanges();
2677
- const R = l.dataStream.length - 2 + r;
2635
+ const I = l.dataStream.length - 2 + r;
2678
2636
  C.forEach((E) => {
2679
- E.startOffset = Math.max(0, Math.min(E.startOffset, R)), E.endOffset = Math.max(0, Math.min(E.endOffset, R));
2637
+ E.startOffset = Math.max(0, Math.min(E.startOffset, I)), E.endOffset = Math.max(0, Math.min(E.endOffset, I));
2680
2638
  });
2681
2639
  }
2682
- return o.syncExecuteCommand(jn.id, {
2683
- unitId: m,
2684
- body: Pn(l, 0, l.dataStream.length - 2),
2685
- textRanges: d != null ? d : C
2640
+ return o.syncExecuteCommand(Hn.id, {
2641
+ unitId: p,
2642
+ body: Dn(l, 0, l.dataStream.length - 2),
2643
+ textRanges: h != null ? h : C
2686
2644
  }), v;
2687
2645
  }
2688
2646
  });
2689
2647
  }
2690
- function hc() {
2691
- const e = y(Et), t = e.getCurrentTheme();
2648
+ function fc() {
2649
+ const e = b(It), t = e.getCurrentTheme();
2692
2650
  return le(() => {
2693
2651
  const o = [
2694
2652
  e.getColorFromTheme("loop-color.1"),
@@ -2707,16 +2665,16 @@ function hc() {
2707
2665
  return { formulaRefColors: o, numberColor: r, stringColor: s, plainTextColor: i };
2708
2666
  }, [t]);
2709
2667
  }
2710
- function fc(e, t, n) {
2711
- const { formulaRefColors: o, numberColor: r, stringColor: s, plainTextColor: i } = t, c = [], a = [], d = /* @__PURE__ */ new Map();
2712
- let f = 0;
2713
- for (let m = 0, u = n.length; m < u; m++) {
2714
- const h = n[m];
2715
- if (typeof h == "string") {
2716
- const R = c[c.length - 1], E = R ? R.ed : 0, p = E + h.length;
2668
+ function gc(e, t, n) {
2669
+ const { formulaRefColors: o, numberColor: r, stringColor: s, plainTextColor: i } = t, c = [], a = [], h = /* @__PURE__ */ new Map();
2670
+ let g = 0;
2671
+ for (let p = 0, u = n.length; p < u; p++) {
2672
+ const d = n[p];
2673
+ if (typeof d == "string") {
2674
+ const I = c[c.length - 1], E = I ? I.ed : 0, m = E + d.length;
2717
2675
  c.push({
2718
2676
  st: E,
2719
- ed: p,
2677
+ ed: m,
2720
2678
  ts: {
2721
2679
  cl: {
2722
2680
  rgb: i
@@ -2726,10 +2684,10 @@ function fc(e, t, n) {
2726
2684
  });
2727
2685
  continue;
2728
2686
  }
2729
- if (e.hasDefinedNameDescription(h.token.trim())) {
2687
+ if (e.hasDefinedNameDescription(d.token.trim())) {
2730
2688
  c.push({
2731
- st: h.startIndex,
2732
- ed: h.endIndex + 1,
2689
+ st: d.startIndex,
2690
+ ed: d.endIndex + 1,
2733
2691
  ts: {
2734
2692
  cl: {
2735
2693
  rgb: i
@@ -2739,21 +2697,21 @@ function fc(e, t, n) {
2739
2697
  });
2740
2698
  continue;
2741
2699
  }
2742
- const { startIndex: l, endIndex: S, nodeType: v, token: g } = h;
2700
+ const { startIndex: l, endIndex: S, nodeType: v, token: f } = d;
2743
2701
  let C = "";
2744
2702
  if (v === Q.REFERENCE) {
2745
- if (d.has(g))
2746
- C = d.get(g);
2703
+ if (h.has(f))
2704
+ C = h.get(f);
2747
2705
  else {
2748
- const R = f % o.length;
2749
- C = o[R], d.set(g, C), f++;
2706
+ const I = g % o.length;
2707
+ C = o[I], h.set(f, C), g++;
2750
2708
  }
2751
2709
  a.push({
2752
- refIndex: m,
2710
+ refIndex: p,
2753
2711
  themeColor: C,
2754
- token: g,
2755
- startIndex: h.startIndex,
2756
- endIndex: h.endIndex,
2712
+ token: f,
2713
+ startIndex: d.startIndex,
2714
+ endIndex: d.endIndex,
2757
2715
  index: a.length
2758
2716
  });
2759
2717
  } else v === Q.NUMBER ? C = r : (v === Q.STRING || v === Q.ARRAY) && (C = s);
@@ -2779,166 +2737,166 @@ function fc(e, t, n) {
2779
2737
  }
2780
2738
  return { textRuns: c, refSelections: a };
2781
2739
  }
2782
- const gc = (e, t, n, o) => {
2783
- const r = y(pe), s = y(Zt), i = X(t);
2740
+ const mc = (e, t, n, o) => {
2741
+ const r = b(ve), s = b(Yt), i = X(t);
2784
2742
  i.current = t;
2785
2743
  const c = X(o);
2786
2744
  c.current = o, P(() => {
2787
2745
  if (!n || !e)
2788
2746
  return;
2789
- const d = `sheet.formula-embedding-editor.${n.getEditorId()}`, f = new Ye(), m = (l, S) => {
2747
+ const h = `sheet.formula-embedding-editor.${n.getEditorId()}`, g = new Ye(), p = (l, S) => {
2790
2748
  if (c.current) {
2791
2749
  c.current(l, S);
2792
2750
  return;
2793
2751
  }
2794
- let v = de.LEFT;
2795
- l === L.ARROW_DOWN ? v = de.DOWN : l === L.ARROW_UP ? v = de.UP : l === L.ARROW_RIGHT && (v = de.RIGHT), S === V.SHIFT ? r.executeCommand(zo.id, {
2752
+ let v = xe.LEFT;
2753
+ l === L.ARROW_DOWN ? v = xe.DOWN : l === L.ARROW_UP ? v = xe.UP : l === L.ARROW_RIGHT && (v = xe.RIGHT), S === W.SHIFT ? r.executeCommand(Go.id, {
2796
2754
  direction: v
2797
- }) : r.executeCommand(Zo.id, {
2755
+ }) : r.executeCommand(zo.id, {
2798
2756
  direction: v
2799
2757
  });
2800
2758
  }, u = (l, S) => {
2801
- let v = de.DOWN;
2802
- l === L.ARROW_DOWN ? v = de.DOWN : l === L.ARROW_UP ? v = de.UP : l === L.ARROW_LEFT ? v = de.LEFT : l === L.ARROW_RIGHT && (v = de.RIGHT), i.current ? S === V.CTRL_COMMAND ? r.executeCommand(Hn.id, {
2759
+ let v = xe.DOWN;
2760
+ l === L.ARROW_DOWN ? v = xe.DOWN : l === L.ARROW_UP ? v = xe.UP : l === L.ARROW_LEFT ? v = xe.LEFT : l === L.ARROW_RIGHT && (v = xe.RIGHT), i.current ? S === W.CTRL_COMMAND ? r.executeCommand(Un.id, {
2803
2761
  direction: v,
2804
- jumpOver: Bn.moveGap,
2762
+ jumpOver: Wn.moveGap,
2805
2763
  extra: "formula-editor",
2806
- fromCurrentSelection: i.current === Me.NEED_ADD || i.current === Me.EDIT_OTHER_SHEET_REFERENCE
2807
- }) : S === V.SHIFT ? r.executeCommand(qn.id, {
2764
+ fromCurrentSelection: i.current === we.NEED_ADD || i.current === we.EDIT_OTHER_SHEET_REFERENCE
2765
+ }) : S === W.SHIFT ? r.executeCommand(Vn.id, {
2808
2766
  direction: v,
2809
2767
  extra: "formula-editor"
2810
- }) : S === (V.CTRL_COMMAND | V.SHIFT) ? r.executeCommand(qn.id, {
2768
+ }) : S === (W.CTRL_COMMAND | W.SHIFT) ? r.executeCommand(Vn.id, {
2811
2769
  direction: v,
2812
- jumpOver: Bn.moveGap,
2770
+ jumpOver: Wn.moveGap,
2813
2771
  extra: "formula-editor"
2814
- }) : r.executeCommand(Hn.id, {
2772
+ }) : r.executeCommand(Un.id, {
2815
2773
  direction: v,
2816
2774
  extra: "formula-editor",
2817
- fromCurrentSelection: i.current === Me.NEED_ADD || i.current === Me.EDIT_OTHER_SHEET_REFERENCE
2818
- }) : m(l, S);
2775
+ fromCurrentSelection: i.current === we.NEED_ADD || i.current === we.EDIT_OTHER_SHEET_REFERENCE
2776
+ }) : p(l, S);
2819
2777
  };
2820
- return f.add(r.registerCommand({
2821
- id: d,
2822
- type: be.OPERATION,
2778
+ return g.add(r.registerCommand({
2779
+ id: h,
2780
+ type: ye.OPERATION,
2823
2781
  handler(l, S) {
2824
- const { keyCode: v, metaKey: g } = S;
2825
- u(v, g);
2782
+ const { keyCode: v, metaKey: f } = S;
2783
+ u(v, f);
2826
2784
  }
2827
2785
  })), [
2828
2786
  { keyCode: L.ARROW_DOWN },
2829
2787
  { keyCode: L.ARROW_LEFT },
2830
2788
  { keyCode: L.ARROW_RIGHT },
2831
2789
  { keyCode: L.ARROW_UP },
2832
- { keyCode: L.ARROW_DOWN, metaKey: V.SHIFT },
2833
- { keyCode: L.ARROW_LEFT, metaKey: V.SHIFT },
2834
- { keyCode: L.ARROW_RIGHT, metaKey: V.SHIFT },
2835
- { keyCode: L.ARROW_UP, metaKey: V.SHIFT },
2836
- { keyCode: L.ARROW_DOWN, metaKey: V.CTRL_COMMAND },
2837
- { keyCode: L.ARROW_LEFT, metaKey: V.CTRL_COMMAND },
2838
- { keyCode: L.ARROW_RIGHT, metaKey: V.CTRL_COMMAND },
2839
- { keyCode: L.ARROW_UP, metaKey: V.CTRL_COMMAND },
2840
- { keyCode: L.ARROW_DOWN, metaKey: V.CTRL_COMMAND | V.SHIFT },
2841
- { keyCode: L.ARROW_LEFT, metaKey: V.CTRL_COMMAND | V.SHIFT },
2842
- { keyCode: L.ARROW_RIGHT, metaKey: V.CTRL_COMMAND | V.SHIFT },
2843
- { keyCode: L.ARROW_UP, metaKey: V.CTRL_COMMAND | V.SHIFT }
2790
+ { keyCode: L.ARROW_DOWN, metaKey: W.SHIFT },
2791
+ { keyCode: L.ARROW_LEFT, metaKey: W.SHIFT },
2792
+ { keyCode: L.ARROW_RIGHT, metaKey: W.SHIFT },
2793
+ { keyCode: L.ARROW_UP, metaKey: W.SHIFT },
2794
+ { keyCode: L.ARROW_DOWN, metaKey: W.CTRL_COMMAND },
2795
+ { keyCode: L.ARROW_LEFT, metaKey: W.CTRL_COMMAND },
2796
+ { keyCode: L.ARROW_RIGHT, metaKey: W.CTRL_COMMAND },
2797
+ { keyCode: L.ARROW_UP, metaKey: W.CTRL_COMMAND },
2798
+ { keyCode: L.ARROW_DOWN, metaKey: W.CTRL_COMMAND | W.SHIFT },
2799
+ { keyCode: L.ARROW_LEFT, metaKey: W.CTRL_COMMAND | W.SHIFT },
2800
+ { keyCode: L.ARROW_RIGHT, metaKey: W.CTRL_COMMAND | W.SHIFT },
2801
+ { keyCode: L.ARROW_UP, metaKey: W.CTRL_COMMAND | W.SHIFT }
2844
2802
  ].map(({ keyCode: l, metaKey: S }) => ({
2845
- id: d,
2803
+ id: h,
2846
2804
  binding: S ? l | S : l,
2847
2805
  preconditions: () => !0,
2848
2806
  priority: 900,
2849
2807
  staticParameters: {
2850
- eventType: xe.Keyboard,
2808
+ eventType: Ae.Keyboard,
2851
2809
  keyCode: l,
2852
2810
  metaKey: S
2853
2811
  }
2854
2812
  })).forEach((l) => {
2855
- f.add(s.registerShortcut(l));
2813
+ g.add(s.registerShortcut(l));
2856
2814
  }), () => {
2857
- f.dispose();
2815
+ g.dispose();
2858
2816
  };
2859
2817
  }, [r, n, e, s]);
2860
- }, mc = (e, t, n, o, r = !0) => {
2861
- var h;
2862
- const s = y(Te), i = y(hn), c = y(Es), a = y(Gt), d = y(ne), f = _e(le(() => d.getCurrentTypeOfUnit$(W.UNIVER_SHEET), [d])), m = s.getRenderById((h = f == null ? void 0 : f.getUnitId()) != null ? h : ""), u = m == null ? void 0 : m.with(Le);
2863
- Pt(() => {
2818
+ }, pc = (e, t, n, o, r = !0) => {
2819
+ var d;
2820
+ const s = b(Te), i = b(ln), c = b(Rs), a = b(Kt), h = b(re), g = Re(le(() => h.getCurrentTypeOfUnit$(B.UNIVER_SHEET), [h])), p = s.getRenderById((d = g == null ? void 0 : g.getUnitId()) != null ? d : ""), u = p == null ? void 0 : p.with(Ue);
2821
+ Ut(() => {
2864
2822
  if (e)
2865
- return i.setContextValue(Un, !0), r && c.disable(), () => {
2866
- const l = d.getCurrentUnitOfType(W.UNIVER_DOC);
2867
- (l == null ? void 0 : l.getUnitId()) === o && i.setContextValue(Un, !1), r && c.enable(), a.clear();
2823
+ return i.setContextValue(Ln, !0), r && c.disable(), () => {
2824
+ const l = h.getCurrentUnitOfType(B.UNIVER_DOC);
2825
+ (l == null ? void 0 : l.getUnitId()) === o && i.setContextValue(Ln, !1), r && c.enable(), a.clear();
2868
2826
  };
2869
- }, [i, e, a, r, o]), Pt(() => {
2827
+ }, [i, e, a, r, o]), Ut(() => {
2870
2828
  if (e && t) {
2871
2829
  const l = u == null ? void 0 : u.enableSelectionChanging();
2872
- return i.setContextValue(zn, !0), () => {
2873
- i.setContextValue(zn, !1), l == null || l.dispose();
2830
+ return i.setContextValue(jn, !0), () => {
2831
+ i.setContextValue(jn, !1), l == null || l.dispose();
2874
2832
  };
2875
2833
  }
2876
2834
  }, [i, e, u, t]), P(() => {
2877
2835
  e && (u == null || u.setSkipLastEnabled(!1));
2878
2836
  }, [e, u]);
2879
- }, pc = (e, t, n) => {
2880
- const o = y(ne), r = y(_n);
2881
- return $t(() => {
2837
+ }, Sc = (e, t, n) => {
2838
+ const o = b(re), r = b(vn);
2839
+ return Pt(() => {
2882
2840
  if (e) {
2883
- const i = [...r.getWorkbookSelections(t).getSelectionsOfWorksheet(n)], c = o.getCurrentUnitForType(W.UNIVER_SHEET), a = c == null ? void 0 : c.getActiveSheet();
2841
+ const i = [...r.getWorkbookSelections(t).getSelectionsOfWorksheet(n)], c = o.getCurrentUnitForType(B.UNIVER_SHEET), a = c == null ? void 0 : c.getActiveSheet();
2884
2842
  (c == null ? void 0 : c.getUnitId()) !== t && o.setCurrentUnitForType(t), a && a.getSheetId() === n && r.setSelections(i);
2885
2843
  }
2886
2844
  }, [e, r, n, t, o]);
2887
- }, Sc = (e) => e.reduce((t, n) => typeof n == "string" ? t + n.length : t + n.token.length, 0), dn = (e) => e.map((t) => typeof t == "string" ? t : t.token).join(""), Ft = (e, t = !1, n = "", o = !1) => !t && !o ? e.map((r) => Ee(r.range)) : e.map((r) => o ? Ho(r) : r.sheetName !== "" && r.sheetName !== n ? _t(r.sheetName, r.range) : Ee(r.range)), vc = (e) => {
2888
- var f, m, u;
2845
+ }, vc = (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(""), Dt = (e, t = !1, n = "", o = !1) => !t && !o ? e.map((r) => be(r.range)) : e.map((r) => o ? Vo(r) : r.sheetName !== "" && r.sheetName !== n ? Ct(r.sheetName, r.range) : be(r.range)), Cc = (e) => {
2846
+ var g, p, u;
2889
2847
  const { editor: t, lexerTreeBuilder: n } = e, o = t == null ? void 0 : t.getSelectionRanges();
2890
2848
  if ((o == null ? void 0 : o.length) !== 1)
2891
2849
  return;
2892
- const s = o[0].startOffset - 1, i = ((m = (f = t == null ? void 0 : t.getDocumentData().body) == null ? void 0 : f.dataStream) != null ? m : `\r
2893
- `).slice(0, -2), c = (u = n.sequenceNodesBuilder(i.slice(1))) != null ? u : [], a = Nn(c, s, !1), d = Hr(c, a);
2850
+ const s = o[0].startOffset - 1, i = ((p = (g = t == null ? void 0 : t.getDocumentData().body) == null ? void 0 : g.dataStream) != null ? p : `\r
2851
+ `).slice(0, -2), c = (u = n.sequenceNodesBuilder(i.slice(1))) != null ? u : [], a = yn(c, s, !1), h = Hr(c, a);
2894
2852
  return {
2895
2853
  nodeIndex: a,
2896
- updatingRefIndex: d,
2854
+ updatingRefIndex: h,
2897
2855
  sequenceNodes: c,
2898
2856
  offset: s
2899
2857
  };
2900
- }, Cc = (() => {
2901
- }), _c = (e, t, n, o, r, s, i, c, a, d = Cc) => {
2858
+ }, _c = (() => {
2859
+ }), Rc = (e, t, n, o, r, s, i, c, a, h = _c) => {
2902
2860
  var M;
2903
- const f = y(Te), m = y(ne), u = y(pe), h = y(Tr), l = y(Et), S = y(ye), v = m.getUnit(o), g = ee((w, k) => {
2904
- var $, I, _;
2905
- return (_ = (I = ($ = m.getUnit(w)) == null ? void 0 : $.getSheetBySheetId(k)) == null ? void 0 : I.getName()) != null ? _ : "";
2906
- }), C = le(() => g(o, r), [g, r, o]), R = _e(v == null ? void 0 : v.activeSheet$), E = rt({ activeSheet: R, sheetName: C }), p = _e(le(() => m.getCurrentTypeOfUnit$(W.UNIVER_SHEET), [m])), b = f.getRenderById((M = p == null ? void 0 : p.getUnitId()) != null ? M : ""), T = b == null ? void 0 : b.with(Le), F = b == null ? void 0 : b.with(bt), A = y(Gt), N = ee((w, k, $) => {
2907
- var Y, re, he, G, J, ot, st, Ot, Oe, Nt;
2908
- const I = vc({ editor: a, lexerTreeBuilder: S });
2909
- if (!I) return;
2910
- const { nodeIndex: _, updatingRefIndex: O, sequenceNodes: D, offset: U } = I;
2911
- if (n.current === Me.NEED_ADD)
2861
+ const g = b(Te), p = b(re), u = b(ve), d = b(yr), l = b(It), S = b(ke), v = p.getUnit(o), f = ee((w, F) => {
2862
+ var $, R, _;
2863
+ return (_ = (R = ($ = p.getUnit(w)) == null ? void 0 : $.getSheetBySheetId(F)) == null ? void 0 : R.getName()) != null ? _ : "";
2864
+ }), C = le(() => f(o, r), [f, r, o]), I = Re(v == null ? void 0 : v.activeSheet$), E = Qe({ activeSheet: I, sheetName: C }), m = Re(le(() => p.getCurrentTypeOfUnit$(B.UNIVER_SHEET), [p])), y = g.getRenderById((M = m == null ? void 0 : m.getUnitId()) != null ? M : ""), T = y == null ? void 0 : y.with(Ue), A = y == null ? void 0 : y.with(Et), k = b(Kt), N = ee((w, F, $) => {
2865
+ var Y, oe, ge, G, J, Je, et, Nt, Ne, Mt;
2866
+ const R = Cc({ editor: a, lexerTreeBuilder: S });
2867
+ if (!R) return;
2868
+ const { nodeIndex: _, updatingRefIndex: O, sequenceNodes: D, offset: U } = R;
2869
+ if (n.current === we.NEED_ADD)
2912
2870
  if (U !== 0) {
2913
2871
  if (_ === -1 && D.length)
2914
2872
  return;
2915
- const K = w[w.length - 1], te = D.splice(_ + 1), fe = (Y = K.sheetId) != null ? Y : r, oe = {
2873
+ const K = w[w.length - 1], te = D.splice(_ + 1), me = (Y = K.sheetId) != null ? Y : r, se = {
2916
2874
  range: K,
2917
- unitId: (re = K.unitId) != null ? re : p.getUnitId(),
2918
- sheetName: g((he = K.unitId) != null ? he : p.getUnitId(), fe)
2919
- }, ae = fe !== r, ge = (p == null ? void 0 : p.getUnitId()) !== o, Se = Ft([oe], i && (ae || ge), C, ge);
2920
- D.push({ token: Se[0], nodeType: Q.REFERENCE });
2921
- const We = [...D, ...te], He = dn(We);
2922
- d(He, Sc(D), k);
2875
+ unitId: (oe = K.unitId) != null ? oe : m.getUnitId(),
2876
+ sheetName: f((ge = K.unitId) != null ? ge : m.getUnitId(), me)
2877
+ }, ue = me !== r, pe = (m == null ? void 0 : m.getUnitId()) !== o, Ce = Dt([se], i && (ue || pe), C, pe);
2878
+ D.push({ token: Ce[0], nodeType: Q.REFERENCE });
2879
+ const Ve = [...D, ...te], He = an(Ve);
2880
+ h(He, vc(D), F);
2923
2881
  } else {
2924
- const K = w[w.length - 1], te = (G = K.sheetId) != null ? G : r, fe = {
2882
+ const K = w[w.length - 1], te = (G = K.sheetId) != null ? G : r, me = {
2925
2883
  range: K,
2926
- unitId: (J = K.unitId) != null ? J : p.getUnitId(),
2927
- sheetName: g((ot = K.unitId) != null ? ot : p.getUnitId(), te)
2928
- }, oe = te !== r, ae = (p == null ? void 0 : p.getUnitId()) !== o, ge = Ft([fe], i && (oe || ae), C, ae);
2929
- D.unshift({ token: ge[0], nodeType: Q.REFERENCE });
2930
- const Se = dn(D);
2931
- d(Se, ge[0].length, k);
2932
- }
2933
- else if (n.current === Me.EDIT_OTHER_SHEET_REFERENCE || n.current === Me.EDIT_OTHER_WORKBOOK_REFERENCE) {
2884
+ unitId: (J = K.unitId) != null ? J : m.getUnitId(),
2885
+ sheetName: f((Je = K.unitId) != null ? Je : m.getUnitId(), te)
2886
+ }, se = te !== r, ue = (m == null ? void 0 : m.getUnitId()) !== o, pe = Dt([me], i && (se || ue), C, ue);
2887
+ D.unshift({ token: pe[0], nodeType: Q.REFERENCE });
2888
+ const Ce = an(D);
2889
+ h(Ce, pe[0].length, F);
2890
+ }
2891
+ else if (n.current === we.EDIT_OTHER_SHEET_REFERENCE || n.current === we.EDIT_OTHER_WORKBOOK_REFERENCE) {
2934
2892
  const K = w.pop();
2935
2893
  if (!K) return;
2936
2894
  const te = D[_];
2937
2895
  if (typeof te == "object" && te.nodeType === Q.REFERENCE) {
2938
- const fe = te.token;
2939
- (p == null ? void 0 : p.getUnitId()) !== o ? te.token = Bo((st = p == null ? void 0 : p.getUnitId()) != null ? st : "", C, K) : te.token = C === (R == null ? void 0 : R.getName()) ? Ee(K) : _t(R.getName(), K);
2940
- const ae = U + (te.token.length - fe.length);
2941
- d(qo(D), ae, k);
2896
+ const me = te.token;
2897
+ (m == null ? void 0 : m.getUnitId()) !== o ? te.token = Ho((et = m == null ? void 0 : m.getUnitId()) != null ? et : "", C, K) : te.token = C === (I == null ? void 0 : I.getName()) ? be(K) : Ct(I.getName(), K);
2898
+ const ue = U + (te.token.length - me.length);
2899
+ h(Bo(D), ue, F);
2942
2900
  }
2943
2901
  } else {
2944
2902
  const K = [...w];
@@ -2947,104 +2905,104 @@ const gc = (e, t, n, o) => {
2947
2905
  z && K.splice(O, 0, z);
2948
2906
  }
2949
2907
  let te = 0;
2950
- const fe = D.map((z) => {
2951
- var Re, we, it, Be;
2908
+ const me = D.map((z) => {
2909
+ var Ie, De, tt, Be;
2952
2910
  if (typeof z == "string")
2953
2911
  return z;
2954
2912
  if (z.nodeType === Q.REFERENCE) {
2955
- const me = ht(z.token);
2956
- 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)
2913
+ const Se = ut(z.token);
2914
+ if (Se.sheetName || (Se.sheetName = C), (Se.unitId || o) !== (m == null ? void 0 : m.getUnitId()) || i && ((Ie = E.current.activeSheet) == null ? void 0 : Ie.getName()) !== Se.sheetName)
2957
2915
  return z.token;
2958
- const ie = K[te];
2959
- if (te++, !ie)
2916
+ const ce = K[te];
2917
+ if (te++, !ce)
2960
2918
  return "";
2961
- const gt = (we = ie.sheetId) != null ? we : r, Jt = {
2962
- range: ie,
2963
- unitId: (it = ie.unitId) != null ? it : p.getUnitId(),
2964
- sheetName: g((Be = ie.unitId) != null ? Be : p.getUnitId(), gt)
2965
- }, Mt = (p == null ? void 0 : p.getUnitId()) !== o;
2966
- return Ft([Jt], i && (gt !== r || Mt), C, Mt)[0];
2919
+ const ft = (De = ce.sheetId) != null ? De : r, Xt = {
2920
+ range: ce,
2921
+ unitId: (tt = ce.unitId) != null ? tt : m.getUnitId(),
2922
+ sheetName: f((Be = ce.unitId) != null ? Be : m.getUnitId(), ft)
2923
+ }, xt = (m == null ? void 0 : m.getUnitId()) !== o;
2924
+ return Dt([Xt], i && (ft !== r || xt), C, xt)[0];
2967
2925
  }
2968
2926
  return z.token;
2969
2927
  });
2970
- let oe = "", ae;
2971
- fe.forEach((z, Re) => {
2972
- oe += z, Re === _ && (ae = oe.length);
2928
+ let se = "", ue;
2929
+ me.forEach((z, Ie) => {
2930
+ se += z, Ie === _ && (ue = se.length);
2973
2931
  });
2974
- const ge = [];
2932
+ const pe = [];
2975
2933
  for (let z = te; z <= w.length - 1; z++) {
2976
- const Re = w[z], we = (Ot = Re.sheetId) != null ? Ot : r, it = {
2977
- range: Re,
2978
- unitId: (Oe = Re.unitId) != null ? Oe : p.getUnitId(),
2979
- sheetName: g((Nt = Re.unitId) != null ? Nt : p.getUnitId(), we)
2980
- }, Be = (p == null ? void 0 : p.getUnitId()) !== o, ie = Ft([it], i && (we !== r || Be), C, Be);
2981
- ge.push(ie[0]);
2982
- }
2983
- const Se = D[D.length - 1], We = Se && (typeof Se == "string" ? !1 : Se.nodeType === Q.REFERENCE), He = `${oe}${ge.length && We ? "," : ""}${ge.join(",")}`;
2984
- d(He, !ge.length && ae ? ae : He.length, k);
2934
+ const Ie = w[z], De = (Nt = Ie.sheetId) != null ? Nt : r, tt = {
2935
+ range: Ie,
2936
+ unitId: (Ne = Ie.unitId) != null ? Ne : m.getUnitId(),
2937
+ sheetName: f((Mt = Ie.unitId) != null ? Mt : m.getUnitId(), De)
2938
+ }, Be = (m == null ? void 0 : m.getUnitId()) !== o, ce = Dt([tt], i && (De !== r || Be), C, Be);
2939
+ pe.push(ce[0]);
2940
+ }
2941
+ const Ce = D[D.length - 1], Ve = Ce && (typeof Ce == "string" ? !1 : Ce.nodeType === Q.REFERENCE), He = `${se}${pe.length && Ve ? "," : ""}${pe.join(",")}`;
2942
+ h(He, !pe.length && ue ? ue : He.length, F);
2985
2943
  }
2986
2944
  });
2987
2945
  P(() => {
2988
2946
  if (T && e) {
2989
- let w = !0, k = 0;
2947
+ let w = !0, F = 0;
2990
2948
  const $ = (_, O) => {
2991
2949
  if (w) {
2992
- w = !1, k = _.length;
2950
+ w = !1, F = _.length;
2993
2951
  return;
2994
2952
  }
2995
- const D = _.length > k;
2996
- O && (k = _.length), N(_.map((U) => U.rangeWithCoord), O, D);
2997
- }, I = new Ye();
2998
- return I.add(T.selectionMoving$.subscribe((_) => {
2953
+ const D = _.length > F;
2954
+ O && (F = _.length), N(_.map((U) => U.rangeWithCoord), O, D);
2955
+ }, R = new Ye();
2956
+ return R.add(T.selectionMoving$.subscribe((_) => {
2999
2957
  $(_, !1);
3000
- })), I.add(T.selectionMoveEnd$.subscribe((_) => {
2958
+ })), R.add(T.selectionMoveEnd$.subscribe((_) => {
3001
2959
  $(_, !0);
3002
2960
  })), () => {
3003
- I.dispose();
2961
+ R.dispose();
3004
2962
  };
3005
2963
  }
3006
2964
  }, [e, N, T]), P(() => {
3007
2965
  if (t && T && a) {
3008
- const w = new Ye(), k = () => {
2966
+ const w = new Ye(), F = () => {
3009
2967
  w.dispose(), T.getSelectionControls().forEach((_, O) => {
3010
2968
  w.add(
3011
2969
  _.selectionScaling$.subscribe((D) => {
3012
- const U = T.getSelectionDataWithStyle().map((re) => re.rangeWithCoord), Y = U[O];
2970
+ const U = T.getSelectionDataWithStyle().map((oe) => oe.rangeWithCoord), Y = U[O];
3013
2971
  D.sheetId = Y.sheetId, D.unitId = Y.unitId, U[O] = D, N(U, !1);
3014
2972
  })
3015
2973
  ), w.add(
3016
2974
  _.selectionMoving$.subscribe((D) => {
3017
- const U = T.getSelectionDataWithStyle().map((re) => re.rangeWithCoord), Y = U[O];
2975
+ const U = T.getSelectionDataWithStyle().map((oe) => oe.rangeWithCoord), Y = U[O];
3018
2976
  D.sheetId = Y.sheetId, D.unitId = Y.unitId, U[O] = D, N(U, !0);
3019
2977
  })
3020
2978
  );
3021
2979
  });
3022
- }, $ = Go(
2980
+ }, $ = Yo(
3023
2981
  a.input$,
3024
- A.selectionSet$,
2982
+ k.selectionSet$,
3025
2983
  T.selectionMoveEnd$
3026
2984
  ).pipe(
3027
- As(50)
2985
+ ws(50)
3028
2986
  ).subscribe(() => {
3029
- k();
2987
+ F();
3030
2988
  });
3031
2989
  return () => {
3032
2990
  $.unsubscribe(), w.dispose();
3033
2991
  };
3034
2992
  }
3035
- }, [a, t, N, T, A.selectionSet$]), T == null || T.getSelectionDataWithStyle(), P(() => {
2993
+ }, [a, t, N, T, k.selectionSet$]), T == null || T.getSelectionDataWithStyle(), P(() => {
3036
2994
  if (c) {
3037
- const w = u.onCommandExecuted((k) => {
3038
- var I;
3039
- if (k.id !== Rn.id)
2995
+ const w = u.onCommandExecuted((F) => {
2996
+ var R;
2997
+ if (F.id !== Cn.id)
3040
2998
  return;
3041
- const $ = k.params;
2999
+ const $ = F.params;
3042
3000
  if ($.extra === "formula-editor" && $.selections.length) {
3043
3001
  const _ = $.selections[$.selections.length - 1];
3044
3002
  if (_) {
3045
3003
  const { range: O, primary: D } = _;
3046
- (D != null && D.isMergedMainCell || D != null && D.isMerged) && fn.contains(D, O) && (O.startRow = D.startRow, O.endRow = D.startRow, O.startColumn = D.startColumn, O.endColumn = D.startColumn), O.unitId = $.unitId, O.sheetId = $.subUnitId;
3047
- const U = n.current === Me.NEED_ADD, Y = ((I = T == null ? void 0 : T.getSelectionDataWithStyle()) != null ? I : []).map((re) => re.rangeWithCoord);
3004
+ (D != null && D.isMergedMainCell || D != null && D.isMerged) && un.contains(D, O) && (O.startRow = D.startRow, O.endRow = D.startRow, O.startColumn = D.startColumn, O.endColumn = D.startColumn), O.unitId = $.unitId, O.sheetId = $.subUnitId;
3005
+ const U = n.current === we.NEED_ADD, Y = ((R = T == null ? void 0 : T.getSelectionDataWithStyle()) != null ? R : []).map((oe) => oe.rangeWithCoord);
3048
3006
  U ? Y.push(O) : Y[Y.length - 1] = O, N(Y, !0);
3049
3007
  }
3050
3008
  }
@@ -3056,47 +3014,47 @@ const gc = (e, t, n, o) => {
3056
3014
  }, [u, a, n, S, c, N, T]), P(() => {
3057
3015
  if (!a)
3058
3016
  return;
3059
- const w = h.textSelection$.subscribe((k) => {
3060
- k.unitId === a.getEditorId() && qr({
3017
+ const w = d.textSelection$.subscribe((F) => {
3018
+ F.unitId === a.getEditorId() && qr({
3061
3019
  unitId: o,
3062
3020
  subUnitId: r,
3063
3021
  refSelections: s.current,
3064
3022
  editor: a,
3065
- refSelectionsService: A,
3023
+ refSelectionsService: k,
3066
3024
  refSelectionsRenderService: T,
3067
- sheetSkeletonManagerService: F,
3025
+ sheetSkeletonManagerService: A,
3068
3026
  themeService: l,
3069
- univerInstanceService: m,
3070
- currentWorkbook: p
3027
+ univerInstanceService: p,
3028
+ currentWorkbook: m
3071
3029
  });
3072
3030
  });
3073
3031
  return () => w.unsubscribe();
3074
- }, [h.textSelection$, a, s, T, A, F, r, l, o, m]);
3075
- }, Rc = (e, t, n, o, r, s) => {
3076
- const i = y(pe), c = y(Ze), d = y(Te).getRenderById(t), f = y(ne), m = d == null ? void 0 : d.with(Le);
3032
+ }, [d.textSelection$, a, s, T, k, A, r, l, o, p]);
3033
+ }, Ic = (e, t, n, o, r, s) => {
3034
+ const i = b(ve), c = b(ze), h = b(Te).getRenderById(t), g = b(re), p = h == null ? void 0 : h.with(Ue);
3077
3035
  P(() => {
3078
- if (e && m)
3036
+ if (e && p)
3079
3037
  if (n) {
3080
3038
  const u = () => {
3081
- const S = m.getSelectionControls().length;
3039
+ const S = p.getSelectionControls().length;
3082
3040
  for (let v = 1; v <= S; v++)
3083
- m.clearLastSelection();
3041
+ p.clearLastSelection();
3084
3042
  return setTimeout(() => {
3085
3043
  s();
3086
3044
  }, 30);
3087
- }, h = i.onCommandExecuted((S) => {
3088
- S.id === Zn.id && u();
3089
- }), l = f.getCurrentTypeOfUnit$(W.UNIVER_SHEET).subscribe((S) => {
3045
+ }, d = i.onCommandExecuted((S) => {
3046
+ S.id === Kn.id && u();
3047
+ }), l = g.getCurrentTypeOfUnit$(B.UNIVER_SHEET).subscribe((S) => {
3090
3048
  u();
3091
3049
  });
3092
3050
  return () => {
3093
- h.dispose(), l.unsubscribe();
3051
+ d.dispose(), l.unsubscribe();
3094
3052
  };
3095
3053
  } else {
3096
- const u = i.beforeCommandExecuted((h) => {
3097
- if (h.id === Zn.id) {
3054
+ const u = i.beforeCommandExecuted((d) => {
3055
+ if (d.id === Kn.id) {
3098
3056
  o(!1), r(), s();
3099
- const l = c.getEditor(gn);
3057
+ const l = c.getEditor(dn);
3100
3058
  l == null || l.focus();
3101
3059
  }
3102
3060
  });
@@ -3104,9 +3062,9 @@ const gc = (e, t, n, o) => {
3104
3062
  u.dispose();
3105
3063
  };
3106
3064
  }
3107
- }, [e, m]);
3108
- }, Ic = (e, t, n) => {
3109
- const o = y(ye), r = X(!0);
3065
+ }, [e, p]);
3066
+ }, Ec = (e, t, n) => {
3067
+ const o = b(ke), r = X(!0);
3110
3068
  P(() => {
3111
3069
  if (e) {
3112
3070
  const s = setTimeout(() => {
@@ -3119,27 +3077,27 @@ const gc = (e, t, n, o) => {
3119
3077
  }, [e]), P(() => {
3120
3078
  if (!r.current && t) {
3121
3079
  const s = o.checkIfAddBracket(n);
3122
- t(s === 0 && n.startsWith(pr.EQUALS), `${n}`);
3080
+ t(s === 0 && n.startsWith(dr.EQUALS), `${n}`);
3123
3081
  }
3124
3082
  }, [n, t]);
3125
- }, Ec = (e, t = [], n) => {
3126
- const o = y(zt), [r, s] = H([]), [i, c] = H(""), a = X(-1), d = rt({ nodes: t }), f = () => {
3083
+ }, bc = (e, t = [], n) => {
3084
+ const o = b(dt), [r, s] = V([]), [i, c] = V(""), a = X(-1), h = Qe({ nodes: t }), g = () => {
3127
3085
  s([]), c(""), a.current = -1;
3128
3086
  };
3129
3087
  return P(() => {
3130
3088
  if (n && e) {
3131
- const u = n.input$.pipe(Cn(300)).subscribe(() => {
3132
- const h = n.getSelectionRanges();
3133
- if (h.length === 1) {
3134
- const l = d.current.nodes, S = h[0];
3089
+ const u = n.input$.pipe(Sn(300)).subscribe(() => {
3090
+ const d = n.getSelectionRanges();
3091
+ if (d.length === 1) {
3092
+ const l = h.current.nodes, S = d[0];
3135
3093
  if (S.collapsed) {
3136
- const v = Nn(l, S.startOffset - 1, !1);
3094
+ const v = yn(l, S.startOffset - 1, !1);
3137
3095
  a.current = v;
3138
- const g = l[v];
3139
- if (g && typeof g != "string" && g.nodeType === Q.FUNCTION) {
3096
+ const f = l[v];
3097
+ if (f && typeof f != "string" && f.nodeType === Q.FUNCTION) {
3140
3098
  a.current = v;
3141
- const C = g.token, R = o.getSearchListByNameFirstLetter(C);
3142
- s(R), c(C);
3099
+ const C = f.token, I = o.getSearchListByNameFirstLetter(C);
3100
+ s(I), c(C);
3143
3101
  return;
3144
3102
  }
3145
3103
  }
@@ -3151,102 +3109,102 @@ const gc = (e, t, n, o) => {
3151
3109
  };
3152
3110
  }
3153
3111
  }, [n, e]), P(() => {
3154
- e || f();
3112
+ e || g();
3155
3113
  }, [e]), {
3156
3114
  searchList: r,
3157
3115
  searchText: i,
3158
- handlerFormulaReplace: (u, h) => {
3159
- const l = [...d.current.nodes];
3116
+ handlerFormulaReplace: (u, d) => {
3117
+ const l = [...h.current.nodes];
3160
3118
  if (a.current !== -1) {
3161
3119
  const S = l.splice(a.current + 1), v = l.pop() || "";
3162
- let g = (typeof v == "string" ? v.length : v.token.length) - u.length;
3163
- return l.push(u), S[0] !== Ge.OPEN_BRACKET && h !== cn.DefinedName && (l.push(Ge.OPEN_BRACKET), g--), { text: dn([...l, ...S]), offset: g };
3120
+ let f = (typeof v == "string" ? v.length : v.token.length) - u.length;
3121
+ return l.push(u), S[0] !== Ge.OPEN_BRACKET && d !== fe.DefinedName && (l.push(Ge.OPEN_BRACKET), f--), { text: an([...l, ...S]), offset: f };
3164
3122
  }
3165
3123
  },
3166
- reset: f
3124
+ reset: g
3167
3125
  };
3168
- }, bc = () => {
3169
- }, yc = Ve(Tc);
3170
- function Tc(e, t) {
3171
- const { isFocus: n, sequenceNodes: o, onSelect: r, editor: s, onClose: i = bc } = e, c = s.getEditorId(), a = y(Zt), d = y(pe), { searchList: f, searchText: m, handlerFormulaReplace: u, reset: h } = Ec(n, o, s), l = le(() => !!f.length, [f]), S = X(void 0), [v, g] = H(0), C = X(!1), [R] = Br(c, l, [m, f]), E = rt({ searchList: f, active: v }), p = (N, M) => {
3126
+ }, yc = () => {
3127
+ }, Tc = We(Oc);
3128
+ function Oc(e, t) {
3129
+ const { isFocus: n, sequenceNodes: o, onSelect: r, editor: s, onClose: i = yc } = e, c = s.getEditorId(), a = b(Yt), h = b(ve), { searchList: g, searchText: p, handlerFormulaReplace: u, reset: d } = bc(n, o, s), l = le(() => !!g.length, [g]), S = X(void 0), [v, f] = V(0), C = X(!1), [I] = Br(c, l, [p, g]), E = Qe({ searchList: g, active: v }), m = (N, M) => {
3172
3130
  const w = u(N, M);
3173
- w && (h(), r(w));
3131
+ w && (d(), r(w));
3174
3132
  };
3175
- function b(N) {
3176
- C.current && g(N);
3133
+ function y(N) {
3134
+ C.current && f(N);
3177
3135
  }
3178
3136
  function T() {
3179
- C.current && g(-1);
3137
+ C.current && f(-1);
3180
3138
  }
3181
3139
  P(() => {
3182
- if (!f.length)
3140
+ if (!g.length)
3183
3141
  return;
3184
- const N = `sheet.formula-embedding-editor.search_function.${c}`, M = new Ye(), w = (k) => {
3185
- const { searchList: $, active: I } = E.current;
3186
- switch (k) {
3142
+ const N = `sheet.formula-embedding-editor.search_function.${c}`, M = new Ye(), w = (F) => {
3143
+ const { searchList: $, active: R } = E.current;
3144
+ switch (F) {
3187
3145
  case L.ARROW_UP: {
3188
- g((_) => {
3146
+ f((_) => {
3189
3147
  const O = Math.max(0, _ - 1);
3190
- return F(O), O;
3148
+ return A(O), O;
3191
3149
  });
3192
3150
  break;
3193
3151
  }
3194
3152
  case L.ARROW_DOWN: {
3195
- g((_) => {
3153
+ f((_) => {
3196
3154
  const O = Math.min($.length - 1, _ + 1);
3197
- return F(O), O;
3155
+ return A(O), O;
3198
3156
  });
3199
3157
  break;
3200
3158
  }
3201
3159
  case L.TAB:
3202
3160
  case L.ENTER: {
3203
- const _ = $[I];
3204
- p(_.name, _.functionType);
3161
+ const _ = $[R];
3162
+ m(_.name, _.functionType);
3205
3163
  break;
3206
3164
  }
3207
3165
  case L.ESC: {
3208
- h(), i();
3166
+ d(), i();
3209
3167
  break;
3210
3168
  }
3211
3169
  }
3212
3170
  };
3213
- return M.add(d.registerCommand({
3171
+ return M.add(h.registerCommand({
3214
3172
  id: N,
3215
- type: be.OPERATION,
3216
- handler(k, $) {
3217
- const { keyCode: I } = $;
3218
- w(I);
3173
+ type: ye.OPERATION,
3174
+ handler(F, $) {
3175
+ const { keyCode: R } = $;
3176
+ w(R);
3219
3177
  }
3220
- })), [L.ARROW_UP, L.ARROW_DOWN, L.ENTER, L.ESC, L.TAB].map((k) => ({
3178
+ })), [L.ARROW_UP, L.ARROW_DOWN, L.ENTER, L.ESC, L.TAB].map((F) => ({
3221
3179
  id: N,
3222
- binding: k,
3180
+ binding: F,
3223
3181
  preconditions: () => !0,
3224
3182
  priority: 1e3,
3225
3183
  staticParameters: {
3226
- eventType: xe.Keyboard,
3227
- keyCode: k
3184
+ eventType: Ae.Keyboard,
3185
+ keyCode: F
3228
3186
  }
3229
- })).forEach((k) => {
3230
- M.add(a.registerShortcut(k));
3187
+ })).forEach((F) => {
3188
+ M.add(a.registerShortcut(F));
3231
3189
  }), () => {
3232
3190
  M.dispose();
3233
3191
  };
3234
- }, [f]);
3235
- function F(N) {
3192
+ }, [g]);
3193
+ function A(N) {
3236
3194
  const M = S.current;
3237
3195
  if (!M) return;
3238
3196
  const w = M.children[N];
3239
3197
  if (!w) return;
3240
- const $ = M.getBoundingClientRect().top, I = M.offsetHeight, _ = w.getBoundingClientRect(), O = _.top, D = _.height;
3241
- if (O >= 0 && O > $ && O - $ + D <= I)
3198
+ const $ = M.getBoundingClientRect().top, R = M.offsetHeight, _ = w.getBoundingClientRect(), O = _.top, D = _.height;
3199
+ if (O >= 0 && O > $ && O - $ + D <= R)
3242
3200
  return;
3243
- const U = w.offsetTop - (I - D) / 2;
3201
+ const U = w.offsetTop - (R - D) / 2;
3244
3202
  M.scrollTo({
3245
3203
  top: U,
3246
3204
  behavior: "smooth"
3247
3205
  });
3248
3206
  }
3249
- const A = le(() => {
3207
+ const k = le(() => {
3250
3208
  let N = "";
3251
3209
  return () => {
3252
3210
  clearTimeout(N), C.current = !0, N = setTimeout(() => {
@@ -3254,30 +3212,30 @@ function Tc(e, t) {
3254
3212
  }, 300);
3255
3213
  };
3256
3214
  }, []);
3257
- return f.length > 0 && l && /* @__PURE__ */ x(ln, { portal: !0, anchorRect$: R, direction: "vertical", children: /* @__PURE__ */ x(
3215
+ return g.length > 0 && l && /* @__PURE__ */ x(on, { portal: !0, anchorRect$: I, direction: "vertical", children: /* @__PURE__ */ x(
3258
3216
  "ul",
3259
3217
  {
3260
3218
  ref: (N) => {
3261
3219
  S.current = N, t && (t.current = N);
3262
3220
  },
3263
3221
  "data-u-comp": "sheets-formula-editor",
3264
- 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", bn, ut),
3265
- children: f.map((N, M) => /* @__PURE__ */ B(
3222
+ className: ie("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, it),
3223
+ children: g.map((N, M) => /* @__PURE__ */ H(
3266
3224
  "li",
3267
3225
  {
3268
- 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", {
3226
+ className: ie("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
3227
  "univer-bg-gray-200 dark:!univer-bg-gray-600": v === M
3270
3228
  }),
3271
- onMouseEnter: () => b(M),
3229
+ onMouseEnter: () => y(M),
3272
3230
  onMouseLeave: T,
3273
- onMouseMove: A,
3231
+ onMouseMove: k,
3274
3232
  onClick: () => {
3275
- p(N.name, N.functionType), s && s.focus();
3233
+ m(N.name, N.functionType), s && s.focus();
3276
3234
  },
3277
3235
  children: [
3278
- /* @__PURE__ */ B("span", { className: "univer-block univer-truncate univer-text-xs", children: [
3279
- /* @__PURE__ */ x("span", { className: "univer-text-red-500", children: N.name.substring(0, m.length) }),
3280
- /* @__PURE__ */ x("span", { children: N.name.slice(m.length) })
3236
+ /* @__PURE__ */ H("span", { className: "univer-block univer-truncate univer-text-xs", children: [
3237
+ /* @__PURE__ */ x("span", { className: "univer-text-red-500", children: N.name.substring(0, p.length) }),
3238
+ /* @__PURE__ */ x("span", { children: N.name.slice(p.length) })
3281
3239
  ] }),
3282
3240
  /* @__PURE__ */ x(
3283
3241
  "span",
@@ -3293,9 +3251,9 @@ function Tc(e, t) {
3293
3251
  }
3294
3252
  ) });
3295
3253
  }
3296
- const Oc = (e) => e.startsWith(pr.EQUALS) ? e.slice(1) : "", or = () => {
3297
- }, Nc = Ve((e, t) => {
3298
- var wn, kn, An, Fn;
3254
+ const Nc = (e) => e.startsWith(dr.EQUALS) ? e.slice(1) : "", Qn = () => {
3255
+ }, Mc = We((e, t) => {
3256
+ var Nn, Mn, xn, wn;
3299
3257
  const {
3300
3258
  errorText: n,
3301
3259
  initValue: o,
@@ -3303,71 +3261,71 @@ const Oc = (e) => e.startsWith(pr.EQUALS) ? e.slice(1) : "", or = () => {
3303
3261
  subUnitId: s,
3304
3262
  isFocus: i = !0,
3305
3263
  isSupportAcrossSheet: c = !1,
3306
- onFocus: a = or,
3307
- onBlur: d = or,
3308
- onChange: f,
3309
- onVerify: m,
3264
+ onFocus: a = Qn,
3265
+ onBlur: h = Qn,
3266
+ onChange: g,
3267
+ onVerify: p,
3310
3268
  className: u,
3311
- editorId: h,
3269
+ editorId: d,
3312
3270
  moveCursor: l = !0,
3313
3271
  onFormulaSelectingChange: S,
3314
3272
  keyboardEventConfig: v,
3315
- onMoveInEditor: g,
3273
+ onMoveInEditor: f,
3316
3274
  resetSelectionOnBlur: C = !0,
3317
- autoScrollbar: R = !0,
3275
+ autoScrollbar: I = !0,
3318
3276
  isSingle: E = !0,
3319
- disableSelectionOnClick: p = !1,
3320
- autofocus: b = !0,
3277
+ disableSelectionOnClick: m = !1,
3278
+ autofocus: y = !0,
3321
3279
  disableContextMenu: T,
3322
- style: F
3323
- } = e, A = y(Ze), N = X(null), M = ee(f);
3324
- Os(t, () => ({
3280
+ style: A
3281
+ } = e, k = b(ze), N = X(null), M = ee(g);
3282
+ ys(t, () => ({
3325
3283
  isClickOutSide: (Z) => N.current ? !N.current.contains(Z.target) : !1
3326
3284
  }));
3327
- const w = ee(S), k = X(null), $ = X(void 0), I = $.current, [_, O] = H(i), D = X(null), U = le(() => h != null ? h : ao(`${ko}-${Yt(4)}`), []), Y = le(() => n !== void 0, [n]), re = y(ne), he = re.getUnit(U);
3328
- _e(he == null ? void 0 : he.change$);
3329
- const G = ac(), J = uo.transform.getPlainText((kn = (wn = he == null ? void 0 : he.getBody()) == null ? void 0 : wn.dataStream) != null ? kn : ""), ot = rt(J), st = le(() => Oc(J), [J]), Ot = le(() => G(st), [st, G]), { isSelecting: Oe, isSelectingRef: Nt } = lc({ unitId: r, subUnitId: s, editorId: U, isFocus: _, disableOnClick: p }), K = X(""), fe = y(Te).getRenderById(U), oe = fe == null ? void 0 : fe.with(_r), ae = oe == null ? void 0 : oe.isFocusing, ge = le(() => re.getCurrentTypeOfUnit$(W.UNIVER_DOC), [re]), Se = _e(ge), We = (Se == null ? void 0 : Se.getUnitId()) === U, He = X([]), z = Oe, we = (Fn = (An = y(Sn).getConfig(xr)) == null ? void 0 : An.functionScreenTips) != null ? Fn : !0;
3330
- bs(() => {
3285
+ const w = ee(S), F = X(null), $ = X(void 0), R = $.current, [_, O] = V(i), D = X(null), U = le(() => d != null ? d : ao(`${wo}-${hn(4)}`), []), Y = le(() => n !== void 0, [n]), oe = b(re), ge = oe.getUnit(U);
3286
+ Re(ge == null ? void 0 : ge.change$);
3287
+ const G = uc(), J = lo.transform.getPlainText((Mn = (Nn = ge == null ? void 0 : ge.getBody()) == null ? void 0 : Nn.dataStream) != null ? Mn : ""), Je = Qe(J), et = le(() => Nc(J), [J]), Nt = le(() => G(et), [et, G]), { isSelecting: Ne, isSelectingRef: Mt } = lc({ unitId: r, subUnitId: s, editorId: U, isFocus: _, disableOnClick: m }), K = X(""), me = b(Te).getRenderById(U), se = me == null ? void 0 : me.with(mr), ue = se == null ? void 0 : se.isFocusing, pe = le(() => oe.getCurrentTypeOfUnit$(B.UNIVER_DOC), [oe]), Ce = Re(pe), Ve = (Ce == null ? void 0 : Ce.getUnitId()) === U, He = X([]), z = Ne, De = (wn = (xn = b(gn).getConfig(xr)) == null ? void 0 : xn.functionScreenTips) != null ? wn : !0;
3288
+ Is(() => {
3331
3289
  M(J);
3332
3290
  }, [J, M]);
3333
- const it = jr("="), Be = dc(r, s), me = ee((Z, ce = !0, ke, Ne) => {
3291
+ const tt = jr("="), Be = hc(r, s), Se = ee((Z, ae = !0, Le, Me) => {
3334
3292
  if (!$.current) return;
3335
3293
  K.current = Z;
3336
- const xt = Z[0] === "=" ? Z.slice(1) : "", Ae = G(xt), Gr = Ae.reduce((qe, kt) => typeof kt == "object" ? `${qe}${kt.token}` : `${qe}${kt}`, ""), wt = it(
3294
+ const wt = Z[0] === "=" ? Z.slice(1) : "", $e = G(wt), Yr = $e.reduce((qe, kt) => typeof kt == "object" ? `${qe}${kt.token}` : `${qe}${kt}`, ""), Ft = tt(
3337
3295
  $.current,
3338
- Gr === xt ? Ae : [],
3339
- ce,
3340
- Ne
3296
+ Yr === wt ? $e : [],
3297
+ ae,
3298
+ Me
3341
3299
  );
3342
- if (He.current = wt, ke) {
3343
- const qe = Ne != null ? Ne : I == null ? void 0 : I.getSelectionRanges();
3300
+ if (He.current = Ft, Le) {
3301
+ const qe = Me != null ? Me : R == null ? void 0 : R.getSelectionRanges();
3344
3302
  if ((qe == null ? void 0 : qe.length) !== 1)
3345
3303
  return;
3346
- const zr = qe[0].startOffset - 1, Zr = Nn(Ae, zr, !1), Dn = Hr(Ae, Zr);
3347
- if (Dn >= 0) {
3348
- const Ln = wt.splice(Dn, 1)[0];
3349
- Ln && wt.push(Ln);
3304
+ const Gr = qe[0].startOffset - 1, zr = yn($e, Gr, !1), Fn = Hr($e, zr);
3305
+ if (Fn >= 0) {
3306
+ const kn = Ft.splice(Fn, 1)[0];
3307
+ kn && Ft.push(kn);
3350
3308
  }
3351
- Be(_ ? wt : [], $.current);
3309
+ Be(_ ? Ft : [], $.current);
3352
3310
  }
3353
3311
  });
3354
3312
  P(() => {
3355
- _ && me(J, !1, !0);
3313
+ _ && Se(J, !1, !0);
3356
3314
  }, [_]), P(() => {
3357
3315
  if (_) {
3358
3316
  if (K.current === J) return;
3359
- me(J, !1, !0);
3317
+ Se(J, !1, !0);
3360
3318
  }
3361
- }, [J]), Ic(_, m, J);
3362
- const ie = ic(I), gt = pc(_, r, s);
3319
+ }, [J]), Ec(_, p, J);
3320
+ const ce = cc(R), ft = Sc(_, r, s);
3363
3321
  P(() => {
3364
3322
  var Z;
3365
- w(Oe, (Z = oe == null ? void 0 : oe.isFocusing) != null ? Z : !0);
3366
- }, [w, Oe]), Xo(_, v, I), Pt(() => {
3323
+ w(Ne, (Z = se == null ? void 0 : se.isFocusing) != null ? Z : !0);
3324
+ }, [w, Ne]), Zo(_, v, R), Ut(() => {
3367
3325
  let Z;
3368
3326
  if (D.current) {
3369
- Z = A.register({
3370
- autofocus: b,
3327
+ Z = k.register({
3328
+ autofocus: y,
3371
3329
  editorUnitId: U,
3372
3330
  initialSnapshot: {
3373
3331
  id: U,
@@ -3382,63 +3340,63 @@ const Oc = (e) => e.startsWith(pr.EQUALS) ? e.slice(1) : "", or = () => {
3382
3340
  documentStyle: {}
3383
3341
  }
3384
3342
  }, D.current);
3385
- const ce = A.getEditor(U);
3386
- $.current = ce, me(o, !1, !0);
3343
+ const ae = k.getEditor(U);
3344
+ $.current = ae, Se(o, !1, !0);
3387
3345
  }
3388
3346
  return () => {
3389
3347
  Z == null || Z.dispose();
3390
3348
  };
3391
- }, []), Pt(() => {
3392
- i ? (O(i), ie()) : (C && (I == null || I.blur(), gt()), O(i));
3393
- }, [i, I, ie, gt, C]);
3394
- const { checkScrollBar: Jt } = Qo(I, E, R);
3395
- mc(_, !!(Oe && We), r, U, T), gc(!!(_ && ae && l), z, I, g);
3396
- const Mt = ee((Z, ce, ke) => {
3397
- if (!ae)
3349
+ }, []), Ut(() => {
3350
+ i ? (O(i), ce()) : (C && (R == null || R.blur(), ft()), O(i));
3351
+ }, [i, R, ce, ft, C]);
3352
+ const { checkScrollBar: Xt } = Xo(R, E, I);
3353
+ pc(_, !!(Ne && Ve), r, U, T), mc(!!(_ && ue && l), z, R, f);
3354
+ const xt = ee((Z, ae, Le) => {
3355
+ if (!ue)
3398
3356
  return;
3399
- const Ne = ce !== -1 ? [{ startOffset: ce + 1, endOffset: ce + 1, collapsed: !0 }] : void 0;
3400
- me(`=${Z}`, !0, ke, Ne), ke && (ie(), ce !== -1 && setTimeout(() => {
3401
- const xt = { startOffset: ce + 1, endOffset: ce + 1 }, Ae = I == null ? void 0 : I.render.with(Jo);
3402
- Ae == null || Ae.scrollToRange({ ...xt, collapsed: !0 });
3403
- }, 50), Jt());
3357
+ const Me = ae !== -1 ? [{ startOffset: ae + 1, endOffset: ae + 1, collapsed: !0 }] : void 0;
3358
+ Se(`=${Z}`, !0, Le, Me), Le && (ce(), ae !== -1 && setTimeout(() => {
3359
+ const wt = { startOffset: ae + 1, endOffset: ae + 1 }, $e = R == null ? void 0 : R.render.with(Qo);
3360
+ $e == null || $e.scrollToRange({ ...wt, collapsed: !0 });
3361
+ }, 50), Xt());
3404
3362
  });
3405
- _c(
3406
- _ && !!(Oe && We),
3363
+ Rc(
3364
+ _ && !!(Ne && Ve),
3407
3365
  _,
3408
- Nt,
3366
+ Mt,
3409
3367
  r,
3410
3368
  s,
3411
3369
  He,
3412
3370
  c,
3413
3371
  !!z,
3414
- I,
3415
- Mt
3416
- ), Rc(_ && !!(Oe && We), r, c, O, d, () => {
3417
- me(ot.current, !1, !0);
3372
+ R,
3373
+ xt
3374
+ ), Ic(_ && !!(Ne && Ve), r, c, O, h, () => {
3375
+ Se(Je.current, !1, !0);
3418
3376
  });
3419
- const Mn = (Z) => {
3377
+ const Tn = (Z) => {
3420
3378
  if (Z) {
3421
- const ce = I == null ? void 0 : I.getSelectionRanges();
3422
- if (ce && ce.length === 1) {
3423
- const ke = ce[0];
3424
- if (ke.collapsed) {
3425
- const Ne = Z.offset;
3379
+ const ae = R == null ? void 0 : R.getSelectionRanges();
3380
+ if (ae && ae.length === 1) {
3381
+ const Le = ae[0];
3382
+ if (Le.collapsed) {
3383
+ const Me = Z.offset;
3426
3384
  setTimeout(() => {
3427
- I == null || I.setSelectionRanges([{ startOffset: ke.startOffset - Ne, endOffset: ke.endOffset - Ne }]);
3385
+ R == null || R.setSelectionRanges([{ startOffset: Le.startOffset - Me, endOffset: Le.endOffset - Me }]);
3428
3386
  }, 30);
3429
3387
  }
3430
3388
  }
3431
- ie(), me(`=${Z.text}`);
3389
+ ce(), Se(`=${Z.text}`);
3432
3390
  }
3433
- }, xn = () => {
3434
- O(!0), a(), ie();
3391
+ }, On = () => {
3392
+ O(!0), a(), ce();
3435
3393
  };
3436
- return /* @__PURE__ */ B("div", { className: u, children: [
3394
+ return /* @__PURE__ */ H("div", { className: u, children: [
3437
3395
  /* @__PURE__ */ x(
3438
3396
  "div",
3439
3397
  {
3440
3398
  ref: N,
3441
- className: se("univer-relative univer-box-border univer-flex univer-size-full univer-items-center univer-justify-around univer-gap-2 univer-rounded-none univer-p-0 univer-ring-1", {
3399
+ className: ie("univer-relative univer-box-border univer-flex univer-size-full univer-items-center univer-justify-around univer-gap-2 univer-rounded-none univer-p-0 univer-ring-1", {
3442
3400
  "univer-ring-primary-500": _,
3443
3401
  "univer-ring-red-500": Y
3444
3402
  }),
@@ -3447,43 +3405,43 @@ const Oc = (e) => e.startsWith(pr.EQUALS) ? e.slice(1) : "", or = () => {
3447
3405
  {
3448
3406
  ref: D,
3449
3407
  className: "univer-relative univer-size-full",
3450
- onMouseUp: xn
3408
+ onMouseUp: On
3451
3409
  }
3452
3410
  )
3453
3411
  }
3454
3412
  ),
3455
3413
  n !== void 0 && /* @__PURE__ */ x("div", { className: "univer-my-1 univer-text-xs univer-text-red-500", children: n }),
3456
- we && I && st !== "" && /* @__PURE__ */ x(
3457
- sc,
3414
+ De && R && et !== "" && /* @__PURE__ */ x(
3415
+ ic,
3458
3416
  {
3459
- editor: I,
3417
+ editor: R,
3460
3418
  isFocus: _,
3461
3419
  formulaText: J,
3462
- onClose: () => ie()
3420
+ onClose: () => ce()
3463
3421
  }
3464
3422
  ),
3465
- we && !!I && /* @__PURE__ */ x(
3466
- yc,
3423
+ De && !!R && /* @__PURE__ */ x(
3424
+ Tc,
3467
3425
  {
3468
3426
  isFocus: _,
3469
- sequenceNodes: Ot,
3470
- onSelect: Mn,
3471
- ref: k,
3472
- editor: I
3427
+ sequenceNodes: Nt,
3428
+ onSelect: Tn,
3429
+ ref: F,
3430
+ editor: R
3473
3431
  }
3474
3432
  )
3475
3433
  ] });
3476
3434
  });
3477
- function Mc(e, t, n, o) {
3478
- const r = y(ye), s = jr(""), i = _e(e == null ? void 0 : e.getDocumentDataModel().change$), [c, a] = H([]), d = y(Ao), f = X(""), m = y(ne);
3435
+ function xc(e, t, n, o) {
3436
+ const r = b(ke), s = jr(""), i = Re(e == null ? void 0 : e.getDocumentDataModel().change$), [c, a] = V([]), h = b(Fo), g = X(""), p = b(re);
3479
3437
  return P(() => {
3480
3438
  if (!e) return;
3481
3439
  const u = e.getDocumentDataModel().getPlainText();
3482
- if (f.current === u)
3440
+ if (g.current === u)
3483
3441
  return;
3484
- f.current = u;
3485
- const h = r.sequenceNodesBuilder(u);
3486
- a(h != null ? h : []);
3442
+ g.current = u;
3443
+ const d = r.sequenceNodesBuilder(u);
3444
+ a(d != null ? d : []);
3487
3445
  }, [i, e, r]), P(() => {
3488
3446
  var l, S;
3489
3447
  if (!e) return;
@@ -3499,13 +3457,13 @@ function Mc(e, t, n, o) {
3499
3457
  });
3500
3458
  return;
3501
3459
  }
3502
- const u = s(e, c, !1), h = new Ye();
3460
+ const u = s(e, c, !1), d = new Ye();
3503
3461
  return u.forEach((v) => {
3504
- const g = ht(v.token), C = m.getCurrentUnitForType(W.UNIVER_SHEET), R = C == null ? void 0 : C.getActiveSheet();
3505
- if (!g.sheetName && o !== (R == null ? void 0 : R.getSheetId()) || g.sheetName && (R == null ? void 0 : R.getName()) !== g.sheetName)
3462
+ const f = ut(v.token), C = p.getCurrentUnitForType(B.UNIVER_SHEET), I = C == null ? void 0 : C.getActiveSheet();
3463
+ if (!f.sheetName && o !== (I == null ? void 0 : I.getSheetId()) || f.sheetName && (I == null ? void 0 : I.getName()) !== f.sheetName)
3506
3464
  return;
3507
- const E = new pn(v.themeColor).toRgb(), p = d.addShape({
3508
- range: g.range,
3465
+ const E = new fn(v.themeColor).toRgb(), m = h.addShape({
3466
+ range: f.range,
3509
3467
  style: {
3510
3468
  stroke: v.themeColor,
3511
3469
  fill: `rgba(${E.r}, ${E.g}, ${E.b}, 0.1)`,
@@ -3513,44 +3471,44 @@ function Mc(e, t, n, o) {
3513
3471
  },
3514
3472
  primary: null
3515
3473
  });
3516
- p && h.add(() => d.removeShape(p));
3474
+ m && d.add(() => h.removeShape(m));
3517
3475
  }), () => {
3518
- h.dispose();
3476
+ d.dispose();
3519
3477
  };
3520
- }, [e, t, s, d, c]), { sequenceNodes: c };
3478
+ }, [e, t, s, h, c]), { sequenceNodes: c };
3521
3479
  }
3522
- function xc(e) {
3523
- const t = y(_n), { supportAcrossSheet: n = !1, keepSheetReference: o = !1, unitId: r, subUnitId: s, onChange: i } = e, a = y(ne).getUnit(r, W.UNIVER_SHEET), d = ee(i), f = ee((m, u) => {
3524
- const h = a == null ? void 0 : a.getActiveSheet();
3525
- if (!h || !n && h.getSheetId() !== s || !(m != null && m.length)) return;
3526
- const l = o ? h.getName() : h.getSheetId() === s ? "" : h.getName(), S = m.map((v) => ({
3480
+ function wc(e) {
3481
+ const t = b(vn), { supportAcrossSheet: n = !1, keepSheetReference: o = !1, unitId: r, subUnitId: s, onChange: i } = e, a = b(re).getUnit(r, B.UNIVER_SHEET), h = ee(i), g = ee((p, u) => {
3482
+ const d = a == null ? void 0 : a.getActiveSheet();
3483
+ if (!d || !n && d.getSheetId() !== s || !(p != null && p.length)) return;
3484
+ const l = o ? d.getName() : d.getSheetId() === s ? "" : d.getName(), S = p.map((v) => ({
3527
3485
  range: v.range,
3528
3486
  unitId: r,
3529
3487
  sheetName: l
3530
3488
  }));
3531
- d(S, u);
3489
+ h(S, u);
3532
3490
  });
3533
3491
  P(() => {
3534
- const m = new Ye();
3535
- return m.add(t.selectionMoveStart$.subscribe((u) => {
3536
- f(u, !0);
3537
- })), m.add(t.selectionMoving$.subscribe((u) => {
3538
- f(u, !1);
3539
- })), m.add(t.selectionMoveEnd$.subscribe((u) => {
3540
- f(u, !1);
3492
+ const p = new Ye();
3493
+ return p.add(t.selectionMoveStart$.subscribe((u) => {
3494
+ g(u, !0);
3495
+ })), p.add(t.selectionMoving$.subscribe((u) => {
3496
+ g(u, !1);
3497
+ })), p.add(t.selectionMoveEnd$.subscribe((u) => {
3498
+ g(u, !1);
3541
3499
  })), () => {
3542
- m.dispose();
3500
+ p.dispose();
3543
3501
  };
3544
- }, [f, t.selectionMoveEnd$, t.selectionMoveStart$, t.selectionMoving$]);
3502
+ }, [g, t.selectionMoveEnd$, t.selectionMoveStart$, t.selectionMoving$]);
3545
3503
  }
3546
- const sr = (e) => !e.some((n) => {
3504
+ const Jn = (e) => !e.some((n) => {
3547
3505
  if (typeof n == "string") {
3548
3506
  if (n !== Ge.COMMA)
3549
3507
  return !0;
3550
3508
  } else if (n.nodeType !== Q.REFERENCE)
3551
3509
  return !0;
3552
3510
  return !1;
3553
- }), wc = (e) => {
3511
+ }), Fc = (e) => {
3554
3512
  if (e.endColumn < e.startColumn) {
3555
3513
  const t = e.endColumn;
3556
3514
  e.endColumn = e.startColumn, e.startColumn = t;
@@ -3571,113 +3529,113 @@ function kc(e) {
3571
3529
  supportAcrossSheet: i,
3572
3530
  keepSheetReference: c,
3573
3531
  onConfirm: a,
3574
- onClose: d,
3575
- onShowBySelection: f
3576
- } = e, m = y(dt), u = y(ye), [h, l] = H([]), [S, v] = H(0), g = X(null);
3532
+ onClose: h,
3533
+ onShowBySelection: g
3534
+ } = e, p = b(lt), u = b(ke), [d, l] = V([]), [S, v] = V(0), f = X(null);
3577
3535
  P(() => {
3578
3536
  if (t && n.length) {
3579
- const p = n.map((b) => b.sheetName ? _t(b.sheetName, b.range) : Ee(b.range));
3580
- l(p), v(p.length - 1);
3537
+ const m = n.map((y) => y.sheetName ? Ct(y.sheetName, y.range) : be(y.range));
3538
+ l(m), v(m.length - 1);
3581
3539
  } else
3582
3540
  l([""]), v(0);
3583
3541
  }, [t]);
3584
- const C = (p, b) => {
3585
- const T = [...h];
3586
- T[p] = b, l(T);
3587
- }, R = () => {
3588
- l([...h, ""]), v(h.length);
3589
- }, E = (p) => {
3590
- h.splice(p, 1), l([...h]);
3542
+ const C = (m, y) => {
3543
+ const T = [...d];
3544
+ T[m] = y, l(T);
3545
+ }, I = () => {
3546
+ l([...d, ""]), v(d.length);
3547
+ }, E = (m) => {
3548
+ d.splice(m, 1), l([...d]);
3591
3549
  };
3592
- return xc({
3550
+ return wc({
3593
3551
  unitId: o,
3594
3552
  subUnitId: r,
3595
3553
  supportAcrossSheet: i,
3596
3554
  keepSheetReference: c,
3597
- onChange: (p, b) => {
3598
- if (!t && f != null && f(p))
3555
+ onChange: (m, y) => {
3556
+ if (!t && g != null && g(m))
3599
3557
  return;
3600
- const T = new Set(h), F = p.map((M) => M.sheetName ? _t(M.sheetName, M.range) : Ee(M.range)), A = F.filter((M) => !T.has(M));
3601
- if (!A.length) return;
3602
- const N = [...h];
3603
- if (F.length > 1) {
3604
- b || N.splice(S, 1), N.push(...A);
3558
+ const T = new Set(d), A = m.map((M) => M.sheetName ? Ct(M.sheetName, M.range) : be(M.range)), k = A.filter((M) => !T.has(M));
3559
+ if (!k.length) return;
3560
+ const N = [...d];
3561
+ if (A.length > 1) {
3562
+ y || N.splice(S, 1), N.push(...k);
3605
3563
  const M = N.slice(0, s);
3606
3564
  l(M), v(M.length - 1), requestAnimationFrame(() => {
3607
3565
  var w;
3608
- (w = g.current) == null || w.scrollTo({ top: g.current.scrollHeight });
3566
+ (w = f.current) == null || w.scrollTo({ top: f.current.scrollHeight });
3609
3567
  });
3610
3568
  } else {
3611
- N.splice(S, 1, ...A);
3569
+ N.splice(S, 1, ...k);
3612
3570
  const M = N.slice(0, s);
3613
- l(M), v(S + A.length - 1);
3571
+ l(M), v(S + k.length - 1);
3614
3572
  }
3615
3573
  }
3616
3574
  }), /* @__PURE__ */ x(
3617
- ks,
3575
+ xs,
3618
3576
  {
3619
3577
  width: "328px",
3620
3578
  open: t,
3621
- title: m.t("rangeSelector.title"),
3579
+ title: p.t("rangeSelector.title"),
3622
3580
  draggable: !0,
3623
3581
  mask: !1,
3624
3582
  maskClosable: !1,
3625
- footer: /* @__PURE__ */ B("footer", { className: "univer-flex univer-gap-2", children: [
3626
- /* @__PURE__ */ x(at, { onClick: d, children: m.t("rangeSelector.cancel") }),
3583
+ footer: /* @__PURE__ */ H("footer", { className: "univer-flex univer-gap-2", children: [
3584
+ /* @__PURE__ */ x(ot, { onClick: h, children: p.t("rangeSelector.cancel") }),
3627
3585
  /* @__PURE__ */ x(
3628
- at,
3586
+ ot,
3629
3587
  {
3630
3588
  variant: "primary",
3631
3589
  onClick: () => {
3632
3590
  a(
3633
- h.filter((p) => {
3634
- const b = u.sequenceNodesBuilder(p);
3635
- return b && b.length === 1 && typeof b[0] != "string" && b[0].nodeType === Q.REFERENCE;
3636
- }).map((p) => ht(p)).map((p) => ({ ...p, range: wc(p.range) }))
3591
+ d.filter((m) => {
3592
+ const y = u.sequenceNodesBuilder(m);
3593
+ return y && y.length === 1 && typeof y[0] != "string" && y[0].nodeType === Q.REFERENCE;
3594
+ }).map((m) => ut(m)).map((m) => ({ ...m, range: Fc(m.range) }))
3637
3595
  );
3638
3596
  },
3639
- children: m.t("rangeSelector.confirm")
3597
+ children: p.t("rangeSelector.confirm")
3640
3598
  }
3641
3599
  )
3642
3600
  ] }),
3643
- onClose: d,
3644
- children: /* @__PURE__ */ B(
3601
+ onClose: h,
3602
+ children: /* @__PURE__ */ H(
3645
3603
  "div",
3646
3604
  {
3647
- ref: g,
3648
- className: se("-univer-mx-6 univer-max-h-60 univer-overflow-y-auto univer-px-6", ut),
3605
+ ref: f,
3606
+ className: ie("-univer-mx-6 univer-max-h-60 univer-overflow-y-auto univer-px-6", it),
3649
3607
  children: [
3650
- h.map((p, b) => /* @__PURE__ */ B(
3608
+ d.map((m, y) => /* @__PURE__ */ H(
3651
3609
  "div",
3652
3610
  {
3653
3611
  className: "univer-mb-2 univer-flex univer-items-center univer-gap-4",
3654
3612
  children: [
3655
3613
  /* @__PURE__ */ x(
3656
- yr,
3614
+ br,
3657
3615
  {
3658
- className: se("univer-w-full", {
3659
- "univer-border-primary-600": S === b
3616
+ className: ie("univer-w-full", {
3617
+ "univer-border-primary-600": S === y
3660
3618
  }),
3661
- placeholder: m.t("rangeSelector.placeHolder"),
3662
- onFocus: () => v(b),
3663
- value: p,
3664
- onChange: (T) => C(b, T)
3619
+ placeholder: p.t("rangeSelector.placeHolder"),
3620
+ onFocus: () => v(y),
3621
+ value: m,
3622
+ onChange: (T) => C(y, T)
3665
3623
  }
3666
3624
  ),
3667
- h.length > 1 && /* @__PURE__ */ x(
3625
+ d.length > 1 && /* @__PURE__ */ x(
3668
3626
  $r,
3669
3627
  {
3670
3628
  className: "univer-cursor-pointer",
3671
- onClick: () => E(b)
3629
+ onClick: () => E(y)
3672
3630
  }
3673
3631
  )
3674
3632
  ]
3675
3633
  },
3676
- b
3634
+ y
3677
3635
  )),
3678
- h.length < s && /* @__PURE__ */ x("div", { children: /* @__PURE__ */ B(at, { variant: "link", onClick: R, children: [
3636
+ d.length < s && /* @__PURE__ */ x("div", { children: /* @__PURE__ */ H(ot, { variant: "link", onClick: I, children: [
3679
3637
  /* @__PURE__ */ x(Pr, {}),
3680
- /* @__PURE__ */ x("span", { children: m.t("rangeSelector.addAnotherRange") })
3638
+ /* @__PURE__ */ x("span", { children: p.t("rangeSelector.addAnotherRange") })
3681
3639
  ] }) })
3682
3640
  ]
3683
3641
  }
@@ -3686,33 +3644,33 @@ function kc(e) {
3686
3644
  );
3687
3645
  }
3688
3646
  function Ac(e) {
3689
- return e.split(Ge.COMMA).filter((t) => !!t).map((t) => ht(t));
3647
+ return e.split(Ge.COMMA).filter((t) => !!t).map((t) => ut(t));
3690
3648
  }
3691
- function Fc(e) {
3692
- return e.map((t) => t.sheetName ? _t(t.sheetName, t.range) : Ee(t.range)).join(Ge.COMMA);
3649
+ function Dc(e) {
3650
+ return e.map((t) => t.sheetName ? Ct(t.sheetName, t.range) : be(t.range)).join(Ge.COMMA);
3693
3651
  }
3694
3652
  function Kr(e) {
3695
- const [t, n] = H(null), {
3653
+ const [t, n] = V(null), {
3696
3654
  onVerify: o,
3697
3655
  selectorRef: r,
3698
3656
  unitId: s,
3699
3657
  subUnitId: i,
3700
3658
  maxRangeCount: c,
3701
3659
  supportAcrossSheet: a,
3702
- keepSheetReference: d,
3703
- autoFocus: f,
3704
- onChange: m,
3660
+ keepSheetReference: h,
3661
+ autoFocus: g,
3662
+ onChange: p,
3705
3663
  onRangeSelectorDialogVisibleChange: u,
3706
- onClickOutside: h,
3664
+ onClickOutside: d,
3707
3665
  onFocusChange: l,
3708
3666
  forceShowDialogWhenSelectionChanged: S,
3709
3667
  hideEditor: v,
3710
- resetRange: g
3711
- } = e, [C, R] = H(f != null ? f : !1), [E, p] = H(!1), [b, T] = H([]), F = y(dt), A = y(Ze), { sequenceNodes: N } = Mc(t, C, s, i), M = rt(N), w = y(pe), k = ee(() => {
3712
- t == null || t.setSelectionRanges([]), t == null || t.blur(), A.blur();
3668
+ resetRange: f
3669
+ } = e, [C, I] = V(g != null ? g : !1), [E, m] = V(!1), [y, T] = V([]), A = b(lt), k = b(ze), { sequenceNodes: N } = xc(t, C, s, i), M = Qe(N), w = b(ve), F = ee(() => {
3670
+ t == null || t.setSelectionRanges([]), t == null || t.blur(), k.blur();
3713
3671
  }), $ = ee(() => {
3714
- var I;
3715
- k(), T(Ac((I = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? I : "")), p(!0);
3672
+ var R;
3673
+ F(), T(Ac((R = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? R : "")), m(!0);
3716
3674
  });
3717
3675
  return P(() => {
3718
3676
  r && (r.current = {
@@ -3720,51 +3678,51 @@ function Kr(e) {
3720
3678
  return t;
3721
3679
  },
3722
3680
  focus() {
3723
- A.focus(t.getEditorId());
3681
+ k.focus(t.getEditorId());
3724
3682
  },
3725
- blur: k,
3726
- verify: () => sr(M.current),
3727
- showDialog: (I) => {
3728
- k(), T(I), p(!0);
3683
+ blur: F,
3684
+ verify: () => Jn(M.current),
3685
+ showDialog: (R) => {
3686
+ F(), T(R), m(!0);
3729
3687
  },
3730
3688
  hideDialog: () => {
3731
- T([]), p(!1);
3689
+ T([]), m(!1);
3732
3690
  },
3733
3691
  getValue: () => {
3734
- var I;
3735
- return (I = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? I : "";
3692
+ var R;
3693
+ return (R = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? R : "";
3736
3694
  }
3737
3695
  });
3738
- }, [k, t, A, r, M]), P(() => {
3739
- var I;
3740
- o == null || o(sr(N), (I = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? I : "");
3696
+ }, [F, t, k, r, M]), P(() => {
3697
+ var R;
3698
+ o == null || o(Jn(N), (R = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? R : "");
3741
3699
  }, [N]), P(() => {
3742
3700
  u == null || u(E);
3743
3701
  }, [E]), P(() => {
3744
- if (E && g)
3702
+ if (E && f)
3745
3703
  return () => {
3746
- const I = {
3704
+ const R = {
3747
3705
  unitId: s,
3748
3706
  subUnitId: i,
3749
- selections: g
3707
+ selections: f
3750
3708
  };
3751
- w.executeCommand(Rn.id, I);
3709
+ w.executeCommand(Cn.id, R);
3752
3710
  };
3753
- }, [E]), /* @__PURE__ */ B(Ts, { children: [
3711
+ }, [E]), /* @__PURE__ */ H(bs, { children: [
3754
3712
  v ? null : /* @__PURE__ */ x(
3755
- es,
3713
+ Jo,
3756
3714
  {
3757
3715
  isSingle: !0,
3758
3716
  ...e,
3759
- onFocusChange: (I, _) => {
3760
- R(I), l == null || l(I, _);
3717
+ onFocusChange: (R, _) => {
3718
+ I(R), l == null || l(R, _);
3761
3719
  },
3762
3720
  editorRef: n,
3763
3721
  onClickOutside: () => {
3764
- R(!1), k(), h == null || h();
3722
+ I(!1), F(), d == null || d();
3765
3723
  },
3766
- icon: /* @__PURE__ */ x(ws, { title: F.t("rangeSelector.buttonTooltip"), placement: "bottom", children: /* @__PURE__ */ x(
3767
- Vr,
3724
+ icon: /* @__PURE__ */ x(Ms, { title: A.t("rangeSelector.buttonTooltip"), placement: "bottom", children: /* @__PURE__ */ x(
3725
+ Wr,
3768
3726
  {
3769
3727
  className: "univer-cursor-pointer dark:!univer-text-gray-300",
3770
3728
  onClick: $
@@ -3775,30 +3733,30 @@ function Kr(e) {
3775
3733
  /* @__PURE__ */ x(
3776
3734
  kc,
3777
3735
  {
3778
- initialValue: b,
3736
+ initialValue: y,
3779
3737
  unitId: s,
3780
3738
  subUnitId: i,
3781
3739
  visible: E,
3782
3740
  maxRangeCount: c,
3783
- onConfirm: (I) => {
3784
- const _ = Fc(I), O = ho.newEmptyData();
3785
- O.body.dataStream = _, t == null || t.replaceText(_, !1), m == null || m(O, _), p(!1), T([]), requestAnimationFrame(() => {
3786
- k();
3741
+ onConfirm: (R) => {
3742
+ const _ = Dc(R), O = uo.newEmptyData();
3743
+ O.body.dataStream = _, t == null || t.replaceText(_, !1), p == null || p(O, _), m(!1), T([]), requestAnimationFrame(() => {
3744
+ F();
3787
3745
  });
3788
3746
  },
3789
3747
  onClose: () => {
3790
- p(!1), T([]);
3748
+ m(!1), T([]);
3791
3749
  },
3792
3750
  supportAcrossSheet: a,
3793
- keepSheetReference: d,
3794
- onShowBySelection: (I) => C || S ? (T(I), p(!0), !1) : !0
3751
+ keepSheetReference: h,
3752
+ onShowBySelection: (R) => C || S ? (T(R), m(!0), !1) : !0
3795
3753
  }
3796
3754
  )
3797
3755
  ] });
3798
3756
  }
3799
- const Dc = () => {
3757
+ const Lc = () => {
3800
3758
  var o, r;
3801
- const e = y(Wr), t = _e(e.currentSelector$), n = X(null);
3759
+ const e = b(Vr), t = Re(e.currentSelector$), n = X(null);
3802
3760
  return P(() => {
3803
3761
  var s, i;
3804
3762
  if (t)
@@ -3815,89 +3773,90 @@ const Dc = () => {
3815
3773
  selectorRef: n,
3816
3774
  onChange: (s, i) => {
3817
3775
  var c;
3818
- t == null || t.callback((c = i == null ? void 0 : i.split(",").map((a) => ht(a))) != null ? c : []);
3776
+ t == null || t.callback((c = i == null ? void 0 : i.split(",").map((a) => ut(a))) != null ? c : []);
3819
3777
  }
3820
3778
  }
3821
3779
  );
3822
3780
  };
3823
- var Lc = Object.defineProperty, $c = Object.getOwnPropertyDescriptor, Pc = (e, t, n) => t in e ? Lc(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Uc = (e, t, n, o) => {
3824
- for (var r = o > 1 ? void 0 : o ? $c(t, n) : t, s = e.length - 1, i; s >= 0; s--)
3781
+ var $c = Object.defineProperty, Pc = Object.getOwnPropertyDescriptor, Uc = (e, t, n) => t in e ? $c(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Wc = (e, t, n, o) => {
3782
+ for (var r = o > 1 ? void 0 : o ? Pc(t, n) : t, s = e.length - 1, i; s >= 0; s--)
3825
3783
  (i = e[s]) && (r = i(r) || r);
3826
3784
  return r;
3827
- }, Dt = (e, t) => (n, o) => t(n, o, e), Yr = (e, t, n) => Pc(e, typeof t != "symbol" ? t + "" : t, n);
3828
- let Kt = class extends go {
3829
- constructor(e = er, t, n, o, r) {
3785
+ }, Lt = (e, t) => (n, o) => t(n, o, e), Zt = (e, t, n) => Uc(e, typeof t != "symbol" ? t + "" : t, n);
3786
+ let ct = class extends fo {
3787
+ constructor(e = zn, t, n, o, r) {
3830
3788
  super(), this._config = e, this._injector = t, this._renderManagerService = n, this._configService = o, this._uiPartsService = r;
3831
- const { menu: s, ...i } = mo(
3832
- er,
3789
+ const { menu: s, ...i } = go(
3790
+ zn,
3833
3791
  this._config
3834
3792
  );
3835
3793
  s && this._configService.setConfig("menu", s, { merge: !0 }), this._configService.setConfig(xr, i, { merge: !0 });
3836
3794
  }
3837
3795
  onStarting() {
3838
- po(this._injector, [
3839
- [Xt, { useClass: an }],
3840
- [Wr],
3796
+ mo(this._injector, [
3797
+ [Gt, { useClass: sn }],
3798
+ [Vr],
3841
3799
  [qt],
3842
3800
  [Vt],
3843
- [Wt],
3844
3801
  [Ht],
3845
3802
  [Bt],
3846
- [Ut],
3803
+ [Wt],
3847
3804
  [jt]
3848
3805
  ]), this._initUIPart();
3849
3806
  }
3850
3807
  onReady() {
3851
3808
  [
3852
- [Le]
3809
+ [Ue]
3853
3810
  ].forEach((e) => {
3854
- this.disposeWithMe(this._renderManagerService.registerRenderModule(W.UNIVER_SHEET, e));
3811
+ this.disposeWithMe(this._renderManagerService.registerRenderModule(B.UNIVER_SHEET, e));
3855
3812
  });
3856
3813
  }
3857
3814
  onRendered() {
3858
3815
  [
3859
- [un]
3816
+ [cn]
3860
3817
  ].forEach((e) => {
3861
- this.disposeWithMe(this._renderManagerService.registerRenderModule(W.UNIVER_SHEET, e));
3862
- }), So(this._injector, [
3818
+ this.disposeWithMe(this._renderManagerService.registerRenderModule(B.UNIVER_SHEET, e));
3819
+ }), po(this._injector, [
3863
3820
  [qt],
3864
3821
  // FormulaProgressBar relies on TriggerCalculationController, but it is necessary to ensure that the formula calculation is done after rendered.
3865
- [Wt],
3822
+ [Vt],
3866
3823
  [Bt],
3867
3824
  [jt]
3868
3825
  ]);
3869
3826
  }
3870
3827
  onSteady() {
3871
- this._injector.get(Vt), this._injector.get(Ut);
3828
+ this._injector.get(Wt);
3872
3829
  }
3873
3830
  _initUIPart() {
3874
- const e = this._injector.get(Er);
3875
- this.disposeWithMe(e.register(Fo, Kr)), this.disposeWithMe(e.register(Do, Nc)), this.disposeWithMe(this._uiPartsService.registerComponent(ys.GLOBAL, () => br(Dc, this._injector)));
3831
+ const e = this._injector.get(Ir);
3832
+ this.disposeWithMe(e.register(ko, Kr)), this.disposeWithMe(e.register(Ao, Mc)), this.disposeWithMe(this._uiPartsService.registerComponent(Es.GLOBAL, () => Er(Lc, this._injector)));
3876
3833
  }
3877
3834
  };
3878
- Yr(Kt, "pluginName", Or);
3879
- Yr(Kt, "type", W.UNIVER_SHEET);
3880
- Kt = Uc([
3881
- fo(Cs),
3882
- Dt(1, q(It)),
3883
- Dt(2, Te),
3884
- Dt(3, Sn),
3885
- Dt(4, Ir)
3886
- ], Kt);
3835
+ Zt(ct, "pluginName", Tr);
3836
+ Zt(ct, "packageName", Mr.name);
3837
+ Zt(ct, "version", Mr.version);
3838
+ Zt(ct, "type", B.UNIVER_SHEET);
3839
+ ct = Wc([
3840
+ ho(ps),
3841
+ Lt(1, q(Rt)),
3842
+ Lt(2, Te),
3843
+ Lt(3, gn),
3844
+ Lt(4, Rr)
3845
+ ], ct);
3887
3846
  export {
3888
- $s as FORMULA_PROMPT_ACTIVATED,
3889
- Nc as FormulaEditor,
3890
- Ut as FormulaReorderController,
3891
- Wr as GlobalRangeSelectorService,
3892
- Ps as HelpFunctionOperation,
3893
- ve as InsertFunctionOperation,
3894
- On as MoreFunctionsOperation,
3847
+ Ds as FORMULA_PROMPT_ACTIVATED,
3848
+ Mc as FormulaEditor,
3849
+ Wt as FormulaReorderController,
3850
+ Vr as GlobalRangeSelectorService,
3851
+ Ls as HelpFunctionOperation,
3852
+ ne as InsertFunctionOperation,
3853
+ he as MoreFunctionsOperation,
3895
3854
  Kr as RangeSelector,
3896
- Le as RefSelectionsRenderService,
3897
- Mr as ReferenceAbsoluteOperation,
3898
- js as SearchFunctionOperation,
3899
- ft as SelectEditorFormulaOperation,
3900
- yn as SheetCopyFormulaOnlyCommand,
3901
- Tn as SheetOnlyPasteFormulaCommand,
3902
- Kt as UniverSheetsFormulaUIPlugin
3855
+ Ue as RefSelectionsRenderService,
3856
+ Nr as ReferenceAbsoluteOperation,
3857
+ Bs as SearchFunctionOperation,
3858
+ ht as SelectEditorFormulaOperation,
3859
+ En as SheetCopyFormulaOnlyCommand,
3860
+ bn as SheetOnlyPasteFormulaCommand,
3861
+ ct as UniverSheetsFormulaUIPlugin
3903
3862
  };