@univerjs/sheets-formula 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1,26 +1,26 @@
1
- var Ka = Object.defineProperty;
2
- var ka = (a, e, n) => e in a ? Ka(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n;
3
- var W = (a, e, n) => ka(a, typeof e != "symbol" ? e + "" : e, n);
4
- import { CommandType as yt, ICommandService as fe, ObjectMatrix as G, generateRandomId as da, IUniverInstanceService as Se, Rectangle as me, sequenceExecuteAsync as Qa, Inject as X, LifecycleService as $a, Disposable as ne, ILogService as ja, IConfigService as Ae, LocaleService as qt, isFormulaString as Me, isFormulaId as pa, cellToRange as La, Tools as Xe, Direction as Ke, getIntersectRange as We, RANGE_TYPE as Y, UniverInstanceType as ae, Injector as ut, InterceptorEffectEnum as za, CellValueType as wt, isRealNum as Za, createIdentifier as gt, toDisposable as oe, moveRangeByOffset as St, DisposableCollection as ke, AbsoluteRefType as Qe, Optional as Ja, DependentOn as Pa, Plugin as Ta, merge as Ea, touchDependencies as Fe, isNodeEnv as Yt } from "@univerjs/core";
5
- import { SetRangeValuesCommand as Ia, SheetsSelectionsService as en, getSheetCommandTarget as tn, findFirstNonEmptyCell as an, alignToMergedCellsBorders as st, expandToContinuousRange as nn, SetSelectionsOperation as rn, SetRangeValuesMutation as z, SetStyleCommand as ht, SetBorderCommand as Na, ClearSelectionFormatCommand as Ra, handleMoveCols as Sa, EffectRefRangId as H, runRefRangeMutations as w, handleMoveRows as Aa, handleMoveRange as Ca, handleInsertRangeMoveRight as Da, handleInsertRangeMoveDown as ba, handleDeleteRangeMoveUp as Oa, handleDeleteRangeMoveLeft as Ma, handleIRemoveCol as xa, handleIRemoveRow as _a, handleInsertCol as ya, handleInsertRow as qa, RemoveDefinedNameCommand as ga, SetDefinedNameCommand as ha, RemoveSheetCommand as on, SetWorksheetNameCommand as un, DeleteRangeMoveLeftCommand as mn, DeleteRangeMoveUpCommand as fn, RemoveColCommand as cn, RemoveRowCommand as ln, InsertRangeMoveDownCommand as sn, InsertRangeMoveRightCommand as dn, InsertColCommand as pn, InsertRowCommand as Ln, MoveColsCommand as Pn, MoveRowsCommand as Tn, MoveRangeCommand as En, SheetInterceptorService as Ut, RemoveSheetMutation as At, InsertSheetMutation as Ct, MoveRangeMutation as Xt, MoveRowsMutation as Wt, MoveColsMutation as Kt, ReorderRangeMutation as kt, RemoveRowMutation as Qt, RemoveColMutation as $t, InsertColMutation as jt, InsertRowMutation as zt, SetRowHiddenMutation as Zt, SetRowVisibleMutation as Jt, INTERCEPTOR_POINT as In, SetWorksheetActiveOperation as Nn, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as dt, RefRangeService as Rn, handleDefaultRangeChangeWithEffectRefCommands as ea, getSeparateEffectedRangesOnCommand as Sn, handleCommonDefaultRangeChangeWithEffectRefCommands as An, UniverSheetsPlugin as Cn } from "@univerjs/sheets";
6
- import { serializeRange as _e, IActiveDirtyManagerService as Ft, SetFormulaCalculationResultMutation as Dn, RemoveOtherFormulaMutation as bn, SetOtherFormulaMutation as On, FormulaDataModel as mt, SetFormulaCalculationStartMutation as Ee, SetFormulaCalculationStopMutation as ta, ENGINE_FORMULA_CYCLE_REFERENCE_COUNT as aa, SetFormulaCalculationNotificationMutation as Mn, FormulaExecuteStageType as Be, FormulaExecutedStateType as De, sequenceNodeType as te, deserializeRangeWithSheetWithCache as Le, serializeRangeToRefString as ft, ErrorType as Q, IDefinedNamesService as Bt, LexerTreeBuilder as vt, generateStringWithSequence as $e, SetDefinedNameMutation as ye, SetFormulaDataMutation as ve, SetArrayFormulaDataMutation as Dt, initSheetFormulaData as na, RemoveDefinedNameMutation as bt, stripErrorMargin as xn, FunctionType as t, FUNCTION_NAMES_ARRAY as ia, FUNCTION_NAMES_COMPATIBILITY as x, FUNCTION_NAMES_CUBE as de, FUNCTION_NAMES_DATABASE as k, FUNCTION_NAMES_DATE as v, FUNCTION_NAMES_ENGINEERING as C, FUNCTION_NAMES_FINANCIAL as D, FUNCTION_NAMES_INFORMATION as V, FUNCTION_NAMES_LOGICAL as K, FUNCTION_NAMES_LOOKUP as y, FUNCTION_NAMES_MATH as T, FUNCTION_NAMES_STATISTICAL as l, FUNCTION_NAMES_TEXT as b, FUNCTION_NAMES_WEB as pt, IFunctionService as Vt, isReferenceStrings as _n, functionArray as yn, functionCompatibility as qn, functionCube as gn, functionDatabase as hn, functionDate as Un, functionEngineering as Fn, functionFinancial as Bn, functionInformation as vn, functionLogical as Vn, functionLookup as Gn, functionMath as Hn, functionMeta as wn, functionStatistical as Yn, functionText as Xn, functionUniver as Wn, functionWeb as Kn, serializeRangeWithSpreadsheet as ra, serializeRangeWithSheet as oa, CustomFunction as Ot, AsyncCustomFunction as Ua, UniverFormulaEnginePlugin as Fa, IFormulaCurrentConfigService as kn, Lexer as Qn, AstTreeBuilder as $n, Interpreter as jn, generateExecuteAstNodeData as zn, getObjectValue as Zn } from "@univerjs/engine-formula";
7
- import { Subject as ua, BehaviorSubject as Ba, bufferWhen as Jn, filter as ma, map as ei } from "rxjs";
8
- import { IRPCChannelService as va, fromModule as ti, toModule as ai } from "@univerjs/rpc";
9
- const ni = {
1
+ var ja = Object.defineProperty;
2
+ var za = (a, e, n) => e in a ? ja(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n;
3
+ var W = (a, e, n) => za(a, typeof e != "symbol" ? e + "" : e, n);
4
+ import { CommandType as vt, ICommandService as ue, ObjectMatrix as V, generateRandomId as La, IUniverInstanceService as Ee, Rectangle as fe, sequenceExecuteAsync as Za, Inject as X, LifecycleService as Ja, Disposable as ee, ILogService as en, IConfigService as be, LocaleService as Vt, isFormulaString as ye, isFormulaId as Pa, cellToRange as Ta, Tools as We, Direction as ke, getIntersectRange as Ke, RANGE_TYPE as Y, UniverInstanceType as j, Injector as ct, InterceptorEffectEnum as tn, CellValueType as Wt, isRealNum as an, createIdentifier as Gt, toDisposable as J, moveRangeByOffset as xt, DisposableCollection as Qe, AbsoluteRefType as $e, Optional as nn, DependentOn as Ea, Plugin as Ia, merge as Na, touchDependencies as Be, isNodeEnv as Kt } from "@univerjs/core";
5
+ import { SetRangeValuesCommand as Ra, SheetsSelectionsService as rn, getSheetCommandTarget as on, findFirstNonEmptyCell as un, alignToMergedCellsBorders as It, expandToContinuousRange as mn, SetSelectionsOperation as fn, SetRangeValuesMutation as k, SetStyleCommand as Ht, SetBorderCommand as Sa, ClearSelectionFormatCommand as Aa, handleMoveCols as Ca, EffectRefRangId as H, runRefRangeMutations as w, handleMoveRows as Da, handleMoveRange as ba, handleInsertRangeMoveRight as Oa, handleInsertRangeMoveDown as Ma, handleDeleteRangeMoveUp as xa, handleDeleteRangeMoveLeft as _a, handleIRemoveCol as ya, handleIRemoveRow as qa, handleInsertCol as ga, handleInsertRow as ha, RemoveDefinedNameCommand as Ua, SetDefinedNameCommand as Fa, RemoveSheetCommand as cn, SetWorksheetNameCommand as ln, DeleteRangeMoveLeftCommand as sn, DeleteRangeMoveUpCommand as dn, RemoveColCommand as pn, RemoveRowCommand as Ln, InsertRangeMoveDownCommand as Pn, InsertRangeMoveRightCommand as Tn, InsertColCommand as En, InsertRowCommand as In, MoveColsCommand as Nn, MoveRowsCommand as Rn, MoveRangeCommand as Sn, SheetInterceptorService as wt, RemoveSheetMutation as _t, InsertSheetMutation as yt, MoveRangeMutation as kt, MoveRowsMutation as Qt, MoveColsMutation as $t, ReorderRangeMutation as jt, RemoveRowMutation as zt, RemoveColMutation as Zt, InsertColMutation as Jt, InsertRowMutation as ea, SetRowHiddenMutation as ta, SetRowVisibleMutation as aa, INTERCEPTOR_POINT as An, SetWorksheetActiveOperation as Ba, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as Nt, RefRangeService as Cn, handleDefaultRangeChangeWithEffectRefCommands as na, getSeparateEffectedRangesOnCommand as Dn, handleCommonDefaultRangeChangeWithEffectRefCommands as bn, UniverSheetsPlugin as On } from "@univerjs/sheets";
6
+ import { serializeRange as Ce, IActiveDirtyManagerService as Yt, SetFormulaCalculationResultMutation as va, RemoveOtherFormulaMutation as Mn, SetOtherFormulaMutation as xn, FormulaDataModel as lt, SetFormulaCalculationStartMutation as Ne, SetFormulaCalculationStopMutation as ia, ENGINE_FORMULA_CYCLE_REFERENCE_COUNT as ra, SetFormulaCalculationNotificationMutation as _n, FormulaExecuteStageType as ve, FormulaExecutedStateType as Me, sequenceNodeType as ie, deserializeRangeWithSheetWithCache as Pe, serializeRangeToRefString as st, ErrorType as $, IDefinedNamesService as dt, LexerTreeBuilder as pt, generateStringWithSequence as je, SetDefinedNameMutation as De, SetFormulaDataMutation as Ve, SetArrayFormulaDataMutation as qt, initSheetFormulaData as oa, RemoveDefinedNameMutation as gt, IFunctionService as Lt, stripErrorMargin as yn, FunctionType as t, FUNCTION_NAMES_ARRAY as ua, FUNCTION_NAMES_COMPATIBILITY as x, FUNCTION_NAMES_CUBE as de, FUNCTION_NAMES_DATABASE as Q, 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 y, FUNCTION_NAMES_MATH as T, FUNCTION_NAMES_STATISTICAL as l, FUNCTION_NAMES_TEXT as b, FUNCTION_NAMES_WEB as Rt, isReferenceStrings as qn, functionArray as gn, functionCompatibility as hn, functionCube as Un, functionDatabase as Fn, functionDate as Bn, functionEngineering as vn, functionFinancial as Vn, functionInformation as Gn, functionLogical as Hn, functionLookup as wn, functionMath as Yn, functionMeta as Xn, functionStatistical as Wn, functionText as Kn, functionUniver as kn, functionWeb as Qn, SetSuperTableMutation as $n, RemoveSuperTableMutation as jn, serializeRangeWithSheet as ze, ISuperTableService as zn, serializeRangeWithSpreadsheet as ma, CustomFunction as ht, AsyncCustomFunction as Va, UniverFormulaEnginePlugin as Ga, IFormulaCurrentConfigService as Zn, Lexer as Jn, AstTreeBuilder as ei, Interpreter as ti, generateExecuteAstNodeData as ai, getObjectValue as ni } from "@univerjs/engine-formula";
7
+ import { Subject as fa, BehaviorSubject as Ha, bufferWhen as ii, filter as ca, map as ri } from "rxjs";
8
+ import { IRPCChannelService as wa, fromModule as oi, toModule as ui } from "@univerjs/rpc";
9
+ const mi = {
10
10
  id: "formula.command.insert-function",
11
- type: yt.COMMAND,
11
+ type: vt.COMMAND,
12
12
  handler: async (a, e) => {
13
- const { list: n, listOfRangeHasNumber: i } = e, r = a.get(fe), o = new G();
13
+ const { list: n, listOfRangeHasNumber: i } = e, r = a.get(ue), o = new V();
14
14
  n.forEach((f) => {
15
- const { range: m, primary: c, formula: d } = f, { row: P, column: E } = c, p = da(6);
16
- o.setValue(P, E, {
17
- f: d,
15
+ const { range: m, primary: c, formula: s } = f, { row: L, column: E } = c, p = La(6);
16
+ o.setValue(L, E, {
17
+ f: s,
18
18
  si: p
19
19
  });
20
- const { startRow: I, startColumn: S, endRow: R, endColumn: s } = m;
20
+ const { startRow: I, startColumn: S, endRow: R, endColumn: d } = m;
21
21
  for (let A = I; A <= R; A++)
22
- for (let N = S; N <= s; N++)
23
- (A !== P || N !== E) && o.setValue(A, N, {
22
+ for (let N = S; N <= d; N++)
23
+ (A !== L || N !== E) && o.setValue(A, N, {
24
24
  si: p
25
25
  });
26
26
  }), i && i.length > 0 && i.forEach((f) => {
@@ -32,104 +32,104 @@ const ni = {
32
32
  const u = {
33
33
  value: o.getData()
34
34
  };
35
- return r.executeCommand(Ia.id, u);
35
+ return r.executeCommand(Ra.id, u);
36
36
  }
37
- }, ii = {
37
+ }, fi = {
38
38
  id: "sheets-formula.command.quick-sum",
39
- type: yt.COMMAND,
39
+ type: vt.COMMAND,
40
40
  handler: async (a) => {
41
- const n = a.get(en).getCurrentLastSelection();
41
+ const n = a.get(rn).getCurrentLastSelection();
42
42
  if (!n) return !1;
43
- const i = a.get(Se), r = tn(i);
43
+ const i = a.get(Ee), r = on(i);
44
44
  if (!r) return !1;
45
45
  const o = n.range, { worksheet: u } = r;
46
- let f = an(o, u);
46
+ let f = un(o, u);
47
47
  if (!f) return !1;
48
- f = st(f, u);
49
- const m = nn({
48
+ f = It(f, u);
49
+ const m = mn({
50
50
  startRow: f.startRow,
51
51
  startColumn: f.startColumn,
52
52
  endRow: o.endRow,
53
53
  endColumn: o.endColumn
54
- }, { left: !0, right: !0, up: !0, down: !0 }, u), c = new G(), d = st({
54
+ }, { left: !0, right: !0, up: !0, down: !0 }, u), c = new V(), s = It({
55
55
  startRow: m.endRow,
56
56
  endRow: m.endRow,
57
57
  startColumn: m.startColumn,
58
58
  endColumn: m.endColumn
59
59
  }, u);
60
- if (!me.equals(d, m))
61
- for (const p of u.iterateByColumn(d))
60
+ if (!fe.equals(s, m))
61
+ for (const p of u.iterateByColumn(s))
62
62
  (!p.value || !u.cellHasValue(p.value)) && c.setValue(p.row, p.col, {
63
- f: `=SUM(${_e({
63
+ f: `=SUM(${Ce({
64
64
  startColumn: p.col,
65
65
  endColumn: p.col,
66
66
  startRow: m.startRow,
67
67
  endRow: p.row - 1
68
68
  })})`
69
69
  });
70
- const P = st({
70
+ const L = It({
71
71
  startRow: m.startRow,
72
72
  startColumn: m.endColumn,
73
73
  endRow: m.endRow,
74
74
  endColumn: m.endColumn
75
75
  }, u);
76
- if (!me.equals(P, m))
77
- for (const p of u.iterateByRow(P))
76
+ if (!fe.equals(L, m))
77
+ for (const p of u.iterateByRow(L))
78
78
  (!p.value || !u.cellHasValue(p.value)) && c.setValue(p.row, p.col, {
79
- f: `=SUM(${_e({
79
+ f: `=SUM(${Ce({
80
80
  startColumn: m.startColumn,
81
81
  endColumn: p.col - 1,
82
82
  startRow: p.row,
83
83
  endRow: p.row
84
84
  })})`
85
85
  });
86
- const E = a.get(fe);
87
- return (await Qa([
86
+ const E = a.get(ue);
87
+ return (await Za([
88
88
  {
89
- id: Ia.id,
89
+ id: Ra.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: fn.id,
97
97
  params: {
98
98
  unitId: r.unitId,
99
99
  subUnitId: r.subUnitId,
100
100
  selections: [{
101
101
  range: m,
102
- primary: me.contains(m, n.primary) ? n.primary : { ...f, actualRow: f.startRow, actualColumn: f.startColumn },
102
+ primary: fe.contains(m, n.primary) ? n.primary : { ...f, actualRow: f.startRow, actualColumn: f.startColumn },
103
103
  style: null
104
104
  }]
105
105
  }
106
106
  }
107
107
  ], E)).result;
108
108
  }
109
- }, Oe = {
110
- type: yt.MUTATION,
109
+ }, _e = {
110
+ type: vt.MUTATION,
111
111
  id: "sheet.mutation.data-validation-formula-mark-dirty",
112
112
  handler() {
113
113
  return !0;
114
114
  }
115
- }, ge = "sheets-formula.base.config";
116
- var Pe = /* @__PURE__ */ ((a) => (a[a.FORCED = 0] = "FORCED", a[a.WHEN_EMPTY = 1] = "WHEN_EMPTY", a[a.NO_CALCULATION = 2] = "NO_CALCULATION", a))(Pe || {});
117
- const fa = {}, ri = "sheets-formula.remote.config", ca = {};
118
- var Ie = /* @__PURE__ */ ((a) => (a[a.NOT_REGISTER = 1] = "NOT_REGISTER", a[a.SUCCESS = 2] = "SUCCESS", a[a.WAIT = 3] = "WAIT", a[a.ERROR = 4] = "ERROR", a))(Ie || {}), oi = Object.getOwnPropertyDescriptor, ui = (a, e, n, i) => {
119
- for (var r = i > 1 ? void 0 : i ? oi(e, n) : e, o = a.length - 1, u; o >= 0; o--)
115
+ }, he = "sheets-formula.base.config";
116
+ var Te = /* @__PURE__ */ ((a) => (a[a.FORCED = 0] = "FORCED", a[a.WHEN_EMPTY = 1] = "WHEN_EMPTY", a[a.NO_CALCULATION = 2] = "NO_CALCULATION", a))(Te || {});
117
+ const la = {}, ci = "sheets-formula.remote.config", sa = {};
118
+ var Re = /* @__PURE__ */ ((a) => (a[a.NOT_REGISTER = 1] = "NOT_REGISTER", a[a.SUCCESS = 2] = "SUCCESS", a[a.WAIT = 3] = "WAIT", a[a.ERROR = 4] = "ERROR", a))(Re || {}), li = Object.getOwnPropertyDescriptor, si = (a, e, n, i) => {
119
+ for (var r = i > 1 ? void 0 : i ? li(e, n) : e, o = a.length - 1, u; o >= 0; o--)
120
120
  (u = a[o]) && (r = u(r) || r);
121
121
  return r;
122
- }, Lt = (a, e) => (n, i) => e(n, i, a);
123
- let je = class extends ne {
122
+ }, St = (a, e) => (n, i) => e(n, i, a);
123
+ let Ze = class extends ee {
124
124
  constructor(e, n, i) {
125
125
  super();
126
126
  W(this, "_formulaCacheMap", /* @__PURE__ */ new Map());
127
- W(this, "_formulaChangeWithRange$", new ua());
127
+ W(this, "_formulaChangeWithRange$", new fa());
128
128
  W(this, "formulaChangeWithRange$", this._formulaChangeWithRange$.asObservable());
129
129
  // FIXME: this design could be improved.
130
- W(this, "_formulaResult$", new ua());
130
+ W(this, "_formulaResult$", new fa());
131
131
  W(this, "formulaResult$", this._formulaResult$.asObservable());
132
- W(this, "calculateStarted$", new Ba(!1));
132
+ W(this, "calculateStarted$", new Ha(!1));
133
133
  this._commandService = e, this._activeDirtyManagerService = n, this._lifecycleService = i, this._initFormulaRegister(), this._initFormulaCalculationResultChange();
134
134
  }
135
135
  dispose() {
@@ -142,13 +142,13 @@ let je = class extends ne {
142
142
  return r || (r = /* @__PURE__ */ new Map(), i.set(n, r)), r;
143
143
  }
144
144
  _createFormulaId(e, n) {
145
- return `formula.${e}_${n}_${da(8)}`;
145
+ return `formula.${e}_${n}_${La(8)}`;
146
146
  }
147
147
  _initFormulaRegister() {
148
148
  this._activeDirtyManagerService.register(
149
- Oe.id,
149
+ _e.id,
150
150
  {
151
- commandId: Oe.id,
151
+ commandId: _e.id,
152
152
  getDirtyData(n) {
153
153
  return {
154
154
  dirtyUnitOtherFormulaMap: n.params
@@ -170,42 +170,42 @@ let je = class extends ne {
170
170
  }
171
171
  }
172
172
  };
173
- this._commandService.executeCommand(On.id, c).then(() => {
173
+ this._commandService.executeCommand(xn.id, c).then(() => {
174
174
  this._commandService.executeCommand(
175
- Oe.id,
175
+ _e.id,
176
176
  { [i]: { [r]: { [u]: !0 } } }
177
177
  );
178
178
  });
179
179
  };
180
180
  this.disposeWithMe(
181
- this._formulaChangeWithRange$.pipe(Jn(() => this.calculateStarted$.pipe(ma((n) => n)))).subscribe((n) => n.forEach(e))
181
+ this._formulaChangeWithRange$.pipe(ii(() => this.calculateStarted$.pipe(ca((n) => n)))).subscribe((n) => n.forEach(e))
182
182
  ), this.disposeWithMe(
183
- this._formulaChangeWithRange$.pipe(ma(() => this.calculateStarted$.getValue())).subscribe(e)
183
+ this._formulaChangeWithRange$.pipe(ca(() => this.calculateStarted$.getValue())).subscribe(e)
184
184
  );
185
185
  }
186
186
  _initFormulaCalculationResultChange() {
187
187
  this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
188
- if (e.id === Dn.id) {
188
+ if (e.id === va.id) {
189
189
  const n = e.params, { unitOtherData: i } = n, r = {};
190
190
  for (const o in i) {
191
191
  const u = i[o], f = {};
192
192
  r[o] = f;
193
193
  for (const m in u) {
194
- const c = this._ensureCacheMap(o, m), d = u[m], P = [];
195
- f[m] = P;
196
- for (const E in d) {
197
- const p = d[E];
194
+ const c = this._ensureCacheMap(o, m), s = u[m], L = [];
195
+ f[m] = L;
196
+ for (const E in s) {
197
+ const p = s[E];
198
198
  if (c.has(E)) {
199
199
  const I = c.get(E);
200
200
  if (!I)
201
201
  continue;
202
202
  I.result || (I.result = {});
203
- const S = new G(p), R = new G(I.result);
204
- S.forValue((s, A, N) => {
205
- R.setValue(s, A, N);
206
- }), I.status = Ie.SUCCESS, I.callbacks.forEach((s) => {
207
- s(p);
208
- }), I.callbacks.clear(), P.push(I);
203
+ const S = new V(p), R = new V(I.result);
204
+ S.forValue((d, A, N) => {
205
+ R.setValue(d, A, N);
206
+ }), I.status = Re.SUCCESS, I.callbacks.forEach((d) => {
207
+ d(p);
208
+ }), I.callbacks.clear(), L.push(I);
209
209
  }
210
210
  }
211
211
  }
@@ -218,7 +218,7 @@ let je = class extends ne {
218
218
  const u = this._createFormulaId(e, n);
219
219
  return this._ensureCacheMap(e, n).set(u, {
220
220
  result: void 0,
221
- status: Ie.WAIT,
221
+ status: Re.WAIT,
222
222
  formulaId: u,
223
223
  callbacks: /* @__PURE__ */ new Set(),
224
224
  extra: o
@@ -236,13 +236,13 @@ let je = class extends ne {
236
236
  subUnitId: n,
237
237
  formulaIdList: i
238
238
  };
239
- this._commandService.executeCommand(bn.id, r);
239
+ this._commandService.executeCommand(Mn.id, r);
240
240
  const o = this._ensureCacheMap(e, n);
241
241
  i.forEach((u) => o.delete(u));
242
242
  }
243
243
  getFormulaValue(e, n, i) {
244
244
  const r = this._ensureCacheMap(e, n), o = r.get(i);
245
- return o ? o.status === Ie.SUCCESS || o.status === Ie.ERROR ? Promise.resolve(o) : new Promise((u) => {
245
+ return o ? o.status === Re.SUCCESS || o.status === Re.ERROR ? Promise.resolve(o) : new Promise((u) => {
246
246
  o.callbacks.add(() => {
247
247
  u(r.get(i));
248
248
  });
@@ -253,24 +253,24 @@ let je = class extends ne {
253
253
  }
254
254
  markFormulaDirty(e, n, i) {
255
255
  const r = this.getFormulaValueSync(e, n, i);
256
- r && (r.status = Ie.WAIT, this._commandService.executeCommand(
257
- Oe.id,
256
+ r && (r.status = Re.WAIT, this._commandService.executeCommand(
257
+ _e.id,
258
258
  { [e]: { [n]: { [i]: !0 } } }
259
259
  ));
260
260
  }
261
261
  };
262
- je = ui([
263
- Lt(0, fe),
264
- Lt(1, Ft),
265
- Lt(2, X($a))
266
- ], je);
267
- var mi = Object.getOwnPropertyDescriptor, fi = (a, e, n, i) => {
268
- for (var r = i > 1 ? void 0 : i ? mi(e, n) : e, o = a.length - 1, u; o >= 0; o--)
262
+ Ze = si([
263
+ St(0, ue),
264
+ St(1, Yt),
265
+ St(2, X(Ja))
266
+ ], Ze);
267
+ var di = Object.getOwnPropertyDescriptor, pi = (a, e, n, i) => {
268
+ for (var r = i > 1 ? void 0 : i ? di(e, n) : e, o = a.length - 1, u; o >= 0; o--)
269
269
  (u = a[o]) && (r = u(r) || r);
270
270
  return r;
271
271
  }, pe = (a, e) => (n, i) => e(n, i, a);
272
- const la = { done: 0, count: 0 }, Pt = { onlyLocal: !0 };
273
- let xe = class extends ne {
272
+ const da = { done: 0, count: 0 }, At = { onlyLocal: !0 };
273
+ let qe = class extends ee {
274
274
  constructor(e, n, i, r, o, u, f) {
275
275
  super();
276
276
  W(this, "_waitingCommandQueue", []);
@@ -293,7 +293,7 @@ let xe = class extends ne {
293
293
  * The mark of forced calculation. If a new mutation triggers dirty area calculation during the forced calculation process, forced calculation is still required.
294
294
  */
295
295
  W(this, "_forceCalculating", !1);
296
- W(this, "_progress$", new Ba(la));
296
+ W(this, "_progress$", new Ha(da));
297
297
  W(this, "progress$", this._progress$.asObservable());
298
298
  this._commandService = e, this._activeDirtyManagerService = n, this._logService = i, this._configService = r, this._formulaDataModel = o, this._localeService = u, this._registerOtherFormulaService = f, this._commandExecutedListener(), this._initialExecuteFormulaProcessListener(), this._initialExecuteFormula();
299
299
  }
@@ -322,17 +322,17 @@ let xe = class extends ne {
322
322
  this._doneCalculationTaskCount = 0, this._totalCalculationTaskCount = 0, this._emitProgress();
323
323
  }
324
324
  dispose() {
325
- super.dispose(), this._progress$.next(la), this._progress$.complete(), clearTimeout(this._setTimeoutKey);
325
+ super.dispose(), this._progress$.next(da), this._progress$.complete(), clearTimeout(this._setTimeoutKey);
326
326
  }
327
327
  _getCalculationMode() {
328
328
  var n;
329
- const e = this._configService.getConfig(ge);
330
- return (n = e == null ? void 0 : e.initialFormulaComputing) != null ? n : Pe.WHEN_EMPTY;
329
+ const e = this._configService.getConfig(he);
330
+ return (n = e == null ? void 0 : e.initialFormulaComputing) != null ? n : Te.WHEN_EMPTY;
331
331
  }
332
332
  _commandExecutedListener() {
333
333
  this.disposeWithMe(
334
334
  this._commandService.beforeCommandExecuted((e) => {
335
- if (e.id === Ee.id) {
335
+ if (e.id === Ne.id) {
336
336
  const n = e.params;
337
337
  n.rowData = this._formulaDataModel.getHiddenRowsFiltered();
338
338
  }
@@ -340,14 +340,14 @@ let xe = class extends ne {
340
340
  ), this.disposeWithMe(
341
341
  this._commandService.onCommandExecuted((e, n) => {
342
342
  if (this._activeDirtyManagerService.get(e.id)) {
343
- if (e.id === z.id) {
343
+ if (e.id === k.id) {
344
344
  const i = e.params;
345
- if (n && n.onlyLocal === !0 || i.trigger === ht.id || i.trigger === Na.id || i.trigger === Ra.id)
345
+ if (n && n.onlyLocal === !0 || i.trigger === Ht.id || i.trigger === Sa.id || i.trigger === Aa.id)
346
346
  return;
347
347
  }
348
348
  this._waitingCommandQueue.push(e), clearTimeout(this._setTimeoutKey), this._setTimeoutKey = setTimeout(() => {
349
349
  const i = this._generateDirty(this._waitingCommandQueue);
350
- this._executingDirtyData = this._mergeDirty(this._executingDirtyData, i), this._executionInProgressParams == null ? this._commandService.executeCommand(Ee.id, { ...this._executingDirtyData }, Pt) : (this._restartCalculation = !0, this._commandService.executeCommand(ta.id, {})), this._waitingCommandQueue = [];
350
+ this._executingDirtyData = this._mergeDirty(this._executingDirtyData, i), this._executionInProgressParams == null ? this._commandService.executeCommand(Ne.id, { ...this._executingDirtyData }, At) : (this._restartCalculation = !0, this._commandService.executeCommand(ia.id, {})), this._waitingCommandQueue = [];
351
351
  }, 100);
352
352
  }
353
353
  })
@@ -359,8 +359,8 @@ let xe = class extends ne {
359
359
  const c = this._activeDirtyManagerService.get(m.id);
360
360
  if (c == null)
361
361
  continue;
362
- const d = c.getDirtyData(m), { dirtyRanges: P, dirtyNameMap: E, dirtyDefinedNameMap: p, dirtyUnitFeatureMap: I, dirtyUnitOtherFormulaMap: S, clearDependencyTreeCache: R } = d;
363
- P != null && this._mergeDirtyRanges(n, P), E != null && this._mergeDirtyNameMap(i, E), p != null && this._mergeDirtyNameMap(r, p), I != null && this._mergeDirtyUnitFeatureOrOtherFormulaMap(o, I), S != null && this._mergeDirtyUnitFeatureOrOtherFormulaMap(u, S), R != null && this._mergeDirtyNameMap(f, R);
362
+ const s = c.getDirtyData(m), { dirtyRanges: L, dirtyNameMap: E, dirtyDefinedNameMap: p, dirtyUnitFeatureMap: I, dirtyUnitOtherFormulaMap: S, clearDependencyTreeCache: R } = s;
363
+ L != null && this._mergeDirtyRanges(n, L), E != null && this._mergeDirtyNameMap(i, E), p != null && this._mergeDirtyNameMap(r, p), I != null && this._mergeDirtyUnitFeatureOrOtherFormulaMap(o, I), S != null && this._mergeDirtyUnitFeatureOrOtherFormulaMap(u, S), R != null && this._mergeDirtyNameMap(f, R);
364
364
  }
365
365
  return {
366
366
  dirtyRanges: n,
@@ -370,7 +370,7 @@ let xe = class extends ne {
370
370
  dirtyUnitOtherFormulaMap: u,
371
371
  forceCalculation: !1,
372
372
  clearDependencyTreeCache: f,
373
- maxIteration: this._configService.getConfig(aa)
373
+ maxIteration: this._configService.getConfig(ra)
374
374
  // numfmtItemMap,
375
375
  };
376
376
  }
@@ -399,8 +399,8 @@ let xe = class extends ne {
399
399
  let r = !1;
400
400
  for (const o of e)
401
401
  if (i.unitId === o.unitId && i.sheetId === o.sheetId) {
402
- const { startRow: u, startColumn: f, endRow: m, endColumn: c } = i.range, { startRow: d, startColumn: P, endRow: E, endColumn: p } = o.range;
403
- if (u === d && f === P && m === E && c === p) {
402
+ const { startRow: u, startColumn: f, endRow: m, endColumn: c } = i.range, { startRow: s, startColumn: L, endRow: E, endColumn: p } = o.range;
403
+ if (u === s && f === L && m === E && c === p) {
404
404
  r = !0;
405
405
  break;
406
406
  }
@@ -431,32 +431,32 @@ let xe = class extends ne {
431
431
  this.disposeWithMe(
432
432
  // eslint-disable-next-line max-lines-per-function, complexity
433
433
  this._commandService.onCommandExecuted((i) => {
434
- if (i.id === Ee.id) {
434
+ if (i.id === Ne.id) {
435
435
  const { forceCalculation: o = !1 } = i.params;
436
436
  o && (this._forceCalculating = !0);
437
- } else i.id === ta.id && this.clearProgress();
438
- if (i.id !== Mn.id)
437
+ } else i.id === ia.id && this.clearProgress();
438
+ if (i.id !== _n.id)
439
439
  return;
440
440
  const r = i.params;
441
441
  if (r.stageInfo != null) {
442
442
  const {
443
443
  stage: o
444
444
  } = r.stageInfo;
445
- if (o === Be.START)
445
+ if (o === ve.START)
446
446
  n === 0 && (this._startExecutionTime = performance.now()), n++, e !== null && (clearTimeout(e), e = null), e = setTimeout(() => {
447
447
  e = null, this._startProgress();
448
448
  }, 1e3);
449
- else if (o === Be.CURRENTLY_CALCULATING) {
449
+ else if (o === ve.CURRENTLY_CALCULATING) {
450
450
  if (this._executionInProgressParams = r.stageInfo, e === null) {
451
451
  const u = this._localeService.t("formula.progress.calculating");
452
452
  this._calculateProgress(u);
453
453
  }
454
- } else if (o === Be.START_DEPENDENCY_ARRAY_FORMULA) {
454
+ } else if (o === ve.START_DEPENDENCY_ARRAY_FORMULA) {
455
455
  if (this._executionInProgressParams = r.stageInfo, e === null) {
456
456
  const u = this._localeService.t("formula.progress.array-analysis");
457
457
  this._calculateProgress(u);
458
458
  }
459
- } else if (o === Be.CURRENTLY_CALCULATING_ARRAY_FORMULA && (this._executionInProgressParams = r.stageInfo, e === null)) {
459
+ } else if (o === ve.CURRENTLY_CALCULATING_ARRAY_FORMULA && (this._executionInProgressParams = r.stageInfo, e === null)) {
460
460
  const u = this._localeService.t("formula.progress.array-calculation");
461
461
  this._calculateProgress(u);
462
462
  }
@@ -464,25 +464,25 @@ let xe = class extends ne {
464
464
  const o = r.functionsExecutedState;
465
465
  let u = "";
466
466
  switch (n--, o) {
467
- case De.NOT_EXECUTED:
467
+ case Me.NOT_EXECUTED:
468
468
  u = "No tasks are being executed anymore", this._resetExecutingDirtyData();
469
469
  break;
470
- case De.STOP_EXECUTION:
470
+ case Me.STOP_EXECUTION:
471
471
  u = "The execution of the formula has been stopped", n = 0;
472
472
  break;
473
- case De.SUCCESS:
473
+ case Me.SUCCESS:
474
474
  u = "Formula calculation succeeded", (n === 0 || n === -1) && (u += `. Total time consumed: ${performance.now() - this._startExecutionTime} ms`), this._resetExecutingDirtyData();
475
475
  break;
476
- case De.INITIAL:
476
+ case Me.INITIAL:
477
477
  u = "Waiting for calculation", this._resetExecutingDirtyData();
478
478
  break;
479
479
  }
480
- (n === 0 || n === -1) && (e ? (clearTimeout(e), e = null, this.clearProgress()) : this._completeProgress(), n = 0, this._doneCalculationTaskCount = 0, this._totalCalculationTaskCount = 0, this._forceCalculating = !1), o === De.STOP_EXECUTION && this._restartCalculation ? (this._restartCalculation = !1, this._commandService.executeCommand(
481
- Ee.id,
480
+ (n === 0 || n === -1) && (e ? (clearTimeout(e), e = null, this.clearProgress()) : this._completeProgress(), n = 0, this._doneCalculationTaskCount = 0, this._totalCalculationTaskCount = 0, this._forceCalculating = !1), o === Me.STOP_EXECUTION && this._restartCalculation ? (this._restartCalculation = !1, this._commandService.executeCommand(
481
+ Ne.id,
482
482
  {
483
483
  ...this._executingDirtyData
484
484
  },
485
- Pt
485
+ At
486
486
  )) : this._executionInProgressParams = null, this._logService.debug("[TriggerCalculationController]", u);
487
487
  }
488
488
  })
@@ -501,10 +501,10 @@ let xe = class extends ne {
501
501
  }
502
502
  _initialExecuteFormula() {
503
503
  const e = this._getCalculationMode(), n = this._getDirtyDataByCalculationMode(e);
504
- this._commandService.executeCommand(Ee.id, n, Pt), this._registerOtherFormulaService.calculateStarted$.next(!0);
504
+ this._commandService.executeCommand(Ne.id, n, At), this._registerOtherFormulaService.calculateStarted$.next(!0);
505
505
  }
506
506
  _getDirtyDataByCalculationMode(e) {
507
- const n = e === Pe.FORCED, i = e === Pe.WHEN_EMPTY ? this._formulaDataModel.getFormulaDirtyRanges() : [];
507
+ const n = e === Te.FORCED, i = e === Te.WHEN_EMPTY ? this._formulaDataModel.getFormulaDirtyRanges() : [];
508
508
  return {
509
509
  forceCalculation: n,
510
510
  dirtyRanges: i,
@@ -513,24 +513,24 @@ let xe = class extends ne {
513
513
  dirtyUnitFeatureMap: {},
514
514
  dirtyUnitOtherFormulaMap: {},
515
515
  clearDependencyTreeCache: {},
516
- maxIteration: this._configService.getConfig(aa)
516
+ maxIteration: this._configService.getConfig(ra)
517
517
  };
518
518
  }
519
519
  };
520
- xe = fi([
521
- pe(0, fe),
522
- pe(1, Ft),
523
- pe(2, ja),
524
- pe(3, Ae),
525
- pe(4, X(mt)),
526
- pe(5, X(qt)),
527
- pe(6, X(je))
528
- ], xe);
529
- function ci(a, e, n) {
520
+ qe = pi([
521
+ pe(0, ue),
522
+ pe(1, Yt),
523
+ pe(2, en),
524
+ pe(3, be),
525
+ pe(4, X(lt)),
526
+ pe(5, X(Vt)),
527
+ pe(6, X(Ze))
528
+ ], qe);
529
+ function Li(a, e, n) {
530
530
  var i;
531
531
  return a == null || a[e] == null || ((i = a[e]) == null ? void 0 : i[n]) == null;
532
532
  }
533
- function Tt(a, e, n) {
533
+ function Ct(a, e, n) {
534
534
  var i;
535
535
  if (n) {
536
536
  if (a && a[e] && ((i = a[e]) != null && i[n]))
@@ -545,47 +545,47 @@ function Tt(a, e, n) {
545
545
  };
546
546
  }
547
547
  var _ = /* @__PURE__ */ ((a) => (a[a.MoveRange = 0] = "MoveRange", a[a.MoveRows = 1] = "MoveRows", a[a.MoveCols = 2] = "MoveCols", a[a.InsertRow = 3] = "InsertRow", a[a.InsertColumn = 4] = "InsertColumn", a[a.RemoveRow = 5] = "RemoveRow", a[a.RemoveColumn = 6] = "RemoveColumn", a[a.DeleteMoveLeft = 7] = "DeleteMoveLeft", a[a.DeleteMoveUp = 8] = "DeleteMoveUp", a[a.InsertMoveDown = 9] = "InsertMoveDown", a[a.InsertMoveRight = 10] = "InsertMoveRight", a[a.SetName = 11] = "SetName", a[a.RemoveSheet = 12] = "RemoveSheet", a[a.SetDefinedName = 13] = "SetDefinedName", a[a.RemoveDefinedName = 14] = "RemoveDefinedName", a))(_ || {});
548
- const li = [
548
+ const Pi = [
549
549
  11,
550
550
  12,
551
551
  13,
552
552
  14
553
553
  /* RemoveDefinedName */
554
554
  ];
555
- function si(a, e, n) {
555
+ function Ti(a, e, n) {
556
556
  const { type: i } = n;
557
- return li.includes(i) ? di(a, e) : pi(a, e, n);
557
+ return Pi.includes(i) ? Ei(a, e) : Ii(a, e, n);
558
558
  }
559
- function di(a, e) {
559
+ function Ei(a, e) {
560
560
  const n = [], i = [];
561
561
  return Object.keys(e).forEach((r) => {
562
562
  const o = e[r], u = a[r];
563
563
  if (o == null || u == null)
564
564
  return !0;
565
565
  Object.keys(o).forEach((f) => {
566
- const m = new G(o[f] || {}), c = new G(u[f] || {}), d = new G(), P = new G();
567
- if (m.forValue((R, s, A) => {
566
+ const m = new V(o[f] || {}), c = new V(u[f] || {}), s = new V(), L = new V();
567
+ if (m.forValue((R, d, A) => {
568
568
  if (A == null)
569
569
  return !0;
570
- const N = qe(A);
571
- N !== null && (d.setValue(R, s, N), P.setValue(R, s, c.getValue(R, s)));
572
- }), d.getSizeOf() === 0)
570
+ const N = ge(A);
571
+ N !== null && (s.setValue(R, d, N), L.setValue(R, d, c.getValue(R, d)));
572
+ }), s.getSizeOf() === 0)
573
573
  return;
574
574
  const E = {
575
575
  subUnitId: f,
576
576
  unitId: r,
577
- cellValue: d.getMatrix()
577
+ cellValue: s.getMatrix()
578
578
  }, p = {
579
- id: z.id,
579
+ id: k.id,
580
580
  params: E
581
581
  };
582
582
  i.push(p);
583
583
  const I = {
584
584
  subUnitId: f,
585
585
  unitId: r,
586
- cellValue: P.getMatrix()
586
+ cellValue: L.getMatrix()
587
587
  }, S = {
588
- id: z.id,
588
+ id: k.id,
589
589
  params: I
590
590
  };
591
591
  n.push(S);
@@ -595,8 +595,8 @@ function di(a, e) {
595
595
  redos: i
596
596
  };
597
597
  }
598
- function pi(a, e, n) {
599
- const { redoFormulaData: i, undoFormulaData: r } = Li(a, e, n), o = [], u = [];
598
+ function Ii(a, e, n) {
599
+ const { redoFormulaData: i, undoFormulaData: r } = Ni(a, e, n), o = [], u = [];
600
600
  return Object.keys(i).forEach((f) => {
601
601
  Object.keys(i[f]).forEach((m) => {
602
602
  if (Object.keys(i[f][m]).length !== 0) {
@@ -604,11 +604,11 @@ function pi(a, e, n) {
604
604
  subUnitId: m,
605
605
  unitId: f,
606
606
  cellValue: i[f][m]
607
- }, d = {
608
- id: z.id,
607
+ }, s = {
608
+ id: k.id,
609
609
  params: c
610
610
  };
611
- o.push(d);
611
+ o.push(s);
612
612
  }
613
613
  });
614
614
  }), Object.keys(r).forEach((f) => {
@@ -618,11 +618,11 @@ function pi(a, e, n) {
618
618
  subUnitId: m,
619
619
  unitId: f,
620
620
  cellValue: r[f][m]
621
- }, d = {
622
- id: z.id,
621
+ }, s = {
622
+ id: k.id,
623
623
  params: c
624
624
  };
625
- u.push(d);
625
+ u.push(s);
626
626
  }
627
627
  });
628
628
  }), {
@@ -630,26 +630,26 @@ function pi(a, e, n) {
630
630
  redos: o
631
631
  };
632
632
  }
633
- function Li(a, e, n) {
633
+ function Ni(a, e, n) {
634
634
  const i = {}, r = {}, { unitId: o, sheetId: u } = n;
635
635
  return (/* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(e)])).forEach((m) => {
636
- if (ci(a, m, u))
636
+ if (Li(a, m, u))
637
637
  return;
638
638
  (/* @__PURE__ */ new Set([
639
639
  ...Object.keys(a[m] || {}),
640
640
  ...Object.keys(e[m] || {})
641
- ])).forEach((d) => {
641
+ ])).forEach((s) => {
642
642
  var A, N;
643
- const P = (A = a[m]) == null ? void 0 : A[d], E = (N = e[m]) == null ? void 0 : N[d], p = new G(P || {}), I = new G(E || {});
643
+ const L = (A = a[m]) == null ? void 0 : A[s], E = (N = e[m]) == null ? void 0 : N[s], p = new V(L || {}), I = new V(E || {});
644
644
  let S = [];
645
- m !== o || d !== u ? S = Ti(I) : S = Pi(p, I, n);
646
- const R = yi(S, p, I), s = qi(S, p);
647
- i[m] || (i[m] = {}), r[m] || (r[m] = {}), i[m][d] = {
648
- ...i[m][d],
645
+ m !== o || s !== u ? S = Si(I) : S = Ri(p, I, n);
646
+ const R = Fi(S, p, I), d = Bi(S, p);
647
+ i[m] || (i[m] = {}), r[m] || (r[m] = {}), i[m][s] = {
648
+ ...i[m][s],
649
649
  ...R
650
- }, r[m][d] = {
651
- ...r[m][d],
652
- ...s
650
+ }, r[m][s] = {
651
+ ...r[m][s],
652
+ ...d
653
653
  };
654
654
  });
655
655
  }), {
@@ -657,11 +657,11 @@ function Li(a, e, n) {
657
657
  undoFormulaData: r
658
658
  };
659
659
  }
660
- function Pi(a, e, n) {
660
+ function Ri(a, e, n) {
661
661
  const { type: i, from: r, to: o, range: u } = n, f = [];
662
- return a.forValue((m, c, d) => {
663
- if (d == null || !Va(d)) return !0;
664
- const P = La(m, c);
662
+ return a.forValue((m, c, s) => {
663
+ if (s == null || !Ya(s)) return !0;
664
+ const L = Ta(m, c);
665
665
  let E = null, p = !1;
666
666
  if ([
667
667
  0,
@@ -669,71 +669,71 @@ function Pi(a, e, n) {
669
669
  2
670
670
  /* MoveCols */
671
671
  ].includes(i))
672
- E = Ei(i, r, o, P);
672
+ E = Ai(i, r, o, L);
673
673
  else if (u != null) {
674
- const I = Ii(P, n);
674
+ const I = Ci(L, n);
675
675
  E = I.newCell, p = I.isReverse;
676
676
  }
677
- if (Xe.diffValue(P, E) && !e.getValue(m, c))
677
+ if (We.diffValue(L, E) && !e.getValue(m, c))
678
678
  return !0;
679
- p ? f.unshift({ oldCell: P, newCell: E }) : f.push({ oldCell: P, newCell: E });
679
+ p ? f.unshift({ oldCell: L, newCell: E }) : f.push({ oldCell: L, newCell: E });
680
680
  }), f;
681
681
  }
682
- function Ti(a) {
682
+ function Si(a) {
683
683
  const e = [];
684
684
  return a.forValue((n, i, r) => {
685
- if (r == null || !Va(r)) return !0;
686
- const o = La(n, i);
685
+ if (r == null || !Ya(r)) return !0;
686
+ const o = Ta(n, i);
687
687
  e.push({ oldCell: o, newCell: o });
688
688
  }), e;
689
689
  }
690
- function Ei(a, e, n, i) {
690
+ function Ai(a, e, n, i) {
691
691
  if (e == null || n == null)
692
692
  return null;
693
693
  switch (a) {
694
694
  case 0:
695
- return Ni(e, n, i);
695
+ return Di(e, n, i);
696
696
  case 1:
697
- return Ri(e, n, i);
697
+ return bi(e, n, i);
698
698
  case 2:
699
- return Si(e, n, i);
699
+ return Oi(e, n, i);
700
700
  default:
701
701
  return null;
702
702
  }
703
703
  }
704
- function Ii(a, e) {
704
+ function Ci(a, e) {
705
705
  const { type: n, rangeFilteredRows: i } = e, r = e.range;
706
706
  let o = null, u = !1;
707
707
  switch (n) {
708
708
  case 3:
709
- o = Ai(r, a), u = !0;
709
+ o = Mi(r, a), u = !0;
710
710
  break;
711
711
  case 4:
712
- o = Ci(r, a), u = !0;
712
+ o = xi(r, a), u = !0;
713
713
  break;
714
714
  case 5:
715
- o = Di(r, a, i);
715
+ o = _i(r, a, i);
716
716
  break;
717
717
  case 6:
718
- o = bi(r, a);
718
+ o = yi(r, a);
719
719
  break;
720
720
  case 7:
721
- o = Oi(r, a);
721
+ o = qi(r, a);
722
722
  break;
723
723
  case 8:
724
- o = Mi(r, a);
724
+ o = gi(r, a);
725
725
  break;
726
726
  case 9:
727
- o = xi(r, a), u = !0;
727
+ o = hi(r, a), u = !0;
728
728
  break;
729
729
  case 10:
730
- o = _i(r, a), u = !0;
730
+ o = Ui(r, a), u = !0;
731
731
  break;
732
732
  }
733
733
  return { newCell: o, isReverse: u };
734
734
  }
735
- function Ni(a, e, n) {
736
- const i = Ca(
735
+ function Di(a, e, n) {
736
+ const i = ba(
737
737
  {
738
738
  id: H.MoveRangeCommandId,
739
739
  params: { toRange: e, fromRange: a }
@@ -742,8 +742,8 @@ function Ni(a, e, n) {
742
742
  );
743
743
  return w(i, n);
744
744
  }
745
- function Ri(a, e, n) {
746
- const i = Aa(
745
+ function bi(a, e, n) {
746
+ const i = Da(
747
747
  {
748
748
  id: H.MoveRowsCommandId,
749
749
  params: { toRange: e, fromRange: a }
@@ -752,8 +752,8 @@ function Ri(a, e, n) {
752
752
  );
753
753
  return w(i, n);
754
754
  }
755
- function Si(a, e, n) {
756
- const i = Sa(
755
+ function Oi(a, e, n) {
756
+ const i = Ca(
757
757
  {
758
758
  id: H.MoveColsCommandId,
759
759
  params: { toRange: e, fromRange: a }
@@ -762,28 +762,28 @@ function Si(a, e, n) {
762
762
  );
763
763
  return w(i, n);
764
764
  }
765
- function Ai(a, e) {
766
- const n = qa(
765
+ function Mi(a, e) {
766
+ const n = ha(
767
767
  {
768
768
  id: H.InsertRowCommandId,
769
- params: { range: a, unitId: "", subUnitId: "", direction: Ke.DOWN }
769
+ params: { range: a, unitId: "", subUnitId: "", direction: ke.DOWN }
770
770
  },
771
771
  e
772
772
  );
773
773
  return w(n, e);
774
774
  }
775
- function Ci(a, e) {
776
- const n = ya(
775
+ function xi(a, e) {
776
+ const n = ga(
777
777
  {
778
778
  id: H.InsertColCommandId,
779
- params: { range: a, unitId: "", subUnitId: "", direction: Ke.RIGHT }
779
+ params: { range: a, unitId: "", subUnitId: "", direction: ke.RIGHT }
780
780
  },
781
781
  e
782
782
  );
783
783
  return w(n, e);
784
784
  }
785
- function Di(a, e, n) {
786
- const i = _a(
785
+ function _i(a, e, n) {
786
+ const i = qa(
787
787
  {
788
788
  id: H.RemoveRowCommandId,
789
789
  params: { range: a }
@@ -793,8 +793,8 @@ function Di(a, e, n) {
793
793
  );
794
794
  return w(i, e);
795
795
  }
796
- function bi(a, e) {
797
- const n = xa(
796
+ function yi(a, e) {
797
+ const n = ya(
798
798
  {
799
799
  id: H.RemoveColCommandId,
800
800
  params: { range: a }
@@ -803,8 +803,8 @@ function bi(a, e) {
803
803
  );
804
804
  return w(n, e);
805
805
  }
806
- function Oi(a, e) {
807
- const n = Ma(
806
+ function qi(a, e) {
807
+ const n = _a(
808
808
  {
809
809
  id: H.DeleteRangeMoveLeftCommandId,
810
810
  params: { range: a }
@@ -813,8 +813,8 @@ function Oi(a, e) {
813
813
  );
814
814
  return w(n, e);
815
815
  }
816
- function Mi(a, e) {
817
- const n = Oa(
816
+ function gi(a, e) {
817
+ const n = xa(
818
818
  {
819
819
  id: H.DeleteRangeMoveUpCommandId,
820
820
  params: { range: a }
@@ -823,8 +823,8 @@ function Mi(a, e) {
823
823
  );
824
824
  return w(n, e);
825
825
  }
826
- function xi(a, e) {
827
- const n = ba(
826
+ function hi(a, e) {
827
+ const n = Ma(
828
828
  {
829
829
  id: H.InsertRangeMoveDownCommandId,
830
830
  params: { range: a }
@@ -833,8 +833,8 @@ function xi(a, e) {
833
833
  );
834
834
  return w(n, e);
835
835
  }
836
- function _i(a, e) {
837
- const n = Da(
836
+ function Ui(a, e) {
837
+ const n = Oa(
838
838
  {
839
839
  id: H.InsertRangeMoveRightCommandId,
840
840
  params: { range: a }
@@ -843,33 +843,33 @@ function _i(a, e) {
843
843
  );
844
844
  return w(n, e);
845
845
  }
846
- function yi(a, e, n) {
846
+ function Fi(a, e, n) {
847
847
  var r, o, u;
848
- const i = new G({});
848
+ const i = new V({});
849
849
  for (let f = 0; f < a.length; f++) {
850
850
  const { oldCell: m, newCell: c } = a[f];
851
851
  if ((r = i.getValue(m.startRow, m.startColumn)) != null && r.f || (o = i.getValue(m.startRow, m.startColumn)) != null && o.si || i.setValue(m.startRow, m.startColumn, { f: null, si: null }), c) {
852
- const d = (u = n.getValue(m.startRow, m.startColumn)) != null ? u : e.getValue(m.startRow, m.startColumn), P = qe(d);
853
- i.setValue(c.startRow, c.startColumn, P);
852
+ const s = (u = n.getValue(m.startRow, m.startColumn)) != null ? u : e.getValue(m.startRow, m.startColumn), L = ge(s);
853
+ i.setValue(c.startRow, c.startColumn, L);
854
854
  }
855
855
  }
856
856
  return i.getMatrix();
857
857
  }
858
- function qi(a, e) {
859
- const n = new G({});
858
+ function Bi(a, e) {
859
+ const n = new V({});
860
860
  for (let i = a.length - 1; i >= 0; i--) {
861
- const { oldCell: r, newCell: o } = a[i], u = e.getValue(r.startRow, r.startColumn), f = qe(u);
861
+ const { oldCell: r, newCell: o } = a[i], u = e.getValue(r.startRow, r.startColumn), f = ge(u);
862
862
  if (n.setValue(r.startRow, r.startColumn, f), o) {
863
- const m = e.getValue(o.startRow, o.startColumn), c = qe(m);
863
+ const m = e.getValue(o.startRow, o.startColumn), c = ge(m);
864
864
  n.setValue(o.startRow, o.startColumn, c != null ? c : { f: null, si: null });
865
865
  }
866
866
  }
867
867
  return n.getMatrix();
868
868
  }
869
- function qe(a) {
869
+ function ge(a) {
870
870
  if (a == null)
871
- return;
872
- const { f: e, si: n, x: i = 0, y: r = 0 } = a, o = Me(e), u = pa(n);
871
+ return null;
872
+ const { f: e, si: n, x: i = 0, y: r = 0 } = a, o = ye(e), u = Pa(n);
873
873
  if (!o && !u)
874
874
  return {
875
875
  f: null,
@@ -878,18 +878,18 @@ function qe(a) {
878
878
  const f = {};
879
879
  return u && (f.si = n), o && i === 0 && r === 0 && (f.f = e), f.f === void 0 && (f.f = null), f.si === void 0 && (f.si = null), f;
880
880
  }
881
- function gi(a) {
882
- const e = new G({});
883
- return new G(a).forValue((i, r, o) => {
884
- const u = qe(o);
885
- u && e.setValue(i, r, u);
881
+ function vi(a) {
882
+ const e = new V({});
883
+ return new V(a).forValue((i, r, o) => {
884
+ const u = ge(o);
885
+ u !== void 0 && e.setValue(i, r, u);
886
886
  }), e.getMatrix();
887
887
  }
888
- function Va(a) {
889
- const e = (a == null ? void 0 : a.f) || "", n = (a == null ? void 0 : a.si) || "", i = Me(e), r = pa(n);
888
+ function Ya(a) {
889
+ const e = (a == null ? void 0 : a.f) || "", n = (a == null ? void 0 : a.si) || "", i = ye(e), r = Pa(n);
890
890
  return !!(i || r);
891
891
  }
892
- function Ga(a, e, n, i, r, o) {
892
+ function Xa(a, e, n, i, r, o) {
893
893
  if ((r == null || r.length === 0) && (o == null || o.length === 0)) {
894
894
  if (a === n && e === i)
895
895
  return !0;
@@ -897,36 +897,36 @@ function Ga(a, e, n, i, r, o) {
897
897
  return !0;
898
898
  return !1;
899
899
  }
900
- function Ha(a, e, n = 0, i = 0) {
900
+ function Wa(a, e, n = 0, i = 0) {
901
901
  const r = [];
902
902
  for (let o = 0, u = a.length; o < u; o++) {
903
903
  const f = a[o];
904
- if (typeof f == "string" || f.nodeType !== te.REFERENCE || e.includes(o)) {
904
+ if (typeof f == "string" || f.nodeType !== ie.REFERENCE || e.includes(o)) {
905
905
  r.push(f);
906
906
  continue;
907
907
  }
908
- const { token: m } = f, c = Le(m), { range: d, sheetName: P, unitId: E } = c, p = me.moveOffset(d, n, i);
908
+ const { token: m } = f, c = Pe(m), { range: s, sheetName: L, unitId: E } = c, p = fe.moveOffset(s, n, i);
909
909
  r.push({
910
910
  ...f,
911
- token: ft({
911
+ token: st({
912
912
  range: p,
913
913
  unitId: E,
914
- sheetName: P
914
+ sheetName: L
915
915
  })
916
916
  });
917
917
  }
918
918
  return r;
919
919
  }
920
- function wa(a, e, n, i) {
921
- const { type: r, unitId: o, sheetId: u, range: f, from: m, to: c, rangeFilteredRows: d } = e, {
922
- range: P,
920
+ function Ka(a, e, n, i) {
921
+ const { type: r, unitId: o, sheetId: u, range: f, from: m, to: c, rangeFilteredRows: s } = e, {
922
+ range: L,
923
923
  sheetId: E,
924
924
  unitId: p,
925
925
  sheetName: I,
926
926
  refOffsetX: S,
927
927
  refOffsetY: R
928
928
  } = a;
929
- if (!Ga(
929
+ if (!Xa(
930
930
  o,
931
931
  u,
932
932
  n,
@@ -935,211 +935,211 @@ function wa(a, e, n, i) {
935
935
  E
936
936
  ))
937
937
  return;
938
- const s = me.moveOffset(P, S, R);
938
+ const d = fe.moveOffset(L, S, R);
939
939
  let A = null;
940
940
  if (r === _.MoveRange) {
941
941
  if (m == null || c == null)
942
942
  return;
943
- const N = It(s, m), L = We(s, m);
944
- if (L == null || N !== 4)
943
+ const N = bt(d, m), P = Ke(d, m);
944
+ if (P == null || N !== 4)
945
945
  return;
946
- const g = Ca(
946
+ const g = ba(
947
947
  { id: H.MoveRangeCommandId, params: { toRange: c, fromRange: m } },
948
- L
949
- ), q = w(g, L);
948
+ P
949
+ ), q = w(g, P);
950
950
  if (q == null)
951
- return Q.REF;
952
- A = Et(N, q, m, c, s, L);
951
+ return $.REF;
952
+ A = Dt(N, q, m, c, d, P);
953
953
  } else if (r === _.MoveRows) {
954
954
  if (m == null || c == null)
955
955
  return;
956
- const N = It(s, m);
957
- let L = We(s, m);
958
- if (L == null && (m.endRow < s.startRow && c.endRow <= s.startRow || m.startRow > s.endRow && c.startRow > s.endRow))
956
+ const N = bt(d, m);
957
+ let P = Ke(d, m);
958
+ if (P == null && (m.endRow < d.startRow && c.endRow <= d.startRow || m.startRow > d.endRow && c.startRow > d.endRow))
959
959
  return;
960
- L == null && (L = {
961
- startRow: s.startRow,
962
- endRow: s.endRow,
963
- startColumn: s.startColumn,
964
- endColumn: s.endColumn,
960
+ P == null && (P = {
961
+ startRow: d.startRow,
962
+ endRow: d.endRow,
963
+ startColumn: d.startColumn,
964
+ endColumn: d.endColumn,
965
965
  rangeType: Y.NORMAL
966
966
  });
967
- const g = Aa(
967
+ const g = Da(
968
968
  { id: H.MoveRowsCommandId, params: { toRange: c, fromRange: m } },
969
- L
970
- ), q = w(g, L);
969
+ P
970
+ ), q = w(g, P);
971
971
  if (q == null)
972
- return Q.REF;
973
- A = Et(N, q, m, c, s, L);
972
+ return $.REF;
973
+ A = Dt(N, q, m, c, d, P);
974
974
  } else if (r === _.MoveCols) {
975
975
  if (m == null || c == null)
976
976
  return;
977
- const N = It(s, m);
978
- let L = We(s, m);
979
- if (L == null && (m.endColumn < s.startColumn && c.endColumn <= s.startColumn || m.startColumn > s.endColumn && c.startColumn > s.endColumn))
977
+ const N = bt(d, m);
978
+ let P = Ke(d, m);
979
+ if (P == null && (m.endColumn < d.startColumn && c.endColumn <= d.startColumn || m.startColumn > d.endColumn && c.startColumn > d.endColumn))
980
980
  return;
981
- L == null && (L = {
982
- startRow: s.startRow,
983
- endRow: s.endRow,
984
- startColumn: s.startColumn,
985
- endColumn: s.endColumn,
981
+ P == null && (P = {
982
+ startRow: d.startRow,
983
+ endRow: d.endRow,
984
+ startColumn: d.startColumn,
985
+ endColumn: d.endColumn,
986
986
  rangeType: Y.NORMAL
987
987
  });
988
- const g = Sa(
988
+ const g = Ca(
989
989
  { id: H.MoveColsCommandId, params: { toRange: c, fromRange: m } },
990
- L
991
- ), q = w(g, L);
990
+ P
991
+ ), q = w(g, P);
992
992
  if (q == null)
993
- return Q.REF;
994
- A = Et(N, q, m, c, s, L);
993
+ return $.REF;
994
+ A = Dt(N, q, m, c, d, P);
995
995
  }
996
996
  if (f != null) {
997
997
  if (r === _.InsertRow) {
998
- const N = qa(
998
+ const N = ha(
999
999
  {
1000
1000
  id: H.InsertRowCommandId,
1001
- params: { range: f, unitId: "", subUnitId: "", direction: Ke.DOWN }
1001
+ params: { range: f, unitId: "", subUnitId: "", direction: ke.DOWN }
1002
1002
  },
1003
- s
1004
- ), L = w(N, s);
1005
- if (L == null)
1003
+ d
1004
+ ), P = w(N, d);
1005
+ if (P == null)
1006
1006
  return;
1007
1007
  A = {
1008
- ...s,
1009
- ...L
1008
+ ...d,
1009
+ ...P
1010
1010
  };
1011
1011
  } else if (r === _.InsertColumn) {
1012
- const N = ya(
1012
+ const N = ga(
1013
1013
  {
1014
1014
  id: H.InsertColCommandId,
1015
- params: { range: f, unitId: "", subUnitId: "", direction: Ke.RIGHT }
1015
+ params: { range: f, unitId: "", subUnitId: "", direction: ke.RIGHT }
1016
1016
  },
1017
- s
1018
- ), L = w(N, s);
1019
- if (L == null)
1017
+ d
1018
+ ), P = w(N, d);
1019
+ if (P == null)
1020
1020
  return;
1021
1021
  A = {
1022
- ...s,
1023
- ...L
1022
+ ...d,
1023
+ ...P
1024
1024
  };
1025
1025
  } else if (r === _.RemoveRow) {
1026
- const N = _a(
1026
+ const N = qa(
1027
1027
  {
1028
1028
  id: H.RemoveRowCommandId,
1029
1029
  params: { range: f }
1030
1030
  },
1031
- s,
1032
- d
1033
- ), L = w(N, s);
1034
- if (L == null)
1035
- return Q.REF;
1031
+ d,
1032
+ s
1033
+ ), P = w(N, d);
1034
+ if (P == null)
1035
+ return $.REF;
1036
1036
  A = {
1037
- ...s,
1038
- ...L
1037
+ ...d,
1038
+ ...P
1039
1039
  };
1040
1040
  } else if (r === _.RemoveColumn) {
1041
- const N = xa(
1041
+ const N = ya(
1042
1042
  {
1043
1043
  id: H.RemoveColCommandId,
1044
1044
  params: { range: f }
1045
1045
  },
1046
- s
1047
- ), L = w(N, s);
1048
- if (L == null)
1049
- return Q.REF;
1046
+ d
1047
+ ), P = w(N, d);
1048
+ if (P == null)
1049
+ return $.REF;
1050
1050
  A = {
1051
- ...s,
1052
- ...L
1051
+ ...d,
1052
+ ...P
1053
1053
  };
1054
1054
  } else if (r === _.DeleteMoveLeft) {
1055
- const N = Ma(
1055
+ const N = _a(
1056
1056
  {
1057
1057
  id: H.DeleteRangeMoveLeftCommandId,
1058
1058
  params: { range: f }
1059
1059
  },
1060
- s
1061
- ), L = w(N, s);
1062
- if (L == null)
1063
- return Q.REF;
1060
+ d
1061
+ ), P = w(N, d);
1062
+ if (P == null)
1063
+ return $.REF;
1064
1064
  A = {
1065
- ...s,
1066
- ...L
1065
+ ...d,
1066
+ ...P
1067
1067
  };
1068
1068
  } else if (r === _.DeleteMoveUp) {
1069
- const N = Oa(
1069
+ const N = xa(
1070
1070
  {
1071
1071
  id: H.DeleteRangeMoveUpCommandId,
1072
1072
  params: { range: f }
1073
1073
  },
1074
- s
1075
- ), L = w(N, s);
1076
- if (L == null)
1077
- return Q.REF;
1074
+ d
1075
+ ), P = w(N, d);
1076
+ if (P == null)
1077
+ return $.REF;
1078
1078
  A = {
1079
- ...s,
1080
- ...L
1079
+ ...d,
1080
+ ...P
1081
1081
  };
1082
1082
  } else if (r === _.InsertMoveDown) {
1083
- const N = ba(
1083
+ const N = Ma(
1084
1084
  {
1085
1085
  id: H.InsertRangeMoveDownCommandId,
1086
1086
  params: { range: f }
1087
1087
  },
1088
- s
1089
- ), L = w(N, s);
1090
- if (L == null)
1088
+ d
1089
+ ), P = w(N, d);
1090
+ if (P == null)
1091
1091
  return;
1092
1092
  A = {
1093
- ...s,
1094
- ...L
1093
+ ...d,
1094
+ ...P
1095
1095
  };
1096
1096
  } else if (r === _.InsertMoveRight) {
1097
- const N = Da(
1097
+ const N = Oa(
1098
1098
  {
1099
1099
  id: H.InsertRangeMoveRightCommandId,
1100
1100
  params: { range: f }
1101
1101
  },
1102
- s
1103
- ), L = w(N, s);
1104
- if (L == null)
1102
+ d
1103
+ ), P = w(N, d);
1104
+ if (P == null)
1105
1105
  return;
1106
1106
  A = {
1107
- ...s,
1108
- ...L
1107
+ ...d,
1108
+ ...P
1109
1109
  };
1110
1110
  }
1111
1111
  }
1112
1112
  if (A != null)
1113
- return ft({
1113
+ return st({
1114
1114
  range: A,
1115
1115
  sheetName: I,
1116
1116
  unitId: p
1117
1117
  });
1118
1118
  }
1119
- function Et(a, e, n, i, r, o) {
1120
- const { startRow: u, endRow: f, startColumn: m, endColumn: c, rangeType: d } = be(e), {
1121
- startRow: P,
1119
+ function Dt(a, e, n, i, r, o) {
1120
+ const { startRow: u, endRow: f, startColumn: m, endColumn: c, rangeType: s } = xe(e), {
1121
+ startRow: L,
1122
1122
  startColumn: E,
1123
1123
  endRow: p,
1124
1124
  endColumn: I,
1125
1125
  rangeType: S = Y.NORMAL
1126
- } = be(n), { startRow: R, startColumn: s, endRow: A, endColumn: N } = be(i), {
1127
- startRow: L,
1126
+ } = xe(n), { startRow: R, startColumn: d, endRow: A, endColumn: N } = xe(i), {
1127
+ startRow: P,
1128
1128
  endRow: g,
1129
1129
  startColumn: q,
1130
1130
  endColumn: U
1131
- } = be(o), {
1131
+ } = xe(o), {
1132
1132
  startRow: h,
1133
1133
  endRow: M,
1134
1134
  startColumn: F,
1135
1135
  endColumn: B,
1136
- rangeType: J = Y.NORMAL
1137
- } = be(r), O = { ...r };
1136
+ rangeType: ae = Y.NORMAL
1137
+ } = xe(r), O = { ...r };
1138
1138
  function ce() {
1139
- return d === Y.COLUMN && J === Y.COLUMN ? !0 : m >= F && c <= B;
1139
+ return s === Y.COLUMN && ae === Y.COLUMN ? !0 : m >= F && c <= B;
1140
1140
  }
1141
- function ee() {
1142
- return d === Y.ROW && J === Y.ROW ? !0 : u >= h && f <= M;
1141
+ function ne() {
1142
+ return s === Y.ROW && ae === Y.ROW ? !0 : u >= h && f <= M;
1143
1143
  }
1144
1144
  if (a === 0)
1145
1145
  if (ce())
@@ -1156,13 +1156,13 @@ function Et(a, e, n, i, r, o) {
1156
1156
  if (f > M)
1157
1157
  O.endRow = f;
1158
1158
  else if (f <= h)
1159
- O.startRow += M - P + 1;
1159
+ O.startRow += M - L + 1;
1160
1160
  else
1161
1161
  return;
1162
1162
  else
1163
1163
  return;
1164
1164
  else if (a === 2)
1165
- if (ee())
1165
+ if (ne())
1166
1166
  if (m < F)
1167
1167
  O.startColumn = m;
1168
1168
  else if (m >= B)
@@ -1172,7 +1172,7 @@ function Et(a, e, n, i, r, o) {
1172
1172
  else
1173
1173
  return;
1174
1174
  else if (a === 3)
1175
- if (ee())
1175
+ if (ne())
1176
1176
  if (c > B)
1177
1177
  O.endColumn = c;
1178
1178
  else if (c <= F)
@@ -1181,91 +1181,91 @@ function Et(a, e, n, i, r, o) {
1181
1181
  return;
1182
1182
  else
1183
1183
  return;
1184
- else a === 4 ? (O.startRow = u, O.startColumn = m, O.endRow = f, O.endColumn = c) : E <= F && I >= B || S === Y.ROW && J === Y.ROW ? n.endRow < h ? (R >= h && (O.startRow -= p - P + 1), R >= M && (O.endRow -= p - P + 1)) : n.startRow > M ? (A <= M && (O.endRow += p - P + 1), A <= h && (O.startRow += p - P + 1)) : n.startRow >= h && n.endRow <= M && (R <= h ? O.startRow += p - P + 1 : R >= M && (O.endRow -= p - P + 1)) : P <= h && p >= M || S === Y.COLUMN && J === Y.COLUMN ? n.endColumn < F ? (s >= F && (O.startColumn -= I - E + 1), s >= B && (O.endColumn -= I - E + 1)) : n.startColumn > B ? (N <= B && (O.endColumn += I - E + 1), N <= F && (O.startColumn += I - E + 1)) : n.startColumn >= F && n.endColumn <= B && (s <= F ? O.startColumn += I - E + 1 : s >= B && (O.endColumn -= I - E + 1)) : ((s <= U + 1 && N >= B || s <= F && N >= q - 1) && R <= h && A >= M || (R <= g + 1 && A >= M || R <= h && A >= L - 1) && s <= F && N >= B, O.startRow = u, O.startColumn = m, O.endRow = f, O.endColumn = c);
1184
+ else a === 4 ? (O.startRow = u, O.startColumn = m, O.endRow = f, O.endColumn = c) : E <= F && I >= B || S === Y.ROW && ae === Y.ROW ? n.endRow < h ? (R >= h && (O.startRow -= p - L + 1), R >= M && (O.endRow -= p - L + 1)) : n.startRow > M ? (A <= M && (O.endRow += p - L + 1), A <= h && (O.startRow += p - L + 1)) : n.startRow >= h && n.endRow <= M && (R <= h ? O.startRow += p - L + 1 : R >= M && (O.endRow -= p - L + 1)) : L <= h && p >= M || S === Y.COLUMN && ae === Y.COLUMN ? n.endColumn < F ? (d >= F && (O.startColumn -= I - E + 1), d >= B && (O.endColumn -= I - E + 1)) : n.startColumn > B ? (N <= B && (O.endColumn += I - E + 1), N <= F && (O.startColumn += I - E + 1)) : n.startColumn >= F && n.endColumn <= B && (d <= F ? O.startColumn += I - E + 1 : d >= B && (O.endColumn -= I - E + 1)) : ((d <= U + 1 && N >= B || d <= F && N >= q - 1) && R <= h && A >= M || (R <= g + 1 && A >= M || R <= h && A >= P - 1) && d <= F && N >= B, O.startRow = u, O.startColumn = m, O.endRow = f, O.endColumn = c);
1185
1185
  return O;
1186
1186
  }
1187
- function It(a, e) {
1188
- const n = Ne(a.startRow), i = Re(a.endRow), r = Ne(a.startColumn), o = Re(a.endColumn), u = Ne(e.startRow), f = Re(e.endRow), m = Ne(e.startColumn), c = Re(e.endColumn);
1189
- function d() {
1187
+ function bt(a, e) {
1188
+ const n = Se(a.startRow), i = Ae(a.endRow), r = Se(a.startColumn), o = Ae(a.endColumn), u = Se(e.startRow), f = Ae(e.endRow), m = Se(e.startColumn), c = Ae(e.endColumn);
1189
+ function s() {
1190
1190
  return a.rangeType === Y.COLUMN && e.rangeType === Y.COLUMN ? !0 : n >= u && i <= f;
1191
1191
  }
1192
- function P() {
1192
+ function L() {
1193
1193
  return a.rangeType === Y.ROW && e.rangeType === Y.ROW ? !0 : r >= m && o <= c;
1194
1194
  }
1195
1195
  function E() {
1196
1196
  return a.rangeType === Y.ALL && e.rangeType === Y.ALL;
1197
1197
  }
1198
- return d() && P() || E() ? 4 : P() && n >= u && n <= f && i > f ? 0 : P() && i >= u && i <= f && n < u ? 1 : d() && r >= m && r <= c && o > c ? 2 : d() && o >= m && o <= c && r < m ? 3 : null;
1198
+ return s() && L() || E() ? 4 : L() && n >= u && n <= f && i > f ? 0 : L() && i >= u && i <= f && n < u ? 1 : s() && r >= m && r <= c && o > c ? 2 : s() && o >= m && o <= c && r < m ? 3 : null;
1199
1199
  }
1200
- function Ne(a) {
1200
+ function Se(a) {
1201
1201
  return isNaN(a) ? -1 / 0 : a;
1202
1202
  }
1203
- function Re(a) {
1203
+ function Ae(a) {
1204
1204
  return isNaN(a) ? 1 / 0 : a;
1205
1205
  }
1206
- function be(a) {
1206
+ function xe(a) {
1207
1207
  const { startRow: e, endRow: n, startColumn: i, endColumn: r } = a;
1208
1208
  return {
1209
1209
  ...a,
1210
- startRow: Ne(e),
1211
- endRow: Re(n),
1212
- startColumn: Ne(i),
1213
- endColumn: Re(r)
1210
+ startRow: Se(e),
1211
+ endRow: Ae(n),
1212
+ startColumn: Se(i),
1213
+ endColumn: Ae(r)
1214
1214
  };
1215
1215
  }
1216
- function Ya(a, e) {
1216
+ function ka(a, e) {
1217
1217
  const { id: n } = e;
1218
1218
  let i = null;
1219
1219
  switch (n) {
1220
+ case Sn.id:
1221
+ i = Vi(e, a);
1222
+ break;
1223
+ case Rn.id:
1224
+ i = Gi(e, a);
1225
+ break;
1226
+ case Nn.id:
1227
+ i = Hi(e, a);
1228
+ break;
1229
+ case In.id:
1230
+ i = wi(e);
1231
+ break;
1220
1232
  case En.id:
1221
- i = hi(e, a);
1233
+ i = Yi(e);
1222
1234
  break;
1223
1235
  case Tn.id:
1224
- i = Ui(e, a);
1236
+ i = Xi(e, a);
1225
1237
  break;
1226
1238
  case Pn.id:
1227
- i = Fi(e, a);
1239
+ i = Wi(e, a);
1228
1240
  break;
1229
1241
  case Ln.id:
1230
- i = Bi(e);
1242
+ i = Ki(e, a);
1231
1243
  break;
1232
1244
  case pn.id:
1233
- i = vi(e);
1245
+ i = ki(e, a);
1234
1246
  break;
1235
1247
  case dn.id:
1236
- i = Vi(e, a);
1248
+ i = Qi(e, a);
1237
1249
  break;
1238
1250
  case sn.id:
1239
- i = Gi(e, a);
1251
+ i = $i(e, a);
1240
1252
  break;
1241
1253
  case ln.id:
1242
- i = Hi(e, a);
1254
+ i = ji(e, a);
1243
1255
  break;
1244
1256
  case cn.id:
1245
- i = wi(e, a);
1246
- break;
1247
- case fn.id:
1248
- i = Yi(e, a);
1249
- break;
1250
- case mn.id:
1251
- i = Xi(e, a);
1257
+ i = zi(e, a);
1252
1258
  break;
1253
- case un.id:
1254
- i = Wi(e, a);
1259
+ case Fa.id:
1260
+ i = Zi(e, a);
1255
1261
  break;
1256
- case on.id:
1257
- i = Ki(e, a);
1258
- break;
1259
- case ha.id:
1260
- i = ki(e, a);
1261
- break;
1262
- case ga.id:
1263
- i = Qi(e, a);
1262
+ case Ua.id:
1263
+ i = Ji(e, a);
1264
1264
  break;
1265
1265
  }
1266
1266
  return i;
1267
1267
  }
1268
- function Z(a) {
1268
+ function te(a) {
1269
1269
  var i;
1270
1270
  const e = a.getUnitId(), n = ((i = a.getActiveSheet()) == null ? void 0 : i.getSheetId()) || "";
1271
1271
  return {
@@ -1273,12 +1273,12 @@ function Z(a) {
1273
1273
  sheetId: n
1274
1274
  };
1275
1275
  }
1276
- function hi(a, e) {
1276
+ function Vi(a, e) {
1277
1277
  const { params: n } = a;
1278
1278
  if (!n) return null;
1279
1279
  const { fromRange: i, toRange: r } = n;
1280
1280
  if (!i || !r) return null;
1281
- const { unitId: o, sheetId: u } = Z(e);
1281
+ const { unitId: o, sheetId: u } = te(e);
1282
1282
  return {
1283
1283
  type: _.MoveRange,
1284
1284
  from: i,
@@ -1287,7 +1287,7 @@ function hi(a, e) {
1287
1287
  sheetId: u
1288
1288
  };
1289
1289
  }
1290
- function Ui(a, e) {
1290
+ function Gi(a, e) {
1291
1291
  const { params: n } = a;
1292
1292
  if (!n) return null;
1293
1293
  const {
@@ -1295,13 +1295,13 @@ function Ui(a, e) {
1295
1295
  toRange: { startRow: o, endRow: u }
1296
1296
  } = n, f = e.getUnitId(), m = e.getActiveSheet();
1297
1297
  if (!m) return null;
1298
- const c = m.getSheetId(), d = {
1298
+ const c = m.getSheetId(), s = {
1299
1299
  startRow: i,
1300
1300
  startColumn: 0,
1301
1301
  endRow: r,
1302
1302
  endColumn: m.getColumnCount() - 1,
1303
1303
  rangeType: Y.ROW
1304
- }, P = {
1304
+ }, L = {
1305
1305
  startRow: o,
1306
1306
  startColumn: 0,
1307
1307
  endRow: u,
@@ -1310,13 +1310,13 @@ function Ui(a, e) {
1310
1310
  };
1311
1311
  return {
1312
1312
  type: _.MoveRows,
1313
- from: d,
1314
- to: P,
1313
+ from: s,
1314
+ to: L,
1315
1315
  unitId: f,
1316
1316
  sheetId: c
1317
1317
  };
1318
1318
  }
1319
- function Fi(a, e) {
1319
+ function Hi(a, e) {
1320
1320
  const { params: n } = a;
1321
1321
  if (!n) return null;
1322
1322
  const {
@@ -1324,13 +1324,13 @@ function Fi(a, e) {
1324
1324
  toRange: { startColumn: o, endColumn: u }
1325
1325
  } = n, f = e.getUnitId(), m = e.getActiveSheet();
1326
1326
  if (!m) return null;
1327
- const c = m.getSheetId(), d = {
1327
+ const c = m.getSheetId(), s = {
1328
1328
  startRow: 0,
1329
1329
  startColumn: i,
1330
1330
  endRow: m.getRowCount() - 1,
1331
1331
  endColumn: r,
1332
1332
  rangeType: Y.COLUMN
1333
- }, P = {
1333
+ }, L = {
1334
1334
  startRow: 0,
1335
1335
  startColumn: o,
1336
1336
  endRow: m.getRowCount() - 1,
@@ -1339,13 +1339,13 @@ function Fi(a, e) {
1339
1339
  };
1340
1340
  return {
1341
1341
  type: _.MoveCols,
1342
- from: d,
1343
- to: P,
1342
+ from: s,
1343
+ to: L,
1344
1344
  unitId: f,
1345
1345
  sheetId: c
1346
1346
  };
1347
1347
  }
1348
- function Bi(a) {
1348
+ function wi(a) {
1349
1349
  const { params: e } = a;
1350
1350
  if (!e) return null;
1351
1351
  const { range: n, unitId: i, subUnitId: r } = e;
@@ -1356,7 +1356,7 @@ function Bi(a) {
1356
1356
  sheetId: r
1357
1357
  };
1358
1358
  }
1359
- function vi(a) {
1359
+ function Yi(a) {
1360
1360
  const { params: e } = a;
1361
1361
  if (!e) return null;
1362
1362
  const { range: n, unitId: i, subUnitId: r } = e;
@@ -1367,10 +1367,10 @@ function vi(a) {
1367
1367
  sheetId: r
1368
1368
  };
1369
1369
  }
1370
- function Vi(a, e) {
1370
+ function Xi(a, e) {
1371
1371
  const { params: n } = a;
1372
1372
  if (!n) return null;
1373
- const { range: i } = n, { unitId: r, sheetId: o } = Z(e);
1373
+ const { range: i } = n, { unitId: r, sheetId: o } = te(e);
1374
1374
  return {
1375
1375
  type: _.InsertMoveRight,
1376
1376
  range: i,
@@ -1378,10 +1378,10 @@ function Vi(a, e) {
1378
1378
  sheetId: o
1379
1379
  };
1380
1380
  }
1381
- function Gi(a, e) {
1381
+ function Wi(a, e) {
1382
1382
  const { params: n } = a;
1383
1383
  if (!n) return null;
1384
- const { range: i } = n, { unitId: r, sheetId: o } = Z(e);
1384
+ const { range: i } = n, { unitId: r, sheetId: o } = te(e);
1385
1385
  return {
1386
1386
  type: _.InsertMoveDown,
1387
1387
  range: i,
@@ -1389,11 +1389,11 @@ function Gi(a, e) {
1389
1389
  sheetId: o
1390
1390
  };
1391
1391
  }
1392
- function Hi(a, e) {
1392
+ function Ki(a, e) {
1393
1393
  var u, f;
1394
1394
  const { params: n } = a;
1395
1395
  if (!n) return null;
1396
- const { range: i } = n, { unitId: r, sheetId: o } = Z(e);
1396
+ const { range: i } = n, { unitId: r, sheetId: o } = te(e);
1397
1397
  return {
1398
1398
  type: _.RemoveRow,
1399
1399
  range: i,
@@ -1402,10 +1402,10 @@ function Hi(a, e) {
1402
1402
  rangeFilteredRows: (f = (u = e.getSheetBySheetId(o)) == null ? void 0 : u.getRangeFilterRows(i)) != null ? f : []
1403
1403
  };
1404
1404
  }
1405
- function wi(a, e) {
1405
+ function ki(a, e) {
1406
1406
  const { params: n } = a;
1407
1407
  if (!n) return null;
1408
- const { range: i } = n, { unitId: r, sheetId: o } = Z(e);
1408
+ const { range: i } = n, { unitId: r, sheetId: o } = te(e);
1409
1409
  return {
1410
1410
  type: _.RemoveColumn,
1411
1411
  range: i,
@@ -1413,10 +1413,10 @@ function wi(a, e) {
1413
1413
  sheetId: o
1414
1414
  };
1415
1415
  }
1416
- function Yi(a, e) {
1416
+ function Qi(a, e) {
1417
1417
  const { params: n } = a;
1418
1418
  if (!n) return null;
1419
- const { range: i } = n, { unitId: r, sheetId: o } = Z(e);
1419
+ const { range: i } = n, { unitId: r, sheetId: o } = te(e);
1420
1420
  return {
1421
1421
  type: _.DeleteMoveUp,
1422
1422
  range: i,
@@ -1424,10 +1424,10 @@ function Yi(a, e) {
1424
1424
  sheetId: o
1425
1425
  };
1426
1426
  }
1427
- function Xi(a, e) {
1427
+ function $i(a, e) {
1428
1428
  const { params: n } = a;
1429
1429
  if (!n) return null;
1430
- const { range: i } = n, { unitId: r, sheetId: o } = Z(e);
1430
+ const { range: i } = n, { unitId: r, sheetId: o } = te(e);
1431
1431
  return {
1432
1432
  type: _.DeleteMoveLeft,
1433
1433
  range: i,
@@ -1435,10 +1435,10 @@ function Xi(a, e) {
1435
1435
  sheetId: o
1436
1436
  };
1437
1437
  }
1438
- function Wi(a, e) {
1438
+ function ji(a, e) {
1439
1439
  const { params: n } = a;
1440
1440
  if (!n) return null;
1441
- const { unitId: i, subUnitId: r, name: o } = n, { unitId: u, sheetId: f } = Z(e);
1441
+ const { unitId: i, subUnitId: r, name: o } = n, { unitId: u, sheetId: f } = te(e);
1442
1442
  return {
1443
1443
  type: _.SetName,
1444
1444
  unitId: i || u,
@@ -1446,20 +1446,20 @@ function Wi(a, e) {
1446
1446
  sheetName: o
1447
1447
  };
1448
1448
  }
1449
- function Ki(a, e) {
1449
+ function zi(a, e) {
1450
1450
  const { params: n } = a;
1451
1451
  if (!n) return null;
1452
- const { unitId: i, subUnitId: r } = n, { unitId: o, sheetId: u } = Z(e);
1452
+ const { unitId: i, subUnitId: r } = n, { unitId: o, sheetId: u } = te(e);
1453
1453
  return {
1454
1454
  type: _.RemoveSheet,
1455
1455
  unitId: i || o,
1456
1456
  sheetId: r || u
1457
1457
  };
1458
1458
  }
1459
- function ki(a, e) {
1459
+ function Zi(a, e) {
1460
1460
  const { params: n } = a;
1461
1461
  if (!n) return null;
1462
- const { unitId: i, name: r, id: o } = n, { sheetId: u } = Z(e);
1462
+ const { unitId: i, name: r, id: o } = n, { sheetId: u } = te(e);
1463
1463
  return {
1464
1464
  type: _.SetDefinedName,
1465
1465
  unitId: i,
@@ -1468,10 +1468,10 @@ function ki(a, e) {
1468
1468
  definedNameId: o
1469
1469
  };
1470
1470
  }
1471
- function Qi(a, e) {
1471
+ function Ji(a, e) {
1472
1472
  const { params: n } = a;
1473
1473
  if (!n) return null;
1474
- const { unitId: i, name: r, id: o } = n, { sheetId: u } = Z(e);
1474
+ const { unitId: i, name: r, id: o } = n, { sheetId: u } = te(e);
1475
1475
  return {
1476
1476
  type: _.RemoveDefinedName,
1477
1477
  unitId: i,
@@ -1480,12 +1480,12 @@ function Qi(a, e) {
1480
1480
  definedNameId: o
1481
1481
  };
1482
1482
  }
1483
- var $i = Object.getOwnPropertyDescriptor, ji = (a, e, n, i) => {
1484
- for (var r = i > 1 ? void 0 : i ? $i(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1483
+ var er = Object.getOwnPropertyDescriptor, tr = (a, e, n, i) => {
1484
+ for (var r = i > 1 ? void 0 : i ? er(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1485
1485
  (u = a[o]) && (r = u(r) || r);
1486
1486
  return r;
1487
- }, Ve = (a, e) => (n, i) => e(n, i, a);
1488
- let ze = class extends ne {
1487
+ }, Ge = (a, e) => (n, i) => e(n, i, a);
1488
+ let Je = class extends ee {
1489
1489
  constructor(a, e, n, i) {
1490
1490
  super(), this._definedNamesService = a, this._univerInstanceService = e, this._sheetInterceptorService = n, this._lexerTreeBuilder = i, this._initialize();
1491
1491
  }
@@ -1496,18 +1496,18 @@ let ze = class extends ne {
1496
1496
  this.disposeWithMe(
1497
1497
  this._sheetInterceptorService.interceptCommand({
1498
1498
  getMutations: (a) => {
1499
- if (a.id === ha.id || a.id === ga.id)
1499
+ if (a.id === Fa.id || a.id === Ua.id)
1500
1500
  return {
1501
1501
  redos: [],
1502
1502
  undos: []
1503
1503
  };
1504
- const e = this._univerInstanceService.getCurrentUnitForType(ae.UNIVER_SHEET);
1504
+ const e = this._univerInstanceService.getCurrentUnitForType(j.UNIVER_SHEET);
1505
1505
  if (e == null)
1506
1506
  return {
1507
1507
  redos: [],
1508
1508
  undos: []
1509
1509
  };
1510
- const n = Ya(e, a);
1510
+ const n = ka(e, a);
1511
1511
  return n ? this._getUpdateDefinedNameMutations(e, n) : {
1512
1512
  redos: [],
1513
1513
  undos: []
@@ -1527,16 +1527,16 @@ let ze = class extends ne {
1527
1527
  const u = [], f = [];
1528
1528
  return Object.values(o).forEach((m) => {
1529
1529
  var R;
1530
- const { formulaOrRefString: c } = m, d = this._lexerTreeBuilder.sequenceNodesBuilder(c);
1531
- if (d == null)
1530
+ const { formulaOrRefString: c } = m, s = this._lexerTreeBuilder.sequenceNodesBuilder(c);
1531
+ if (s == null)
1532
1532
  return !0;
1533
- let P = !1;
1533
+ let L = !1;
1534
1534
  const E = [];
1535
- for (let s = 0, A = d.length; s < A; s++) {
1536
- const N = d[s];
1537
- if (typeof N == "string" || N.nodeType !== te.REFERENCE)
1535
+ for (let d = 0, A = s.length; d < A; d++) {
1536
+ const N = s[d];
1537
+ if (typeof N == "string" || N.nodeType !== ie.REFERENCE)
1538
1538
  continue;
1539
- const { token: L } = N, g = Le(L), { range: q, sheetName: U, unitId: h } = g, M = ((R = a.getSheetBySheetName(U)) == null ? void 0 : R.getSheetId()) || "", F = {
1539
+ const { token: P } = N, g = Pe(P), { range: q, sheetName: U, unitId: h } = g, M = ((R = a.getSheetBySheetName(U)) == null ? void 0 : R.getSheetId()) || "", F = {
1540
1540
  range: q,
1541
1541
  sheetId: M,
1542
1542
  unitId: h,
@@ -1549,32 +1549,32 @@ let ze = class extends ne {
1549
1549
  B = this._removeSheet(m, i, r);
1550
1550
  else if (n === _.SetName) {
1551
1551
  const {
1552
- sheetId: J,
1552
+ sheetId: ae,
1553
1553
  sheetName: O
1554
1554
  } = e;
1555
- if (O == null || M == null || M.length === 0 || J !== M)
1555
+ if (O == null || M == null || M.length === 0 || ae !== M)
1556
1556
  continue;
1557
- B = ft({
1557
+ B = st({
1558
1558
  range: q,
1559
1559
  sheetName: O,
1560
1560
  unitId: h
1561
1561
  });
1562
1562
  } else
1563
- B = wa(
1563
+ B = Ka(
1564
1564
  F,
1565
1565
  e,
1566
1566
  i,
1567
1567
  r
1568
1568
  );
1569
- B != null && (d[s] = {
1569
+ B != null && (s[d] = {
1570
1570
  ...N,
1571
1571
  token: B
1572
- }, P = !0, E.push(s));
1572
+ }, L = !0, E.push(d));
1573
1573
  }
1574
- if (!P)
1574
+ if (!L)
1575
1575
  return !0;
1576
- const p = $e(Ha(d, E)), I = {
1577
- id: ye.id,
1576
+ const p = je(Wa(s, E)), I = {
1577
+ id: De.id,
1578
1578
  params: {
1579
1579
  unitId: i,
1580
1580
  ...m,
@@ -1583,7 +1583,7 @@ let ze = class extends ne {
1583
1583
  };
1584
1584
  u.push(I);
1585
1585
  const S = {
1586
- id: ye.id,
1586
+ id: De.id,
1587
1587
  params: {
1588
1588
  unitId: i,
1589
1589
  ...m
@@ -1598,21 +1598,21 @@ let ze = class extends ne {
1598
1598
  _removeSheet(a, e, n) {
1599
1599
  var o;
1600
1600
  const { formulaOrRefString: i } = a;
1601
- return ((o = this._definedNamesService.getWorksheetByRef(e, i)) == null ? void 0 : o.getSheetId()) === n ? Q.REF : null;
1601
+ return ((o = this._definedNamesService.getWorksheetByRef(e, i)) == null ? void 0 : o.getSheetId()) === n ? $.REF : null;
1602
1602
  }
1603
1603
  };
1604
- ze = ji([
1605
- Ve(0, Bt),
1606
- Ve(1, Se),
1607
- Ve(2, X(Ut)),
1608
- Ve(3, X(vt))
1609
- ], ze);
1610
- var zi = Object.getOwnPropertyDescriptor, Zi = (a, e, n, i) => {
1611
- for (var r = i > 1 ? void 0 : i ? zi(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1604
+ Je = tr([
1605
+ Ge(0, dt),
1606
+ Ge(1, Ee),
1607
+ Ge(2, X(wt)),
1608
+ Ge(3, X(pt))
1609
+ ], Je);
1610
+ var ar = Object.getOwnPropertyDescriptor, nr = (a, e, n, i) => {
1611
+ for (var r = i > 1 ? void 0 : i ? ar(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1612
1612
  (u = a[o]) && (r = u(r) || r);
1613
1613
  return r;
1614
- }, ue = (a, e) => (n, i) => e(n, i, a);
1615
- let Ze = class extends ne {
1614
+ }, me = (a, e) => (n, i) => e(n, i, a);
1615
+ let et = class extends ee {
1616
1616
  constructor(a, e, n, i, r, o, u, f) {
1617
1617
  super(), this._univerInstanceService = a, this._commandService = e, this._lexerTreeBuilder = n, this._formulaDataModel = i, this._sheetInterceptorService = r, this._definedNamesService = o, this._configService = u, this._injector = f, this._commandExecutedListener();
1618
1618
  }
@@ -1622,21 +1622,21 @@ let Ze = class extends ne {
1622
1622
  })), this.disposeWithMe(
1623
1623
  this._commandService.onCommandExecuted((a) => {
1624
1624
  if (a.params)
1625
- if (a.id === At.id) {
1625
+ if (a.id === _t.id) {
1626
1626
  const { subUnitId: e, unitId: n } = a.params;
1627
1627
  this._handleWorkbookDisposed(n, e);
1628
- } else a.id === Ct.id && this._handleInsertSheetMutation(a.params);
1628
+ } else a.id === yt.id && this._handleInsertSheetMutation(a.params);
1629
1629
  })
1630
1630
  ), this.disposeWithMe(
1631
1631
  this._commandService.beforeCommandExecuted((a, e) => {
1632
- if (a.id === z.id) {
1632
+ if (a.id === k.id) {
1633
1633
  const n = a.params;
1634
- if (e && e.onlyLocal === !0 || n.trigger === ht.id || n.trigger === Na.id || n.trigger === Ra.id)
1634
+ if (e && e.onlyLocal === !0 || n.trigger === Ht.id || n.trigger === Sa.id || n.trigger === Aa.id)
1635
1635
  return;
1636
1636
  this._handleSetRangeValuesMutation(n);
1637
1637
  }
1638
1638
  })
1639
- ), this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(ae.UNIVER_SHEET).subscribe((a) => this._handleWorkbookAdded(a))), this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(ae.UNIVER_SHEET).pipe(ei((a) => a.getUnitId())).subscribe((a) => this._handleWorkbookDisposed(a)));
1639
+ ), this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(j.UNIVER_SHEET).subscribe((a) => this._handleWorkbookAdded(a))), this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(j.UNIVER_SHEET).pipe(ri((a) => a.getUnitId())).subscribe((a) => this._handleWorkbookDisposed(a)));
1640
1640
  }
1641
1641
  _handleSetRangeValuesMutation(a) {
1642
1642
  const { subUnitId: e, unitId: n, cellValue: i } = a;
@@ -1651,18 +1651,18 @@ let Ze = class extends ne {
1651
1651
  }
1652
1652
  };
1653
1653
  this._commandService.executeCommand(
1654
- z.id,
1654
+ k.id,
1655
1655
  {
1656
1656
  unitId: n,
1657
1657
  subUnitId: e,
1658
- cellValue: gi(r)
1658
+ cellValue: vi(r)
1659
1659
  },
1660
1660
  {
1661
1661
  onlyLocal: !0,
1662
1662
  fromFormula: !0
1663
1663
  }
1664
1664
  ), this._formulaDataModel.updateArrayFormulaCellData(n, e, i), this._formulaDataModel.updateArrayFormulaRange(n, e, i), this._commandService.executeCommand(
1665
- ve.id,
1665
+ Ve.id,
1666
1666
  {
1667
1667
  formulaData: o
1668
1668
  },
@@ -1670,7 +1670,7 @@ let Ze = class extends ne {
1670
1670
  onlyLocal: !0
1671
1671
  }
1672
1672
  ), this._commandService.executeCommand(
1673
- Dt.id,
1673
+ qt.id,
1674
1674
  {
1675
1675
  arrayFormulaRange: this._formulaDataModel.getArrayFormulaRange(),
1676
1676
  arrayFormulaCellData: this._formulaDataModel.getArrayFormulaCellData()
@@ -1683,9 +1683,9 @@ let Ze = class extends ne {
1683
1683
  );
1684
1684
  }
1685
1685
  _handleWorkbookDisposed(a, e) {
1686
- const n = this._formulaDataModel.getFormulaData(), i = Tt(n, a, e), r = this._formulaDataModel.getArrayFormulaRange(), o = Tt(r, a, e), u = this._formulaDataModel.getArrayFormulaCellData(), f = Tt(u, a, e);
1686
+ const n = this._formulaDataModel.getFormulaData(), i = Ct(n, a, e), r = this._formulaDataModel.getArrayFormulaRange(), o = Ct(r, a, e), u = this._formulaDataModel.getArrayFormulaCellData(), f = Ct(u, a, e);
1687
1687
  i && this._commandService.executeCommand(
1688
- ve.id,
1688
+ Ve.id,
1689
1689
  {
1690
1690
  formulaData: i
1691
1691
  },
@@ -1693,7 +1693,7 @@ let Ze = class extends ne {
1693
1693
  onlyLocal: !0
1694
1694
  }
1695
1695
  ), o && f && this._commandService.executeCommand(
1696
- Dt.id,
1696
+ qt.id,
1697
1697
  {
1698
1698
  arrayFormulaRange: r,
1699
1699
  arrayFormulaCellData: u
@@ -1704,9 +1704,9 @@ let Ze = class extends ne {
1704
1704
  );
1705
1705
  }
1706
1706
  _handleInsertSheetMutation(a) {
1707
- const { sheet: e, unitId: n } = a, i = this._formulaDataModel.getFormulaData(), { id: r, cellData: o } = e, u = new G(o), f = na(i, n, r, u);
1707
+ const { sheet: e, unitId: n } = a, i = this._formulaDataModel.getFormulaData(), { id: r, cellData: o } = e, u = new V(o), f = oa(i, n, r, u);
1708
1708
  this._commandService.executeCommand(
1709
- ve.id,
1709
+ Ve.id,
1710
1710
  {
1711
1711
  formulaData: f
1712
1712
  },
@@ -1720,14 +1720,14 @@ let Ze = class extends ne {
1720
1720
  const e = {}, n = a.getUnitId(), i = { [n]: {} };
1721
1721
  a.getSheets().forEach((c) => {
1722
1722
  var p;
1723
- const d = c.getCellMatrix(), P = c.getSheetId(), E = na(e, n, P, d);
1724
- i[n][P] = (p = E[n]) == null ? void 0 : p[P];
1725
- }), this._commandService.executeCommand(ve.id, { formulaData: i }, { onlyLocal: !0 });
1726
- const o = this._configService.getConfig(ge), u = (m = o == null ? void 0 : o.initialFormulaComputing) != null ? m : Pe.WHEN_EMPTY, f = this._getDirtyDataByCalculationMode(u);
1727
- this._commandService.executeCommand(Ee.id, f, { onlyLocal: !0 });
1723
+ const s = c.getCellMatrix(), L = c.getSheetId(), E = oa(e, n, L, s);
1724
+ i[n][L] = (p = E[n]) == null ? void 0 : p[L];
1725
+ }), this._commandService.executeCommand(Ve.id, { formulaData: i }, { onlyLocal: !0 });
1726
+ const o = this._configService.getConfig(he), u = (m = o == null ? void 0 : o.initialFormulaComputing) != null ? m : Te.WHEN_EMPTY, f = this._getDirtyDataByCalculationMode(u);
1727
+ this._commandService.executeCommand(Ne.id, f, { onlyLocal: !0 });
1728
1728
  }
1729
1729
  _getDirtyDataByCalculationMode(a) {
1730
- const e = a === Pe.FORCED, n = a === Pe.WHEN_EMPTY ? this._formulaDataModel.getFormulaDirtyRanges() : [];
1730
+ const e = a === Te.FORCED, n = a === Te.WHEN_EMPTY ? this._formulaDataModel.getFormulaDirtyRanges() : [];
1731
1731
  return {
1732
1732
  forceCalculation: e,
1733
1733
  dirtyRanges: n,
@@ -1739,19 +1739,19 @@ let Ze = class extends ne {
1739
1739
  };
1740
1740
  }
1741
1741
  _getUpdateFormula(a) {
1742
- const e = this._univerInstanceService.getCurrentUnitForType(ae.UNIVER_SHEET);
1742
+ const e = this._univerInstanceService.getCurrentUnitForType(j.UNIVER_SHEET);
1743
1743
  if (!e)
1744
1744
  return {
1745
1745
  undos: [],
1746
1746
  redos: []
1747
1747
  };
1748
- const n = Ya(e, a);
1748
+ const n = ka(e, a);
1749
1749
  if (n) {
1750
1750
  const { unitSheetNameMap: i } = this._formulaDataModel.getCalculateData(), r = this._formulaDataModel.getFormulaData(), { newFormulaData: o } = this._getFormulaReferenceMoveInfo(
1751
1751
  r,
1752
1752
  i,
1753
1753
  n
1754
- ), { undos: u, redos: f } = si(r, o, n);
1754
+ ), { undos: u, redos: f } = Ti(r, o, n);
1755
1755
  return {
1756
1756
  undos: u,
1757
1757
  redos: f
@@ -1764,7 +1764,7 @@ let Ze = class extends ne {
1764
1764
  }
1765
1765
  // eslint-disable-next-line max-lines-per-function
1766
1766
  _getFormulaReferenceMoveInfo(a, e, n) {
1767
- if (!Xe.isDefine(a)) return { newFormulaData: {}, oldFormulaData: {} };
1767
+ if (!We.isDefine(a)) return { newFormulaData: {}, oldFormulaData: {} };
1768
1768
  const i = Object.keys(a);
1769
1769
  if (i.length === 0) return { newFormulaData: {}, oldFormulaData: {} };
1770
1770
  const r = {}, o = {};
@@ -1773,123 +1773,123 @@ let Ze = class extends ne {
1773
1773
  if (f == null)
1774
1774
  continue;
1775
1775
  const m = Object.keys(f);
1776
- Xe.isDefine(r[u]) || (r[u] = {}), Xe.isDefine(o[u]) || (o[u] = {});
1776
+ We.isDefine(r[u]) || (r[u] = {}), We.isDefine(o[u]) || (o[u] = {});
1777
1777
  for (const c of m) {
1778
- const d = new G(f[c] || {}), P = new G(), E = [];
1779
- d.forValue((p, I, S) => {
1778
+ const s = new V(f[c] || {}), L = new V(), E = [];
1779
+ s.forValue((p, I, S) => {
1780
1780
  var F;
1781
1781
  if (!S) return !0;
1782
- const { f: R, x: s, y: A, si: N } = S, L = this._lexerTreeBuilder.sequenceNodesBuilder(R);
1783
- if (L == null)
1782
+ const { f: R, x: d, y: A, si: N } = S, P = this._lexerTreeBuilder.sequenceNodesBuilder(R);
1783
+ if (P == null)
1784
1784
  return !0;
1785
1785
  let g = !1;
1786
1786
  const q = [], { type: U, from: h } = n;
1787
- for (let B = 0, J = L.length; B < J; B++) {
1788
- const O = L[B];
1787
+ for (let B = 0, ae = P.length; B < ae; B++) {
1788
+ const O = P[B];
1789
1789
  if (typeof O == "string")
1790
1790
  continue;
1791
- const { token: ce, nodeType: ee } = O;
1792
- if ((U === _.SetDefinedName || U === _.RemoveDefinedName) && (ee === te.DEFINED_NAME || ee === te.FUNCTION)) {
1793
- const { definedNameId: Ue, definedName: Te } = n;
1794
- if (Ue === void 0 || Te === void 0)
1791
+ const { token: ce, nodeType: ne } = O;
1792
+ if ((U === _.SetDefinedName || U === _.RemoveDefinedName) && (ne === ie.DEFINED_NAME || ne === ie.FUNCTION)) {
1793
+ const { definedNameId: Fe, definedName: Ie } = n;
1794
+ if (Fe === void 0 || Ie === void 0)
1795
1795
  continue;
1796
- const se = this._definedNamesService.getValueById(u, Ue);
1796
+ const se = this._definedNamesService.getValueById(u, Fe);
1797
1797
  if (se == null || se.name !== ce)
1798
1798
  continue;
1799
- L[B] = {
1799
+ P[B] = {
1800
1800
  ...O,
1801
- token: U === _.SetDefinedName ? Te : Q.REF
1801
+ token: U === _.SetDefinedName ? Ie : $.REF
1802
1802
  }, g = !0, q.push(B);
1803
1803
  continue;
1804
- } else if (ee !== te.REFERENCE)
1804
+ } else if (ne !== ie.REFERENCE)
1805
1805
  continue;
1806
- const le = Le(ce), { range: $, sheetName: ie, unitId: re } = le, he = re == null || re.length === 0 ? u : re, j = ((F = e == null ? void 0 : e[he]) == null ? void 0 : F[ie]) || "";
1807
- if (!Ga(
1806
+ const le = Pe(ce), { range: z, sheetName: re, unitId: oe } = le, Ue = oe == null || oe.length === 0 ? u : oe, Z = ((F = e == null ? void 0 : e[Ue]) == null ? void 0 : F[re]) || "";
1807
+ if (!Xa(
1808
1808
  n.unitId,
1809
1809
  n.sheetId,
1810
1810
  u,
1811
1811
  c,
1812
- re,
1813
- j
1812
+ oe,
1813
+ Z
1814
1814
  ))
1815
1815
  continue;
1816
- const lt = {
1817
- range: $,
1818
- sheetId: j,
1819
- unitId: re,
1820
- sheetName: ie,
1821
- refOffsetX: s || 0,
1816
+ const Et = {
1817
+ range: z,
1818
+ sheetId: Z,
1819
+ unitId: oe,
1820
+ sheetName: re,
1821
+ refOffsetX: d || 0,
1822
1822
  refOffsetY: A || 0
1823
1823
  };
1824
- let Ce = null;
1824
+ let Oe = null;
1825
1825
  if (U === _.SetName) {
1826
1826
  const {
1827
- unitId: Ue,
1828
- sheetId: Te,
1827
+ unitId: Fe,
1828
+ sheetId: Ie,
1829
1829
  sheetName: se
1830
1830
  } = n;
1831
- if (se == null || j == null || j.length === 0 || Te !== j)
1831
+ if (se == null || Z == null || Z.length === 0 || Ie !== Z)
1832
1832
  continue;
1833
- Ce = ft({
1834
- range: $,
1833
+ Oe = st({
1834
+ range: z,
1835
1835
  sheetName: se,
1836
- unitId: re
1836
+ unitId: oe
1837
1837
  });
1838
1838
  } else if (U === _.RemoveSheet) {
1839
1839
  const {
1840
- unitId: Ue,
1841
- sheetId: Te,
1840
+ unitId: Fe,
1841
+ sheetId: Ie,
1842
1842
  sheetName: se
1843
1843
  } = n;
1844
- if (j == null || j.length === 0 || Te !== j)
1844
+ if (Z == null || Z.length === 0 || Ie !== Z)
1845
1845
  continue;
1846
- Ce = Q.REF;
1847
- } else U !== _.SetDefinedName && (Ce = wa(
1848
- lt,
1846
+ Oe = $.REF;
1847
+ } else U !== _.SetDefinedName && (Oe = Ka(
1848
+ Et,
1849
1849
  n,
1850
1850
  u,
1851
1851
  c
1852
1852
  ));
1853
- Ce != null && (L[B] = {
1853
+ Oe != null && (P[B] = {
1854
1854
  ...O,
1855
- token: Ce
1856
- }, g = !0, q.push(B), N && (s != null ? s : 0) === 0 && (A != null ? A : 0) === 0 && E.push(N));
1855
+ token: Oe
1856
+ }, g = !0, q.push(B), N && (d != null ? d : 0) === 0 && (A != null ? A : 0) === 0 && E.push(N));
1857
1857
  }
1858
1858
  if (!g)
1859
1859
  if (N && [_.MoveRows, _.MoveCols, _.MoveRange].includes(U)) {
1860
1860
  if (h && h.startRow <= p && p <= h.endRow && h.startColumn <= I && I <= h.endColumn)
1861
- (s != null ? s : 0) === 0 && (A != null ? A : 0) === 0 && E.push(N);
1861
+ (d != null ? d : 0) === 0 && (A != null ? A : 0) === 0 && E.push(N);
1862
1862
  else if (!E.includes(N))
1863
1863
  return !0;
1864
1864
  } else
1865
1865
  return !0;
1866
- const M = Ha(L, q, s, A);
1867
- P.setValue(p, I, {
1868
- f: `=${$e(M)}`
1866
+ const M = Wa(P, q, d, A);
1867
+ L.setValue(p, I, {
1868
+ f: `=${je(M)}`
1869
1869
  });
1870
- }), o[u] && (o[u][c] = P.getData());
1870
+ }), o[u] && (o[u][c] = L.getData());
1871
1871
  }
1872
1872
  }
1873
1873
  return { newFormulaData: o };
1874
1874
  }
1875
1875
  };
1876
- Ze = Zi([
1877
- ue(0, Se),
1878
- ue(1, fe),
1879
- ue(2, X(vt)),
1880
- ue(3, X(mt)),
1881
- ue(4, X(Ut)),
1882
- ue(5, Bt),
1883
- ue(6, Ae),
1884
- ue(7, X(ut))
1885
- ], Ze);
1886
- const Ji = "SHEETS_FORMULA_PLUGIN";
1887
- var er = Object.getOwnPropertyDescriptor, tr = (a, e, n, i) => {
1888
- for (var r = i > 1 ? void 0 : i ? er(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1876
+ et = nr([
1877
+ me(0, Ee),
1878
+ me(1, ue),
1879
+ me(2, X(pt)),
1880
+ me(3, X(lt)),
1881
+ me(4, X(wt)),
1882
+ me(5, dt),
1883
+ me(6, be),
1884
+ me(7, X(ct))
1885
+ ], et);
1886
+ const ir = "SHEETS_FORMULA_PLUGIN";
1887
+ var rr = Object.getOwnPropertyDescriptor, or = (a, e, n, i) => {
1888
+ for (var r = i > 1 ? void 0 : i ? rr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1889
1889
  (u = a[o]) && (r = u(r) || r);
1890
1890
  return r;
1891
- }, Nt = (a, e) => (n, i) => e(n, i, a);
1892
- let Je = class extends ne {
1891
+ }, Ot = (a, e) => (n, i) => e(n, i, a);
1892
+ let tt = class extends ee {
1893
1893
  constructor(a, e, n) {
1894
1894
  super(), this._activeDirtyManagerService = a, this._univerInstanceService = e, this._formulaDataModel = n, this._initialize();
1895
1895
  }
@@ -1897,19 +1897,19 @@ let Je = class extends ne {
1897
1897
  this._initialConversion();
1898
1898
  }
1899
1899
  _initialConversion() {
1900
- this._activeDirtyManagerService.register(z.id, {
1901
- commandId: z.id,
1900
+ this._activeDirtyManagerService.register(k.id, {
1901
+ commandId: k.id,
1902
1902
  getDirtyData: (a) => {
1903
1903
  const e = a.params;
1904
- return e.trigger === ht.id ? {} : {
1904
+ return e.trigger === Ht.id ? {} : {
1905
1905
  dirtyRanges: this._getSetRangeValuesMutationDirtyRange(e)
1906
1906
  };
1907
1907
  }
1908
1908
  }), this._initialMove(), this._initialRowAndColumn(), this._initialHideRow(), this._initialSheet(), this._initialDefinedName();
1909
1909
  }
1910
1910
  _initialMove() {
1911
- this._activeDirtyManagerService.register(Xt.id, {
1912
- commandId: Xt.id,
1911
+ this._activeDirtyManagerService.register(kt.id, {
1912
+ commandId: kt.id,
1913
1913
  getDirtyData: (a) => {
1914
1914
  const e = a.params;
1915
1915
  return {
@@ -1922,8 +1922,8 @@ let Je = class extends ne {
1922
1922
  }
1923
1923
  };
1924
1924
  }
1925
- }), this._activeDirtyManagerService.register(Wt.id, {
1926
- commandId: Wt.id,
1925
+ }), this._activeDirtyManagerService.register(Qt.id, {
1926
+ commandId: Qt.id,
1927
1927
  getDirtyData: (a) => {
1928
1928
  const e = a.params;
1929
1929
  return {
@@ -1935,8 +1935,8 @@ let Je = class extends ne {
1935
1935
  }
1936
1936
  };
1937
1937
  }
1938
- }), this._activeDirtyManagerService.register(Kt.id, {
1939
- commandId: Kt.id,
1938
+ }), this._activeDirtyManagerService.register($t.id, {
1939
+ commandId: $t.id,
1940
1940
  getDirtyData: (a) => {
1941
1941
  const e = a.params;
1942
1942
  return {
@@ -1948,8 +1948,8 @@ let Je = class extends ne {
1948
1948
  }
1949
1949
  };
1950
1950
  }
1951
- }), this._activeDirtyManagerService.register(kt.id, {
1952
- commandId: kt.id,
1951
+ }), this._activeDirtyManagerService.register(jt.id, {
1952
+ commandId: jt.id,
1953
1953
  getDirtyData: (a) => {
1954
1954
  const e = a.params;
1955
1955
  return {
@@ -1964,8 +1964,8 @@ let Je = class extends ne {
1964
1964
  });
1965
1965
  }
1966
1966
  _initialRowAndColumn() {
1967
- this._activeDirtyManagerService.register(Qt.id, {
1968
- commandId: Qt.id,
1967
+ this._activeDirtyManagerService.register(zt.id, {
1968
+ commandId: zt.id,
1969
1969
  getDirtyData: (a) => {
1970
1970
  const e = a.params;
1971
1971
  return {
@@ -1977,8 +1977,8 @@ let Je = class extends ne {
1977
1977
  }
1978
1978
  };
1979
1979
  }
1980
- }), this._activeDirtyManagerService.register($t.id, {
1981
- commandId: $t.id,
1980
+ }), this._activeDirtyManagerService.register(Zt.id, {
1981
+ commandId: Zt.id,
1982
1982
  getDirtyData: (a) => {
1983
1983
  const e = a.params;
1984
1984
  return {
@@ -1990,8 +1990,8 @@ let Je = class extends ne {
1990
1990
  }
1991
1991
  };
1992
1992
  }
1993
- }), this._activeDirtyManagerService.register(jt.id, {
1994
- commandId: jt.id,
1993
+ }), this._activeDirtyManagerService.register(Jt.id, {
1994
+ commandId: Jt.id,
1995
1995
  getDirtyData: (a) => {
1996
1996
  const e = a.params;
1997
1997
  return {
@@ -2002,8 +2002,8 @@ let Je = class extends ne {
2002
2002
  }
2003
2003
  };
2004
2004
  }
2005
- }), this._activeDirtyManagerService.register(zt.id, {
2006
- commandId: zt.id,
2005
+ }), this._activeDirtyManagerService.register(ea.id, {
2006
+ commandId: ea.id,
2007
2007
  getDirtyData: (a) => {
2008
2008
  const e = a.params;
2009
2009
  return {
@@ -2017,8 +2017,8 @@ let Je = class extends ne {
2017
2017
  });
2018
2018
  }
2019
2019
  _initialHideRow() {
2020
- this._activeDirtyManagerService.register(Zt.id, {
2021
- commandId: Zt.id,
2020
+ this._activeDirtyManagerService.register(ta.id, {
2021
+ commandId: ta.id,
2022
2022
  getDirtyData: (a) => {
2023
2023
  const e = a.params;
2024
2024
  return {
@@ -2030,8 +2030,8 @@ let Je = class extends ne {
2030
2030
  }
2031
2031
  };
2032
2032
  }
2033
- }), this._activeDirtyManagerService.register(Jt.id, {
2034
- commandId: Jt.id,
2033
+ }), this._activeDirtyManagerService.register(aa.id, {
2034
+ commandId: aa.id,
2035
2035
  getDirtyData: (a) => {
2036
2036
  const e = a.params;
2037
2037
  return {
@@ -2046,8 +2046,8 @@ let Je = class extends ne {
2046
2046
  });
2047
2047
  }
2048
2048
  _initialSheet() {
2049
- this._activeDirtyManagerService.register(At.id, {
2050
- commandId: At.id,
2049
+ this._activeDirtyManagerService.register(_t.id, {
2050
+ commandId: _t.id,
2051
2051
  getDirtyData: (a) => {
2052
2052
  const e = a.params;
2053
2053
  return {
@@ -2059,8 +2059,8 @@ let Je = class extends ne {
2059
2059
  }
2060
2060
  };
2061
2061
  }
2062
- }), this._activeDirtyManagerService.register(Ct.id, {
2063
- commandId: Ct.id,
2062
+ }), this._activeDirtyManagerService.register(yt.id, {
2063
+ commandId: yt.id,
2064
2064
  getDirtyData: (a) => {
2065
2065
  const e = a.params;
2066
2066
  return {
@@ -2070,14 +2070,14 @@ let Je = class extends ne {
2070
2070
  });
2071
2071
  }
2072
2072
  _initialDefinedName() {
2073
- this._activeDirtyManagerService.register(ye.id, {
2074
- commandId: ye.id,
2073
+ this._activeDirtyManagerService.register(De.id, {
2074
+ commandId: De.id,
2075
2075
  getDirtyData: (a) => {
2076
2076
  const e = a.params;
2077
2077
  return { dirtyDefinedNameMap: this._getDefinedNameMutation(e) };
2078
2078
  }
2079
- }), this._activeDirtyManagerService.register(bt.id, {
2080
- commandId: bt.id,
2079
+ }), this._activeDirtyManagerService.register(gt.id, {
2080
+ commandId: gt.id,
2081
2081
  getDirtyData: (a) => {
2082
2082
  const e = a.params;
2083
2083
  return { dirtyDefinedNameMap: this._getDefinedNameMutation(e) };
@@ -2106,20 +2106,20 @@ let Je = class extends ne {
2106
2106
  }
2107
2107
  _getRemoveRowOrColumnMutation(a, e = !0) {
2108
2108
  const { subUnitId: n, unitId: i, range: r } = a, o = [], u = this._univerInstanceService.getUniverSheetInstance(i), f = u == null ? void 0 : u.getSheetBySheetId(n), m = (f == null ? void 0 : f.getRowCount()) || 0, c = (f == null ? void 0 : f.getColumnCount()) || 0;
2109
- let d = null;
2110
- const { startRow: P, endRow: E, startColumn: p, endColumn: I } = r;
2111
- e === !0 ? d = this._rangeToMatrix({
2112
- startRow: P,
2109
+ let s = null;
2110
+ const { startRow: L, endRow: E, startColumn: p, endColumn: I } = r;
2111
+ e === !0 ? s = this._rangeToMatrix({
2112
+ startRow: L,
2113
2113
  startColumn: 0,
2114
2114
  endRow: E,
2115
2115
  endColumn: c - 1
2116
- }) : d = this._rangeToMatrix({
2116
+ }) : s = this._rangeToMatrix({
2117
2117
  startRow: 0,
2118
2118
  startColumn: p,
2119
2119
  endRow: m,
2120
2120
  endColumn: I
2121
2121
  });
2122
- const S = d.getData();
2122
+ const S = s.getData();
2123
2123
  return o.push(...this._getDirtyRangesByCellValue(i, n, S)), o.push(...this._getDirtyRangesForArrayFormula(i, n, S)), o;
2124
2124
  }
2125
2125
  _getHideRowMutation(a) {
@@ -2138,7 +2138,7 @@ let Je = class extends ne {
2138
2138
  return e[i] == null && (e[i] = {}), e[i][n.id] = n.name, e;
2139
2139
  }
2140
2140
  _rangeToMatrix(a) {
2141
- const e = new G(), { startRow: n, startColumn: i, endRow: r, endColumn: o } = a;
2141
+ const e = new V(), { startRow: n, startColumn: i, endRow: r, endColumn: o } = a;
2142
2142
  for (let u = n; u <= r; u++)
2143
2143
  for (let f = i; f <= o; f++)
2144
2144
  e.setValue(u, f, {});
@@ -2146,7 +2146,7 @@ let Je = class extends ne {
2146
2146
  }
2147
2147
  _getDirtyRangesByCellValue(a, e, n) {
2148
2148
  const i = [];
2149
- return n == null || new G(n).getDiscreteRanges().forEach((u) => {
2149
+ return n == null || new V(n).getDiscreteRanges().forEach((u) => {
2150
2150
  i.push({ unitId: a, sheetId: e, range: u });
2151
2151
  }), i;
2152
2152
  }
@@ -2159,15 +2159,15 @@ let Je = class extends ne {
2159
2159
  const i = [];
2160
2160
  if (n == null)
2161
2161
  return i;
2162
- const r = new G(n), o = this._formulaDataModel.getArrayFormulaRange();
2162
+ const r = new V(n), o = this._formulaDataModel.getArrayFormulaRange();
2163
2163
  if ((u = o == null ? void 0 : o[a]) != null && u[e]) {
2164
- const m = new G((f = o == null ? void 0 : o[a]) == null ? void 0 : f[e]);
2165
- r.forValue((c, d) => {
2166
- m.forValue((P, E, p) => {
2164
+ const m = new V((f = o == null ? void 0 : o[a]) == null ? void 0 : f[e]);
2165
+ r.forValue((c, s) => {
2166
+ m.forValue((L, E, p) => {
2167
2167
  if (p == null)
2168
2168
  return !0;
2169
- const { startRow: I, startColumn: S, endRow: R, endColumn: s } = p;
2170
- c >= I && c <= R && d >= S && d <= s && i.push({
2169
+ const { startRow: I, startColumn: S, endRow: R, endColumn: d } = p;
2170
+ c >= I && c <= R && s >= S && s <= d && i.push({
2171
2171
  unitId: a,
2172
2172
  sheetId: e,
2173
2173
  range: {
@@ -2183,19 +2183,19 @@ let Je = class extends ne {
2183
2183
  return i;
2184
2184
  }
2185
2185
  };
2186
- Je = tr([
2187
- Nt(0, Ft),
2188
- Nt(1, Se),
2189
- Nt(2, X(mt))
2190
- ], Je);
2191
- var ar = Object.getOwnPropertyDescriptor, nr = (a, e, n, i) => {
2192
- for (var r = i > 1 ? void 0 : i ? ar(e, n) : e, o = a.length - 1, u; o >= 0; o--)
2186
+ tt = or([
2187
+ Ot(0, Yt),
2188
+ Ot(1, Ee),
2189
+ Ot(2, X(lt))
2190
+ ], tt);
2191
+ var ur = Object.getOwnPropertyDescriptor, mr = (a, e, n, i) => {
2192
+ for (var r = i > 1 ? void 0 : i ? ur(e, n) : e, o = a.length - 1, u; o >= 0; o--)
2193
2193
  (u = a[o]) && (r = u(r) || r);
2194
2194
  return r;
2195
- }, Ge = (a, e) => (n, i) => e(n, i, a);
2196
- let et = class extends ne {
2197
- constructor(a, e, n, i) {
2198
- super(), this._commandService = a, this._configService = e, this._sheetInterceptorService = n, this._formulaDataModel = i, this._initialize();
2195
+ }, Le = (a, e) => (n, i) => e(n, i, a);
2196
+ let at = class extends ee {
2197
+ constructor(a, e, n, i, r, o, u) {
2198
+ super(), this._commandService = a, this._configService = e, this._sheetInterceptorService = n, this._formulaDataModel = i, this._lexerTreeBuilder = r, this._functionService = o, this._definedNamesService = u, this._initialize();
2199
2199
  }
2200
2200
  _initialize() {
2201
2201
  this._commandExecutedListener(), this._initInterceptorCellContent();
@@ -2203,24 +2203,56 @@ let et = class extends ne {
2203
2203
  _commandExecutedListener() {
2204
2204
  this.disposeWithMe(
2205
2205
  this._commandService.onCommandExecuted((a) => {
2206
- var r;
2207
- if (a.id !== Dt.id)
2208
- return;
2209
- const e = a.params;
2210
- if (e == null)
2211
- return;
2212
- const { arrayFormulaRange: n, arrayFormulaCellData: i } = e;
2213
- this._formulaDataModel.setArrayFormulaRange(n), this._formulaDataModel.setArrayFormulaCellData(i), (r = this._configService.getConfig(ge)) != null && r.writeArrayFormulaToSnapshot && this._writeArrayFormulaToSnapshot(n, i);
2206
+ var n;
2207
+ const e = (n = this._configService.getConfig(he)) == null ? void 0 : n.writeArrayFormulaToSnapshot;
2208
+ if (a.id === qt.id) {
2209
+ const i = a.params;
2210
+ if (i == null)
2211
+ return;
2212
+ const { arrayFormulaRange: r, arrayFormulaCellData: o, arrayFormulaEmbedded: u } = i;
2213
+ this._formulaDataModel.setArrayFormulaRange(r), this._formulaDataModel.setArrayFormulaCellData(o), e && this._writeArrayFormulaToSnapshot(r, o, u);
2214
+ } else a.id === va.id && e && (this._addPrefixToFunctionSnapshot(), this._addPrefixToDefinedNamesFunctionSnapshot());
2214
2215
  })
2215
2216
  );
2216
2217
  }
2217
- _writeArrayFormulaToSnapshot(a, e) {
2218
+ _addPrefixToDefinedNamesFunctionSnapshot() {
2219
+ const a = this._definedNamesService.getAllDefinedNames();
2220
+ Object.entries(a).forEach(([e, n]) => {
2221
+ n && Array.from(Object.entries(n)).forEach(([i, r]) => {
2222
+ const { formulaOrRefString: o } = r;
2223
+ if (o.substring(0, 1) === "=") {
2224
+ const u = this._lexerTreeBuilder.getNewFormulaWithPrefix(o, this._functionService.hasExecutor.bind(this._functionService));
2225
+ u && this._commandService.executeCommand(De.id, {
2226
+ ...r,
2227
+ unitId: e,
2228
+ formulaOrRefStringWithPrefix: u
2229
+ }, {
2230
+ onlyLocal: !0,
2231
+ fromFormula: !0
2232
+ });
2233
+ }
2234
+ });
2235
+ });
2236
+ }
2237
+ _addPrefixToFunctionSnapshot() {
2238
+ const a = this._formulaDataModel.getFormulaData(), e = /* @__PURE__ */ new Map();
2218
2239
  Object.entries(a).forEach(([n, i]) => {
2219
2240
  i && Array.from(Object.entries(i)).forEach(([r, o]) => {
2220
- const u = new G();
2221
- new G(o).forValue((m, c, d) => {
2222
- u.setValue(m, c, { ref: _e(d) });
2223
- }), this._commandService.executeCommand(z.id, {
2241
+ if (!o)
2242
+ return;
2243
+ const u = new V();
2244
+ new V(o).forValue((m, c, s) => {
2245
+ const L = s == null ? void 0 : s.f;
2246
+ if ((s == null ? void 0 : s.x) != null || !L || L.length === 0)
2247
+ return;
2248
+ if (e.has(L)) {
2249
+ const p = e.get(L);
2250
+ u.setValue(m, c, { xf: p });
2251
+ return;
2252
+ }
2253
+ const E = this._lexerTreeBuilder.getNewFormulaWithPrefix(L, this._functionService.hasExecutor.bind(this._functionService));
2254
+ E && (u.setValue(m, c, { xf: E }), e.set(L, E));
2255
+ }), this._commandService.executeCommand(k.id, {
2224
2256
  unitId: n,
2225
2257
  subUnitId: r,
2226
2258
  cellValue: u.getMatrix()
@@ -2229,12 +2261,51 @@ let et = class extends ne {
2229
2261
  fromFormula: !0
2230
2262
  });
2231
2263
  });
2232
- }), Array.from(Object.entries(e)).forEach(([n, i]) => {
2233
- i && Array.from(Object.entries(i)).forEach(([r, o]) => {
2234
- this._commandService.executeCommand(z.id, {
2235
- unitId: n,
2236
- subUnitId: r,
2237
- cellValue: o
2264
+ }), e.clear();
2265
+ }
2266
+ _writeArrayFormulaToSnapshot(a, e, n) {
2267
+ a && Object.entries(a).forEach(([i, r]) => {
2268
+ r && Array.from(Object.entries(r)).forEach(([o, u]) => {
2269
+ const f = new V();
2270
+ new V(u).forValue((c, s, L) => {
2271
+ f.setValue(c, s, { ref: Ce(L) });
2272
+ }), this._commandService.executeCommand(k.id, {
2273
+ unitId: i,
2274
+ subUnitId: o,
2275
+ cellValue: f.getMatrix()
2276
+ }, {
2277
+ onlyLocal: !0,
2278
+ fromFormula: !0
2279
+ });
2280
+ });
2281
+ }), n && Object.entries(n).forEach(([i, r]) => {
2282
+ r && Array.from(Object.entries(r)).forEach(([o, u]) => {
2283
+ const f = new V();
2284
+ new V(u).forValue((c, s) => {
2285
+ var E, p, I;
2286
+ (I = (p = (E = a == null ? void 0 : a[i]) == null ? void 0 : E[o]) == null ? void 0 : p[c]) != null && I[s] || f.setValue(c, s, {
2287
+ ref: Ce({
2288
+ startRow: c,
2289
+ endRow: c,
2290
+ startColumn: s,
2291
+ endColumn: s
2292
+ })
2293
+ });
2294
+ }), this._commandService.executeCommand(k.id, {
2295
+ unitId: i,
2296
+ subUnitId: o,
2297
+ cellValue: f.getMatrix()
2298
+ }, {
2299
+ onlyLocal: !0,
2300
+ fromFormula: !0
2301
+ });
2302
+ });
2303
+ }), e && Object.entries(e).forEach(([i, r]) => {
2304
+ r && Array.from(Object.entries(r)).forEach(([o, u]) => {
2305
+ this._commandService.executeCommand(k.id, {
2306
+ unitId: i,
2307
+ subUnitId: o,
2308
+ cellValue: u
2238
2309
  }, {
2239
2310
  onlyLocal: !0,
2240
2311
  fromFormula: !0
@@ -2244,28 +2315,31 @@ let et = class extends ne {
2244
2315
  }
2245
2316
  _initInterceptorCellContent() {
2246
2317
  this.disposeWithMe(
2247
- this._sheetInterceptorService.intercept(In.CELL_CONTENT, {
2318
+ this._sheetInterceptorService.intercept(An.CELL_CONTENT, {
2248
2319
  priority: 100,
2249
- effect: za.Value,
2320
+ effect: tn.Value,
2250
2321
  handler: (a, e, n) => {
2251
- var d, P, E;
2322
+ var s, L, E;
2252
2323
  let i = a;
2253
- const { unitId: r, subUnitId: o, row: u, col: f } = e, m = this._formulaDataModel.getArrayFormulaCellData(), c = (E = (P = (d = m == null ? void 0 : m[r]) == null ? void 0 : d[o]) == null ? void 0 : P[u]) == null ? void 0 : E[f];
2254
- return c == null ? n(i) : ((!i || i === e.rawData) && (i = { ...e.rawData }), c.v == null && c.t == null ? (i.v = 0, i.t = wt.NUMBER, n(i)) : (i == null ? void 0 : i.t) === wt.NUMBER && i.v !== void 0 && i.v !== null && Za(i.v) ? (i.v = xn(Number(i.v)), n(i)) : (i.v = c.v, i.t = c.t, n(i)));
2324
+ const { unitId: r, subUnitId: o, row: u, col: f } = e, m = this._formulaDataModel.getArrayFormulaCellData(), c = (E = (L = (s = m == null ? void 0 : m[r]) == null ? void 0 : s[o]) == null ? void 0 : L[u]) == null ? void 0 : E[f];
2325
+ return c == null ? n(i) : ((!i || i === e.rawData) && (i = { ...e.rawData }), c.v == null && c.t == null ? (i.v = 0, i.t = Wt.NUMBER, n(i)) : (i == null ? void 0 : i.t) === Wt.NUMBER && i.v !== void 0 && i.v !== null && an(i.v) ? (i.v = yn(Number(i.v)), n(i)) : (i.v = c.v, i.t = c.t, n(i)));
2255
2326
  }
2256
2327
  })
2257
2328
  );
2258
2329
  }
2259
2330
  };
2260
- et = nr([
2261
- Ge(0, fe),
2262
- Ge(1, Ae),
2263
- Ge(2, X(Ut)),
2264
- Ge(3, X(mt))
2265
- ], et);
2266
- const ir = [
2331
+ at = mr([
2332
+ Le(0, ue),
2333
+ Le(1, be),
2334
+ Le(2, X(wt)),
2335
+ Le(3, X(lt)),
2336
+ Le(4, X(pt)),
2337
+ Le(5, Lt),
2338
+ Le(6, dt)
2339
+ ], at);
2340
+ const fr = [
2267
2341
  {
2268
- functionName: ia.ARRAY_CONSTRAIN,
2342
+ functionName: ua.ARRAY_CONSTRAIN,
2269
2343
  functionType: t.Array,
2270
2344
  description: "formula.functionList.ARRAY_CONSTRAIN.description",
2271
2345
  abstract: "formula.functionList.ARRAY_CONSTRAIN.abstract",
@@ -2294,7 +2368,7 @@ const ir = [
2294
2368
  ]
2295
2369
  },
2296
2370
  {
2297
- functionName: ia.FLATTEN,
2371
+ functionName: ua.FLATTEN,
2298
2372
  functionType: t.Array,
2299
2373
  description: "formula.functionList.FLATTEN.description",
2300
2374
  abstract: "formula.functionList.FLATTEN.abstract",
@@ -2315,7 +2389,7 @@ const ir = [
2315
2389
  }
2316
2390
  ]
2317
2391
  }
2318
- ], rr = [
2392
+ ], cr = [
2319
2393
  {
2320
2394
  functionName: x.BETADIST,
2321
2395
  functionType: t.Compatibility,
@@ -3369,7 +3443,7 @@ const ir = [
3369
3443
  }
3370
3444
  ]
3371
3445
  }
3372
- ], or = [
3446
+ ], lr = [
3373
3447
  {
3374
3448
  functionName: de.CUBEKPIMEMBER,
3375
3449
  functionType: t.Cube,
@@ -3524,9 +3598,9 @@ const ir = [
3524
3598
  }
3525
3599
  ]
3526
3600
  }
3527
- ], ur = [
3601
+ ], sr = [
3528
3602
  {
3529
- functionName: k.DAVERAGE,
3603
+ functionName: Q.DAVERAGE,
3530
3604
  functionType: t.Database,
3531
3605
  description: "formula.functionList.DAVERAGE.description",
3532
3606
  abstract: "formula.functionList.DAVERAGE.abstract",
@@ -3555,7 +3629,7 @@ const ir = [
3555
3629
  ]
3556
3630
  },
3557
3631
  {
3558
- functionName: k.DCOUNT,
3632
+ functionName: Q.DCOUNT,
3559
3633
  functionType: t.Database,
3560
3634
  description: "formula.functionList.DCOUNT.description",
3561
3635
  abstract: "formula.functionList.DCOUNT.abstract",
@@ -3584,7 +3658,7 @@ const ir = [
3584
3658
  ]
3585
3659
  },
3586
3660
  {
3587
- functionName: k.DCOUNTA,
3661
+ functionName: Q.DCOUNTA,
3588
3662
  functionType: t.Database,
3589
3663
  description: "formula.functionList.DCOUNTA.description",
3590
3664
  abstract: "formula.functionList.DCOUNTA.abstract",
@@ -3613,7 +3687,7 @@ const ir = [
3613
3687
  ]
3614
3688
  },
3615
3689
  {
3616
- functionName: k.DGET,
3690
+ functionName: Q.DGET,
3617
3691
  functionType: t.Database,
3618
3692
  description: "formula.functionList.DGET.description",
3619
3693
  abstract: "formula.functionList.DGET.abstract",
@@ -3642,7 +3716,7 @@ const ir = [
3642
3716
  ]
3643
3717
  },
3644
3718
  {
3645
- functionName: k.DMAX,
3719
+ functionName: Q.DMAX,
3646
3720
  functionType: t.Database,
3647
3721
  description: "formula.functionList.DMAX.description",
3648
3722
  abstract: "formula.functionList.DMAX.abstract",
@@ -3671,7 +3745,7 @@ const ir = [
3671
3745
  ]
3672
3746
  },
3673
3747
  {
3674
- functionName: k.DMIN,
3748
+ functionName: Q.DMIN,
3675
3749
  functionType: t.Database,
3676
3750
  description: "formula.functionList.DMIN.description",
3677
3751
  abstract: "formula.functionList.DMIN.abstract",
@@ -3700,7 +3774,7 @@ const ir = [
3700
3774
  ]
3701
3775
  },
3702
3776
  {
3703
- functionName: k.DPRODUCT,
3777
+ functionName: Q.DPRODUCT,
3704
3778
  functionType: t.Database,
3705
3779
  description: "formula.functionList.DPRODUCT.description",
3706
3780
  abstract: "formula.functionList.DPRODUCT.abstract",
@@ -3729,7 +3803,7 @@ const ir = [
3729
3803
  ]
3730
3804
  },
3731
3805
  {
3732
- functionName: k.DSTDEV,
3806
+ functionName: Q.DSTDEV,
3733
3807
  functionType: t.Database,
3734
3808
  description: "formula.functionList.DSTDEV.description",
3735
3809
  abstract: "formula.functionList.DSTDEV.abstract",
@@ -3758,7 +3832,7 @@ const ir = [
3758
3832
  ]
3759
3833
  },
3760
3834
  {
3761
- functionName: k.DSTDEVP,
3835
+ functionName: Q.DSTDEVP,
3762
3836
  functionType: t.Database,
3763
3837
  description: "formula.functionList.DSTDEVP.description",
3764
3838
  abstract: "formula.functionList.DSTDEVP.abstract",
@@ -3787,7 +3861,7 @@ const ir = [
3787
3861
  ]
3788
3862
  },
3789
3863
  {
3790
- functionName: k.DSUM,
3864
+ functionName: Q.DSUM,
3791
3865
  functionType: t.Database,
3792
3866
  description: "formula.functionList.DSUM.description",
3793
3867
  abstract: "formula.functionList.DSUM.abstract",
@@ -3816,7 +3890,7 @@ const ir = [
3816
3890
  ]
3817
3891
  },
3818
3892
  {
3819
- functionName: k.DVAR,
3893
+ functionName: Q.DVAR,
3820
3894
  functionType: t.Database,
3821
3895
  description: "formula.functionList.DVAR.description",
3822
3896
  abstract: "formula.functionList.DVAR.abstract",
@@ -3845,7 +3919,7 @@ const ir = [
3845
3919
  ]
3846
3920
  },
3847
3921
  {
3848
- functionName: k.DVARP,
3922
+ functionName: Q.DVARP,
3849
3923
  functionType: t.Database,
3850
3924
  description: "formula.functionList.DVARP.description",
3851
3925
  abstract: "formula.functionList.DVARP.abstract",
@@ -3873,7 +3947,7 @@ const ir = [
3873
3947
  }
3874
3948
  ]
3875
3949
  }
3876
- ], mr = [
3950
+ ], dr = [
3877
3951
  {
3878
3952
  functionName: v.DATE,
3879
3953
  functionType: t.Date,
@@ -4445,7 +4519,7 @@ const ir = [
4445
4519
  }
4446
4520
  ]
4447
4521
  }
4448
- ], fr = [
4522
+ ], pr = [
4449
4523
  {
4450
4524
  functionName: C.BESSELI,
4451
4525
  functionType: t.Engineering,
@@ -5518,7 +5592,7 @@ const ir = [
5518
5592
  }
5519
5593
  ]
5520
5594
  }
5521
- ], cr = [
5595
+ ], Lr = [
5522
5596
  {
5523
5597
  functionName: D.ACCRINT,
5524
5598
  functionType: t.Financial,
@@ -7779,9 +7853,9 @@ const ir = [
7779
7853
  }
7780
7854
  ]
7781
7855
  }
7782
- ], lr = [
7856
+ ], Pr = [
7783
7857
  {
7784
- functionName: V.CELL,
7858
+ functionName: G.CELL,
7785
7859
  functionType: t.Information,
7786
7860
  description: "formula.functionList.CELL.description",
7787
7861
  abstract: "formula.functionList.CELL.abstract",
@@ -7803,7 +7877,7 @@ const ir = [
7803
7877
  ]
7804
7878
  },
7805
7879
  {
7806
- functionName: V.ERROR_TYPE,
7880
+ functionName: G.ERROR_TYPE,
7807
7881
  functionType: t.Information,
7808
7882
  description: "formula.functionList.ERROR_TYPE.description",
7809
7883
  abstract: "formula.functionList.ERROR_TYPE.abstract",
@@ -7818,7 +7892,7 @@ const ir = [
7818
7892
  ]
7819
7893
  },
7820
7894
  {
7821
- functionName: V.INFO,
7895
+ functionName: G.INFO,
7822
7896
  functionType: t.Information,
7823
7897
  description: "formula.functionList.INFO.description",
7824
7898
  abstract: "formula.functionList.INFO.abstract",
@@ -7840,7 +7914,7 @@ const ir = [
7840
7914
  ]
7841
7915
  },
7842
7916
  {
7843
- functionName: V.ISBETWEEN,
7917
+ functionName: G.ISBETWEEN,
7844
7918
  functionType: t.Information,
7845
7919
  description: "formula.functionList.ISBETWEEN.description",
7846
7920
  abstract: "formula.functionList.ISBETWEEN.abstract",
@@ -7883,7 +7957,7 @@ const ir = [
7883
7957
  ]
7884
7958
  },
7885
7959
  {
7886
- functionName: V.ISBLANK,
7960
+ functionName: G.ISBLANK,
7887
7961
  functionType: t.Information,
7888
7962
  description: "formula.functionList.ISBLANK.description",
7889
7963
  abstract: "formula.functionList.ISBLANK.abstract",
@@ -7898,7 +7972,7 @@ const ir = [
7898
7972
  ]
7899
7973
  },
7900
7974
  {
7901
- functionName: V.ISDATE,
7975
+ functionName: G.ISDATE,
7902
7976
  functionType: t.Information,
7903
7977
  description: "formula.functionList.ISDATE.description",
7904
7978
  abstract: "formula.functionList.ISDATE.abstract",
@@ -7913,7 +7987,7 @@ const ir = [
7913
7987
  ]
7914
7988
  },
7915
7989
  {
7916
- functionName: V.ISEMAIL,
7990
+ functionName: G.ISEMAIL,
7917
7991
  functionType: t.Information,
7918
7992
  description: "formula.functionList.ISEMAIL.description",
7919
7993
  abstract: "formula.functionList.ISEMAIL.abstract",
@@ -7928,7 +8002,7 @@ const ir = [
7928
8002
  ]
7929
8003
  },
7930
8004
  {
7931
- functionName: V.ISERR,
8005
+ functionName: G.ISERR,
7932
8006
  functionType: t.Information,
7933
8007
  description: "formula.functionList.ISERR.description",
7934
8008
  abstract: "formula.functionList.ISERR.abstract",
@@ -7943,7 +8017,7 @@ const ir = [
7943
8017
  ]
7944
8018
  },
7945
8019
  {
7946
- functionName: V.ISERROR,
8020
+ functionName: G.ISERROR,
7947
8021
  functionType: t.Information,
7948
8022
  description: "formula.functionList.ISERROR.description",
7949
8023
  abstract: "formula.functionList.ISERROR.abstract",
@@ -7958,7 +8032,7 @@ const ir = [
7958
8032
  ]
7959
8033
  },
7960
8034
  {
7961
- functionName: V.ISEVEN,
8035
+ functionName: G.ISEVEN,
7962
8036
  functionType: t.Information,
7963
8037
  description: "formula.functionList.ISEVEN.description",
7964
8038
  abstract: "formula.functionList.ISEVEN.abstract",
@@ -7973,7 +8047,7 @@ const ir = [
7973
8047
  ]
7974
8048
  },
7975
8049
  {
7976
- functionName: V.ISFORMULA,
8050
+ functionName: G.ISFORMULA,
7977
8051
  functionType: t.Information,
7978
8052
  description: "formula.functionList.ISFORMULA.description",
7979
8053
  abstract: "formula.functionList.ISFORMULA.abstract",
@@ -7988,7 +8062,7 @@ const ir = [
7988
8062
  ]
7989
8063
  },
7990
8064
  {
7991
- functionName: V.ISLOGICAL,
8065
+ functionName: G.ISLOGICAL,
7992
8066
  functionType: t.Information,
7993
8067
  description: "formula.functionList.ISLOGICAL.description",
7994
8068
  abstract: "formula.functionList.ISLOGICAL.abstract",
@@ -8003,7 +8077,7 @@ const ir = [
8003
8077
  ]
8004
8078
  },
8005
8079
  {
8006
- functionName: V.ISNA,
8080
+ functionName: G.ISNA,
8007
8081
  functionType: t.Information,
8008
8082
  description: "formula.functionList.ISNA.description",
8009
8083
  abstract: "formula.functionList.ISNA.abstract",
@@ -8018,7 +8092,7 @@ const ir = [
8018
8092
  ]
8019
8093
  },
8020
8094
  {
8021
- functionName: V.ISNONTEXT,
8095
+ functionName: G.ISNONTEXT,
8022
8096
  functionType: t.Information,
8023
8097
  description: "formula.functionList.ISNONTEXT.description",
8024
8098
  abstract: "formula.functionList.ISNONTEXT.abstract",
@@ -8033,7 +8107,7 @@ const ir = [
8033
8107
  ]
8034
8108
  },
8035
8109
  {
8036
- functionName: V.ISNUMBER,
8110
+ functionName: G.ISNUMBER,
8037
8111
  functionType: t.Information,
8038
8112
  description: "formula.functionList.ISNUMBER.description",
8039
8113
  abstract: "formula.functionList.ISNUMBER.abstract",
@@ -8048,7 +8122,7 @@ const ir = [
8048
8122
  ]
8049
8123
  },
8050
8124
  {
8051
- functionName: V.ISODD,
8125
+ functionName: G.ISODD,
8052
8126
  functionType: t.Information,
8053
8127
  description: "formula.functionList.ISODD.description",
8054
8128
  abstract: "formula.functionList.ISODD.abstract",
@@ -8063,7 +8137,7 @@ const ir = [
8063
8137
  ]
8064
8138
  },
8065
8139
  {
8066
- functionName: V.ISOMITTED,
8140
+ functionName: G.ISOMITTED,
8067
8141
  functionType: t.Information,
8068
8142
  description: "formula.functionList.ISOMITTED.description",
8069
8143
  abstract: "formula.functionList.ISOMITTED.abstract",
@@ -8085,7 +8159,7 @@ const ir = [
8085
8159
  ]
8086
8160
  },
8087
8161
  {
8088
- functionName: V.ISREF,
8162
+ functionName: G.ISREF,
8089
8163
  functionType: t.Information,
8090
8164
  description: "formula.functionList.ISREF.description",
8091
8165
  abstract: "formula.functionList.ISREF.abstract",
@@ -8100,7 +8174,7 @@ const ir = [
8100
8174
  ]
8101
8175
  },
8102
8176
  {
8103
- functionName: V.ISTEXT,
8177
+ functionName: G.ISTEXT,
8104
8178
  functionType: t.Information,
8105
8179
  description: "formula.functionList.ISTEXT.description",
8106
8180
  abstract: "formula.functionList.ISTEXT.abstract",
@@ -8115,7 +8189,7 @@ const ir = [
8115
8189
  ]
8116
8190
  },
8117
8191
  {
8118
- functionName: V.ISURL,
8192
+ functionName: G.ISURL,
8119
8193
  functionType: t.Information,
8120
8194
  description: "formula.functionList.ISURL.description",
8121
8195
  abstract: "formula.functionList.ISURL.abstract",
@@ -8130,7 +8204,7 @@ const ir = [
8130
8204
  ]
8131
8205
  },
8132
8206
  {
8133
- functionName: V.N,
8207
+ functionName: G.N,
8134
8208
  functionType: t.Information,
8135
8209
  description: "formula.functionList.N.description",
8136
8210
  abstract: "formula.functionList.N.abstract",
@@ -8145,14 +8219,14 @@ const ir = [
8145
8219
  ]
8146
8220
  },
8147
8221
  {
8148
- functionName: V.NA,
8222
+ functionName: G.NA,
8149
8223
  functionType: t.Information,
8150
8224
  description: "formula.functionList.NA.description",
8151
8225
  abstract: "formula.functionList.NA.abstract",
8152
8226
  functionParameter: []
8153
8227
  },
8154
8228
  {
8155
- functionName: V.SHEET,
8229
+ functionName: G.SHEET,
8156
8230
  functionType: t.Information,
8157
8231
  description: "formula.functionList.SHEET.description",
8158
8232
  abstract: "formula.functionList.SHEET.abstract",
@@ -8167,14 +8241,14 @@ const ir = [
8167
8241
  ]
8168
8242
  },
8169
8243
  {
8170
- functionName: V.SHEETS,
8244
+ functionName: G.SHEETS,
8171
8245
  functionType: t.Information,
8172
8246
  description: "formula.functionList.SHEETS.description",
8173
8247
  abstract: "formula.functionList.SHEETS.abstract",
8174
8248
  functionParameter: []
8175
8249
  },
8176
8250
  {
8177
- functionName: V.TYPE,
8251
+ functionName: G.TYPE,
8178
8252
  functionType: t.Information,
8179
8253
  description: "formula.functionList.TYPE.description",
8180
8254
  abstract: "formula.functionList.TYPE.abstract",
@@ -8188,7 +8262,7 @@ const ir = [
8188
8262
  }
8189
8263
  ]
8190
8264
  }
8191
- ], sr = [
8265
+ ], Tr = [
8192
8266
  {
8193
8267
  functionName: K.AND,
8194
8268
  functionType: t.Logical,
@@ -8662,7 +8736,7 @@ const ir = [
8662
8736
  }
8663
8737
  ]
8664
8738
  }
8665
- ], dr = [
8739
+ ], Er = [
8666
8740
  {
8667
8741
  functionName: y.ADDRESS,
8668
8742
  functionType: t.Lookup,
@@ -9694,7 +9768,7 @@ const ir = [
9694
9768
  }
9695
9769
  ]
9696
9770
  }
9697
- ], pr = [
9771
+ ], Ir = [
9698
9772
  {
9699
9773
  functionName: T.ABS,
9700
9774
  functionType: t.Math,
@@ -11332,7 +11406,7 @@ const ir = [
11332
11406
  }
11333
11407
  ]
11334
11408
  }
11335
- ], Lr = [
11409
+ ], Nr = [
11336
11410
  {
11337
11411
  functionName: l.AVEDEV,
11338
11412
  functionType: t.Statistical,
@@ -14274,7 +14348,7 @@ const ir = [
14274
14348
  }
14275
14349
  ]
14276
14350
  }
14277
- ], Pr = [
14351
+ ], Rr = [
14278
14352
  {
14279
14353
  functionName: b.ASC,
14280
14354
  functionType: t.Text,
@@ -15488,9 +15562,9 @@ const ir = [
15488
15562
  }
15489
15563
  ]
15490
15564
  }
15491
- ], Tr = [], Er = [
15565
+ ], Sr = [], Ar = [
15492
15566
  {
15493
- functionName: pt.ENCODEURL,
15567
+ functionName: Rt.ENCODEURL,
15494
15568
  functionType: t.Web,
15495
15569
  description: "formula.functionList.ENCODEURL.description",
15496
15570
  abstract: "formula.functionList.ENCODEURL.abstract",
@@ -15505,7 +15579,7 @@ const ir = [
15505
15579
  ]
15506
15580
  },
15507
15581
  {
15508
- functionName: pt.FILTERXML,
15582
+ functionName: Rt.FILTERXML,
15509
15583
  functionType: t.Web,
15510
15584
  description: "formula.functionList.FILTERXML.description",
15511
15585
  abstract: "formula.functionList.FILTERXML.abstract",
@@ -15527,7 +15601,7 @@ const ir = [
15527
15601
  ]
15528
15602
  },
15529
15603
  {
15530
- functionName: pt.WEBSERVICE,
15604
+ functionName: Rt.WEBSERVICE,
15531
15605
  functionType: t.Web,
15532
15606
  description: "formula.functionList.WEBSERVICE.description",
15533
15607
  abstract: "formula.functionList.WEBSERVICE.abstract",
@@ -15548,34 +15622,34 @@ const ir = [
15548
15622
  }
15549
15623
  ]
15550
15624
  }
15551
- ], Ir = [
15552
- ...cr,
15553
- ...mr,
15554
- ...pr,
15625
+ ], Cr = [
15555
15626
  ...Lr,
15556
15627
  ...dr,
15557
- ...ur,
15558
- ...Pr,
15628
+ ...Ir,
15629
+ ...Nr,
15630
+ ...Er,
15559
15631
  ...sr,
15632
+ ...Rr,
15633
+ ...Tr,
15634
+ ...Pr,
15635
+ ...pr,
15560
15636
  ...lr,
15637
+ ...cr,
15638
+ ...Ar,
15561
15639
  ...fr,
15562
- ...or,
15563
- ...rr,
15564
- ...Er,
15565
- ...ir,
15566
- ...Tr
15640
+ ...Sr
15567
15641
  ];
15568
- function Nr(a, e) {
15642
+ function Dr(a, e) {
15569
15643
  let n = "";
15570
15644
  return a.aliasFunctionName ? (n = e.t(a.aliasFunctionName), n === a.aliasFunctionName && (n = a.functionName)) : n = a.functionName, n;
15571
15645
  }
15572
- var Rr = Object.getOwnPropertyDescriptor, Sr = (a, e, n, i) => {
15573
- for (var r = i > 1 ? void 0 : i ? Rr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15646
+ var br = Object.getOwnPropertyDescriptor, Or = (a, e, n, i) => {
15647
+ for (var r = i > 1 ? void 0 : i ? br(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15574
15648
  (u = a[o]) && (r = u(r) || r);
15575
15649
  return r;
15576
- }, Rt = (a, e) => (n, i) => e(n, i, a);
15577
- const Gt = gt("formula.description-service");
15578
- let Mt = class {
15650
+ }, Mt = (a, e) => (n, i) => e(n, i, a);
15651
+ const Pt = Gt("formula.description-service");
15652
+ let Ut = class {
15579
15653
  constructor(a, e, n) {
15580
15654
  W(this, "_descriptions", []);
15581
15655
  this._functionService = a, this._localeService = e, this._configService = n, this._initialize();
@@ -15614,7 +15688,7 @@ let Mt = class {
15614
15688
  }), e;
15615
15689
  }
15616
15690
  registerDescriptions(a) {
15617
- return this._descriptions = this._descriptions.concat(a), this._registerDescriptions(), oe(() => {
15691
+ return this._descriptions = this._descriptions.concat(a), this._registerDescriptions(), J(() => {
15618
15692
  const e = a.map((n) => n.functionName);
15619
15693
  this.unregisterDescriptions(e);
15620
15694
  });
@@ -15633,7 +15707,7 @@ let Mt = class {
15633
15707
  if (e.length === 0)
15634
15708
  return !1;
15635
15709
  const n = e[0].description;
15636
- return !_n(n);
15710
+ return !qn(n);
15637
15711
  }
15638
15712
  _initialize() {
15639
15713
  this._localeService.localeChanged$.subscribe(() => {
@@ -15643,8 +15717,6 @@ let Mt = class {
15643
15717
  _initDescription() {
15644
15718
  var i;
15645
15719
  const a = [
15646
- ...yn,
15647
- ...qn,
15648
15720
  ...gn,
15649
15721
  ...hn,
15650
15722
  ...Un,
@@ -15658,13 +15730,15 @@ let Mt = class {
15658
15730
  ...Yn,
15659
15731
  ...Xn,
15660
15732
  ...Wn,
15661
- ...Kn
15662
- ].map((r) => r[1]), e = Ir.filter((r) => a.includes(r.functionName)), n = this._configService.getConfig(ge);
15733
+ ...Kn,
15734
+ ...kn,
15735
+ ...Qn
15736
+ ].map((r) => r[1]), e = Cr.filter((r) => a.includes(r.functionName)), n = this._configService.getConfig(he);
15663
15737
  this._descriptions = e.concat((i = n == null ? void 0 : n.description) != null ? i : []);
15664
15738
  }
15665
15739
  _registerDescriptions() {
15666
15740
  const a = this._localeService, e = this._descriptions.map((n) => ({
15667
- functionName: Nr(n, a),
15741
+ functionName: Dr(n, a),
15668
15742
  functionType: n.functionType,
15669
15743
  description: a.t(n.description),
15670
15744
  abstract: a.t(n.abstract),
@@ -15679,17 +15753,17 @@ let Mt = class {
15679
15753
  this._functionService.registerDescriptions(...e);
15680
15754
  }
15681
15755
  };
15682
- Mt = Sr([
15683
- Rt(0, Vt),
15684
- Rt(1, X(qt)),
15685
- Rt(2, Ae)
15686
- ], Mt);
15687
- var Ar = Object.getOwnPropertyDescriptor, Cr = (a, e, n, i) => {
15688
- for (var r = i > 1 ? void 0 : i ? Ar(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15756
+ Ut = Or([
15757
+ Mt(0, Lt),
15758
+ Mt(1, X(Vt)),
15759
+ Mt(2, be)
15760
+ ], Ut);
15761
+ var Mr = Object.getOwnPropertyDescriptor, xr = (a, e, n, i) => {
15762
+ for (var r = i > 1 ? void 0 : i ? Mr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15689
15763
  (u = a[o]) && (r = u(r) || r);
15690
15764
  return r;
15691
15765
  }, He = (a, e) => (n, i) => e(n, i, a);
15692
- let tt = class extends ne {
15766
+ let nt = class extends ee {
15693
15767
  constructor(e, n, i, r) {
15694
15768
  super();
15695
15769
  W(this, "_preUnitId", null);
@@ -15699,15 +15773,15 @@ let tt = class extends ne {
15699
15773
  this._descriptionListener(), this._changeUnitListener(), this._changeSheetListener();
15700
15774
  }
15701
15775
  _descriptionListener() {
15702
- oe(
15776
+ J(
15703
15777
  this._definedNamesService.update$.subscribe(() => {
15704
15778
  this._registerDescriptions();
15705
15779
  })
15706
15780
  );
15707
15781
  }
15708
15782
  _changeUnitListener() {
15709
- oe(
15710
- this._univerInstanceService.getCurrentTypeOfUnit$(ae.UNIVER_SHEET).subscribe(() => {
15783
+ J(
15784
+ this._univerInstanceService.getCurrentTypeOfUnit$(j.UNIVER_SHEET).subscribe(() => {
15711
15785
  this._unRegisterDescriptions(), this._registerDescriptions();
15712
15786
  })
15713
15787
  );
@@ -15716,12 +15790,12 @@ let tt = class extends ne {
15716
15790
  this.disposeWithMe(
15717
15791
  this._commandService.onCommandExecuted((e, n) => {
15718
15792
  if (!(n != null && n.fromCollab)) {
15719
- if (e.id === Nn.id)
15793
+ if (e.id === Ba.id)
15720
15794
  this._unregisterDescriptionsForNotInSheetId(), this._registerDescriptions();
15721
- else if (e.id === ye.id) {
15795
+ else if (e.id === De.id) {
15722
15796
  const i = e.params;
15723
15797
  this._registerDescription(i);
15724
- } else if (e.id === bt.id) {
15798
+ } else if (e.id === gt.id) {
15725
15799
  const i = e.params;
15726
15800
  this._unregisterDescription(i);
15727
15801
  }
@@ -15734,7 +15808,7 @@ let tt = class extends ne {
15734
15808
  if (n == null || i == null)
15735
15809
  return;
15736
15810
  const { name: r, comment: o, formulaOrRefString: u, localSheetId: f } = e;
15737
- !this._descriptionService.hasDescription(r) && (f == null || f === dt || f === i) && this._descriptionService.registerDescriptions([{
15811
+ !this._descriptionService.hasDescription(r) && (f == null || f === Nt || f === i) && this._descriptionService.registerDescriptions([{
15738
15812
  functionName: r,
15739
15813
  description: u + (o || ""),
15740
15814
  abstract: u,
@@ -15759,7 +15833,7 @@ let tt = class extends ne {
15759
15833
  }), this._descriptionService.unregisterDescriptions(n), this._preUnitId = null;
15760
15834
  }
15761
15835
  _getUnitIdAndSheetId() {
15762
- const e = this._univerInstanceService.getCurrentUnitForType(ae.UNIVER_SHEET);
15836
+ const e = this._univerInstanceService.getCurrentUnitForType(j.UNIVER_SHEET);
15763
15837
  if (e == null)
15764
15838
  return {};
15765
15839
  const n = e.getActiveSheet();
@@ -15778,7 +15852,7 @@ let tt = class extends ne {
15778
15852
  const r = [];
15779
15853
  this._preUnitId = e, Array.from(Object.values(i)).forEach((o) => {
15780
15854
  const { name: u, comment: f, formulaOrRefString: m, localSheetId: c } = o;
15781
- !this._descriptionService.hasDescription(u) && (c == null || c === dt || c === n) && r.push({
15855
+ !this._descriptionService.hasDescription(u) && (c == null || c === Nt || c === n) && r.push({
15782
15856
  functionName: u,
15783
15857
  description: m + (f || ""),
15784
15858
  abstract: m,
@@ -15797,139 +15871,265 @@ let tt = class extends ne {
15797
15871
  const r = [];
15798
15872
  Array.from(Object.values(i)).forEach((o) => {
15799
15873
  const { name: u, localSheetId: f } = o;
15800
- f !== dt && f !== n && r.push(u);
15874
+ f !== Nt && f !== n && r.push(u);
15801
15875
  }), this._descriptionService.unregisterDescriptions(r);
15802
15876
  }
15803
15877
  };
15804
- tt = Cr([
15805
- He(0, Gt),
15806
- He(1, Bt),
15807
- He(2, Se),
15808
- He(3, fe)
15809
- ], tt);
15810
- var Dr = Object.getOwnPropertyDescriptor, br = (a, e, n, i) => {
15811
- for (var r = i > 1 ? void 0 : i ? Dr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15878
+ nt = xr([
15879
+ He(0, Pt),
15880
+ He(1, dt),
15881
+ He(2, Ee),
15882
+ He(3, ue)
15883
+ ], nt);
15884
+ var _r = Object.getOwnPropertyDescriptor, yr = (a, e, n, i) => {
15885
+ for (var r = i > 1 ? void 0 : i ? _r(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15812
15886
  (u = a[o]) && (r = u(r) || r);
15813
15887
  return r;
15814
- }, Or = (a, e) => (n, i) => e(n, i, a);
15815
- let at = class extends ne {
15888
+ }, qr = (a, e) => (n, i) => e(n, i, a);
15889
+ let it = class extends ee {
15816
15890
  constructor(a) {
15817
15891
  super(), this._commandService = a, [
15818
- ni,
15819
- ii,
15820
- Oe
15892
+ mi,
15893
+ fi,
15894
+ _e
15821
15895
  ].forEach((e) => this._commandService.registerCommand(e));
15822
15896
  }
15823
15897
  };
15824
- at = br([
15825
- Or(0, fe)
15826
- ], at);
15827
- var Mr = Object.getOwnPropertyDescriptor, xr = (a, e, n, i) => {
15828
- for (var r = i > 1 ? void 0 : i ? Mr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15898
+ it = yr([
15899
+ qr(0, ue)
15900
+ ], it);
15901
+ var gr = Object.getOwnPropertyDescriptor, hr = (a, e, n, i) => {
15902
+ for (var r = i > 1 ? void 0 : i ? gr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15829
15903
  (u = a[o]) && (r = u(r) || r);
15830
15904
  return r;
15831
15905
  }, we = (a, e) => (n, i) => e(n, i, a);
15832
- function sa(a, e, n, i) {
15906
+ let rt = class extends ee {
15907
+ constructor(e, n, i, r) {
15908
+ super();
15909
+ W(this, "_preUnitId", null);
15910
+ this._descriptionService = e, this._univerInstanceService = n, this._commandService = i, this._superTableService = r, this._initialize();
15911
+ }
15912
+ _initialize() {
15913
+ this._descriptionListener(), this._changeUnitListener(), this._changeSheetListener();
15914
+ }
15915
+ _descriptionListener() {
15916
+ J(
15917
+ this._superTableService.update$.subscribe(() => {
15918
+ this._registerDescriptions();
15919
+ })
15920
+ );
15921
+ }
15922
+ _changeUnitListener() {
15923
+ J(
15924
+ this._univerInstanceService.getCurrentTypeOfUnit$(j.UNIVER_SHEET).subscribe(() => {
15925
+ this._unRegisterDescriptions(), this._registerDescriptions();
15926
+ })
15927
+ );
15928
+ }
15929
+ _changeSheetListener() {
15930
+ this.disposeWithMe(
15931
+ this._commandService.onCommandExecuted((e, n) => {
15932
+ if (!(n != null && n.fromCollab)) {
15933
+ if (e.id === Ba.id)
15934
+ this._unregisterDescriptionsForNotInSheetId(), this._registerDescriptions();
15935
+ else if (e.id === $n.id) {
15936
+ const i = e.params;
15937
+ this._registerDescription(i);
15938
+ } else if (e.id === jn.id) {
15939
+ const i = e.params;
15940
+ this._unregisterDescription(i);
15941
+ }
15942
+ }
15943
+ })
15944
+ );
15945
+ }
15946
+ _registerDescription(e) {
15947
+ var u, f;
15948
+ const { unitId: n, sheetId: i } = this._getUnitIdAndSheetId();
15949
+ if (n == null || i == null)
15950
+ return;
15951
+ const { tableName: r, reference: o } = e;
15952
+ if (!this._descriptionService.hasDescription(r)) {
15953
+ const m = ((f = (u = this._univerInstanceService.getUnit(n)) == null ? void 0 : u.getSheetBySheetId(o.sheetId)) == null ? void 0 : f.getName()) || "", c = ze(m, o.range);
15954
+ this._descriptionService.registerDescriptions([{
15955
+ functionName: r,
15956
+ description: c,
15957
+ abstract: c,
15958
+ functionType: t.Table,
15959
+ functionParameter: []
15960
+ }]);
15961
+ }
15962
+ }
15963
+ _unregisterDescription(e) {
15964
+ const { tableName: n } = e;
15965
+ this._descriptionService.unregisterDescriptions([n]);
15966
+ }
15967
+ _unRegisterDescriptions() {
15968
+ if (this._preUnitId == null)
15969
+ return;
15970
+ const e = this._superTableService.getTableMap(this._preUnitId);
15971
+ if (e == null)
15972
+ return;
15973
+ const n = [];
15974
+ e.forEach((i, r) => {
15975
+ n.push(r);
15976
+ }), this._descriptionService.unregisterDescriptions(n), this._preUnitId = null;
15977
+ }
15978
+ _getUnitIdAndSheetId() {
15979
+ const e = this._univerInstanceService.getCurrentUnitForType(j.UNIVER_SHEET);
15980
+ if (e == null)
15981
+ return {};
15982
+ const n = e.getActiveSheet();
15983
+ return n == null ? {} : {
15984
+ unitId: e.getUnitId(),
15985
+ sheetId: n.getSheetId()
15986
+ };
15987
+ }
15988
+ _registerDescriptions() {
15989
+ const { unitId: e, sheetId: n } = this._getUnitIdAndSheetId();
15990
+ if (e == null || n == null)
15991
+ return;
15992
+ const i = this._superTableService.getTableMap(e);
15993
+ if (!i)
15994
+ return;
15995
+ const r = [];
15996
+ this._preUnitId = e, i.forEach((o, u) => {
15997
+ var c, s;
15998
+ const f = ((s = (c = this._univerInstanceService.getUnit(e)) == null ? void 0 : c.getSheetBySheetId(o.sheetId)) == null ? void 0 : s.getName()) || "", m = ze(f, o.range);
15999
+ this._descriptionService.hasDescription(u) || r.push({
16000
+ functionName: u,
16001
+ description: m,
16002
+ abstract: m,
16003
+ functionType: t.Table,
16004
+ functionParameter: []
16005
+ });
16006
+ }), this._descriptionService.registerDescriptions(r);
16007
+ }
16008
+ _unregisterDescriptionsForNotInSheetId() {
16009
+ const { unitId: e, sheetId: n } = this._getUnitIdAndSheetId();
16010
+ if (e == null || n == null)
16011
+ return;
16012
+ const i = this._superTableService.getTableMap(e);
16013
+ if (!i)
16014
+ return;
16015
+ const r = [];
16016
+ i.forEach((o, u) => {
16017
+ r.push(u);
16018
+ }), this._descriptionService.unregisterDescriptions(r);
16019
+ }
16020
+ };
16021
+ rt = hr([
16022
+ we(0, Pt),
16023
+ we(1, Ee),
16024
+ we(2, ue),
16025
+ we(3, zn)
16026
+ ], rt);
16027
+ var Ur = Object.getOwnPropertyDescriptor, Fr = (a, e, n, i) => {
16028
+ for (var r = i > 1 ? void 0 : i ? Ur(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16029
+ (u = a[o]) && (r = u(r) || r);
16030
+ return r;
16031
+ }, Ye = (a, e) => (n, i) => e(n, i, a);
16032
+ function pa(a, e, n, i) {
15833
16033
  const r = a.sequenceNodesBuilder(e);
15834
16034
  if (r == null)
15835
16035
  return e;
15836
16036
  const o = [];
15837
16037
  for (let u = 0, f = r.length; u < f; u++) {
15838
16038
  const m = r[u];
15839
- if (typeof m == "string" || m.nodeType !== te.REFERENCE)
16039
+ if (typeof m == "string" || m.nodeType !== ie.REFERENCE)
15840
16040
  continue;
15841
- const { token: c } = m, d = Le(c), { sheetName: P, unitId: E } = d;
15842
- let p = d.range;
15843
- p.startAbsoluteRefType === Qe.ALL && p.endAbsoluteRefType === Qe.ALL || (p = St(p, n, i), o.push({
16041
+ const { token: c } = m, s = Pe(c), { sheetName: L, unitId: E } = s;
16042
+ let p = s.range;
16043
+ p.startAbsoluteRefType === $e.ALL && p.endAbsoluteRefType === $e.ALL || (p = xt(p, n, i), o.push({
15844
16044
  unitId: E,
15845
- sheetName: P,
16045
+ sheetName: L,
15846
16046
  range: p
15847
16047
  }));
15848
16048
  }
15849
16049
  return o.map((u) => `${u.unitId}!${u.sheetName}!${u.range.startRow}!${u.range.endRow}!${u.range.startColumn}!${u.range.endColumn}`).join("|");
15850
16050
  }
15851
- let xt = class extends ne {
16051
+ let Ft = class extends ee {
15852
16052
  constructor(a, e, n, i) {
15853
16053
  super(), this._refRangeService = a, this._lexerTreeBuilder = e, this._univerInstanceService = n, this._injector = i;
15854
16054
  }
15855
16055
  transformFormulaByEffectCommand(a, e, n, i) {
15856
- const r = this._lexerTreeBuilder.sequenceNodesBuilder(n), o = this._univerInstanceService.getCurrentUnitForType(ae.UNIVER_SHEET), u = o.getActiveSheet(), f = o.getUnitId(), m = u.getSheetId(), c = r == null ? void 0 : r.map((d) => {
15857
- if (typeof d == "object" && d.nodeType === te.REFERENCE) {
15858
- const P = Le(d.token), { range: E, unitId: p, sheetName: I } = P, S = this._univerInstanceService.getUnit(p || a), R = I ? S == null ? void 0 : S.getSheetBySheetName(I) : S == null ? void 0 : S.getSheetBySheetId(e);
16056
+ const r = this._lexerTreeBuilder.sequenceNodesBuilder(n), o = this._univerInstanceService.getCurrentUnitForType(j.UNIVER_SHEET), u = o.getActiveSheet(), f = o.getUnitId(), m = u.getSheetId(), c = r == null ? void 0 : r.map((s) => {
16057
+ if (typeof s == "object" && s.nodeType === ie.REFERENCE) {
16058
+ const L = Pe(s.token), { range: E, unitId: p, sheetName: I } = L, S = this._univerInstanceService.getUnit(p || a), R = I ? S == null ? void 0 : S.getSheetBySheetName(I) : S == null ? void 0 : S.getSheetBySheetId(e);
15859
16059
  if (!R)
15860
16060
  throw new Error("Sheet not found");
15861
- const s = S.getUnitId(), A = R.getSheetId();
15862
- if (s !== f || A !== m)
15863
- return d;
15864
- const N = ea(E, i);
15865
- let L = "";
16061
+ const d = S.getUnitId(), A = R.getSheetId();
16062
+ if (d !== f || A !== m)
16063
+ return s;
16064
+ const N = na(E, i);
16065
+ let P = "";
15866
16066
  if (N) {
15867
- const g = N.startColumn - E.startColumn, q = N.startRow - E.startRow, U = St(E, g, q);
15868
- p && I ? L = ra(p, I, U) : I ? L = oa(I, U) : L = _e(U);
16067
+ const g = N.startColumn - E.startColumn, q = N.startRow - E.startRow, U = xt(E, g, q);
16068
+ p && I ? P = ma(p, I, U) : I ? P = ze(I, U) : P = Ce(U);
15869
16069
  } else
15870
- L = Q.REF;
16070
+ P = $.REF;
15871
16071
  return {
15872
- ...d,
15873
- token: L
16072
+ ...s,
16073
+ token: P
15874
16074
  };
15875
16075
  } else
15876
- return d;
16076
+ return s;
15877
16077
  });
15878
- return c ? `=${$e(c)}` : "";
16078
+ return c ? `=${je(c)}` : "";
15879
16079
  }
15880
16080
  registerFormula(a, e, n, i) {
15881
- const r = /* @__PURE__ */ new Map(), o = this._lexerTreeBuilder.sequenceNodesBuilder(n), u = new ke(), f = (m) => {
15882
- const c = this._univerInstanceService.getCurrentUnitForType(ae.UNIVER_SHEET), d = c.getActiveSheet(), P = c.getUnitId(), E = d.getSheetId(), p = o == null ? void 0 : o.map((S) => {
15883
- if (typeof S == "object" && S.nodeType === te.REFERENCE) {
16081
+ const r = /* @__PURE__ */ new Map(), o = this._lexerTreeBuilder.sequenceNodesBuilder(n), u = new Qe(), f = (m) => {
16082
+ const c = this._univerInstanceService.getCurrentUnitForType(j.UNIVER_SHEET), s = c.getActiveSheet(), L = c.getUnitId(), E = s.getSheetId(), p = o == null ? void 0 : o.map((S) => {
16083
+ if (typeof S == "object" && S.nodeType === ie.REFERENCE) {
15884
16084
  const R = r.get(S.token);
15885
- if (R.unitId !== P || R.subUnitId !== E)
16085
+ if (R.unitId !== L || R.subUnitId !== E)
15886
16086
  return S;
15887
- const s = ea(R.range, m);
16087
+ const d = na(R.range, m);
15888
16088
  let A = "";
15889
- if (s) {
15890
- const N = s.startColumn - R.range.startColumn, L = s.startRow - R.range.startRow, g = St(R.range, N, L);
15891
- R.unitId && R.sheetName ? A = ra(R.unitId, R.sheetName, g) : R.sheetName ? A = oa(R.sheetName, g) : A = _e(g);
16089
+ if (d) {
16090
+ const N = d.startColumn - R.range.startColumn, P = d.startRow - R.range.startRow, g = xt(R.range, N, P);
16091
+ R.unitId && R.sheetName ? A = ma(R.unitId, R.sheetName, g) : R.sheetName ? A = ze(R.sheetName, g) : A = Ce(g);
15892
16092
  } else
15893
- A = Q.REF;
16093
+ A = $.REF;
15894
16094
  return {
15895
16095
  ...S,
15896
16096
  token: A
15897
16097
  };
15898
16098
  } else
15899
16099
  return S;
15900
- }), I = p && $e(p);
16100
+ }), I = p && je(p);
15901
16101
  return i(`=${I}`);
15902
16102
  };
15903
16103
  return o == null || o.forEach((m) => {
15904
- if (typeof m == "object" && m.nodeType === te.REFERENCE) {
15905
- const c = Le(m.token), { range: d, unitId: P, sheetName: E } = c, p = this._univerInstanceService.getUnit(P || a), I = E ? p == null ? void 0 : p.getSheetBySheetName(E) : p == null ? void 0 : p.getSheetBySheetId(e);
16104
+ if (typeof m == "object" && m.nodeType === ie.REFERENCE) {
16105
+ const c = Pe(m.token), { range: s, unitId: L, sheetName: E } = c, p = this._univerInstanceService.getUnit(L || a), I = E ? p == null ? void 0 : p.getSheetBySheetName(E) : p == null ? void 0 : p.getSheetBySheetId(e);
15906
16106
  if (!I)
15907
16107
  return;
15908
- const S = p.getUnitId(), R = I.getSheetId(), s = {
16108
+ const S = p.getUnitId(), R = I.getSheetId(), d = {
15909
16109
  unitId: S,
15910
16110
  subUnitId: R,
15911
- range: d,
16111
+ range: s,
15912
16112
  sheetName: E
15913
16113
  };
15914
- r.set(m.token, s), u.add(this._refRangeService.registerRefRange(d, f, S, R));
16114
+ r.set(m.token, d), u.add(this._refRangeService.registerRefRange(s, f, S, R));
15915
16115
  }
15916
16116
  }), u;
15917
16117
  }
15918
16118
  _getFormulaDependcy(a, e, n, i) {
15919
- const r = Me(n) ? this._lexerTreeBuilder.sequenceNodesBuilder(n) : null, o = [];
16119
+ const r = ye(n) ? this._lexerTreeBuilder.sequenceNodesBuilder(n) : null, o = [];
15920
16120
  return r == null || r.forEach((u) => {
15921
- if (typeof u == "object" && u.nodeType === te.REFERENCE) {
15922
- const f = Le(u.token), { range: m, unitId: c, sheetName: d } = f;
15923
- if (m.startAbsoluteRefType === Qe.ALL && m.endAbsoluteRefType === Qe.ALL)
16121
+ if (typeof u == "object" && u.nodeType === ie.REFERENCE) {
16122
+ const f = Pe(u.token), { range: m, unitId: c, sheetName: s } = f;
16123
+ if (m.startAbsoluteRefType === $e.ALL && m.endAbsoluteRefType === $e.ALL)
15924
16124
  return;
15925
- const P = this._univerInstanceService.getUnit(c || a), E = d ? P == null ? void 0 : P.getSheetBySheetName(d) : P == null ? void 0 : P.getSheetBySheetId(e);
16125
+ const L = this._univerInstanceService.getUnit(c || a), E = s ? L == null ? void 0 : L.getSheetBySheetName(s) : L == null ? void 0 : L.getSheetBySheetId(e);
15926
16126
  if (!E)
15927
16127
  return;
15928
- const p = P.getUnitId(), I = E.getSheetId(), S = i[0].startRow, R = i[0].startColumn, s = m.startRow, A = m.startColumn, N = i.map((L) => ({
15929
- startRow: L.startRow - S + s,
15930
- endRow: L.endRow - S + s,
15931
- startColumn: L.startColumn - R + A,
15932
- endColumn: L.endColumn - R + A
16128
+ const p = L.getUnitId(), I = E.getSheetId(), S = i[0].startRow, R = i[0].startColumn, d = m.startRow, A = m.startColumn, N = i.map((P) => ({
16129
+ startRow: P.startRow - S + d,
16130
+ endRow: P.endRow - S + d,
16131
+ startColumn: P.startColumn - R + A,
16132
+ endColumn: P.endColumn - R + A
15933
16133
  }));
15934
16134
  o.push({
15935
16135
  unitId: p,
@@ -15941,70 +16141,70 @@ let xt = class extends ne {
15941
16141
  }
15942
16142
  // eslint-disable-next-line max-lines-per-function
15943
16143
  registerRangeFormula(a, e, n, i, r) {
15944
- const o = new ke(), u = i.map((m) => this._getFormulaDependcy(a, e, m, n)), f = (m) => {
15945
- const c = n[0].startRow, d = n[0].startColumn, P = [{ unitId: a, subUnitId: e, ranges: n }, ...u.flat()], E = [], p = Sn(this._injector, m);
15946
- for (const { unitId: I, subUnitId: S, ranges: R } of P)
16144
+ const o = new Qe(), u = i.map((m) => this._getFormulaDependcy(a, e, m, n)), f = (m) => {
16145
+ const c = n[0].startRow, s = n[0].startColumn, L = [{ unitId: a, subUnitId: e, ranges: n }, ...u.flat()], E = [], p = Dn(this._injector, m);
16146
+ for (const { unitId: I, subUnitId: S, ranges: R } of L)
15947
16147
  if (I === p.unitId && S === p.subUnitId) {
15948
- const s = [], A = R[0].startRow, N = R[0].startColumn, L = A - c, g = N - d;
16148
+ const d = [], A = R[0].startRow, N = R[0].startColumn, P = A - c, g = N - s;
15949
16149
  for (const q of p.ranges) {
15950
- const U = R.map((h) => We(q, h)).filter(Boolean);
15951
- U.length > 0 && s.push(...U);
16150
+ const U = R.map((h) => Ke(q, h)).filter(Boolean);
16151
+ U.length > 0 && d.push(...U);
15952
16152
  }
15953
- s.length > 0 && E.push(
15954
- s.map((q) => ({
15955
- startRow: q.startRow - L,
15956
- endRow: q.endRow - L,
16153
+ d.length > 0 && E.push(
16154
+ d.map((q) => ({
16155
+ startRow: q.startRow - P,
16156
+ endRow: q.endRow - P,
15957
16157
  startColumn: q.startColumn - g,
15958
16158
  endColumn: q.endColumn - g
15959
16159
  }))
15960
16160
  );
15961
16161
  }
15962
16162
  if (E.length > 0) {
15963
- const I = me.splitIntoGrid([...E.flat()]), S = me.subtractMulti(n, I);
15964
- S.sort((L, g) => L.startRow - g.startRow || L.startColumn - g.startColumn);
16163
+ const I = fe.splitIntoGrid([...E.flat()]), S = fe.subtractMulti(n, I);
16164
+ S.sort((P, g) => P.startRow - g.startRow || P.startColumn - g.startColumn);
15965
16165
  const R = /* @__PURE__ */ new Map();
15966
- for (let L = 0; L < I.length; L++) {
15967
- const g = I[L], q = g.startRow, U = g.startColumn, h = q - c, M = U - d, F = An(g, m).sort(($, ie) => $.startRow - ie.startRow || $.startColumn - ie.startColumn);
16166
+ for (let P = 0; P < I.length; P++) {
16167
+ const g = I[P], q = g.startRow, U = g.startColumn, h = q - c, M = U - s, F = bn(g, m).sort((z, re) => z.startRow - re.startRow || z.startColumn - re.startColumn);
15968
16168
  if (!F.length)
15969
16169
  continue;
15970
- const B = F[0].startRow, J = F[0].startColumn, O = B - c, ce = J - d, ee = [];
15971
- for (let $ = 0; $ < i.length; $++) {
15972
- const ie = i[$], re = Me(ie), he = re ? this._lexerTreeBuilder.moveFormulaRefOffset(ie, M, h) : ie, j = re ? this.transformFormulaByEffectCommand(a, e, he, m) : he, lt = sa(this._lexerTreeBuilder, j, -ce, -O);
15973
- ee.push({
15974
- newFormula: j,
15975
- orginFormula: lt
16170
+ const B = F[0].startRow, ae = F[0].startColumn, O = B - c, ce = ae - s, ne = [];
16171
+ for (let z = 0; z < i.length; z++) {
16172
+ const re = i[z], oe = ye(re), Ue = oe ? this._lexerTreeBuilder.moveFormulaRefOffset(re, M, h) : re, Z = oe ? this.transformFormulaByEffectCommand(a, e, Ue, m) : Ue, Et = pa(this._lexerTreeBuilder, Z, -ce, -O);
16173
+ ne.push({
16174
+ newFormula: Z,
16175
+ orginFormula: Et
15976
16176
  });
15977
16177
  }
15978
16178
  const le = {
15979
- formulas: ee,
16179
+ formulas: ne,
15980
16180
  ranges: F,
15981
- key: ee.map(($) => $.orginFormula).join("_")
16181
+ key: ne.map((z) => z.orginFormula).join("_")
15982
16182
  };
15983
16183
  R.has(le.key) ? R.get(le.key).push(le) : R.set(le.key, [le]);
15984
16184
  }
15985
- const s = i.map((L) => sa(this._lexerTreeBuilder, L, 0, 0)).join("_");
16185
+ const d = i.map((P) => pa(this._lexerTreeBuilder, P, 0, 0)).join("_");
15986
16186
  if (S.length > 0) {
15987
- const L = S[0].startRow, g = S[0].startColumn, q = [];
16187
+ const P = S[0].startRow, g = S[0].startColumn, q = [];
15988
16188
  for (let h = 0; h < i.length; h++) {
15989
16189
  const M = i[h];
15990
16190
  q.push({
15991
- newFormula: Me(M) ? this._lexerTreeBuilder.moveFormulaRefOffset(M, g - d, L - c) : M,
16191
+ newFormula: ye(M) ? this._lexerTreeBuilder.moveFormulaRefOffset(M, g - s, P - c) : M,
15992
16192
  orginFormula: M
15993
16193
  });
15994
16194
  }
15995
16195
  const U = {
15996
16196
  formulas: q,
15997
16197
  ranges: S,
15998
- key: s
16198
+ key: d
15999
16199
  };
16000
16200
  R.has(U.key) ? R.get(U.key).push(U) : R.set(U.key, [U]);
16001
16201
  }
16002
16202
  const A = [], N = Array.from(R.keys());
16003
- for (let L = N.length - 1; L >= 0; L--) {
16004
- const g = N[L], q = R.get(g).sort((M, F) => M.ranges[0].startRow - F.ranges[0].startRow || M.ranges[0].startColumn - F.ranges[0].startColumn), U = [];
16203
+ for (let P = N.length - 1; P >= 0; P--) {
16204
+ const g = N[P], q = R.get(g).sort((M, F) => M.ranges[0].startRow - F.ranges[0].startRow || M.ranges[0].startColumn - F.ranges[0].startColumn), U = [];
16005
16205
  for (let M = 0; M < q[0].formulas.length; M++)
16006
16206
  U.push(q[0].formulas[M].newFormula);
16007
- const h = me.mergeRanges(q.map((M) => M.ranges).flat());
16207
+ const h = fe.mergeRanges(q.map((M) => M.ranges).flat());
16008
16208
  h.sort((M, F) => M.startRow - F.startRow || M.startColumn - F.startColumn), A.push({
16009
16209
  formulas: U,
16010
16210
  ranges: h
@@ -16020,62 +16220,62 @@ let xt = class extends ne {
16020
16220
  return n.forEach((m) => {
16021
16221
  const c = this._refRangeService.registerRefRange(m, f, a, e);
16022
16222
  o.add(c);
16023
- }), [...u.flat()].forEach(({ unitId: m, subUnitId: c, ranges: d }) => {
16024
- d.forEach((P) => {
16025
- const E = this._refRangeService.registerRefRange(P, f, m, c);
16223
+ }), [...u.flat()].forEach(({ unitId: m, subUnitId: c, ranges: s }) => {
16224
+ s.forEach((L) => {
16225
+ const E = this._refRangeService.registerRefRange(L, f, m, c);
16026
16226
  o.add(E);
16027
16227
  });
16028
16228
  }), o;
16029
16229
  }
16030
16230
  };
16031
- xt = xr([
16032
- we(0, X(Rn)),
16033
- we(1, X(vt)),
16034
- we(2, Se),
16035
- we(3, X(ut))
16036
- ], xt);
16037
- var _r = Object.getOwnPropertyDescriptor, yr = (a, e, n, i) => {
16038
- for (var r = i > 1 ? void 0 : i ? _r(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16231
+ Ft = Fr([
16232
+ Ye(0, X(Cn)),
16233
+ Ye(1, X(pt)),
16234
+ Ye(2, Ee),
16235
+ Ye(3, X(ct))
16236
+ ], Ft);
16237
+ var Br = Object.getOwnPropertyDescriptor, vr = (a, e, n, i) => {
16238
+ for (var r = i > 1 ? void 0 : i ? Br(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16039
16239
  (u = a[o]) && (r = u(r) || r);
16040
16240
  return r;
16041
- }, qr = (a, e) => (n, i) => e(n, i, a);
16042
- const Ht = "sheets-formula.remote-register-function.service", Xa = gt(Ht);
16043
- let nt = class {
16241
+ }, Vr = (a, e) => (n, i) => e(n, i, a);
16242
+ const Xt = "sheets-formula.remote-register-function.service", Qa = Gt(Xt);
16243
+ let ot = class {
16044
16244
  constructor(a) {
16045
16245
  this._functionService = a;
16046
16246
  }
16047
16247
  async registerFunctions(a) {
16048
- const e = a.map(([n, i]) => gr(n, i));
16248
+ const e = a.map(([n, i]) => Gr(n, i));
16049
16249
  this._functionService.registerExecutors(...e);
16050
16250
  }
16051
16251
  async registerAsyncFunctions(a) {
16052
- const e = a.map(([n, i]) => hr(n, i));
16252
+ const e = a.map(([n, i]) => Hr(n, i));
16053
16253
  this._functionService.registerExecutors(...e);
16054
16254
  }
16055
16255
  async unregisterFunctions(a) {
16056
16256
  this._functionService.unregisterExecutors(...a), this._functionService.unregisterDescriptions(...a), this._functionService.deleteFormulaAstCacheKey(...a);
16057
16257
  }
16058
16258
  };
16059
- nt = yr([
16060
- qr(0, Vt)
16061
- ], nt);
16062
- function gr(a, e) {
16063
- const n = new Ot(e), i = new Function(`return ${a}`)();
16259
+ ot = vr([
16260
+ Vr(0, Lt)
16261
+ ], ot);
16262
+ function Gr(a, e) {
16263
+ const n = new ht(e), i = new Function(`return ${a}`)();
16064
16264
  return n.calculateCustom = i, n;
16065
16265
  }
16066
- function hr(a, e) {
16067
- const n = new Ua(e), i = new Function(`return ${a}`)();
16266
+ function Hr(a, e) {
16267
+ const n = new Va(e), i = new Function(`return ${a}`)();
16068
16268
  return n.calculateCustom = i, n;
16069
16269
  }
16070
- var Ur = Object.getOwnPropertyDescriptor, Fr = (a, e, n, i) => {
16071
- for (var r = i > 1 ? void 0 : i ? Ur(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16270
+ var wr = Object.getOwnPropertyDescriptor, Yr = (a, e, n, i) => {
16271
+ for (var r = i > 1 ? void 0 : i ? wr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16072
16272
  (u = a[o]) && (r = u(r) || r);
16073
16273
  return r;
16074
- }, Ye = (a, e) => (n, i) => e(n, i, a);
16075
- const Br = gt(
16274
+ }, Xe = (a, e) => (n, i) => e(n, i, a);
16275
+ const Xr = Gt(
16076
16276
  "sheets-formula.register-function-service"
16077
16277
  );
16078
- let _t = class extends ne {
16278
+ let Bt = class extends ee {
16079
16279
  constructor(a, e, n, i) {
16080
16280
  super(), this._localeService = a, this._descriptionService = e, this._functionService = n, this._remoteRegisterFunctionService = i;
16081
16281
  }
@@ -16088,7 +16288,7 @@ let _t = class extends ne {
16088
16288
  registerFunctions(a) {
16089
16289
  const { locales: e, description: n, calculate: i } = a;
16090
16290
  e && this._localeService.load(e);
16091
- const r = new ke();
16291
+ const r = new Qe();
16092
16292
  if (n)
16093
16293
  r.add(this._descriptionService.registerDescriptions(n));
16094
16294
  else {
@@ -16104,7 +16304,7 @@ let _t = class extends ne {
16104
16304
  return r.add(this._registerLocalExecutors(i)), this._remoteRegisterFunctionService && r.add(this._registerRemoteExecutors(i)), r;
16105
16305
  }
16106
16306
  _registerSingleFunction(a) {
16107
- const { name: e, func: n, description: i, locales: r, async: o = !1 } = a, u = new ke();
16307
+ const { name: e, func: n, description: i, locales: r, async: o = !1 } = a, u = new Qe();
16108
16308
  if (r && this._localeService.load(r), typeof i == "string") {
16109
16309
  const m = {
16110
16310
  functionName: e,
@@ -16116,118 +16316,120 @@ let _t = class extends ne {
16116
16316
  u.add(this._descriptionService.registerDescriptions([m]));
16117
16317
  } else
16118
16318
  u.add(this._descriptionService.registerDescriptions([i]));
16119
- const f = o ? new Ua(e) : new Ot(e);
16120
- return f.calculateCustom = n, this._functionService.registerExecutors(f), u.add(oe(() => this._functionService.unregisterExecutors(e))), u.add(oe(() => this._functionService.unregisterDescriptions(e))), u.add(oe(() => this._functionService.deleteFormulaAstCacheKey(e))), this._remoteRegisterFunctionService && (this._remoteRegisterFunctionService.registerAsyncFunctions([[n.toString(), e]]), u.add(
16121
- oe(() => this._remoteRegisterFunctionService.unregisterFunctions([e]))
16319
+ const f = o ? new Va(e) : new ht(e);
16320
+ return f.calculateCustom = n, this._functionService.registerExecutors(f), u.add(J(() => this._functionService.unregisterExecutors(e))), u.add(J(() => this._functionService.unregisterDescriptions(e))), u.add(J(() => this._functionService.deleteFormulaAstCacheKey(e))), this._remoteRegisterFunctionService && (this._remoteRegisterFunctionService.registerAsyncFunctions([[n.toString(), e]]), u.add(
16321
+ J(() => this._remoteRegisterFunctionService.unregisterFunctions([e]))
16122
16322
  )), u;
16123
16323
  }
16124
16324
  _registerLocalExecutors(a) {
16125
16325
  const e = a.map(([i, r]) => r), n = a.map(([i, r]) => {
16126
- const o = new Ot(r);
16326
+ const o = new ht(r);
16127
16327
  return o.calculateCustom = i, o;
16128
16328
  });
16129
- return this._functionService.registerExecutors(...n), oe(() => this._functionService.unregisterExecutors(...e));
16329
+ return this._functionService.registerExecutors(...n), J(() => this._functionService.unregisterExecutors(...e));
16130
16330
  }
16131
16331
  _registerRemoteExecutors(a) {
16132
16332
  const e = [], n = a.map(([i, r]) => (e.push(r), [i.toString(), r]));
16133
- return this._remoteRegisterFunctionService.registerFunctions(n), oe(() => this._remoteRegisterFunctionService.unregisterFunctions(e));
16333
+ return this._remoteRegisterFunctionService.registerFunctions(n), J(() => this._remoteRegisterFunctionService.unregisterFunctions(e));
16134
16334
  }
16135
16335
  };
16136
- _t = Fr([
16137
- Ye(0, X(qt)),
16138
- Ye(1, X(Gt)),
16139
- Ye(2, Vt),
16140
- Ye(3, Ja(Xa))
16141
- ], _t);
16142
- var vr = Object.defineProperty, Vr = Object.getOwnPropertyDescriptor, Gr = (a, e, n) => e in a ? vr(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n, Wa = (a, e, n, i) => {
16143
- for (var r = i > 1 ? void 0 : i ? Vr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16336
+ Bt = Yr([
16337
+ Xe(0, X(Vt)),
16338
+ Xe(1, X(Pt)),
16339
+ Xe(2, Lt),
16340
+ Xe(3, nn(Qa))
16341
+ ], Bt);
16342
+ var Wr = Object.defineProperty, Kr = Object.getOwnPropertyDescriptor, kr = (a, e, n) => e in a ? Wr(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n, $a = (a, e, n, i) => {
16343
+ for (var r = i > 1 ? void 0 : i ? Kr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16144
16344
  (u = a[o]) && (r = u(r) || r);
16145
16345
  return r;
16146
- }, it = (a, e) => (n, i) => e(n, i, a), ct = (a, e, n) => Gr(a, typeof e != "symbol" ? e + "" : e, n);
16147
- let rt = class extends Ta {
16148
- constructor(a = ca, e, n) {
16346
+ }, ut = (a, e) => (n, i) => e(n, i, a), Tt = (a, e, n) => kr(a, typeof e != "symbol" ? e + "" : e, n);
16347
+ let mt = class extends Ia {
16348
+ constructor(a = sa, e, n) {
16149
16349
  super(), this._config = a, this._injector = e, this._configService = n;
16150
- const { ...i } = Ea(
16350
+ const { ...i } = Na(
16151
16351
  {},
16152
- ca,
16352
+ sa,
16153
16353
  this._config
16154
16354
  );
16155
- this._configService.setConfig(ri, i);
16355
+ this._configService.setConfig(ci, i);
16156
16356
  }
16157
16357
  onStarting() {
16158
- this._injector.add([nt]), this._injector.get(va).registerChannel(
16159
- Ht,
16160
- ti(this._injector.get(nt))
16358
+ this._injector.add([ot]), this._injector.get(wa).registerChannel(
16359
+ Xt,
16360
+ oi(this._injector.get(ot))
16161
16361
  );
16162
16362
  }
16163
16363
  };
16164
- ct(rt, "pluginName", "SHEET_FORMULA_REMOTE_PLUGIN");
16165
- ct(rt, "type", ae.UNIVER_SHEET);
16166
- rt = Wa([
16167
- Pa(Fa),
16168
- it(1, X(ut)),
16169
- it(2, Ae)
16170
- ], rt);
16171
- let ot = class extends Ta {
16172
- constructor(a = fa, e, n) {
16364
+ Tt(mt, "pluginName", "SHEET_FORMULA_REMOTE_PLUGIN");
16365
+ Tt(mt, "type", j.UNIVER_SHEET);
16366
+ mt = $a([
16367
+ Ea(Ga),
16368
+ ut(1, X(ct)),
16369
+ ut(2, be)
16370
+ ], mt);
16371
+ let ft = class extends Ia {
16372
+ constructor(a = la, e, n) {
16173
16373
  super(), this._config = a, this._injector = e, this._configService = n;
16174
- const { ...i } = Ea(
16374
+ const { ...i } = Na(
16175
16375
  {},
16176
- fa,
16376
+ la,
16177
16377
  this._config
16178
16378
  );
16179
- this._configService.setConfig(ge, i, { merge: !0 });
16379
+ this._configService.setConfig(he, i, { merge: !0 });
16180
16380
  }
16181
16381
  onStarting() {
16182
16382
  const a = this._injector, e = [
16183
- [Br, { useClass: _t }],
16184
- [Gt, { useClass: Mt }],
16383
+ [Xr, { useClass: Bt }],
16384
+ [Pt, { useClass: Ut }],
16385
+ [it],
16386
+ [Ft],
16387
+ [Ze],
16185
16388
  [at],
16186
- [xt],
16187
- [je],
16389
+ [qe],
16188
16390
  [et],
16189
- [xe],
16190
- [Ze],
16191
- [Je],
16192
16391
  [tt],
16193
- [ze]
16392
+ [nt],
16393
+ [Je],
16394
+ [rt]
16194
16395
  ];
16195
16396
  if (this._config.notExecuteFormula) {
16196
- const n = a.get(va);
16197
- e.push([Xa, {
16198
- useFactory: () => ai(n.requestChannel(Ht))
16397
+ const n = a.get(wa);
16398
+ e.push([Qa, {
16399
+ useFactory: () => ui(n.requestChannel(Xt))
16199
16400
  }]);
16200
16401
  }
16201
16402
  e.forEach((n) => a.add(n));
16202
16403
  }
16203
16404
  onReady() {
16204
- Fe(this._injector, [
16405
+ Be(this._injector, [
16406
+ [it],
16407
+ [tt],
16205
16408
  [at],
16206
- [Je],
16207
16409
  [et],
16208
- [Ze],
16209
- [ze]
16210
- ]), Yt() && Fe(this._injector, [
16211
- [xe]
16410
+ [Je]
16411
+ ]), Kt() && Be(this._injector, [
16412
+ [qe]
16212
16413
  ]);
16213
16414
  }
16214
16415
  onRendered() {
16215
- Fe(this._injector, [
16216
- [tt]
16217
- ]), Yt() || Fe(this._injector, [
16218
- [xe]
16416
+ Be(this._injector, [
16417
+ [nt],
16418
+ [rt]
16419
+ ]), Kt() || Be(this._injector, [
16420
+ [qe]
16219
16421
  ]);
16220
16422
  }
16221
16423
  };
16222
- ct(ot, "pluginName", Ji);
16223
- ct(ot, "type", ae.UNIVER_SHEET);
16224
- ot = Wa([
16225
- Pa(Fa, Cn),
16226
- it(1, X(ut)),
16227
- it(2, Ae)
16228
- ], ot);
16229
- function kr(a, e, n, i) {
16230
- const r = a.get(kn), o = a.get(Qn), u = a.get($n), f = a.get(jn);
16424
+ Tt(ft, "pluginName", ir);
16425
+ Tt(ft, "type", j.UNIVER_SHEET);
16426
+ ft = $a([
16427
+ Ea(Ga, On),
16428
+ ut(1, X(ct)),
16429
+ ut(2, be)
16430
+ ], ft);
16431
+ function eo(a, e, n, i) {
16432
+ const r = a.get(Zn), o = a.get(Jn), u = a.get(ei), f = a.get(ti);
16231
16433
  r.load({
16232
16434
  formulaData: {},
16233
16435
  arrayFormulaCellData: {},
@@ -16243,27 +16445,27 @@ function kr(a, e, n, i) {
16243
16445
  },
16244
16446
  dirtyUnitOtherFormulaMap: {}
16245
16447
  });
16246
- const m = o.treeBuilder(e), c = u.parse(m), d = f.execute(zn(c));
16247
- return Zn(d);
16448
+ const m = o.treeBuilder(e), c = u.parse(m), s = f.execute(ai(c));
16449
+ return ni(s);
16248
16450
  }
16249
16451
  export {
16250
- Pe as CalculationMode,
16251
- Mt as DescriptionService,
16252
- xt as FormulaRefRangeService,
16253
- Gt as IDescriptionService,
16254
- Br as IRegisterFunctionService,
16255
- Xa as IRemoteRegisterFunctionService,
16256
- ni as InsertFunctionCommand,
16257
- Oe as OtherFormulaMarkDirty,
16258
- ge as PLUGIN_CONFIG_KEY_BASE,
16259
- ii as QuickSumCommand,
16260
- _t as RegisterFunctionService,
16261
- je as RegisterOtherFormulaService,
16262
- nt as RemoteRegisterFunctionService,
16263
- xe as TriggerCalculationController,
16264
- rt as UniverRemoteSheetsFormulaPlugin,
16265
- ot as UniverSheetsFormulaPlugin,
16266
- ze as UpdateDefinedNameController,
16267
- Ze as UpdateFormulaController,
16268
- kr as calculateFormula
16452
+ Te as CalculationMode,
16453
+ Ut as DescriptionService,
16454
+ Ft as FormulaRefRangeService,
16455
+ Pt as IDescriptionService,
16456
+ Xr as IRegisterFunctionService,
16457
+ Qa as IRemoteRegisterFunctionService,
16458
+ mi as InsertFunctionCommand,
16459
+ _e as OtherFormulaMarkDirty,
16460
+ he as PLUGIN_CONFIG_KEY_BASE,
16461
+ fi as QuickSumCommand,
16462
+ Bt as RegisterFunctionService,
16463
+ Ze as RegisterOtherFormulaService,
16464
+ ot as RemoteRegisterFunctionService,
16465
+ qe as TriggerCalculationController,
16466
+ mt as UniverRemoteSheetsFormulaPlugin,
16467
+ ft as UniverSheetsFormulaPlugin,
16468
+ Je as UpdateDefinedNameController,
16469
+ et as UpdateFormulaController,
16470
+ eo as calculateFormula
16269
16471
  };