@univerjs/sheets-formula 0.12.4 → 0.13.0-insiders.20251216-1519cb7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1,12 +1,12 @@
1
- var en = Object.defineProperty;
2
- var tn = (n, e, a) => e in n ? en(n, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : n[e] = a;
3
- var w = (n, e, a) => tn(n, typeof e != "symbol" ? e + "" : e, a);
4
- import { CommandType as Yt, ICommandService as re, ObjectMatrix as v, generateRandomId as Xt, IUniverInstanceService as Ee, Rectangle as fe, sequenceExecuteAsync as an, Inject as H, Disposable as z, CellValueType as gt, createDocumentModelWithStyle as nn, WrapTextType as rn, PositionedObjectLayoutType as on, BooleanNumber as un, ObjectRelativeFromV as mn, ObjectRelativeFromH as fn, ImageSourceType as cn, DrawingTypeEnum as ln, BuildTextUtils as sn, InterceptorEffectEnum as ht, LifecycleService as dn, ILogService as pn, IConfigService as be, LocaleService as Wt, isFormulaString as ye, isFormulaId as Ia, cellToRange as Na, Tools as Ke, Direction as Qe, getIntersectRange as ke, RANGE_TYPE as W, UniverInstanceType as j, Injector as st, isRealNum as Ln, createIdentifier as Kt, toDisposable as ee, moveRangeByOffset as qt, DisposableCollection as $e, AbsoluteRefType as je, Optional as Pn, DependentOn as Ra, Plugin as Sa, merge as Aa, touchDependencies as ve, isNodeEnv as jt } from "@univerjs/core";
5
- import { SetRangeValuesCommand as Ca, SheetsSelectionsService as Tn, getSheetCommandTarget as En, findFirstNonEmptyCell as In, alignToMergedCellsBorders as Rt, expandToContinuousRange as Nn, SetSelectionsOperation as Rn, SheetInterceptorService as dt, INTERCEPTOR_POINT as Da, InterceptCellContentPriority as Sn, SetRangeValuesMutation as Q, SetStyleCommand as kt, SetBorderCommand as ba, ClearSelectionFormatCommand as Oa, handleMoveCols as Ma, EffectRefRangId as Y, runRefRangeMutations as X, handleMoveRows as xa, handleMoveRange as _a, handleInsertRangeMoveRight as ya, handleInsertRangeMoveDown as ga, handleDeleteRangeMoveUp as ha, handleDeleteRangeMoveLeft as qa, handleIRemoveCol as Ua, handleIRemoveRow as Fa, handleInsertCol as Ba, handleInsertRow as va, RemoveDefinedNameCommand as Va, SetDefinedNameCommand as Ga, RemoveSheetCommand as An, SetWorksheetNameCommand as Cn, DeleteRangeMoveLeftCommand as Dn, DeleteRangeMoveUpCommand as bn, RemoveColCommand as On, RemoveRowCommand as Mn, InsertRangeMoveDownCommand as xn, InsertRangeMoveRightCommand as _n, InsertColCommand as yn, InsertRowCommand as gn, MoveColsCommand as hn, MoveRowsCommand as qn, MoveRangeCommand as Un, RemoveSheetMutation as Ut, InsertSheetMutation as Ft, MoveRangeMutation as zt, MoveRowsMutation as Zt, MoveColsMutation as Jt, ReorderRangeMutation as ea, RemoveRowMutation as ta, RemoveColMutation as aa, InsertColMutation as na, InsertRowMutation as ia, SetRowHiddenMutation as ra, SetRowVisibleMutation as oa, SetWorksheetActiveOperation as Ha, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as St, RefRangeService as Fn, handleDefaultRangeChangeWithEffectRefCommands as ua, getSeparateEffectedRangesOnCommand as Bn, handleCommonDefaultRangeChangeWithEffectRefCommands as vn, UniverSheetsPlugin as Vn } from "@univerjs/sheets";
6
- import { serializeRange as Ce, FormulaDataModel as qe, ErrorType as k, SetImageFormulaDataMutation as Gn, IActiveDirtyManagerService as Qt, SetFormulaCalculationResultMutation as wa, RemoveOtherFormulaMutation as Hn, SetOtherFormulaMutation as wn, SetFormulaCalculationStartMutation as Ne, SetFormulaCalculationStopMutation as ma, ENGINE_FORMULA_CYCLE_REFERENCE_COUNT as fa, SetFormulaCalculationNotificationMutation as Yn, FormulaExecuteStageType as Ve, FormulaExecutedStateType as Me, sequenceNodeType as ie, deserializeRangeWithSheetWithCache as Pe, serializeRangeToRefString as pt, IDefinedNamesService as Lt, LexerTreeBuilder as Pt, generateStringWithSequence as ze, SetDefinedNameMutation as De, SetFormulaDataMutation as Ge, SetArrayFormulaDataMutation as Bt, initSheetFormulaData as ca, RemoveDefinedNameMutation as vt, IFunctionService as Tt, stripErrorMargin as Xn, FunctionType as t, FUNCTION_NAMES_ARRAY as la, FUNCTION_NAMES_COMPATIBILITY as _, FUNCTION_NAMES_CUBE as de, FUNCTION_NAMES_DATABASE as $, FUNCTION_NAMES_DATE as V, FUNCTION_NAMES_ENGINEERING as C, FUNCTION_NAMES_FINANCIAL as D, FUNCTION_NAMES_INFORMATION as G, FUNCTION_NAMES_LOGICAL as K, FUNCTION_NAMES_LOOKUP as g, FUNCTION_NAMES_MATH as E, FUNCTION_NAMES_STATISTICAL as s, FUNCTION_NAMES_TEXT as b, FUNCTION_NAMES_WEB as At, isReferenceStrings as Wn, functionArray as Kn, functionCompatibility as kn, functionCube as Qn, functionDatabase as $n, functionDate as jn, functionEngineering as zn, functionFinancial as Zn, functionInformation as Jn, functionLogical as ei, functionLookup as ti, functionMath as ai, functionMeta as ni, functionStatistical as ii, functionText as ri, functionUniver as oi, functionWeb as ui, SetSuperTableMutation as mi, RemoveSuperTableMutation as fi, serializeRangeWithSheet as Ze, ISuperTableService as ci, serializeRangeWithSpreadsheet as sa, CustomFunction as Vt, AsyncCustomFunction as Ya, UniverFormulaEnginePlugin as Xa, IFormulaCurrentConfigService as li, Lexer as si, AstTreeBuilder as di, Interpreter as pi, generateExecuteAstNodeData as Li, getObjectValue as Pi } from "@univerjs/engine-formula";
7
- import { Subject as da, BehaviorSubject as Wa, bufferWhen as Ti, filter as pa, map as Ei } from "rxjs";
8
- import { IRPCChannelService as Ka, fromModule as Ii, toModule as Ni } from "@univerjs/rpc";
9
- const Ri = {
1
+ var Ja = Object.defineProperty;
2
+ var en = (n, e, a) => e in n ? Ja(n, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : n[e] = a;
3
+ var w = (n, e, a) => en(n, typeof e != "symbol" ? e + "" : e, a);
4
+ import { CommandType as Yt, ICommandService as re, ObjectMatrix as v, generateRandomId as Xt, IUniverInstanceService as Ie, Rectangle as fe, sequenceExecuteAsync as tn, Inject as H, Disposable as z, CellValueType as gt, createDocumentModelWithStyle as an, WrapTextType as nn, PositionedObjectLayoutType as rn, BooleanNumber as on, ObjectRelativeFromV as un, ObjectRelativeFromH as mn, ImageSourceType as fn, DrawingTypeEnum as cn, BuildTextUtils as ln, InterceptorEffectEnum as ht, LifecycleService as sn, ILogService as dn, IConfigService as be, LocaleService as Wt, isFormulaString as ye, isFormulaId as Ea, cellToRange as Ia, Tools as Ke, Direction as Qe, getIntersectRange as ke, RANGE_TYPE as W, UniverInstanceType as j, Injector as st, isRealNum as pn, createIdentifier as Kt, toDisposable as ee, moveRangeByOffset as qt, DisposableCollection as $e, AbsoluteRefType as je, Optional as Ln, DependentOn as Na, Plugin as Ra, merge as Sa, touchDependencies as ve, isNodeEnv as jt } from "@univerjs/core";
5
+ import { SetRangeValuesCommand as Aa, SheetsSelectionsService as Pn, getSheetCommandTarget as Tn, findFirstNonEmptyCell as En, alignToMergedCellsBorders as Rt, expandToContinuousRange as In, SetSelectionsOperation as Nn, SheetInterceptorService as dt, INTERCEPTOR_POINT as Ca, InterceptCellContentPriority as Rn, SetRangeValuesMutation as Q, SetStyleCommand as kt, SetBorderCommand as Da, ClearSelectionFormatCommand as ba, handleMoveCols as Oa, EffectRefRangId as Y, runRefRangeMutations as X, handleMoveRows as Ma, handleMoveRange as xa, handleInsertRangeMoveRight as _a, handleInsertRangeMoveDown as ya, handleDeleteRangeMoveUp as ga, handleDeleteRangeMoveLeft as ha, handleIRemoveCol as qa, handleIRemoveRow as Ua, handleInsertCol as Fa, handleInsertRow as Ba, RemoveDefinedNameCommand as va, SetDefinedNameCommand as Va, RemoveSheetCommand as Sn, SetWorksheetNameCommand as An, DeleteRangeMoveLeftCommand as Cn, DeleteRangeMoveUpCommand as Dn, RemoveColCommand as bn, RemoveRowCommand as On, InsertRangeMoveDownCommand as Mn, InsertRangeMoveRightCommand as xn, InsertColCommand as _n, InsertRowCommand as yn, MoveColsCommand as gn, MoveRowsCommand as hn, MoveRangeCommand as qn, RemoveSheetMutation as Ut, InsertSheetMutation as Ft, MoveRangeMutation as zt, MoveRowsMutation as Zt, MoveColsMutation as Jt, ReorderRangeMutation as ea, RemoveRowMutation as ta, RemoveColMutation as aa, InsertColMutation as na, InsertRowMutation as ia, SetRowHiddenMutation as ra, SetRowVisibleMutation as oa, SetWorksheetActiveOperation as Ga, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as St, RefRangeService as Un, handleDefaultRangeChangeWithEffectRefCommands as ua, getSeparateEffectedRangesOnCommand as Fn, handleCommonDefaultRangeChangeWithEffectRefCommands as Bn, UniverSheetsPlugin as vn } from "@univerjs/sheets";
6
+ import { serializeRange as Ce, FormulaDataModel as qe, ErrorType as k, SetImageFormulaDataMutation as Vn, IActiveDirtyManagerService as Qt, SetFormulaCalculationResultMutation as Ha, RemoveOtherFormulaMutation as Gn, SetOtherFormulaMutation as Hn, SetFormulaCalculationStartMutation as Pe, SetFormulaStringBatchCalculationMutation as wn, ENGINE_FORMULA_RETURN_DEPENDENCY_TREE as Yn, ENGINE_FORMULA_CYCLE_REFERENCE_COUNT as Xn, SetFormulaCalculationStopMutation as ma, SetFormulaCalculationNotificationMutation as Wn, FormulaExecuteStageType as Ve, FormulaExecutedStateType as Me, sequenceNodeType as ie, deserializeRangeWithSheetWithCache as Te, serializeRangeToRefString as pt, IDefinedNamesService as Lt, LexerTreeBuilder as Pt, generateStringWithSequence as ze, SetDefinedNameMutation as De, SetFormulaDataMutation as Ge, SetArrayFormulaDataMutation as Bt, initSheetFormulaData as fa, RemoveDefinedNameMutation as vt, IFunctionService as Tt, stripErrorMargin as Kn, FunctionType as t, FUNCTION_NAMES_ARRAY as ca, FUNCTION_NAMES_COMPATIBILITY as _, FUNCTION_NAMES_CUBE as de, FUNCTION_NAMES_DATABASE as $, FUNCTION_NAMES_DATE as V, FUNCTION_NAMES_ENGINEERING as C, FUNCTION_NAMES_FINANCIAL as D, FUNCTION_NAMES_INFORMATION as G, FUNCTION_NAMES_LOGICAL as K, FUNCTION_NAMES_LOOKUP as g, FUNCTION_NAMES_MATH as E, FUNCTION_NAMES_STATISTICAL as s, FUNCTION_NAMES_TEXT as b, FUNCTION_NAMES_WEB as At, isReferenceStrings as kn, functionArray as Qn, functionCompatibility as $n, functionCube as jn, functionDatabase as zn, functionDate as Zn, functionEngineering as Jn, functionFinancial as ei, functionInformation as ti, functionLogical as ai, functionLookup as ni, functionMath as ii, functionMeta as ri, functionStatistical as oi, functionText as ui, functionUniver as mi, functionWeb as fi, SetSuperTableMutation as ci, RemoveSuperTableMutation as li, serializeRangeWithSheet as Ze, ISuperTableService as si, serializeRangeWithSpreadsheet as la, CustomFunction as Vt, AsyncCustomFunction as wa, UniverFormulaEnginePlugin as Ya, IFormulaCurrentConfigService as di, Lexer as pi, AstTreeBuilder as Li, Interpreter as Pi, generateExecuteAstNodeData as Ti, getObjectValue as Ei } from "@univerjs/engine-formula";
7
+ import { Subject as sa, BehaviorSubject as Xa, bufferWhen as Ii, filter as da, map as Ni } from "rxjs";
8
+ import { IRPCChannelService as Wa, fromModule as Ri, toModule as Si } from "@univerjs/rpc";
9
+ const Ai = {
10
10
  id: "formula.command.insert-function",
11
11
  type: Yt.COMMAND,
12
12
  handler: async (n, e) => {
@@ -32,21 +32,21 @@ const Ri = {
32
32
  const u = {
33
33
  value: o.getData()
34
34
  };
35
- return r.executeCommand(Ca.id, u);
35
+ return r.executeCommand(Aa.id, u);
36
36
  }
37
- }, Si = {
37
+ }, Ci = {
38
38
  id: "sheets-formula.command.quick-sum",
39
39
  type: Yt.COMMAND,
40
40
  handler: async (n) => {
41
- const a = n.get(Tn).getCurrentLastSelection();
41
+ const a = n.get(Pn).getCurrentLastSelection();
42
42
  if (!a) return !1;
43
- const i = n.get(Ee), r = En(i);
43
+ const i = n.get(Ie), r = Tn(i);
44
44
  if (!r) return !1;
45
45
  const o = a.range, { worksheet: u } = r;
46
- let f = In(o, u);
46
+ let f = En(o, u);
47
47
  if (!f) return !1;
48
48
  f = Rt(f, u);
49
- const m = Nn({
49
+ const m = In({
50
50
  startRow: f.startRow,
51
51
  startColumn: f.startColumn,
52
52
  endRow: o.endRow,
@@ -84,16 +84,16 @@ const Ri = {
84
84
  })})`
85
85
  });
86
86
  const T = n.get(re);
87
- return (await an([
87
+ return (await tn([
88
88
  {
89
- id: Ca.id,
89
+ id: Aa.id,
90
90
  params: {
91
91
  range: m,
92
92
  value: c.getMatrix()
93
93
  }
94
94
  },
95
95
  {
96
- id: Rn.id,
96
+ id: Nn.id,
97
97
  params: {
98
98
  unitId: r.unitId,
99
99
  subUnitId: r.subUnitId,
@@ -113,10 +113,10 @@ const Ri = {
113
113
  return !0;
114
114
  }
115
115
  }, Ue = "sheets-formula.base.config";
116
- var Te = /* @__PURE__ */ ((n) => (n[n.FORCED = 0] = "FORCED", n[n.WHEN_EMPTY = 1] = "WHEN_EMPTY", n[n.NO_CALCULATION = 2] = "NO_CALCULATION", n))(Te || {});
117
- const La = {}, Ai = "sheets-formula.remote.config", Pa = {};
118
- var Ci = Object.getOwnPropertyDescriptor, Di = (n, e, a, i) => {
119
- for (var r = i > 1 ? void 0 : i ? Ci(e, a) : e, o = n.length - 1, u; o >= 0; o--)
116
+ var Ee = /* @__PURE__ */ ((n) => (n[n.FORCED = 0] = "FORCED", n[n.WHEN_EMPTY = 1] = "WHEN_EMPTY", n[n.NO_CALCULATION = 2] = "NO_CALCULATION", n))(Ee || {});
117
+ const pa = {}, Di = "sheets-formula.remote.config", La = {};
118
+ var bi = Object.getOwnPropertyDescriptor, Oi = (n, e, a, i) => {
119
+ for (var r = i > 1 ? void 0 : i ? bi(e, a) : e, o = n.length - 1, u; o >= 0; o--)
120
120
  (u = n[o]) && (r = u(r) || r);
121
121
  return r;
122
122
  }, Ct = (n, e) => (a, i) => e(a, i, n);
@@ -136,7 +136,7 @@ let Je = class extends z {
136
136
  _commandExecutedListener() {
137
137
  this.disposeWithMe(
138
138
  this._commandService.onCommandExecuted(async (e) => {
139
- if (e.id === Gn.id) {
139
+ if (e.id === Vn.id) {
140
140
  const a = e.params;
141
141
  if (!a) return;
142
142
  const { imageFormulaData: i } = a;
@@ -155,8 +155,8 @@ let Je = class extends z {
155
155
  // eslint-disable-next-line max-lines-per-function
156
156
  _initInterceptorCellContent() {
157
157
  this.disposeWithMe(
158
- this._sheetInterceptorService.intercept(Da.CELL_CONTENT, {
159
- priority: Sn.CELL_IMAGE,
158
+ this._sheetInterceptorService.intercept(Ca.CELL_CONTENT, {
159
+ priority: Rn.CELL_IMAGE,
160
160
  effect: ht.Value | ht.Style,
161
161
  // eslint-disable-next-line max-lines-per-function
162
162
  handler: (e, a, i) => {
@@ -176,12 +176,12 @@ let Je = class extends z {
176
176
  } = c;
177
177
  if (L)
178
178
  return i(this._errorValueCell);
179
- const N = T || I, d = p || A, S = nn("", {}), R = {
179
+ const N = T || I, d = p || A, S = an("", {}), R = {
180
180
  unitId: r,
181
181
  subUnitId: o,
182
182
  drawingId: Xt(),
183
- drawingType: ln.DRAWING_IMAGE,
184
- imageSourceType: cn.URL,
183
+ drawingType: cn.DRAWING_IMAGE,
184
+ imageSourceType: fn.URL,
185
185
  source: l,
186
186
  transform: {
187
187
  left: 0,
@@ -195,26 +195,26 @@ let Je = class extends z {
195
195
  height: d
196
196
  },
197
197
  positionH: {
198
- relativeFrom: fn.PAGE,
198
+ relativeFrom: mn.PAGE,
199
199
  posOffset: 0
200
200
  },
201
201
  positionV: {
202
- relativeFrom: mn.PARAGRAPH,
202
+ relativeFrom: un.PARAGRAPH,
203
203
  posOffset: 0
204
204
  },
205
205
  angle: 0
206
206
  },
207
- behindDoc: un.FALSE,
207
+ behindDoc: on.FALSE,
208
208
  title: "",
209
209
  description: "",
210
- layoutType: on.INLINE,
210
+ layoutType: rn.INLINE,
211
211
  // Insert inline drawing by default.
212
- wrapText: rn.BOTH_SIDES,
212
+ wrapText: nn.BOTH_SIDES,
213
213
  distB: 0,
214
214
  distL: 0,
215
215
  distR: 0,
216
216
  distT: 0
217
- }, P = sn.drawing.add({
217
+ }, P = ln.drawing.add({
218
218
  documentDataModel: S,
219
219
  drawings: [R],
220
220
  selection: {
@@ -262,13 +262,13 @@ let Je = class extends z {
262
262
  this._refreshRender = e;
263
263
  }
264
264
  };
265
- Je = Di([
265
+ Je = Oi([
266
266
  Ct(0, re),
267
267
  Ct(1, H(dt)),
268
268
  Ct(2, H(qe))
269
269
  ], Je);
270
- var Re = /* @__PURE__ */ ((n) => (n[n.NOT_REGISTER = 1] = "NOT_REGISTER", n[n.SUCCESS = 2] = "SUCCESS", n[n.WAIT = 3] = "WAIT", n[n.ERROR = 4] = "ERROR", n))(Re || {}), bi = Object.getOwnPropertyDescriptor, Oi = (n, e, a, i) => {
271
- for (var r = i > 1 ? void 0 : i ? bi(e, a) : e, o = n.length - 1, u; o >= 0; o--)
270
+ var Re = /* @__PURE__ */ ((n) => (n[n.NOT_REGISTER = 1] = "NOT_REGISTER", n[n.SUCCESS = 2] = "SUCCESS", n[n.WAIT = 3] = "WAIT", n[n.ERROR = 4] = "ERROR", n))(Re || {}), Mi = Object.getOwnPropertyDescriptor, xi = (n, e, a, i) => {
271
+ for (var r = i > 1 ? void 0 : i ? Mi(e, a) : e, o = n.length - 1, u; o >= 0; o--)
272
272
  (u = n[o]) && (r = u(r) || r);
273
273
  return r;
274
274
  }, Dt = (n, e) => (a, i) => e(a, i, n);
@@ -276,12 +276,12 @@ let et = class extends z {
276
276
  constructor(e, a, i) {
277
277
  super();
278
278
  w(this, "_formulaCacheMap", /* @__PURE__ */ new Map());
279
- w(this, "_formulaChangeWithRange$", new da());
279
+ w(this, "_formulaChangeWithRange$", new sa());
280
280
  w(this, "formulaChangeWithRange$", this._formulaChangeWithRange$.asObservable());
281
281
  // FIXME: this design could be improved.
282
- w(this, "_formulaResult$", new da());
282
+ w(this, "_formulaResult$", new sa());
283
283
  w(this, "formulaResult$", this._formulaResult$.asObservable());
284
- w(this, "calculateStarted$", new Wa(!1));
284
+ w(this, "calculateStarted$", new Xa(!1));
285
285
  this._commandService = e, this._activeDirtyManagerService = a, this._lifecycleService = i, this._initFormulaRegister(), this._initFormulaCalculationResultChange();
286
286
  }
287
287
  dispose() {
@@ -322,7 +322,7 @@ let et = class extends z {
322
322
  }
323
323
  }
324
324
  };
325
- this._commandService.executeCommand(wn.id, c).then(() => {
325
+ this._commandService.executeCommand(Hn.id, c).then(() => {
326
326
  this._commandService.executeCommand(
327
327
  _e.id,
328
328
  { [i]: { [r]: { [u]: !0 } } }
@@ -330,14 +330,14 @@ let et = class extends z {
330
330
  });
331
331
  };
332
332
  this.disposeWithMe(
333
- this._formulaChangeWithRange$.pipe(Ti(() => this.calculateStarted$.pipe(pa((a) => a)))).subscribe((a) => a.forEach(e))
333
+ this._formulaChangeWithRange$.pipe(Ii(() => this.calculateStarted$.pipe(da((a) => a)))).subscribe((a) => a.forEach(e))
334
334
  ), this.disposeWithMe(
335
- this._formulaChangeWithRange$.pipe(pa(() => this.calculateStarted$.getValue())).subscribe(e)
335
+ this._formulaChangeWithRange$.pipe(da(() => this.calculateStarted$.getValue())).subscribe(e)
336
336
  );
337
337
  }
338
338
  _initFormulaCalculationResultChange() {
339
339
  this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
340
- if (e.id === wa.id) {
340
+ if (e.id === Ha.id) {
341
341
  const a = e.params, { unitOtherData: i } = a, r = {};
342
342
  for (const o in i) {
343
343
  const u = i[o], f = {};
@@ -388,7 +388,7 @@ let et = class extends z {
388
388
  subUnitId: a,
389
389
  formulaIdList: i
390
390
  };
391
- this._commandService.executeCommand(Hn.id, r);
391
+ this._commandService.executeCommand(Gn.id, r);
392
392
  const o = this._ensureCacheMap(e, a);
393
393
  i.forEach((u) => o.delete(u));
394
394
  }
@@ -411,17 +411,17 @@ let et = class extends z {
411
411
  ));
412
412
  }
413
413
  };
414
- et = Oi([
414
+ et = xi([
415
415
  Dt(0, re),
416
416
  Dt(1, Qt),
417
- Dt(2, H(dn))
417
+ Dt(2, H(sn))
418
418
  ], et);
419
- var Mi = Object.getOwnPropertyDescriptor, xi = (n, e, a, i) => {
420
- for (var r = i > 1 ? void 0 : i ? Mi(e, a) : e, o = n.length - 1, u; o >= 0; o--)
419
+ var _i = Object.getOwnPropertyDescriptor, yi = (n, e, a, i) => {
420
+ for (var r = i > 1 ? void 0 : i ? _i(e, a) : e, o = n.length - 1, u; o >= 0; o--)
421
421
  (u = n[o]) && (r = u(r) || r);
422
422
  return r;
423
423
  }, pe = (n, e) => (a, i) => e(a, i, n);
424
- const Ta = { done: 0, count: 0 }, bt = { onlyLocal: !0 };
424
+ const Pa = { done: 0, count: 0 }, bt = { onlyLocal: !0 };
425
425
  let ge = class extends z {
426
426
  constructor(e, a, i, r, o, u, f) {
427
427
  super();
@@ -445,7 +445,7 @@ let ge = class extends z {
445
445
  * The mark of forced calculation. If a new mutation triggers dirty area calculation during the forced calculation process, forced calculation is still required.
446
446
  */
447
447
  w(this, "_forceCalculating", !1);
448
- w(this, "_progress$", new Wa(Ta));
448
+ w(this, "_progress$", new Xa(Pa));
449
449
  w(this, "progress$", this._progress$.asObservable());
450
450
  this._commandService = e, this._activeDirtyManagerService = a, this._logService = i, this._configService = r, this._formulaDataModel = o, this._localeService = u, this._registerOtherFormulaService = f, this._commandExecutedListener(), this._initialExecuteFormulaProcessListener(), this._initialExecuteFormula();
451
451
  }
@@ -474,19 +474,23 @@ let ge = class extends z {
474
474
  this._doneCalculationTaskCount = 0, this._totalCalculationTaskCount = 0, this._emitProgress();
475
475
  }
476
476
  dispose() {
477
- super.dispose(), this._progress$.next(Ta), this._progress$.complete(), clearTimeout(this._setTimeoutKey);
477
+ super.dispose(), this._progress$.next(Pa), this._progress$.complete(), clearTimeout(this._setTimeoutKey);
478
478
  }
479
479
  _getCalculationMode() {
480
480
  var a;
481
481
  const e = this._configService.getConfig(Ue);
482
- return (a = e == null ? void 0 : e.initialFormulaComputing) != null ? a : Te.WHEN_EMPTY;
482
+ return (a = e == null ? void 0 : e.initialFormulaComputing) != null ? a : Ee.WHEN_EMPTY;
483
483
  }
484
484
  _commandExecutedListener() {
485
485
  this.disposeWithMe(
486
486
  this._commandService.beforeCommandExecuted((e) => {
487
- if (e.id === Ne.id) {
487
+ if (e.id === Pe.id || e.id === wn.id) {
488
488
  const a = e.params;
489
- a.rowData = this._formulaDataModel.getHiddenRowsFiltered();
489
+ if (e.id === Pe.id) {
490
+ const i = this._configService.getConfig(Yn) || !1;
491
+ a.isCalculateTreeModel = i;
492
+ }
493
+ a.maxIteration = this._configService.getConfig(Xn), a.rowData = this._formulaDataModel.getHiddenRowsFiltered();
490
494
  }
491
495
  })
492
496
  ), this.disposeWithMe(
@@ -494,12 +498,12 @@ let ge = class extends z {
494
498
  if (this._activeDirtyManagerService.get(e.id)) {
495
499
  if (e.id === Q.id) {
496
500
  const i = e.params;
497
- if (a && a.onlyLocal === !0 || i.trigger === kt.id || i.trigger === ba.id || i.trigger === Oa.id)
501
+ if (a && a.onlyLocal === !0 || i.trigger === kt.id || i.trigger === Da.id || i.trigger === ba.id)
498
502
  return;
499
503
  }
500
504
  this._waitingCommandQueue.push(e), clearTimeout(this._setTimeoutKey), this._setTimeoutKey = setTimeout(() => {
501
505
  const i = this._generateDirty(this._waitingCommandQueue);
502
- this._executingDirtyData = this._mergeDirty(this._executingDirtyData, i), this._executionInProgressParams == null ? this._commandService.executeCommand(Ne.id, { ...this._executingDirtyData }, bt) : (this._restartCalculation = !0, this._commandService.executeCommand(ma.id, {})), this._waitingCommandQueue = [];
506
+ this._executingDirtyData = this._mergeDirty(this._executingDirtyData, i), this._executionInProgressParams == null ? this._commandService.executeCommand(Pe.id, { ...this._executingDirtyData }, bt) : (this._restartCalculation = !0, this._commandService.executeCommand(ma.id, {})), this._waitingCommandQueue = [];
503
507
  }, 100);
504
508
  }
505
509
  })
@@ -521,24 +525,20 @@ let ge = class extends z {
521
525
  dirtyUnitFeatureMap: o,
522
526
  dirtyUnitOtherFormulaMap: u,
523
527
  forceCalculation: !1,
524
- clearDependencyTreeCache: f,
525
- maxIteration: this._configService.getConfig(fa)
528
+ clearDependencyTreeCache: f
526
529
  // numfmtItemMap,
527
530
  };
528
531
  }
529
532
  _mergeDirty(e, a) {
530
533
  const i = [...e.dirtyRanges, ...a.dirtyRanges], r = { ...e.dirtyNameMap }, o = { ...e.dirtyDefinedNameMap }, u = { ...e.dirtyUnitFeatureMap }, f = { ...e.dirtyUnitOtherFormulaMap }, m = { ...e.clearDependencyTreeCache };
531
- this._mergeDirtyNameMap(r, a.dirtyNameMap), this._mergeDirtyNameMap(o, a.dirtyDefinedNameMap), this._mergeDirtyUnitFeatureOrOtherFormulaMap(u, a.dirtyUnitFeatureMap), this._mergeDirtyUnitFeatureOrOtherFormulaMap(f, a.dirtyUnitOtherFormulaMap), this._mergeDirtyNameMap(m, a.clearDependencyTreeCache);
532
- const c = e.maxIteration || a.maxIteration;
533
- return {
534
+ return this._mergeDirtyNameMap(r, a.dirtyNameMap), this._mergeDirtyNameMap(o, a.dirtyDefinedNameMap), this._mergeDirtyUnitFeatureOrOtherFormulaMap(u, a.dirtyUnitFeatureMap), this._mergeDirtyUnitFeatureOrOtherFormulaMap(f, a.dirtyUnitOtherFormulaMap), this._mergeDirtyNameMap(m, a.clearDependencyTreeCache), {
534
535
  dirtyRanges: i,
535
536
  dirtyNameMap: r,
536
537
  dirtyDefinedNameMap: o,
537
538
  dirtyUnitFeatureMap: u,
538
539
  dirtyUnitOtherFormulaMap: f,
539
540
  forceCalculation: !!this._forceCalculating,
540
- clearDependencyTreeCache: m,
541
- maxIteration: c
541
+ clearDependencyTreeCache: m
542
542
  };
543
543
  }
544
544
  /**
@@ -583,11 +583,11 @@ let ge = class extends z {
583
583
  this.disposeWithMe(
584
584
  // eslint-disable-next-line max-lines-per-function, complexity
585
585
  this._commandService.onCommandExecuted((i) => {
586
- if (i.id === Ne.id) {
586
+ if (i.id === Pe.id) {
587
587
  const { forceCalculation: o = !1 } = i.params;
588
588
  o && (this._forceCalculating = !0);
589
589
  } else i.id === ma.id && this.clearProgress();
590
- if (i.id !== Yn.id)
590
+ if (i.id !== Wn.id)
591
591
  return;
592
592
  const r = i.params;
593
593
  if (r.stageInfo != null) {
@@ -630,7 +630,7 @@ let ge = class extends z {
630
630
  break;
631
631
  }
632
632
  (a === 0 || a === -1) && (e ? (clearTimeout(e), e = null, this.clearProgress()) : this._completeProgress(), a = 0, this._doneCalculationTaskCount = 0, this._totalCalculationTaskCount = 0, this._forceCalculating = !1), o === Me.STOP_EXECUTION && this._restartCalculation ? (this._restartCalculation = !1, this._commandService.executeCommand(
633
- Ne.id,
633
+ Pe.id,
634
634
  {
635
635
  ...this._executingDirtyData
636
636
  },
@@ -653,10 +653,10 @@ let ge = class extends z {
653
653
  }
654
654
  _initialExecuteFormula() {
655
655
  const e = this._getCalculationMode(), a = this._getDirtyDataByCalculationMode(e);
656
- this._commandService.executeCommand(Ne.id, a, bt), this._registerOtherFormulaService.calculateStarted$.next(!0);
656
+ this._commandService.executeCommand(Pe.id, a, bt), this._registerOtherFormulaService.calculateStarted$.next(!0);
657
657
  }
658
658
  _getDirtyDataByCalculationMode(e) {
659
- const a = e === Te.FORCED, i = e === Te.WHEN_EMPTY ? this._formulaDataModel.getFormulaDirtyRanges() : [];
659
+ const a = e === Ee.FORCED, i = e === Ee.WHEN_EMPTY ? this._formulaDataModel.getFormulaDirtyRanges() : [];
660
660
  return {
661
661
  forceCalculation: a,
662
662
  dirtyRanges: i,
@@ -664,21 +664,20 @@ let ge = class extends z {
664
664
  dirtyDefinedNameMap: {},
665
665
  dirtyUnitFeatureMap: {},
666
666
  dirtyUnitOtherFormulaMap: {},
667
- clearDependencyTreeCache: {},
668
- maxIteration: this._configService.getConfig(fa)
667
+ clearDependencyTreeCache: {}
669
668
  };
670
669
  }
671
670
  };
672
- ge = xi([
671
+ ge = yi([
673
672
  pe(0, re),
674
673
  pe(1, Qt),
675
- pe(2, pn),
674
+ pe(2, dn),
676
675
  pe(3, be),
677
676
  pe(4, H(qe)),
678
677
  pe(5, H(Wt)),
679
678
  pe(6, H(et))
680
679
  ], ge);
681
- function _i(n, e, a) {
680
+ function gi(n, e, a) {
682
681
  var i;
683
682
  return n == null || n[e] == null || ((i = n[e]) == null ? void 0 : i[a]) == null;
684
683
  }
@@ -697,18 +696,18 @@ function Ot(n, e, a) {
697
696
  };
698
697
  }
699
698
  var y = /* @__PURE__ */ ((n) => (n[n.MoveRange = 0] = "MoveRange", n[n.MoveRows = 1] = "MoveRows", n[n.MoveCols = 2] = "MoveCols", n[n.InsertRow = 3] = "InsertRow", n[n.InsertColumn = 4] = "InsertColumn", n[n.RemoveRow = 5] = "RemoveRow", n[n.RemoveColumn = 6] = "RemoveColumn", n[n.DeleteMoveLeft = 7] = "DeleteMoveLeft", n[n.DeleteMoveUp = 8] = "DeleteMoveUp", n[n.InsertMoveDown = 9] = "InsertMoveDown", n[n.InsertMoveRight = 10] = "InsertMoveRight", n[n.SetName = 11] = "SetName", n[n.RemoveSheet = 12] = "RemoveSheet", n[n.SetDefinedName = 13] = "SetDefinedName", n[n.RemoveDefinedName = 14] = "RemoveDefinedName", n))(y || {});
700
- const yi = [
699
+ const hi = [
701
700
  11,
702
701
  12,
703
702
  13,
704
703
  14
705
704
  /* RemoveDefinedName */
706
705
  ];
707
- function gi(n, e, a) {
706
+ function qi(n, e, a) {
708
707
  const { type: i } = a;
709
- return yi.includes(i) ? hi(n, e) : qi(n, e, a);
708
+ return hi.includes(i) ? Ui(n, e) : Fi(n, e, a);
710
709
  }
711
- function hi(n, e) {
710
+ function Ui(n, e) {
712
711
  const a = [], i = [];
713
712
  return Object.keys(e).forEach((r) => {
714
713
  const o = e[r], u = n[r];
@@ -747,8 +746,8 @@ function hi(n, e) {
747
746
  redos: i
748
747
  };
749
748
  }
750
- function qi(n, e, a) {
751
- const { redoFormulaData: i, undoFormulaData: r } = Ui(n, e, a), o = [], u = [];
749
+ function Fi(n, e, a) {
750
+ const { redoFormulaData: i, undoFormulaData: r } = Bi(n, e, a), o = [], u = [];
752
751
  return Object.keys(i).forEach((f) => {
753
752
  Object.keys(i[f]).forEach((m) => {
754
753
  if (Object.keys(i[f][m]).length !== 0) {
@@ -782,10 +781,10 @@ function qi(n, e, a) {
782
781
  redos: o
783
782
  };
784
783
  }
785
- function Ui(n, e, a) {
784
+ function Bi(n, e, a) {
786
785
  const i = {}, r = {}, { unitId: o, sheetId: u } = a;
787
786
  return (/* @__PURE__ */ new Set([...Object.keys(n), ...Object.keys(e)])).forEach((m) => {
788
- if (_i(n, m, u))
787
+ if (gi(n, m, u))
789
788
  return;
790
789
  (/* @__PURE__ */ new Set([
791
790
  ...Object.keys(n[m] || {}),
@@ -794,8 +793,8 @@ function Ui(n, e, a) {
794
793
  var S, R;
795
794
  const p = (S = n[m]) == null ? void 0 : S[l], T = (R = e[m]) == null ? void 0 : R[l], L = new v(p || {}), I = new v(T || {});
796
795
  let A = [];
797
- m !== o || l !== u ? A = Bi(I) : A = Fi(L, I, a);
798
- const N = zi(A, L, I), d = Zi(A, L);
796
+ m !== o || l !== u ? A = Vi(I) : A = vi(L, I, a);
797
+ const N = Ji(A, L, I), d = er(A, L);
799
798
  i[m] || (i[m] = {}), r[m] || (r[m] = {}), i[m][l] = {
800
799
  ...i[m][l],
801
800
  ...N
@@ -809,11 +808,11 @@ function Ui(n, e, a) {
809
808
  undoFormulaData: r
810
809
  };
811
810
  }
812
- function Fi(n, e, a) {
811
+ function vi(n, e, a) {
813
812
  const { type: i, from: r, to: o, range: u } = a, f = [];
814
813
  return n.forValue((m, c, l) => {
815
- if (l == null || !ka(l)) return !0;
816
- const p = Na(m, c);
814
+ if (l == null || !Ka(l)) return !0;
815
+ const p = Ia(m, c);
817
816
  let T = null, L = !1;
818
817
  if ([
819
818
  0,
@@ -821,9 +820,9 @@ function Fi(n, e, a) {
821
820
  2
822
821
  /* MoveCols */
823
822
  ].includes(i))
824
- T = vi(i, r, o, p);
823
+ T = Gi(i, r, o, p);
825
824
  else if (u != null) {
826
- const I = Vi(p, a);
825
+ const I = Hi(p, a);
827
826
  T = I.newCell, L = I.isReverse;
828
827
  }
829
828
  if (Ke.diffValue(p, T) && !e.getValue(m, c))
@@ -831,61 +830,61 @@ function Fi(n, e, a) {
831
830
  L ? f.unshift({ oldCell: p, newCell: T }) : f.push({ oldCell: p, newCell: T });
832
831
  }), f;
833
832
  }
834
- function Bi(n) {
833
+ function Vi(n) {
835
834
  const e = [];
836
835
  return n.forValue((a, i, r) => {
837
- if (r == null || !ka(r)) return !0;
838
- const o = Na(a, i);
836
+ if (r == null || !Ka(r)) return !0;
837
+ const o = Ia(a, i);
839
838
  e.push({ oldCell: o, newCell: o });
840
839
  }), e;
841
840
  }
842
- function vi(n, e, a, i) {
841
+ function Gi(n, e, a, i) {
843
842
  if (e == null || a == null)
844
843
  return null;
845
844
  switch (n) {
846
845
  case 0:
847
- return Gi(e, a, i);
846
+ return wi(e, a, i);
848
847
  case 1:
849
- return Hi(e, a, i);
848
+ return Yi(e, a, i);
850
849
  case 2:
851
- return wi(e, a, i);
850
+ return Xi(e, a, i);
852
851
  default:
853
852
  return null;
854
853
  }
855
854
  }
856
- function Vi(n, e) {
855
+ function Hi(n, e) {
857
856
  const { type: a, rangeFilteredRows: i } = e, r = e.range;
858
857
  let o = null, u = !1;
859
858
  switch (a) {
860
859
  case 3:
861
- o = Yi(r, n), u = !0;
860
+ o = Wi(r, n), u = !0;
862
861
  break;
863
862
  case 4:
864
- o = Xi(r, n), u = !0;
863
+ o = Ki(r, n), u = !0;
865
864
  break;
866
865
  case 5:
867
- o = Wi(r, n, i);
866
+ o = ki(r, n, i);
868
867
  break;
869
868
  case 6:
870
- o = Ki(r, n);
869
+ o = Qi(r, n);
871
870
  break;
872
871
  case 7:
873
- o = ki(r, n);
872
+ o = $i(r, n);
874
873
  break;
875
874
  case 8:
876
- o = Qi(r, n);
875
+ o = ji(r, n);
877
876
  break;
878
877
  case 9:
879
- o = $i(r, n), u = !0;
878
+ o = zi(r, n), u = !0;
880
879
  break;
881
880
  case 10:
882
- o = ji(r, n), u = !0;
881
+ o = Zi(r, n), u = !0;
883
882
  break;
884
883
  }
885
884
  return { newCell: o, isReverse: u };
886
885
  }
887
- function Gi(n, e, a) {
888
- const i = _a(
886
+ function wi(n, e, a) {
887
+ const i = xa(
889
888
  {
890
889
  id: Y.MoveRangeCommandId,
891
890
  params: { toRange: e, fromRange: n }
@@ -894,8 +893,8 @@ function Gi(n, e, a) {
894
893
  );
895
894
  return X(i, a);
896
895
  }
897
- function Hi(n, e, a) {
898
- const i = xa(
896
+ function Yi(n, e, a) {
897
+ const i = Ma(
899
898
  {
900
899
  id: Y.MoveRowsCommandId,
901
900
  params: { toRange: e, fromRange: n }
@@ -904,8 +903,8 @@ function Hi(n, e, a) {
904
903
  );
905
904
  return X(i, a);
906
905
  }
907
- function wi(n, e, a) {
908
- const i = Ma(
906
+ function Xi(n, e, a) {
907
+ const i = Oa(
909
908
  {
910
909
  id: Y.MoveColsCommandId,
911
910
  params: { toRange: e, fromRange: n }
@@ -914,8 +913,8 @@ function wi(n, e, a) {
914
913
  );
915
914
  return X(i, a);
916
915
  }
917
- function Yi(n, e) {
918
- const a = va(
916
+ function Wi(n, e) {
917
+ const a = Ba(
919
918
  {
920
919
  id: Y.InsertRowCommandId,
921
920
  params: { range: n, unitId: "", subUnitId: "", direction: Qe.DOWN }
@@ -924,8 +923,8 @@ function Yi(n, e) {
924
923
  );
925
924
  return X(a, e);
926
925
  }
927
- function Xi(n, e) {
928
- const a = Ba(
926
+ function Ki(n, e) {
927
+ const a = Fa(
929
928
  {
930
929
  id: Y.InsertColCommandId,
931
930
  params: { range: n, unitId: "", subUnitId: "", direction: Qe.RIGHT }
@@ -934,8 +933,8 @@ function Xi(n, e) {
934
933
  );
935
934
  return X(a, e);
936
935
  }
937
- function Wi(n, e, a) {
938
- const i = Fa(
936
+ function ki(n, e, a) {
937
+ const i = Ua(
939
938
  {
940
939
  id: Y.RemoveRowCommandId,
941
940
  params: { range: n }
@@ -945,8 +944,8 @@ function Wi(n, e, a) {
945
944
  );
946
945
  return X(i, e);
947
946
  }
948
- function Ki(n, e) {
949
- const a = Ua(
947
+ function Qi(n, e) {
948
+ const a = qa(
950
949
  {
951
950
  id: Y.RemoveColCommandId,
952
951
  params: { range: n }
@@ -955,8 +954,8 @@ function Ki(n, e) {
955
954
  );
956
955
  return X(a, e);
957
956
  }
958
- function ki(n, e) {
959
- const a = qa(
957
+ function $i(n, e) {
958
+ const a = ha(
960
959
  {
961
960
  id: Y.DeleteRangeMoveLeftCommandId,
962
961
  params: { range: n }
@@ -965,8 +964,8 @@ function ki(n, e) {
965
964
  );
966
965
  return X(a, e);
967
966
  }
968
- function Qi(n, e) {
969
- const a = ha(
967
+ function ji(n, e) {
968
+ const a = ga(
970
969
  {
971
970
  id: Y.DeleteRangeMoveUpCommandId,
972
971
  params: { range: n }
@@ -975,8 +974,8 @@ function Qi(n, e) {
975
974
  );
976
975
  return X(a, e);
977
976
  }
978
- function $i(n, e) {
979
- const a = ga(
977
+ function zi(n, e) {
978
+ const a = ya(
980
979
  {
981
980
  id: Y.InsertRangeMoveDownCommandId,
982
981
  params: { range: n }
@@ -985,8 +984,8 @@ function $i(n, e) {
985
984
  );
986
985
  return X(a, e);
987
986
  }
988
- function ji(n, e) {
989
- const a = ya(
987
+ function Zi(n, e) {
988
+ const a = _a(
990
989
  {
991
990
  id: Y.InsertRangeMoveRightCommandId,
992
991
  params: { range: n }
@@ -995,7 +994,7 @@ function ji(n, e) {
995
994
  );
996
995
  return X(a, e);
997
996
  }
998
- function zi(n, e, a) {
997
+ function Ji(n, e, a) {
999
998
  var r, o, u;
1000
999
  const i = new v({});
1001
1000
  for (let f = 0; f < n.length; f++) {
@@ -1007,7 +1006,7 @@ function zi(n, e, a) {
1007
1006
  }
1008
1007
  return i.getMatrix();
1009
1008
  }
1010
- function Zi(n, e) {
1009
+ function er(n, e) {
1011
1010
  const a = new v({});
1012
1011
  for (let i = n.length - 1; i >= 0; i--) {
1013
1012
  const { oldCell: r, newCell: o } = n[i], u = e.getValue(r.startRow, r.startColumn), f = he(u);
@@ -1021,7 +1020,7 @@ function Zi(n, e) {
1021
1020
  function he(n) {
1022
1021
  if (n == null)
1023
1022
  return null;
1024
- const { f: e, si: a, x: i = 0, y: r = 0 } = n, o = ye(e), u = Ia(a);
1023
+ const { f: e, si: a, x: i = 0, y: r = 0 } = n, o = ye(e), u = Ea(a);
1025
1024
  if (!o && !u)
1026
1025
  return {
1027
1026
  f: null,
@@ -1030,18 +1029,18 @@ function he(n) {
1030
1029
  const f = {};
1031
1030
  return u && (f.si = a), o && i === 0 && r === 0 && (f.f = e), f.f === void 0 && (f.f = null), f.si === void 0 && (f.si = null), f;
1032
1031
  }
1033
- function Ji(n) {
1032
+ function tr(n) {
1034
1033
  const e = new v({});
1035
1034
  return new v(n).forValue((i, r, o) => {
1036
1035
  const u = he(o);
1037
1036
  u !== void 0 && e.setValue(i, r, u);
1038
1037
  }), e.getMatrix();
1039
1038
  }
1040
- function ka(n) {
1041
- const e = (n == null ? void 0 : n.f) || "", a = (n == null ? void 0 : n.si) || "", i = ye(e), r = Ia(a);
1039
+ function Ka(n) {
1040
+ const e = (n == null ? void 0 : n.f) || "", a = (n == null ? void 0 : n.si) || "", i = ye(e), r = Ea(a);
1042
1041
  return !!(i || r);
1043
1042
  }
1044
- function Qa(n, e, a, i, r, o) {
1043
+ function ka(n, e, a, i, r, o) {
1045
1044
  if ((r == null || r.length === 0) && (o == null || o.length === 0)) {
1046
1045
  if (n === a && e === i)
1047
1046
  return !0;
@@ -1049,7 +1048,7 @@ function Qa(n, e, a, i, r, o) {
1049
1048
  return !0;
1050
1049
  return !1;
1051
1050
  }
1052
- function $a(n, e, a = 0, i = 0) {
1051
+ function Qa(n, e, a = 0, i = 0) {
1053
1052
  const r = [];
1054
1053
  for (let o = 0, u = n.length; o < u; o++) {
1055
1054
  const f = n[o];
@@ -1057,7 +1056,7 @@ function $a(n, e, a = 0, i = 0) {
1057
1056
  r.push(f);
1058
1057
  continue;
1059
1058
  }
1060
- const { token: m } = f, c = Pe(m), { range: l, sheetName: p, unitId: T } = c, L = fe.moveOffset(l, a, i);
1059
+ const { token: m } = f, c = Te(m), { range: l, sheetName: p, unitId: T } = c, L = fe.moveOffset(l, a, i);
1061
1060
  r.push({
1062
1061
  ...f,
1063
1062
  token: pt({
@@ -1069,7 +1068,7 @@ function $a(n, e, a = 0, i = 0) {
1069
1068
  }
1070
1069
  return r;
1071
1070
  }
1072
- function ja(n, e, a, i) {
1071
+ function $a(n, e, a, i) {
1073
1072
  const { type: r, unitId: o, sheetId: u, range: f, from: m, to: c, rangeFilteredRows: l } = e, {
1074
1073
  range: p,
1075
1074
  sheetId: T,
@@ -1078,7 +1077,7 @@ function ja(n, e, a, i) {
1078
1077
  refOffsetX: A,
1079
1078
  refOffsetY: N
1080
1079
  } = n;
1081
- if (!Qa(
1080
+ if (!ka(
1082
1081
  o,
1083
1082
  u,
1084
1083
  a,
@@ -1095,7 +1094,7 @@ function ja(n, e, a, i) {
1095
1094
  const R = xt(d, m), P = ke(d, m);
1096
1095
  if (P == null || R !== 4)
1097
1096
  return;
1098
- const h = _a(
1097
+ const h = xa(
1099
1098
  { id: Y.MoveRangeCommandId, params: { toRange: c, fromRange: m } },
1100
1099
  P
1101
1100
  ), M = X(h, P);
@@ -1116,7 +1115,7 @@ function ja(n, e, a, i) {
1116
1115
  endColumn: d.endColumn,
1117
1116
  rangeType: W.NORMAL
1118
1117
  });
1119
- const h = xa(
1118
+ const h = Ma(
1120
1119
  { id: Y.MoveRowsCommandId, params: { toRange: c, fromRange: m } },
1121
1120
  P
1122
1121
  ), M = X(h, P);
@@ -1137,7 +1136,7 @@ function ja(n, e, a, i) {
1137
1136
  endColumn: d.endColumn,
1138
1137
  rangeType: W.NORMAL
1139
1138
  });
1140
- const h = Ma(
1139
+ const h = Oa(
1141
1140
  { id: Y.MoveColsCommandId, params: { toRange: c, fromRange: m } },
1142
1141
  P
1143
1142
  ), M = X(h, P);
@@ -1147,7 +1146,7 @@ function ja(n, e, a, i) {
1147
1146
  }
1148
1147
  if (f != null) {
1149
1148
  if (r === y.InsertRow) {
1150
- const R = va(
1149
+ const R = Ba(
1151
1150
  {
1152
1151
  id: Y.InsertRowCommandId,
1153
1152
  params: { range: f, unitId: "", subUnitId: "", direction: Qe.DOWN }
@@ -1161,7 +1160,7 @@ function ja(n, e, a, i) {
1161
1160
  ...P
1162
1161
  };
1163
1162
  } else if (r === y.InsertColumn) {
1164
- const R = Ba(
1163
+ const R = Fa(
1165
1164
  {
1166
1165
  id: Y.InsertColCommandId,
1167
1166
  params: { range: f, unitId: "", subUnitId: "", direction: Qe.RIGHT }
@@ -1175,7 +1174,7 @@ function ja(n, e, a, i) {
1175
1174
  ...P
1176
1175
  };
1177
1176
  } else if (r === y.RemoveRow) {
1178
- const R = Fa(
1177
+ const R = Ua(
1179
1178
  {
1180
1179
  id: Y.RemoveRowCommandId,
1181
1180
  params: { range: f }
@@ -1190,7 +1189,7 @@ function ja(n, e, a, i) {
1190
1189
  ...P
1191
1190
  };
1192
1191
  } else if (r === y.RemoveColumn) {
1193
- const R = Ua(
1192
+ const R = qa(
1194
1193
  {
1195
1194
  id: Y.RemoveColCommandId,
1196
1195
  params: { range: f }
@@ -1204,7 +1203,7 @@ function ja(n, e, a, i) {
1204
1203
  ...P
1205
1204
  };
1206
1205
  } else if (r === y.DeleteMoveLeft) {
1207
- const R = qa(
1206
+ const R = ha(
1208
1207
  {
1209
1208
  id: Y.DeleteRangeMoveLeftCommandId,
1210
1209
  params: { range: f }
@@ -1218,7 +1217,7 @@ function ja(n, e, a, i) {
1218
1217
  ...P
1219
1218
  };
1220
1219
  } else if (r === y.DeleteMoveUp) {
1221
- const R = ha(
1220
+ const R = ga(
1222
1221
  {
1223
1222
  id: Y.DeleteRangeMoveUpCommandId,
1224
1223
  params: { range: f }
@@ -1232,7 +1231,7 @@ function ja(n, e, a, i) {
1232
1231
  ...P
1233
1232
  };
1234
1233
  } else if (r === y.InsertMoveDown) {
1235
- const R = ga(
1234
+ const R = ya(
1236
1235
  {
1237
1236
  id: Y.InsertRangeMoveDownCommandId,
1238
1237
  params: { range: f }
@@ -1246,7 +1245,7 @@ function ja(n, e, a, i) {
1246
1245
  ...P
1247
1246
  };
1248
1247
  } else if (r === y.InsertMoveRight) {
1249
- const R = ya(
1248
+ const R = _a(
1250
1249
  {
1251
1250
  id: Y.InsertRangeMoveRightCommandId,
1252
1251
  params: { range: f }
@@ -1365,55 +1364,55 @@ function xe(n) {
1365
1364
  endColumn: Ae(r)
1366
1365
  };
1367
1366
  }
1368
- function za(n, e) {
1367
+ function ja(n, e) {
1369
1368
  const { id: a } = e;
1370
1369
  let i = null;
1371
1370
  switch (a) {
1372
- case Un.id:
1373
- i = er(e, n);
1374
- break;
1375
1371
  case qn.id:
1376
- i = tr(e, n);
1372
+ i = ar(e, n);
1377
1373
  break;
1378
1374
  case hn.id:
1379
- i = ar(e, n);
1375
+ i = nr(e, n);
1380
1376
  break;
1381
1377
  case gn.id:
1382
- i = nr(e);
1378
+ i = ir(e, n);
1383
1379
  break;
1384
1380
  case yn.id:
1385
- i = ir(e);
1381
+ i = rr(e);
1386
1382
  break;
1387
1383
  case _n.id:
1388
- i = rr(e, n);
1384
+ i = or(e);
1389
1385
  break;
1390
1386
  case xn.id:
1391
- i = or(e, n);
1392
- break;
1393
- case Mn.id:
1394
1387
  i = ur(e, n);
1395
1388
  break;
1396
- case On.id:
1389
+ case Mn.id:
1397
1390
  i = mr(e, n);
1398
1391
  break;
1399
- case bn.id:
1392
+ case On.id:
1400
1393
  i = fr(e, n);
1401
1394
  break;
1402
- case Dn.id:
1395
+ case bn.id:
1403
1396
  i = cr(e, n);
1404
1397
  break;
1405
- case Cn.id:
1398
+ case Dn.id:
1406
1399
  i = lr(e, n);
1407
1400
  break;
1408
- case An.id:
1401
+ case Cn.id:
1409
1402
  i = sr(e, n);
1410
1403
  break;
1411
- case Ga.id:
1404
+ case An.id:
1412
1405
  i = dr(e, n);
1413
1406
  break;
1414
- case Va.id:
1407
+ case Sn.id:
1415
1408
  i = pr(e, n);
1416
1409
  break;
1410
+ case Va.id:
1411
+ i = Lr(e, n);
1412
+ break;
1413
+ case va.id:
1414
+ i = Pr(e, n);
1415
+ break;
1417
1416
  }
1418
1417
  return i;
1419
1418
  }
@@ -1425,7 +1424,7 @@ function te(n) {
1425
1424
  sheetId: a
1426
1425
  };
1427
1426
  }
1428
- function er(n, e) {
1427
+ function ar(n, e) {
1429
1428
  const { params: a } = n;
1430
1429
  if (!a) return null;
1431
1430
  const { fromRange: i, toRange: r } = a;
@@ -1439,7 +1438,7 @@ function er(n, e) {
1439
1438
  sheetId: u
1440
1439
  };
1441
1440
  }
1442
- function tr(n, e) {
1441
+ function nr(n, e) {
1443
1442
  const { params: a } = n;
1444
1443
  if (!a) return null;
1445
1444
  const {
@@ -1468,7 +1467,7 @@ function tr(n, e) {
1468
1467
  sheetId: c
1469
1468
  };
1470
1469
  }
1471
- function ar(n, e) {
1470
+ function ir(n, e) {
1472
1471
  const { params: a } = n;
1473
1472
  if (!a) return null;
1474
1473
  const {
@@ -1497,7 +1496,7 @@ function ar(n, e) {
1497
1496
  sheetId: c
1498
1497
  };
1499
1498
  }
1500
- function nr(n) {
1499
+ function rr(n) {
1501
1500
  const { params: e } = n;
1502
1501
  if (!e) return null;
1503
1502
  const { range: a, unitId: i, subUnitId: r } = e;
@@ -1508,7 +1507,7 @@ function nr(n) {
1508
1507
  sheetId: r
1509
1508
  };
1510
1509
  }
1511
- function ir(n) {
1510
+ function or(n) {
1512
1511
  const { params: e } = n;
1513
1512
  if (!e) return null;
1514
1513
  const { range: a, unitId: i, subUnitId: r } = e;
@@ -1519,7 +1518,7 @@ function ir(n) {
1519
1518
  sheetId: r
1520
1519
  };
1521
1520
  }
1522
- function rr(n, e) {
1521
+ function ur(n, e) {
1523
1522
  const { params: a } = n;
1524
1523
  if (!a) return null;
1525
1524
  const { range: i } = a, { unitId: r, sheetId: o } = te(e);
@@ -1530,7 +1529,7 @@ function rr(n, e) {
1530
1529
  sheetId: o
1531
1530
  };
1532
1531
  }
1533
- function or(n, e) {
1532
+ function mr(n, e) {
1534
1533
  const { params: a } = n;
1535
1534
  if (!a) return null;
1536
1535
  const { range: i } = a, { unitId: r, sheetId: o } = te(e);
@@ -1541,7 +1540,7 @@ function or(n, e) {
1541
1540
  sheetId: o
1542
1541
  };
1543
1542
  }
1544
- function ur(n, e) {
1543
+ function fr(n, e) {
1545
1544
  var u, f;
1546
1545
  const { params: a } = n;
1547
1546
  if (!a) return null;
@@ -1554,7 +1553,7 @@ function ur(n, e) {
1554
1553
  rangeFilteredRows: (f = (u = e.getSheetBySheetId(o)) == null ? void 0 : u.getRangeFilterRows(i)) != null ? f : []
1555
1554
  };
1556
1555
  }
1557
- function mr(n, e) {
1556
+ function cr(n, e) {
1558
1557
  const { params: a } = n;
1559
1558
  if (!a) return null;
1560
1559
  const { range: i } = a, { unitId: r, sheetId: o } = te(e);
@@ -1565,7 +1564,7 @@ function mr(n, e) {
1565
1564
  sheetId: o
1566
1565
  };
1567
1566
  }
1568
- function fr(n, e) {
1567
+ function lr(n, e) {
1569
1568
  const { params: a } = n;
1570
1569
  if (!a) return null;
1571
1570
  const { range: i } = a, { unitId: r, sheetId: o } = te(e);
@@ -1576,7 +1575,7 @@ function fr(n, e) {
1576
1575
  sheetId: o
1577
1576
  };
1578
1577
  }
1579
- function cr(n, e) {
1578
+ function sr(n, e) {
1580
1579
  const { params: a } = n;
1581
1580
  if (!a) return null;
1582
1581
  const { range: i } = a, { unitId: r, sheetId: o } = te(e);
@@ -1587,7 +1586,7 @@ function cr(n, e) {
1587
1586
  sheetId: o
1588
1587
  };
1589
1588
  }
1590
- function lr(n, e) {
1589
+ function dr(n, e) {
1591
1590
  const { params: a } = n;
1592
1591
  if (!a) return null;
1593
1592
  const { unitId: i, subUnitId: r, name: o } = a, { unitId: u, sheetId: f } = te(e);
@@ -1598,7 +1597,7 @@ function lr(n, e) {
1598
1597
  sheetName: o
1599
1598
  };
1600
1599
  }
1601
- function sr(n, e) {
1600
+ function pr(n, e) {
1602
1601
  const { params: a } = n;
1603
1602
  if (!a) return null;
1604
1603
  const { unitId: i, subUnitId: r } = a, { unitId: o, sheetId: u } = te(e);
@@ -1608,7 +1607,7 @@ function sr(n, e) {
1608
1607
  sheetId: r || u
1609
1608
  };
1610
1609
  }
1611
- function dr(n, e) {
1610
+ function Lr(n, e) {
1612
1611
  const { params: a } = n;
1613
1612
  if (!a) return null;
1614
1613
  const { unitId: i, name: r, id: o } = a, { sheetId: u } = te(e);
@@ -1620,7 +1619,7 @@ function dr(n, e) {
1620
1619
  definedNameId: o
1621
1620
  };
1622
1621
  }
1623
- function pr(n, e) {
1622
+ function Pr(n, e) {
1624
1623
  const { params: a } = n;
1625
1624
  if (!a) return null;
1626
1625
  const { unitId: i, name: r, id: o } = a, { sheetId: u } = te(e);
@@ -1632,8 +1631,8 @@ function pr(n, e) {
1632
1631
  definedNameId: o
1633
1632
  };
1634
1633
  }
1635
- var Lr = Object.getOwnPropertyDescriptor, Pr = (n, e, a, i) => {
1636
- for (var r = i > 1 ? void 0 : i ? Lr(e, a) : e, o = n.length - 1, u; o >= 0; o--)
1634
+ var Tr = Object.getOwnPropertyDescriptor, Er = (n, e, a, i) => {
1635
+ for (var r = i > 1 ? void 0 : i ? Tr(e, a) : e, o = n.length - 1, u; o >= 0; o--)
1637
1636
  (u = n[o]) && (r = u(r) || r);
1638
1637
  return r;
1639
1638
  }, He = (n, e) => (a, i) => e(a, i, n);
@@ -1648,7 +1647,7 @@ let tt = class extends z {
1648
1647
  this.disposeWithMe(
1649
1648
  this._sheetInterceptorService.interceptCommand({
1650
1649
  getMutations: (n) => {
1651
- if (n.id === Ga.id || n.id === Va.id)
1650
+ if (n.id === Va.id || n.id === va.id)
1652
1651
  return {
1653
1652
  redos: [],
1654
1653
  undos: []
@@ -1659,7 +1658,7 @@ let tt = class extends z {
1659
1658
  redos: [],
1660
1659
  undos: []
1661
1660
  };
1662
- const a = za(e, n);
1661
+ const a = ja(e, n);
1663
1662
  return a ? this._getUpdateDefinedNameMutations(e, a) : {
1664
1663
  redos: [],
1665
1664
  undos: []
@@ -1688,7 +1687,7 @@ let tt = class extends z {
1688
1687
  const R = l[d];
1689
1688
  if (typeof R == "string" || R.nodeType !== ie.REFERENCE)
1690
1689
  continue;
1691
- const { token: P } = R, h = Pe(P), { range: M, sheetName: U, unitId: q } = h, x = ((N = n.getSheetBySheetName(U)) == null ? void 0 : N.getSheetId()) || "", F = {
1690
+ const { token: P } = R, h = Te(P), { range: M, sheetName: U, unitId: q } = h, x = ((N = n.getSheetBySheetName(U)) == null ? void 0 : N.getSheetId()) || "", F = {
1692
1691
  range: M,
1693
1692
  sheetId: x,
1694
1693
  unitId: q,
@@ -1712,7 +1711,7 @@ let tt = class extends z {
1712
1711
  unitId: q
1713
1712
  });
1714
1713
  } else
1715
- B = ja(
1714
+ B = $a(
1716
1715
  F,
1717
1716
  e,
1718
1717
  i,
@@ -1725,7 +1724,7 @@ let tt = class extends z {
1725
1724
  }
1726
1725
  if (!p)
1727
1726
  return !0;
1728
- const L = ze($a(l, T)), I = {
1727
+ const L = ze(Qa(l, T)), I = {
1729
1728
  id: De.id,
1730
1729
  params: {
1731
1730
  unitId: i,
@@ -1753,14 +1752,14 @@ let tt = class extends z {
1753
1752
  return ((o = this._definedNamesService.getWorksheetByRef(e, i)) == null ? void 0 : o.getSheetId()) === a ? k.REF : null;
1754
1753
  }
1755
1754
  };
1756
- tt = Pr([
1755
+ tt = Er([
1757
1756
  He(0, Lt),
1758
- He(1, Ee),
1757
+ He(1, Ie),
1759
1758
  He(2, H(dt)),
1760
1759
  He(3, H(Pt))
1761
1760
  ], tt);
1762
- var Tr = Object.getOwnPropertyDescriptor, Er = (n, e, a, i) => {
1763
- for (var r = i > 1 ? void 0 : i ? Tr(e, a) : e, o = n.length - 1, u; o >= 0; o--)
1761
+ var Ir = Object.getOwnPropertyDescriptor, Nr = (n, e, a, i) => {
1762
+ for (var r = i > 1 ? void 0 : i ? Ir(e, a) : e, o = n.length - 1, u; o >= 0; o--)
1764
1763
  (u = n[o]) && (r = u(r) || r);
1765
1764
  return r;
1766
1765
  }, me = (n, e) => (a, i) => e(a, i, n);
@@ -1783,12 +1782,12 @@ let at = class extends z {
1783
1782
  this._commandService.beforeCommandExecuted((n, e) => {
1784
1783
  if (n.id === Q.id) {
1785
1784
  const a = n.params;
1786
- if (e && e.onlyLocal === !0 || e && e.syncOnly === !0 || a.trigger === kt.id || a.trigger === ba.id || a.trigger === Oa.id)
1785
+ if (e && e.onlyLocal === !0 || e && e.syncOnly === !0 || a.trigger === kt.id || a.trigger === Da.id || a.trigger === ba.id)
1787
1786
  return;
1788
1787
  this._handleSetRangeValuesMutation(a);
1789
1788
  }
1790
1789
  })
1791
- ), this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(j.UNIVER_SHEET).subscribe((n) => this._handleWorkbookAdded(n))), this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(j.UNIVER_SHEET).pipe(Ei((n) => n.getUnitId())).subscribe((n) => this._handleWorkbookDisposed(n)));
1790
+ ), this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(j.UNIVER_SHEET).subscribe((n) => this._handleWorkbookAdded(n))), this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(j.UNIVER_SHEET).pipe(Ni((n) => n.getUnitId())).subscribe((n) => this._handleWorkbookDisposed(n)));
1792
1791
  }
1793
1792
  _handleSetRangeValuesMutation(n) {
1794
1793
  const { subUnitId: e, unitId: a, cellValue: i } = n;
@@ -1807,7 +1806,7 @@ let at = class extends z {
1807
1806
  {
1808
1807
  unitId: a,
1809
1808
  subUnitId: e,
1810
- cellValue: Ji(r)
1809
+ cellValue: tr(r)
1811
1810
  },
1812
1811
  {
1813
1812
  onlyLocal: !0,
@@ -1856,7 +1855,7 @@ let at = class extends z {
1856
1855
  );
1857
1856
  }
1858
1857
  _handleInsertSheetMutation(n) {
1859
- const { sheet: e, unitId: a } = n, i = this._formulaDataModel.getFormulaData(), { id: r, cellData: o } = e, u = new v(o), f = ca(i, a, r, u);
1858
+ const { sheet: e, unitId: a } = n, i = this._formulaDataModel.getFormulaData(), { id: r, cellData: o } = e, u = new v(o), f = fa(i, a, r, u);
1860
1859
  this._commandService.executeCommand(
1861
1860
  Ge.id,
1862
1861
  {
@@ -1872,14 +1871,14 @@ let at = class extends z {
1872
1871
  const e = {}, a = n.getUnitId(), i = { [a]: {} };
1873
1872
  n.getSheets().forEach((c) => {
1874
1873
  var L;
1875
- const l = c.getCellMatrix(), p = c.getSheetId(), T = ca(e, a, p, l);
1874
+ const l = c.getCellMatrix(), p = c.getSheetId(), T = fa(e, a, p, l);
1876
1875
  i[a][p] = (L = T[a]) == null ? void 0 : L[p];
1877
1876
  }), this._commandService.executeCommand(Ge.id, { formulaData: i }, { onlyLocal: !0 });
1878
- const o = this._configService.getConfig(Ue), u = (m = o == null ? void 0 : o.initialFormulaComputing) != null ? m : Te.WHEN_EMPTY, f = this._getDirtyDataByCalculationMode(u);
1879
- this._commandService.executeCommand(Ne.id, f, { onlyLocal: !0 });
1877
+ const o = this._configService.getConfig(Ue), u = (m = o == null ? void 0 : o.initialFormulaComputing) != null ? m : Ee.WHEN_EMPTY, f = this._getDirtyDataByCalculationMode(u);
1878
+ this._commandService.executeCommand(Pe.id, f, { onlyLocal: !0 });
1880
1879
  }
1881
1880
  _getDirtyDataByCalculationMode(n) {
1882
- const e = n === Te.FORCED, a = n === Te.WHEN_EMPTY ? this._formulaDataModel.getFormulaDirtyRanges() : [];
1881
+ const e = n === Ee.FORCED, a = n === Ee.WHEN_EMPTY ? this._formulaDataModel.getFormulaDirtyRanges() : [];
1883
1882
  return {
1884
1883
  forceCalculation: e,
1885
1884
  dirtyRanges: a,
@@ -1897,13 +1896,13 @@ let at = class extends z {
1897
1896
  undos: [],
1898
1897
  redos: []
1899
1898
  };
1900
- const a = za(e, n);
1899
+ const a = ja(e, n);
1901
1900
  if (a) {
1902
1901
  const { unitSheetNameMap: i } = this._formulaDataModel.getCalculateData(), r = this._formulaDataModel.getFormulaData(), { newFormulaData: o } = this._getFormulaReferenceMoveInfo(
1903
1902
  r,
1904
1903
  i,
1905
1904
  a
1906
- ), { undos: u, redos: f } = gi(r, o, a);
1905
+ ), { undos: u, redos: f } = qi(r, o, a);
1907
1906
  return {
1908
1907
  undos: u,
1909
1908
  redos: f
@@ -1942,21 +1941,21 @@ let at = class extends z {
1942
1941
  continue;
1943
1942
  const { token: ce, nodeType: ne } = O;
1944
1943
  if ((U === y.SetDefinedName || U === y.RemoveDefinedName) && (ne === ie.DEFINED_NAME || ne === ie.FUNCTION)) {
1945
- const { definedNameId: Be, definedName: Ie } = a;
1946
- if (Be === void 0 || Ie === void 0)
1944
+ const { definedNameId: Be, definedName: Ne } = a;
1945
+ if (Be === void 0 || Ne === void 0)
1947
1946
  continue;
1948
1947
  const se = this._definedNamesService.getValueById(u, Be);
1949
1948
  if (se == null || se.name !== ce)
1950
1949
  continue;
1951
1950
  P[B] = {
1952
1951
  ...O,
1953
- token: U === y.SetDefinedName ? Ie : k.REF
1952
+ token: U === y.SetDefinedName ? Ne : k.REF
1954
1953
  }, h = !0, M.push(B);
1955
1954
  continue;
1956
1955
  } else if (ne !== ie.REFERENCE)
1957
1956
  continue;
1958
- const le = Pe(ce), { range: Z, sheetName: oe, unitId: ue } = le, Fe = ue == null || ue.length === 0 ? u : ue, J = ((F = e == null ? void 0 : e[Fe]) == null ? void 0 : F[oe]) || "";
1959
- if (!Qa(
1957
+ const le = Te(ce), { range: Z, sheetName: oe, unitId: ue } = le, Fe = ue == null || ue.length === 0 ? u : ue, J = ((F = e == null ? void 0 : e[Fe]) == null ? void 0 : F[oe]) || "";
1958
+ if (!ka(
1960
1959
  a.unitId,
1961
1960
  a.sheetId,
1962
1961
  u,
@@ -1977,10 +1976,10 @@ let at = class extends z {
1977
1976
  if (U === y.SetName) {
1978
1977
  const {
1979
1978
  unitId: Be,
1980
- sheetId: Ie,
1979
+ sheetId: Ne,
1981
1980
  sheetName: se
1982
1981
  } = a;
1983
- if (se == null || J == null || J.length === 0 || Ie !== J)
1982
+ if (se == null || J == null || J.length === 0 || Ne !== J)
1984
1983
  continue;
1985
1984
  Oe = pt({
1986
1985
  range: Z,
@@ -1990,13 +1989,13 @@ let at = class extends z {
1990
1989
  } else if (U === y.RemoveSheet) {
1991
1990
  const {
1992
1991
  unitId: Be,
1993
- sheetId: Ie,
1992
+ sheetId: Ne,
1994
1993
  sheetName: se
1995
1994
  } = a;
1996
- if (J == null || J.length === 0 || Ie !== J)
1995
+ if (J == null || J.length === 0 || Ne !== J)
1997
1996
  continue;
1998
1997
  Oe = k.REF;
1999
- } else U !== y.SetDefinedName && (Oe = ja(
1998
+ } else U !== y.SetDefinedName && (Oe = $a(
2000
1999
  Nt,
2001
2000
  a,
2002
2001
  u,
@@ -2015,7 +2014,7 @@ let at = class extends z {
2015
2014
  return !0;
2016
2015
  } else
2017
2016
  return !0;
2018
- const x = $a(P, M, d, S);
2017
+ const x = Qa(P, M, d, S);
2019
2018
  p.setValue(L, I, {
2020
2019
  f: `=${ze(x)}`
2021
2020
  });
@@ -2025,8 +2024,8 @@ let at = class extends z {
2025
2024
  return { newFormulaData: o };
2026
2025
  }
2027
2026
  };
2028
- at = Er([
2029
- me(0, Ee),
2027
+ at = Nr([
2028
+ me(0, Ie),
2030
2029
  me(1, re),
2031
2030
  me(2, H(Pt)),
2032
2031
  me(3, H(qe)),
@@ -2035,9 +2034,9 @@ at = Er([
2035
2034
  me(6, be),
2036
2035
  me(7, H(st))
2037
2036
  ], at);
2038
- const Ir = "SHEETS_FORMULA_PLUGIN";
2039
- var Nr = Object.getOwnPropertyDescriptor, Rr = (n, e, a, i) => {
2040
- for (var r = i > 1 ? void 0 : i ? Nr(e, a) : e, o = n.length - 1, u; o >= 0; o--)
2037
+ const Rr = "SHEETS_FORMULA_PLUGIN";
2038
+ var Sr = Object.getOwnPropertyDescriptor, Ar = (n, e, a, i) => {
2039
+ for (var r = i > 1 ? void 0 : i ? Sr(e, a) : e, o = n.length - 1, u; o >= 0; o--)
2041
2040
  (u = n[o]) && (r = u(r) || r);
2042
2041
  return r;
2043
2042
  }, _t = (n, e) => (a, i) => e(a, i, n);
@@ -2335,13 +2334,13 @@ let nt = class extends z {
2335
2334
  return i;
2336
2335
  }
2337
2336
  };
2338
- nt = Rr([
2337
+ nt = Ar([
2339
2338
  _t(0, Qt),
2340
- _t(1, Ee),
2339
+ _t(1, Ie),
2341
2340
  _t(2, H(qe))
2342
2341
  ], nt);
2343
- var Sr = Object.getOwnPropertyDescriptor, Ar = (n, e, a, i) => {
2344
- for (var r = i > 1 ? void 0 : i ? Sr(e, a) : e, o = n.length - 1, u; o >= 0; o--)
2342
+ var Cr = Object.getOwnPropertyDescriptor, Dr = (n, e, a, i) => {
2343
+ for (var r = i > 1 ? void 0 : i ? Cr(e, a) : e, o = n.length - 1, u; o >= 0; o--)
2345
2344
  (u = n[o]) && (r = u(r) || r);
2346
2345
  return r;
2347
2346
  }, Le = (n, e) => (a, i) => e(a, i, n);
@@ -2363,7 +2362,7 @@ let it = class extends z {
2363
2362
  return;
2364
2363
  const { arrayFormulaRange: r, arrayFormulaCellData: o, arrayFormulaEmbedded: u } = i;
2365
2364
  this._formulaDataModel.setArrayFormulaRange(r), this._formulaDataModel.setArrayFormulaCellData(o), e && this._writeArrayFormulaToSnapshot(r, o, u);
2366
- } else n.id === wa.id && e && (this._addPrefixToFunctionSnapshot(), this._addPrefixToDefinedNamesFunctionSnapshot());
2365
+ } else n.id === Ha.id && e && (this._addPrefixToFunctionSnapshot(), this._addPrefixToDefinedNamesFunctionSnapshot());
2367
2366
  })
2368
2367
  );
2369
2368
  }
@@ -2467,20 +2466,20 @@ let it = class extends z {
2467
2466
  }
2468
2467
  _initInterceptorCellContent() {
2469
2468
  this.disposeWithMe(
2470
- this._sheetInterceptorService.intercept(Da.CELL_CONTENT, {
2469
+ this._sheetInterceptorService.intercept(Ca.CELL_CONTENT, {
2471
2470
  priority: 100,
2472
2471
  effect: ht.Value,
2473
2472
  handler: (n, e, a) => {
2474
2473
  var l, p, T;
2475
2474
  let i = n;
2476
2475
  const { unitId: r, subUnitId: o, row: u, col: f } = e, m = this._formulaDataModel.getArrayFormulaCellData(), c = (T = (p = (l = m == null ? void 0 : m[r]) == null ? void 0 : l[o]) == null ? void 0 : p[u]) == null ? void 0 : T[f];
2477
- return c == null ? a(i) : ((!i || i === e.rawData) && (i = { ...e.rawData }), c.v == null && c.t == null ? (i.v = 0, i.t = gt.NUMBER, a(i)) : (i == null ? void 0 : i.t) === gt.NUMBER && i.v !== void 0 && i.v !== null && Ln(i.v) ? (i.v = Xn(Number(i.v)), a(i)) : (i.v = c.v, i.t = c.t, a(i)));
2476
+ return c == null ? a(i) : ((!i || i === e.rawData) && (i = { ...e.rawData }), c.v == null && c.t == null ? (i.v = 0, i.t = gt.NUMBER, a(i)) : (i == null ? void 0 : i.t) === gt.NUMBER && i.v !== void 0 && i.v !== null && pn(i.v) ? (i.v = Kn(Number(i.v)), a(i)) : (i.v = c.v, i.t = c.t, a(i)));
2478
2477
  }
2479
2478
  })
2480
2479
  );
2481
2480
  }
2482
2481
  };
2483
- it = Ar([
2482
+ it = Dr([
2484
2483
  Le(0, re),
2485
2484
  Le(1, be),
2486
2485
  Le(2, H(dt)),
@@ -2489,9 +2488,9 @@ it = Ar([
2489
2488
  Le(5, Tt),
2490
2489
  Le(6, Lt)
2491
2490
  ], it);
2492
- const Cr = [
2491
+ const br = [
2493
2492
  {
2494
- functionName: la.ARRAY_CONSTRAIN,
2493
+ functionName: ca.ARRAY_CONSTRAIN,
2495
2494
  functionType: t.Array,
2496
2495
  description: "formula.functionList.ARRAY_CONSTRAIN.description",
2497
2496
  abstract: "formula.functionList.ARRAY_CONSTRAIN.abstract",
@@ -2520,7 +2519,7 @@ const Cr = [
2520
2519
  ]
2521
2520
  },
2522
2521
  {
2523
- functionName: la.FLATTEN,
2522
+ functionName: ca.FLATTEN,
2524
2523
  functionType: t.Array,
2525
2524
  description: "formula.functionList.FLATTEN.description",
2526
2525
  abstract: "formula.functionList.FLATTEN.abstract",
@@ -2541,7 +2540,7 @@ const Cr = [
2541
2540
  }
2542
2541
  ]
2543
2542
  }
2544
- ], Dr = [
2543
+ ], Or = [
2545
2544
  {
2546
2545
  functionName: _.BETADIST,
2547
2546
  functionType: t.Compatibility,
@@ -3595,7 +3594,7 @@ const Cr = [
3595
3594
  }
3596
3595
  ]
3597
3596
  }
3598
- ], br = [
3597
+ ], Mr = [
3599
3598
  {
3600
3599
  functionName: de.CUBEKPIMEMBER,
3601
3600
  functionType: t.Cube,
@@ -3750,7 +3749,7 @@ const Cr = [
3750
3749
  }
3751
3750
  ]
3752
3751
  }
3753
- ], Or = [
3752
+ ], xr = [
3754
3753
  {
3755
3754
  functionName: $.DAVERAGE,
3756
3755
  functionType: t.Database,
@@ -4099,7 +4098,7 @@ const Cr = [
4099
4098
  }
4100
4099
  ]
4101
4100
  }
4102
- ], Mr = [
4101
+ ], _r = [
4103
4102
  {
4104
4103
  functionName: V.DATE,
4105
4104
  functionType: t.Date,
@@ -4671,7 +4670,7 @@ const Cr = [
4671
4670
  }
4672
4671
  ]
4673
4672
  }
4674
- ], xr = [
4673
+ ], yr = [
4675
4674
  {
4676
4675
  functionName: C.BESSELI,
4677
4676
  functionType: t.Engineering,
@@ -5744,7 +5743,7 @@ const Cr = [
5744
5743
  }
5745
5744
  ]
5746
5745
  }
5747
- ], _r = [
5746
+ ], gr = [
5748
5747
  {
5749
5748
  functionName: D.ACCRINT,
5750
5749
  functionType: t.Financial,
@@ -8005,7 +8004,7 @@ const Cr = [
8005
8004
  }
8006
8005
  ]
8007
8006
  }
8008
- ], yr = [
8007
+ ], hr = [
8009
8008
  {
8010
8009
  functionName: G.CELL,
8011
8010
  functionType: t.Information,
@@ -8414,7 +8413,7 @@ const Cr = [
8414
8413
  }
8415
8414
  ]
8416
8415
  }
8417
- ], gr = [
8416
+ ], qr = [
8418
8417
  {
8419
8418
  functionName: K.AND,
8420
8419
  functionType: t.Logical,
@@ -8888,7 +8887,7 @@ const Cr = [
8888
8887
  }
8889
8888
  ]
8890
8889
  }
8891
- ], hr = [
8890
+ ], Ur = [
8892
8891
  {
8893
8892
  functionName: g.ADDRESS,
8894
8893
  functionType: t.Lookup,
@@ -9941,7 +9940,7 @@ const Cr = [
9941
9940
  }
9942
9941
  ]
9943
9942
  }
9944
- ], qr = [
9943
+ ], Fr = [
9945
9944
  {
9946
9945
  functionName: E.ABS,
9947
9946
  functionType: t.Math,
@@ -11593,7 +11592,7 @@ const Cr = [
11593
11592
  }
11594
11593
  ]
11595
11594
  }
11596
- ], Ur = [
11595
+ ], Br = [
11597
11596
  {
11598
11597
  functionName: s.AVEDEV,
11599
11598
  functionType: t.Statistical,
@@ -14535,7 +14534,7 @@ const Cr = [
14535
14534
  }
14536
14535
  ]
14537
14536
  }
14538
- ], Fr = [
14537
+ ], vr = [
14539
14538
  {
14540
14539
  functionName: b.ASC,
14541
14540
  functionType: t.Text,
@@ -15749,7 +15748,7 @@ const Cr = [
15749
15748
  }
15750
15749
  ]
15751
15750
  }
15752
- ], Br = [], vr = [
15751
+ ], Vr = [], Gr = [
15753
15752
  {
15754
15753
  functionName: At.ENCODEURL,
15755
15754
  functionType: t.Web,
@@ -15809,29 +15808,29 @@ const Cr = [
15809
15808
  }
15810
15809
  ]
15811
15810
  }
15812
- ], Vr = [
15811
+ ], Hr = [
15812
+ ...gr,
15813
15813
  ..._r,
15814
- ...Mr,
15815
- ...qr,
15814
+ ...Fr,
15815
+ ...Br,
15816
15816
  ...Ur,
15817
+ ...xr,
15818
+ ...vr,
15819
+ ...qr,
15817
15820
  ...hr,
15818
- ...Or,
15819
- ...Fr,
15820
- ...gr,
15821
15821
  ...yr,
15822
- ...xr,
15822
+ ...Mr,
15823
+ ...Or,
15824
+ ...Gr,
15823
15825
  ...br,
15824
- ...Dr,
15825
- ...vr,
15826
- ...Cr,
15827
- ...Br
15826
+ ...Vr
15828
15827
  ];
15829
- function Gr(n, e) {
15828
+ function wr(n, e) {
15830
15829
  let a = "";
15831
15830
  return n.aliasFunctionName ? (a = e.t(n.aliasFunctionName), a === n.aliasFunctionName && (a = n.functionName)) : a = n.functionName, a;
15832
15831
  }
15833
- var Hr = Object.getOwnPropertyDescriptor, wr = (n, e, a, i) => {
15834
- for (var r = i > 1 ? void 0 : i ? Hr(e, a) : e, o = n.length - 1, u; o >= 0; o--)
15832
+ var Yr = Object.getOwnPropertyDescriptor, Xr = (n, e, a, i) => {
15833
+ for (var r = i > 1 ? void 0 : i ? Yr(e, a) : e, o = n.length - 1, u; o >= 0; o--)
15835
15834
  (u = n[o]) && (r = u(r) || r);
15836
15835
  return r;
15837
15836
  }, yt = (n, e) => (a, i) => e(a, i, n);
@@ -15894,7 +15893,7 @@ let Gt = class {
15894
15893
  if (e.length === 0)
15895
15894
  return !1;
15896
15895
  const a = e[0].description;
15897
- return !Wn(a);
15896
+ return !kn(a);
15898
15897
  }
15899
15898
  _initialize() {
15900
15899
  this._localeService.localeChanged$.subscribe(() => {
@@ -15904,8 +15903,6 @@ let Gt = class {
15904
15903
  _initDescription() {
15905
15904
  var i;
15906
15905
  const n = [
15907
- ...Kn,
15908
- ...kn,
15909
15906
  ...Qn,
15910
15907
  ...$n,
15911
15908
  ...jn,
@@ -15919,13 +15916,15 @@ let Gt = class {
15919
15916
  ...ii,
15920
15917
  ...ri,
15921
15918
  ...oi,
15922
- ...ui
15923
- ].map((r) => r[1]), e = Vr.filter((r) => n.includes(r.functionName)), a = this._configService.getConfig(Ue);
15919
+ ...ui,
15920
+ ...mi,
15921
+ ...fi
15922
+ ].map((r) => r[1]), e = Hr.filter((r) => n.includes(r.functionName)), a = this._configService.getConfig(Ue);
15924
15923
  this._descriptions = e.concat((i = a == null ? void 0 : a.description) != null ? i : []);
15925
15924
  }
15926
15925
  _registerDescriptions() {
15927
15926
  const n = this._localeService, e = this._descriptions.map((a) => ({
15928
- functionName: Gr(a, n),
15927
+ functionName: wr(a, n),
15929
15928
  functionType: a.functionType,
15930
15929
  description: n.t(a.description),
15931
15930
  abstract: n.t(a.abstract),
@@ -15940,13 +15939,13 @@ let Gt = class {
15940
15939
  this._functionService.registerDescriptions(...e);
15941
15940
  }
15942
15941
  };
15943
- Gt = wr([
15942
+ Gt = Xr([
15944
15943
  yt(0, Tt),
15945
15944
  yt(1, H(Wt)),
15946
15945
  yt(2, be)
15947
15946
  ], Gt);
15948
- var Yr = Object.getOwnPropertyDescriptor, Xr = (n, e, a, i) => {
15949
- for (var r = i > 1 ? void 0 : i ? Yr(e, a) : e, o = n.length - 1, u; o >= 0; o--)
15947
+ var Wr = Object.getOwnPropertyDescriptor, Kr = (n, e, a, i) => {
15948
+ for (var r = i > 1 ? void 0 : i ? Wr(e, a) : e, o = n.length - 1, u; o >= 0; o--)
15950
15949
  (u = n[o]) && (r = u(r) || r);
15951
15950
  return r;
15952
15951
  }, we = (n, e) => (a, i) => e(a, i, n);
@@ -15977,7 +15976,7 @@ let rt = class extends z {
15977
15976
  this.disposeWithMe(
15978
15977
  this._commandService.onCommandExecuted((e, a) => {
15979
15978
  if (!(a != null && a.fromCollab)) {
15980
- if (e.id === Ha.id)
15979
+ if (e.id === Ga.id)
15981
15980
  this._unregisterDescriptionsForNotInSheetId(), this._registerDescriptions();
15982
15981
  else if (e.id === De.id) {
15983
15982
  const i = e.params;
@@ -16062,31 +16061,31 @@ let rt = class extends z {
16062
16061
  }), this._descriptionService.unregisterDescriptions(r);
16063
16062
  }
16064
16063
  };
16065
- rt = Xr([
16064
+ rt = Kr([
16066
16065
  we(0, Et),
16067
16066
  we(1, Lt),
16068
- we(2, Ee),
16067
+ we(2, Ie),
16069
16068
  we(3, re)
16070
16069
  ], rt);
16071
- var Wr = Object.getOwnPropertyDescriptor, Kr = (n, e, a, i) => {
16072
- for (var r = i > 1 ? void 0 : i ? Wr(e, a) : e, o = n.length - 1, u; o >= 0; o--)
16070
+ var kr = Object.getOwnPropertyDescriptor, Qr = (n, e, a, i) => {
16071
+ for (var r = i > 1 ? void 0 : i ? kr(e, a) : e, o = n.length - 1, u; o >= 0; o--)
16073
16072
  (u = n[o]) && (r = u(r) || r);
16074
16073
  return r;
16075
- }, kr = (n, e) => (a, i) => e(a, i, n);
16074
+ }, $r = (n, e) => (a, i) => e(a, i, n);
16076
16075
  let ot = class extends z {
16077
16076
  constructor(n) {
16078
16077
  super(), this._commandService = n, [
16079
- Ri,
16080
- Si,
16078
+ Ai,
16079
+ Ci,
16081
16080
  _e
16082
16081
  ].forEach((e) => this._commandService.registerCommand(e));
16083
16082
  }
16084
16083
  };
16085
- ot = Kr([
16086
- kr(0, re)
16084
+ ot = Qr([
16085
+ $r(0, re)
16087
16086
  ], ot);
16088
- var Qr = Object.getOwnPropertyDescriptor, $r = (n, e, a, i) => {
16089
- for (var r = i > 1 ? void 0 : i ? Qr(e, a) : e, o = n.length - 1, u; o >= 0; o--)
16087
+ var jr = Object.getOwnPropertyDescriptor, zr = (n, e, a, i) => {
16088
+ for (var r = i > 1 ? void 0 : i ? jr(e, a) : e, o = n.length - 1, u; o >= 0; o--)
16090
16089
  (u = n[o]) && (r = u(r) || r);
16091
16090
  return r;
16092
16091
  }, Ye = (n, e) => (a, i) => e(a, i, n);
@@ -16117,12 +16116,12 @@ let ut = class extends z {
16117
16116
  this.disposeWithMe(
16118
16117
  this._commandService.onCommandExecuted((e, a) => {
16119
16118
  if (!(a != null && a.fromCollab)) {
16120
- if (e.id === Ha.id)
16119
+ if (e.id === Ga.id)
16121
16120
  this._unregisterDescriptionsForNotInSheetId(), this._registerDescriptions();
16122
- else if (e.id === mi.id) {
16121
+ else if (e.id === ci.id) {
16123
16122
  const i = e.params;
16124
16123
  this._registerDescription(i);
16125
- } else if (e.id === fi.id) {
16124
+ } else if (e.id === li.id) {
16126
16125
  const i = e.params;
16127
16126
  this._unregisterDescription(i);
16128
16127
  }
@@ -16205,18 +16204,18 @@ let ut = class extends z {
16205
16204
  }), this._descriptionService.unregisterDescriptions(r);
16206
16205
  }
16207
16206
  };
16208
- ut = $r([
16207
+ ut = zr([
16209
16208
  Ye(0, Et),
16210
- Ye(1, Ee),
16209
+ Ye(1, Ie),
16211
16210
  Ye(2, re),
16212
- Ye(3, ci)
16211
+ Ye(3, si)
16213
16212
  ], ut);
16214
- var jr = Object.getOwnPropertyDescriptor, zr = (n, e, a, i) => {
16215
- for (var r = i > 1 ? void 0 : i ? jr(e, a) : e, o = n.length - 1, u; o >= 0; o--)
16213
+ var Zr = Object.getOwnPropertyDescriptor, Jr = (n, e, a, i) => {
16214
+ for (var r = i > 1 ? void 0 : i ? Zr(e, a) : e, o = n.length - 1, u; o >= 0; o--)
16216
16215
  (u = n[o]) && (r = u(r) || r);
16217
16216
  return r;
16218
16217
  }, Xe = (n, e) => (a, i) => e(a, i, n);
16219
- function Ea(n, e, a, i) {
16218
+ function Ta(n, e, a, i) {
16220
16219
  const r = n.sequenceNodesBuilder(e);
16221
16220
  if (r == null)
16222
16221
  return e;
@@ -16225,7 +16224,7 @@ function Ea(n, e, a, i) {
16225
16224
  const m = r[u];
16226
16225
  if (typeof m == "string" || m.nodeType !== ie.REFERENCE)
16227
16226
  continue;
16228
- const { token: c } = m, l = Pe(c), { sheetName: p, unitId: T } = l;
16227
+ const { token: c } = m, l = Te(c), { sheetName: p, unitId: T } = l;
16229
16228
  let L = l.range;
16230
16229
  L.startAbsoluteRefType === je.ALL && L.endAbsoluteRefType === je.ALL || (L = qt(L, a, i), o.push({
16231
16230
  unitId: T,
@@ -16242,7 +16241,7 @@ let Ht = class extends z {
16242
16241
  transformFormulaByEffectCommand(n, e, a, i) {
16243
16242
  const r = this._lexerTreeBuilder.sequenceNodesBuilder(a), o = this._univerInstanceService.getCurrentUnitForType(j.UNIVER_SHEET), u = o.getActiveSheet(), f = o.getUnitId(), m = u.getSheetId(), c = r == null ? void 0 : r.map((l) => {
16244
16243
  if (typeof l == "object" && l.nodeType === ie.REFERENCE) {
16245
- const p = Pe(l.token), { range: T, unitId: L, sheetName: I } = p, A = this._univerInstanceService.getUnit(L || n), N = I ? A == null ? void 0 : A.getSheetBySheetName(I) : A == null ? void 0 : A.getSheetBySheetId(e);
16244
+ const p = Te(l.token), { range: T, unitId: L, sheetName: I } = p, A = this._univerInstanceService.getUnit(L || n), N = I ? A == null ? void 0 : A.getSheetBySheetName(I) : A == null ? void 0 : A.getSheetBySheetId(e);
16246
16245
  if (!N)
16247
16246
  throw new Error("Sheet not found");
16248
16247
  const d = A.getUnitId(), S = N.getSheetId();
@@ -16252,7 +16251,7 @@ let Ht = class extends z {
16252
16251
  let P = "";
16253
16252
  if (R) {
16254
16253
  const h = R.startColumn - T.startColumn, M = R.startRow - T.startRow, U = qt(T, h, M);
16255
- L && I ? P = sa(L, I, U) : I ? P = Ze(I, U) : P = Ce(U);
16254
+ L && I ? P = la(L, I, U) : I ? P = Ze(I, U) : P = Ce(U);
16256
16255
  } else
16257
16256
  P = k.REF;
16258
16257
  return {
@@ -16275,7 +16274,7 @@ let Ht = class extends z {
16275
16274
  let S = "";
16276
16275
  if (d) {
16277
16276
  const R = d.startColumn - N.range.startColumn, P = d.startRow - N.range.startRow, h = qt(N.range, R, P);
16278
- N.unitId && N.sheetName ? S = sa(N.unitId, N.sheetName, h) : N.sheetName ? S = Ze(N.sheetName, h) : S = Ce(h);
16277
+ N.unitId && N.sheetName ? S = la(N.unitId, N.sheetName, h) : N.sheetName ? S = Ze(N.sheetName, h) : S = Ce(h);
16279
16278
  } else
16280
16279
  S = k.REF;
16281
16280
  return {
@@ -16289,7 +16288,7 @@ let Ht = class extends z {
16289
16288
  };
16290
16289
  return o == null || o.forEach((m) => {
16291
16290
  if (typeof m == "object" && m.nodeType === ie.REFERENCE) {
16292
- const c = Pe(m.token), { range: l, unitId: p, sheetName: T } = c, L = this._univerInstanceService.getUnit(p || n), I = T ? L == null ? void 0 : L.getSheetBySheetName(T) : L == null ? void 0 : L.getSheetBySheetId(e);
16291
+ const c = Te(m.token), { range: l, unitId: p, sheetName: T } = c, L = this._univerInstanceService.getUnit(p || n), I = T ? L == null ? void 0 : L.getSheetBySheetName(T) : L == null ? void 0 : L.getSheetBySheetId(e);
16293
16292
  if (!I)
16294
16293
  return;
16295
16294
  const A = L.getUnitId(), N = I.getSheetId(), d = {
@@ -16306,7 +16305,7 @@ let Ht = class extends z {
16306
16305
  const r = ye(a) ? this._lexerTreeBuilder.sequenceNodesBuilder(a) : null, o = [];
16307
16306
  return r == null || r.forEach((u) => {
16308
16307
  if (typeof u == "object" && u.nodeType === ie.REFERENCE) {
16309
- const f = Pe(u.token), { range: m, unitId: c, sheetName: l } = f;
16308
+ const f = Te(u.token), { range: m, unitId: c, sheetName: l } = f;
16310
16309
  if (m.startAbsoluteRefType === je.ALL && m.endAbsoluteRefType === je.ALL)
16311
16310
  return;
16312
16311
  const p = this._univerInstanceService.getUnit(c || n), T = l ? p == null ? void 0 : p.getSheetBySheetName(l) : p == null ? void 0 : p.getSheetBySheetId(e);
@@ -16329,7 +16328,7 @@ let Ht = class extends z {
16329
16328
  // eslint-disable-next-line max-lines-per-function
16330
16329
  registerRangeFormula(n, e, a, i, r) {
16331
16330
  const o = new $e(), u = i.map((m) => this._getFormulaDependcy(n, e, m, a)), f = (m) => {
16332
- const c = a[0].startRow, l = a[0].startColumn, p = [{ unitId: n, subUnitId: e, ranges: a }, ...u.flat()], T = [], L = Bn(this._injector, m);
16331
+ const c = a[0].startRow, l = a[0].startColumn, p = [{ unitId: n, subUnitId: e, ranges: a }, ...u.flat()], T = [], L = Fn(this._injector, m);
16333
16332
  for (const { unitId: I, subUnitId: A, ranges: N } of p)
16334
16333
  if (I === L.unitId && A === L.subUnitId) {
16335
16334
  const d = [], S = N[0].startRow, R = N[0].startColumn, P = S - c, h = R - l;
@@ -16351,12 +16350,12 @@ let Ht = class extends z {
16351
16350
  A.sort((P, h) => P.startRow - h.startRow || P.startColumn - h.startColumn);
16352
16351
  const N = /* @__PURE__ */ new Map();
16353
16352
  for (let P = 0; P < I.length; P++) {
16354
- const h = I[P], M = h.startRow, U = h.startColumn, q = M - c, x = U - l, F = vn(h, m).sort((Z, oe) => Z.startRow - oe.startRow || Z.startColumn - oe.startColumn);
16353
+ const h = I[P], M = h.startRow, U = h.startColumn, q = M - c, x = U - l, F = Bn(h, m).sort((Z, oe) => Z.startRow - oe.startRow || Z.startColumn - oe.startColumn);
16355
16354
  if (!F.length)
16356
16355
  continue;
16357
16356
  const B = F[0].startRow, ae = F[0].startColumn, O = B - c, ce = ae - l, ne = [];
16358
16357
  for (let Z = 0; Z < i.length; Z++) {
16359
- const oe = i[Z], ue = ye(oe), Fe = ue ? this._lexerTreeBuilder.moveFormulaRefOffset(oe, x, q) : oe, J = ue ? this.transformFormulaByEffectCommand(n, e, Fe, m) : Fe, Nt = Ea(this._lexerTreeBuilder, J, -ce, -O);
16358
+ const oe = i[Z], ue = ye(oe), Fe = ue ? this._lexerTreeBuilder.moveFormulaRefOffset(oe, x, q) : oe, J = ue ? this.transformFormulaByEffectCommand(n, e, Fe, m) : Fe, Nt = Ta(this._lexerTreeBuilder, J, -ce, -O);
16360
16359
  ne.push({
16361
16360
  newFormula: J,
16362
16361
  orginFormula: Nt
@@ -16369,7 +16368,7 @@ let Ht = class extends z {
16369
16368
  };
16370
16369
  N.has(le.key) ? N.get(le.key).push(le) : N.set(le.key, [le]);
16371
16370
  }
16372
- const d = i.map((P) => Ea(this._lexerTreeBuilder, P, 0, 0)).join("_");
16371
+ const d = i.map((P) => Ta(this._lexerTreeBuilder, P, 0, 0)).join("_");
16373
16372
  if (A.length > 0) {
16374
16373
  const P = A[0].startRow, h = A[0].startColumn, M = [];
16375
16374
  for (let q = 0; q < i.length; q++) {
@@ -16415,51 +16414,51 @@ let Ht = class extends z {
16415
16414
  }), o;
16416
16415
  }
16417
16416
  };
16418
- Ht = zr([
16419
- Xe(0, H(Fn)),
16417
+ Ht = Jr([
16418
+ Xe(0, H(Un)),
16420
16419
  Xe(1, H(Pt)),
16421
- Xe(2, Ee),
16420
+ Xe(2, Ie),
16422
16421
  Xe(3, H(st))
16423
16422
  ], Ht);
16424
- var Zr = Object.getOwnPropertyDescriptor, Jr = (n, e, a, i) => {
16425
- for (var r = i > 1 ? void 0 : i ? Zr(e, a) : e, o = n.length - 1, u; o >= 0; o--)
16423
+ var eo = Object.getOwnPropertyDescriptor, to = (n, e, a, i) => {
16424
+ for (var r = i > 1 ? void 0 : i ? eo(e, a) : e, o = n.length - 1, u; o >= 0; o--)
16426
16425
  (u = n[o]) && (r = u(r) || r);
16427
16426
  return r;
16428
- }, eo = (n, e) => (a, i) => e(a, i, n);
16429
- const $t = "sheets-formula.remote-register-function.service", Za = Kt($t);
16427
+ }, ao = (n, e) => (a, i) => e(a, i, n);
16428
+ const $t = "sheets-formula.remote-register-function.service", za = Kt($t);
16430
16429
  let mt = class {
16431
16430
  constructor(n) {
16432
16431
  this._functionService = n;
16433
16432
  }
16434
16433
  async registerFunctions(n) {
16435
- const e = n.map(([a, i]) => to(a, i));
16434
+ const e = n.map(([a, i]) => no(a, i));
16436
16435
  this._functionService.registerExecutors(...e);
16437
16436
  }
16438
16437
  async registerAsyncFunctions(n) {
16439
- const e = n.map(([a, i]) => ao(a, i));
16438
+ const e = n.map(([a, i]) => io(a, i));
16440
16439
  this._functionService.registerExecutors(...e);
16441
16440
  }
16442
16441
  async unregisterFunctions(n) {
16443
16442
  this._functionService.unregisterExecutors(...n), this._functionService.unregisterDescriptions(...n), this._functionService.deleteFormulaAstCacheKey(...n);
16444
16443
  }
16445
16444
  };
16446
- mt = Jr([
16447
- eo(0, Tt)
16445
+ mt = to([
16446
+ ao(0, Tt)
16448
16447
  ], mt);
16449
- function to(n, e) {
16448
+ function no(n, e) {
16450
16449
  const a = new Vt(e), i = new Function(`return ${n}`)();
16451
16450
  return a.calculateCustom = i, a;
16452
16451
  }
16453
- function ao(n, e) {
16454
- const a = new Ya(e), i = new Function(`return ${n}`)();
16452
+ function io(n, e) {
16453
+ const a = new wa(e), i = new Function(`return ${n}`)();
16455
16454
  return a.calculateCustom = i, a;
16456
16455
  }
16457
- var no = Object.getOwnPropertyDescriptor, io = (n, e, a, i) => {
16458
- for (var r = i > 1 ? void 0 : i ? no(e, a) : e, o = n.length - 1, u; o >= 0; o--)
16456
+ var ro = Object.getOwnPropertyDescriptor, oo = (n, e, a, i) => {
16457
+ for (var r = i > 1 ? void 0 : i ? ro(e, a) : e, o = n.length - 1, u; o >= 0; o--)
16459
16458
  (u = n[o]) && (r = u(r) || r);
16460
16459
  return r;
16461
16460
  }, We = (n, e) => (a, i) => e(a, i, n);
16462
- const ro = Kt(
16461
+ const uo = Kt(
16463
16462
  "sheets-formula.register-function-service"
16464
16463
  );
16465
16464
  let wt = class extends z {
@@ -16503,7 +16502,7 @@ let wt = class extends z {
16503
16502
  u.add(this._descriptionService.registerDescriptions([m]));
16504
16503
  } else
16505
16504
  u.add(this._descriptionService.registerDescriptions([i]));
16506
- const f = o ? new Ya(e) : new Vt(e);
16505
+ const f = o ? new wa(e) : new Vt(e);
16507
16506
  return f.calculateCustom = a, this._functionService.registerExecutors(f), u.add(ee(() => this._functionService.unregisterExecutors(e))), u.add(ee(() => this._functionService.unregisterDescriptions(e))), u.add(ee(() => this._functionService.deleteFormulaAstCacheKey(e))), this._remoteRegisterFunctionService && (this._remoteRegisterFunctionService.registerAsyncFunctions([[a.toString(), e]]), u.add(
16508
16507
  ee(() => this._remoteRegisterFunctionService.unregisterFunctions([e]))
16509
16508
  )), u;
@@ -16520,54 +16519,54 @@ let wt = class extends z {
16520
16519
  return this._remoteRegisterFunctionService.registerFunctions(a), ee(() => this._remoteRegisterFunctionService.unregisterFunctions(e));
16521
16520
  }
16522
16521
  };
16523
- wt = io([
16522
+ wt = oo([
16524
16523
  We(0, H(Wt)),
16525
16524
  We(1, H(Et)),
16526
16525
  We(2, Tt),
16527
- We(3, Pn(Za))
16526
+ We(3, Ln(za))
16528
16527
  ], wt);
16529
- var oo = Object.defineProperty, uo = Object.getOwnPropertyDescriptor, mo = (n, e, a) => e in n ? oo(n, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : n[e] = a, Ja = (n, e, a, i) => {
16530
- for (var r = i > 1 ? void 0 : i ? uo(e, a) : e, o = n.length - 1, u; o >= 0; o--)
16528
+ var mo = Object.defineProperty, fo = Object.getOwnPropertyDescriptor, co = (n, e, a) => e in n ? mo(n, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : n[e] = a, Za = (n, e, a, i) => {
16529
+ for (var r = i > 1 ? void 0 : i ? fo(e, a) : e, o = n.length - 1, u; o >= 0; o--)
16531
16530
  (u = n[o]) && (r = u(r) || r);
16532
16531
  return r;
16533
- }, ft = (n, e) => (a, i) => e(a, i, n), It = (n, e, a) => mo(n, typeof e != "symbol" ? e + "" : e, a);
16534
- let ct = class extends Sa {
16535
- constructor(n = Pa, e, a) {
16532
+ }, ft = (n, e) => (a, i) => e(a, i, n), It = (n, e, a) => co(n, typeof e != "symbol" ? e + "" : e, a);
16533
+ let ct = class extends Ra {
16534
+ constructor(n = La, e, a) {
16536
16535
  super(), this._config = n, this._injector = e, this._configService = a;
16537
- const { ...i } = Aa(
16536
+ const { ...i } = Sa(
16538
16537
  {},
16539
- Pa,
16538
+ La,
16540
16539
  this._config
16541
16540
  );
16542
- this._configService.setConfig(Ai, i);
16541
+ this._configService.setConfig(Di, i);
16543
16542
  }
16544
16543
  onStarting() {
16545
- this._injector.add([mt]), this._injector.get(Ka).registerChannel(
16544
+ this._injector.add([mt]), this._injector.get(Wa).registerChannel(
16546
16545
  $t,
16547
- Ii(this._injector.get(mt))
16546
+ Ri(this._injector.get(mt))
16548
16547
  );
16549
16548
  }
16550
16549
  };
16551
16550
  It(ct, "pluginName", "SHEET_FORMULA_REMOTE_PLUGIN");
16552
16551
  It(ct, "type", j.UNIVER_SHEET);
16553
- ct = Ja([
16554
- Ra(Xa),
16552
+ ct = Za([
16553
+ Na(Ya),
16555
16554
  ft(1, H(st)),
16556
16555
  ft(2, be)
16557
16556
  ], ct);
16558
- let lt = class extends Sa {
16559
- constructor(n = La, e, a) {
16557
+ let lt = class extends Ra {
16558
+ constructor(n = pa, e, a) {
16560
16559
  super(), this._config = n, this._injector = e, this._configService = a;
16561
- const { ...i } = Aa(
16560
+ const { ...i } = Sa(
16562
16561
  {},
16563
- La,
16562
+ pa,
16564
16563
  this._config
16565
16564
  );
16566
16565
  this._configService.setConfig(Ue, i, { merge: !0 });
16567
16566
  }
16568
16567
  onStarting() {
16569
16568
  const n = this._injector, e = [
16570
- [ro, { useClass: wt }],
16569
+ [uo, { useClass: wt }],
16571
16570
  [Et, { useClass: Gt }],
16572
16571
  [ot],
16573
16572
  [Ht],
@@ -16582,9 +16581,9 @@ let lt = class extends Sa {
16582
16581
  [ut]
16583
16582
  ];
16584
16583
  if (this._config.notExecuteFormula) {
16585
- const a = n.get(Ka);
16586
- e.push([Za, {
16587
- useFactory: () => Ni(a.requestChannel($t))
16584
+ const a = n.get(Wa);
16585
+ e.push([za, {
16586
+ useFactory: () => Si(a.requestChannel($t))
16588
16587
  }]);
16589
16588
  }
16590
16589
  e.forEach((a) => n.add(a));
@@ -16610,15 +16609,15 @@ let lt = class extends Sa {
16610
16609
  ]);
16611
16610
  }
16612
16611
  };
16613
- It(lt, "pluginName", Ir);
16612
+ It(lt, "pluginName", Rr);
16614
16613
  It(lt, "type", j.UNIVER_SHEET);
16615
- lt = Ja([
16616
- Ra(Xa, Vn),
16614
+ lt = Za([
16615
+ Na(Ya, vn),
16617
16616
  ft(1, H(st)),
16618
16617
  ft(2, be)
16619
16618
  ], lt);
16620
- function Po(n, e, a, i) {
16621
- const r = n.get(li), o = n.get(si), u = n.get(di), f = n.get(pi);
16619
+ function Eo(n, e, a, i) {
16620
+ const r = n.get(di), o = n.get(pi), u = n.get(Li), f = n.get(Pi);
16622
16621
  r.load({
16623
16622
  formulaData: {},
16624
16623
  arrayFormulaCellData: {},
@@ -16634,21 +16633,21 @@ function Po(n, e, a, i) {
16634
16633
  },
16635
16634
  dirtyUnitOtherFormulaMap: {}
16636
16635
  });
16637
- const m = o.treeBuilder(e), c = u.parse(m), l = f.execute(Li(c));
16638
- return Pi(l);
16636
+ const m = o.treeBuilder(e), c = u.parse(m), l = f.execute(Ti(c));
16637
+ return Ei(l);
16639
16638
  }
16640
16639
  export {
16641
- Te as CalculationMode,
16640
+ Ee as CalculationMode,
16642
16641
  Gt as DescriptionService,
16643
16642
  Ht as FormulaRefRangeService,
16644
16643
  Et as IDescriptionService,
16645
- ro as IRegisterFunctionService,
16646
- Za as IRemoteRegisterFunctionService,
16644
+ uo as IRegisterFunctionService,
16645
+ za as IRemoteRegisterFunctionService,
16647
16646
  Je as ImageFormulaCellInterceptorController,
16648
- Ri as InsertFunctionCommand,
16647
+ Ai as InsertFunctionCommand,
16649
16648
  _e as OtherFormulaMarkDirty,
16650
16649
  Ue as PLUGIN_CONFIG_KEY_BASE,
16651
- Si as QuickSumCommand,
16650
+ Ci as QuickSumCommand,
16652
16651
  wt as RegisterFunctionService,
16653
16652
  et as RegisterOtherFormulaService,
16654
16653
  mt as RemoteRegisterFunctionService,
@@ -16657,5 +16656,5 @@ export {
16657
16656
  lt as UniverSheetsFormulaPlugin,
16658
16657
  tt as UpdateDefinedNameController,
16659
16658
  at as UpdateFormulaController,
16660
- Po as calculateFormula
16659
+ Eo as calculateFormula
16661
16660
  };