@univerjs/sheets 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  var bi = Object.defineProperty;
2
2
  var Ei = (n, e, t) => e in n ? bi(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
3
  var R = (n, e, t) => Ei(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { CellValueType as re, isTextFormat as ps, isRealNum as xs, isBooleanString as Wo, willLoseNumericPrecision as Ui, CommandType as v, IUniverInstanceService as M, Tools as D, createInterceptorKey as St, Disposable as ae, UniverInstanceType as B, InterceptorEffectEnum as he, InterceptorManager as $s, toDisposable as Oe, remove as ze, composeInterceptors as ki, DisposableCollection as Tt, BooleanNumber as te, HorizontalAlign as Ws, BorderStyleTypes as Vo, Inject as $, IResourceManagerService as wn, RTree as Ti, generateRandomId as Pt, insertMatrixArray as Dn, ObjectMatrix as q, Rectangle as O, moveMatrixArray as Lo, sliceMatrixArray as Ho, concatMatrixArray as Fo, spliceArray as Bo, Range as Y, normalizeTextRuns as Pi, isSafeNumeric as Ni, RANGE_TYPE as H, createRowColIter as Oi, ICommandService as U, IUndoRedoService as V, RxDisposable as jo, sequenceExecute as L, selectionToArray as Di, createIdentifier as Vs, IContextService as zo, ErrorService as Bt, LocaleService as Qe, cellToRange as Go, PermissionStatus as J, IPermissionService as et, isICellData as Ko, mapObjectMatrix as Ai, Dimension as pe, getArrayLength as Jo, Direction as me, Injector as cs, queryObjectMatrix as lt, IConfirmService as xi, CellModeEnum as $i, cloneWorksheetData as qo, IConfigService as In, mergeWorksheetSnapshotWithDefault as Wi, BorderType as de, FontWeight as Vi, FontItalic as Li, ILogService as Yo, DocumentDataModel as Hi, BuildTextUtils as Fi, TextX as Bi, CustomCommandExecutionError as ji, IAuthzIoService as zi, UserManagerService as Gi, LRUMap as Ki, Optional as Ji, isDefaultFormat as qi, DependentOn as Yi, Plugin as Xi, merge as Zi, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE as Qi, AUTO_HEIGHT_FOR_MERGED_CELLS as ea, registerDependencies as ta, mergeOverrideWithDependencies as na, touchDependencies as bn } from "@univerjs/core";
5
- import { Subject as Ae, BehaviorSubject as Rt, merge as qt, shareReplay as sa, takeUntil as nt, switchMap as st, of as Ie, distinctUntilChanged as oa, skip as Xo, map as ks, first as ra, filter as ao } from "rxjs";
4
+ import { CellValueType as re, isTextFormat as ps, isRealNum as xs, isBooleanString as Wo, willLoseNumericPrecision as ki, UniverInstanceType as B, CommandType as v, IUniverInstanceService as M, Tools as D, createInterceptorKey as St, Disposable as ae, InterceptorEffectEnum as he, InterceptorManager as $s, toDisposable as De, remove as Ge, composeInterceptors as Ui, DisposableCollection as Tt, BooleanNumber as te, HorizontalAlign as Ws, BorderStyleTypes as Vo, Inject as $, IResourceManagerService as wn, RTree as Ti, generateRandomId as Pt, insertMatrixArray as Dn, ObjectMatrix as q, Rectangle as O, moveMatrixArray as Lo, sliceMatrixArray as Ho, concatMatrixArray as Fo, spliceArray as Bo, Range as Y, normalizeTextRuns as Pi, isSafeNumeric as Ni, RANGE_TYPE as H, createRowColIter as Oi, ICommandService as k, IUndoRedoService as V, RxDisposable as jo, sequenceExecute as L, selectionToArray as Di, createIdentifier as Vs, IContextService as zo, ErrorService as Bt, LocaleService as et, cellToRange as Go, PermissionStatus as J, IPermissionService as tt, isICellData as Ko, mapObjectMatrix as Ai, Dimension as pe, getArrayLength as Jo, Direction as me, Injector as cs, queryObjectMatrix as lt, IConfirmService as xi, CellModeEnum as $i, cloneWorksheetData as qo, IConfigService as In, mergeWorksheetSnapshotWithDefault as Wi, BorderType as de, FontWeight as Vi, FontItalic as Li, ILogService as Yo, DocumentDataModel as Hi, BuildTextUtils as Fi, TextX as Bi, CustomCommandExecutionError as ji, IAuthzIoService as zi, UserManagerService as Gi, LRUMap as Ki, Optional as Ji, isDefaultFormat as qi, DependentOn as Yi, Plugin as Xi, merge as Zi, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE as Qi, AUTO_HEIGHT_FOR_MERGED_CELLS as ea, registerDependencies as ta, mergeOverrideWithDependencies as na, touchDependencies as bn } from "@univerjs/core";
5
+ import { Subject as xe, BehaviorSubject as Rt, merge as qt, shareReplay as sa, takeUntil as nt, switchMap as st, of as Ie, distinctUntilChanged as oa, skip as Xo, map as Us, first as ra, filter as ao } from "rxjs";
6
6
  import { SetDefinedNameMutation as rn, RemoveDefinedNameMutation as An, SetDefinedNameMutationFactory as ia, IDefinedNamesService as Zo, LexerTreeBuilder as aa, operatorToken as ua, deserializeRangeWithSheet as la, sequenceNodeType as ca, deserializeRangeWithSheetWithCache as da, SetFormulaCalculationResultMutation as ha, handleNumfmtInCell as ga, stripErrorMargin as ma, UniverFormulaEnginePlugin as fa } from "@univerjs/engine-formula";
7
7
  import { takeUntil as uo, filter as lo, map as Ra } from "rxjs/operators";
8
8
  import { DataSyncPrimaryController as Ca } from "@univerjs/rpc";
@@ -30,11 +30,38 @@ function Sa(n) {
30
30
  return !!((e = n == null ? void 0 : n.n) != null && e.pattern);
31
31
  }
32
32
  function ho(n, e) {
33
- return n === null ? null : typeof n == "string" ? xs(n) ? (+n == 0 || +n == 1) && e === re.BOOLEAN ? re.BOOLEAN : e !== re.STRING && e !== re.FORCE_STRING && Ui(n) ? re.FORCE_STRING : re.NUMBER : Wo(n) ? re.BOOLEAN : re.STRING : typeof n == "number" ? (n === 0 || n === 1) && e === re.BOOLEAN ? re.BOOLEAN : re.NUMBER : typeof n == "boolean" ? re.BOOLEAN : re.FORCE_STRING;
33
+ return n === null ? null : typeof n == "string" ? xs(n) ? (+n == 0 || +n == 1) && e === re.BOOLEAN ? re.BOOLEAN : e !== re.STRING && e !== re.FORCE_STRING && ki(n) ? re.FORCE_STRING : re.NUMBER : Wo(n) ? re.BOOLEAN : re.STRING : typeof n == "number" ? (n === 0 || n === 1) && e === re.BOOLEAN ? re.BOOLEAN : re.NUMBER : typeof n == "boolean" ? re.BOOLEAN : re.FORCE_STRING;
34
34
  }
35
- const Ve = (n, e) => {
36
- if (n.get(M).getUniverSheetInstance(e.unitId) == null)
37
- throw new Error("universheet is null error!");
35
+ function Qo(n, e) {
36
+ const { unitId: t } = e, s = t ? n.getUnit(t, B.UNIVER_SHEET) : n.getCurrentUnitOfType(B.UNIVER_SHEET);
37
+ return s ? {
38
+ workbook: s,
39
+ unitId: s.getUnitId()
40
+ } : null;
41
+ }
42
+ function P(n, e = {}) {
43
+ const { unitId: t, subUnitId: s } = e, o = t ? n.getUnit(t, B.UNIVER_SHEET) : n.getCurrentUnitOfType(B.UNIVER_SHEET);
44
+ if (!o) return null;
45
+ const r = s ? o.getSheetBySheetId(s) : o.getActiveSheet(!0);
46
+ return r ? {
47
+ worksheet: r,
48
+ workbook: o,
49
+ unitId: o.getUnitId(),
50
+ subUnitId: r.getSheetId()
51
+ } : null;
52
+ }
53
+ function ye(n, e) {
54
+ const { unitId: t, subUnitId: s } = e, o = n.getUnit(t, B.UNIVER_SHEET);
55
+ if (!o) return null;
56
+ const r = o.getSheetBySheetId(s);
57
+ return r ? {
58
+ worksheet: r,
59
+ workbook: o
60
+ } : null;
61
+ }
62
+ const Le = (n, e) => {
63
+ if (!ye(n.get(M), e))
64
+ throw new Error("Workbook or worksheet is null error!");
38
65
  return {
39
66
  unitId: e.unitId,
40
67
  subUnitId: e.subUnitId,
@@ -44,22 +71,20 @@ const Ve = (n, e) => {
44
71
  id: "sheet.mutation.add-worksheet-merge",
45
72
  type: v.MUTATION,
46
73
  handler: (n, e) => {
47
- const s = n.get(M).getUniverSheetInstance(e.unitId);
48
- if (s == null)
49
- throw new Error("universheet is null error!");
50
- const o = s.getSheetBySheetId(e.subUnitId);
51
- if (!o) return !1;
52
- const i = o.getConfig().mergeData, a = e.ranges;
53
- for (let u = 0; u < a.length; u++)
54
- i.push(a[u]);
55
- return o.getSpanModel().rebuild(i), !0;
74
+ const t = ye(n.get(M), e);
75
+ if (!t)
76
+ throw new Error("Workbook or worksheet is null error!");
77
+ const { worksheet: s } = t, r = s.getConfig().mergeData, i = e.ranges;
78
+ for (let a = 0; a < i.length; a++)
79
+ r.push(i[a]);
80
+ return s.getSpanModel().rebuild(r), !0;
56
81
  }
57
82
  }, wa = St("CELL_CONTENT"), Ia = St("ROW_FILTERED"), mt = {
58
83
  CELL_CONTENT: wa,
59
84
  ROW_FILTERED: Ia
60
85
  };
61
86
  var va = /* @__PURE__ */ ((n) => (n[n.DATA_VALIDATION = 9] = "DATA_VALIDATION", n[n.NUMFMT = 10] = "NUMFMT", n[n.CELL_IMAGE = 11] = "CELL_IMAGE", n))(va || {});
62
- const Qo = "sheet.interceptor.range-theme-id", go = "sheet.interceptor.ignore-range-theme";
87
+ const er = "sheet.interceptor.range-theme-id", go = "sheet.interceptor.ignore-range-theme";
63
88
  var Ma = Object.getOwnPropertyDescriptor, _a = (n, e, t, s) => {
64
89
  for (var o = s > 1 ? void 0 : s ? Ma(e, t) : e, r = n.length - 1, i; r >= 0; r--)
65
90
  (i = n[r]) && (o = i(o) || o);
@@ -122,7 +147,7 @@ let j = class extends ae {
122
147
  return this._commandInterceptors.push(e), this._commandInterceptors.sort((t, s) => {
123
148
  var o, r;
124
149
  return ((o = s.priority) != null ? o : 0) - ((r = t.priority) != null ? r : 0);
125
- }), this.disposeWithMe(Oe(() => ze(this._commandInterceptors, e)));
150
+ }), this.disposeWithMe(De(() => Ge(this._commandInterceptors, e)));
126
151
  }
127
152
  /**
128
153
  * When command is executing, call this method to gether undo redo mutations from upper features.
@@ -150,7 +175,7 @@ let j = class extends ae {
150
175
  return this._afterCommandInterceptors.push(e), this._afterCommandInterceptors.sort((t, s) => {
151
176
  var o, r;
152
177
  return ((o = s.priority) != null ? o : 0) - ((r = t.priority) != null ? r : 0);
153
- }), this.disposeWithMe(Oe(() => ze(this._afterCommandInterceptors, e)));
178
+ }), this.disposeWithMe(De(() => Ge(this._afterCommandInterceptors, e)));
154
179
  }
155
180
  afterCommandExecute(e) {
156
181
  const t = this._afterCommandInterceptors.map((s) => s.getMutations(e));
@@ -165,7 +190,7 @@ let j = class extends ae {
165
190
  return this._autoHeightInterceptors.push(e), this._autoHeightInterceptors.sort((t, s) => {
166
191
  var o, r;
167
192
  return ((o = s.priority) != null ? o : 0) - ((r = t.priority) != null ? r : 0);
168
- }), this.disposeWithMe(Oe(() => ze(this._autoHeightInterceptors, e)));
193
+ }), this.disposeWithMe(De(() => Ge(this._autoHeightInterceptors, e)));
169
194
  }
170
195
  generateMutationsOfAutoHeight(e) {
171
196
  const t = this._autoHeightInterceptors.map((s) => s.getMutations(e));
@@ -197,7 +222,7 @@ let j = class extends ae {
197
222
  return this._beforeCommandInterceptor.push(e), this._beforeCommandInterceptor.sort((t, s) => {
198
223
  var o, r;
199
224
  return ((o = s.priority) != null ? o : 0) - ((r = t.priority) != null ? r : 0);
200
- }), this.disposeWithMe(Oe(() => ze(this._beforeCommandInterceptor, e)));
225
+ }), this.disposeWithMe(De(() => Ge(this._beforeCommandInterceptor, e)));
201
226
  }
202
227
  /**
203
228
  * before command execute, call this method to get the flag of whether it can be executed the command,
@@ -220,7 +245,7 @@ let j = class extends ae {
220
245
  return this._rangeInterceptors.push(e), this._rangeInterceptors.sort((t, s) => {
221
246
  var o, r;
222
247
  return ((o = s.priority) != null ? o : 0) - ((r = t.priority) != null ? r : 0);
223
- }), this.disposeWithMe(Oe(() => ze(this._rangeInterceptors, e)));
248
+ }), this.disposeWithMe(De(() => Ge(this._rangeInterceptors, e)));
224
249
  }
225
250
  generateMutationsByRanges(e) {
226
251
  const t = this._rangeInterceptors.map((s) => s.getMutations(e));
@@ -282,18 +307,18 @@ let j = class extends ae {
282
307
  ), this._interceptorsByName.set(
283
308
  `${s}-${he.Value}`,
284
309
  r.filter((u) => ((u.effect || a) & he.Value) > 0)
285
- ), this.disposeWithMe(Oe(() => {
286
- ze(this._interceptorsByName.get(s), t), ze(this._interceptorsByName.get(`${s}-${i}`), t), ze(this._interceptorsByName.get(`${s}-${he.Style}`), t), ze(this._interceptorsByName.get(`${s}-${he.Value}`), t);
310
+ ), this.disposeWithMe(De(() => {
311
+ Ge(this._interceptorsByName.get(s), t), Ge(this._interceptorsByName.get(`${s}-${i}`), t), Ge(this._interceptorsByName.get(`${s}-${he.Style}`), t), Ge(this._interceptorsByName.get(`${s}-${he.Value}`), t);
287
312
  }));
288
313
  } else
289
- return this._interceptorsByName.set(s, r), this.disposeWithMe(Oe(() => ze(this._interceptorsByName.get(s), t)));
314
+ return this._interceptorsByName.set(s, r), this.disposeWithMe(De(() => Ge(this._interceptorsByName.get(s), t)));
290
315
  }
291
316
  fetchThroughInterceptors(e, t, s, o) {
292
317
  const r = t === void 0 ? e : `${e}-${t}`, i = s != null ? s : r;
293
318
  let a = this._composedInterceptorByKey.get(i);
294
319
  if (!a || this._interceptorsDirty) {
295
320
  let u = this._interceptorsByName.get(r);
296
- u && o && (u = u.filter(o)), a = ki(u || []), this._composedInterceptorByKey.set(i, a);
321
+ u && o && (u = u.filter(o)), a = Ui(u || []), this._composedInterceptorByKey.set(i, a);
297
322
  }
298
323
  return a;
299
324
  }
@@ -334,7 +359,7 @@ let j = class extends ae {
334
359
  }));
335
360
  });
336
361
  };
337
- e.getSheets().forEach((i) => r(i)), t.add(e.sheetCreated$.subscribe((i) => r(i))), t.add(Oe(() => e.getSheets().forEach((i) => this._disposeSheetInterceptor(s, i)))), t.add(e.sheetDisposed$.subscribe((i) => this._disposeSheetInterceptor(s, i))), this._workbookDisposables.set(s, t);
362
+ e.getSheets().forEach((i) => r(i)), t.add(e.sheetCreated$.subscribe((i) => r(i))), t.add(De(() => e.getSheets().forEach((i) => this._disposeSheetInterceptor(s, i)))), t.add(e.sheetDisposed$.subscribe((i) => this._disposeSheetInterceptor(s, i))), this._workbookDisposables.set(s, t);
338
363
  }
339
364
  _disposeWorkbookInterceptor(e) {
340
365
  const t = e.getUnitId(), s = this._workbookDisposables.get(t);
@@ -534,7 +559,7 @@ const Ea = (n, e, t) => new wt(`light-${n}`, {
534
559
  rgb: e
535
560
  }
536
561
  }
537
- }), Ua = (n, e, t) => new wt(`middle-${n}`, {
562
+ }), ka = (n, e, t) => new wt(`middle-${n}`, {
538
563
  headerRowStyle: {
539
564
  bg: {
540
565
  rgb: e
@@ -560,7 +585,7 @@ const Ea = (n, e, t) => new wt(`light-${n}`, {
560
585
  rgb: t
561
586
  }
562
587
  }
563
- }), ka = (n, e, t, s) => new wt(`dark-${n}`, {
588
+ }), Ua = (n, e, t, s) => new wt(`dark-${n}`, {
564
589
  headerRowStyle: {
565
590
  bg: {
566
591
  rgb: e
@@ -749,11 +774,11 @@ const Ea = (n, e, t) => new wt(`light-${n}`, {
749
774
  firstRow: "rgb(250, 209, 232)",
750
775
  secondRow: "rgb(241, 126, 184)"
751
776
  }
752
- ], Oa = Ta.map(({ baseName: n, header: e, color: t }) => Ea(n, e, t)), Da = Pa.map(({ baseName: n, rowHeader: e, colHeader: t }) => Ua(n, e, t)), Aa = Na.map(({ baseName: n, rowHeader: e, firstRow: t, secondRow: s }) => ka(n, e, t, s)), xa = [
777
+ ], Oa = Ta.map(({ baseName: n, header: e, color: t }) => Ea(n, e, t)), Da = Pa.map(({ baseName: n, rowHeader: e, colHeader: t }) => ka(n, e, t)), Aa = Na.map(({ baseName: n, rowHeader: e, firstRow: t, secondRow: s }) => Ua(n, e, t, s)), xa = [
753
778
  ...Oa,
754
779
  ...Da,
755
780
  ...Aa
756
- ], er = {
781
+ ], tr = {
757
782
  headerRowStyle: {
758
783
  bg: {
759
784
  rgb: "rgb(68,114,196)"
@@ -769,8 +794,8 @@ const Ea = (n, e, t) => new wt(`light-${n}`, {
769
794
  rgb: "rgb(217,225,242)"
770
795
  }
771
796
  }
772
- }, $a = new wt("default", er), Wa = new wt("default-last-row", {
773
- ...er,
797
+ }, $a = new wt("default", tr), Wa = new wt("default-last-row", {
798
+ ...tr,
774
799
  lastRowStyle: {
775
800
  bd: {
776
801
  t: {
@@ -852,7 +877,7 @@ let ve = class extends ae {
852
877
  */
853
878
  R(this, "_zebraCrossingCacheMap", /* @__PURE__ */ new Map());
854
879
  R(this, "_rowVisibleFuncSet", /* @__PURE__ */ new Map());
855
- R(this, "_rangeThemeMapChanged$", new Ae());
880
+ R(this, "_rangeThemeMapChanged$", new xe());
856
881
  R(this, "rangeThemeMapChange$", this._rangeThemeMapChanged$.asObservable());
857
882
  this._sheetInterceptorService = e, this._resourceManagerService = t, this._univerInstanceService = s, this._registerIntercept(), this._initSnapshot(), this._initDefaultTheme();
858
883
  }
@@ -998,7 +1023,7 @@ let ve = class extends ae {
998
1023
  }
999
1024
  _registerIntercept() {
1000
1025
  this.disposeWithMe(this._sheetInterceptorService.intercept(mt.CELL_CONTENT, {
1001
- id: Qo,
1026
+ id: er,
1002
1027
  effect: he.Style,
1003
1028
  handler: (e, t, s) => {
1004
1029
  const { row: o, col: r, unitId: i, subUnitId: a } = t, u = this.getCellStyle(i, a, o, r);
@@ -1070,33 +1095,6 @@ ve = Ha([
1070
1095
  Is(1, $(wn)),
1071
1096
  Is(2, $(M))
1072
1097
  ], ve);
1073
- function tr(n, e) {
1074
- const { unitId: t } = e, s = t ? n.getUnit(t, B.UNIVER_SHEET) : n.getCurrentUnitOfType(B.UNIVER_SHEET);
1075
- return s ? {
1076
- workbook: s,
1077
- unitId: s.getUnitId()
1078
- } : null;
1079
- }
1080
- function P(n, e = {}) {
1081
- const { unitId: t, subUnitId: s } = e, o = t ? n.getUnit(t, B.UNIVER_SHEET) : n.getCurrentUnitOfType(B.UNIVER_SHEET);
1082
- if (!o) return null;
1083
- const r = s ? o.getSheetBySheetId(s) : o.getActiveSheet(!0);
1084
- return r ? {
1085
- worksheet: r,
1086
- workbook: o,
1087
- unitId: o.getUnitId(),
1088
- subUnitId: r.getSheetId()
1089
- } : null;
1090
- }
1091
- function tt(n, e) {
1092
- const { unitId: t, subUnitId: s } = e, o = n.getUnit(t, B.UNIVER_SHEET);
1093
- if (!o) return null;
1094
- const r = o.getSheetBySheetId(s);
1095
- return r ? {
1096
- worksheet: r,
1097
- workbook: o
1098
- } : null;
1099
- }
1100
1098
  const an = {
1101
1099
  id: "sheet.mutation.set-worksheet-range-theme-style",
1102
1100
  type: v.MUTATION,
@@ -1106,7 +1104,7 @@ const an = {
1106
1104
  return s.registerRangeThemeRule(a, { range: i, unitId: o, subUnitId: r }), !0;
1107
1105
  }
1108
1106
  }, Ba = (n, e) => {
1109
- const t = tt(n.get(M), e);
1107
+ const t = ye(n.get(M), e);
1110
1108
  if (!t)
1111
1109
  throw new Error("[SetWorksheetRangeThemeStyleMutation]: worksheet is null error!");
1112
1110
  const { worksheet: s } = t;
@@ -1125,7 +1123,7 @@ const an = {
1125
1123
  return s.removeRangeThemeRule(a, { range: i, unitId: o, subUnitId: r }), !0;
1126
1124
  }
1127
1125
  }, ja = (n, e) => {
1128
- const t = tt(n.get(M), e);
1126
+ const t = ye(n.get(M), e);
1129
1127
  if (!t)
1130
1128
  throw new Error("[DeleteWorksheetRangeThemeStyleMutationFactory]: worksheet is null error!");
1131
1129
  const { worksheet: s } = t;
@@ -1170,7 +1168,7 @@ const an = {
1170
1168
  subUnitId: e.subUnitId,
1171
1169
  range: e.range
1172
1170
  };
1173
- }, ke = {
1171
+ }, Te = {
1174
1172
  id: "sheet.mutation.insert-col",
1175
1173
  type: v.MUTATION,
1176
1174
  handler: (n, e) => {
@@ -1233,7 +1231,7 @@ function za(n, e) {
1233
1231
  }
1234
1232
  };
1235
1233
  }
1236
- const qe = {
1234
+ const Ye = {
1237
1235
  id: "sheet.mutation.move-rows",
1238
1236
  type: v.MUTATION,
1239
1237
  handler: (n, e) => {
@@ -1269,7 +1267,7 @@ function Ga(n, e) {
1269
1267
  }
1270
1268
  };
1271
1269
  }
1272
- const Ye = {
1270
+ const Xe = {
1273
1271
  id: "sheet.mutation.move-columns",
1274
1272
  type: v.MUTATION,
1275
1273
  handler: (n, e) => {
@@ -1290,7 +1288,7 @@ const Ye = {
1290
1288
  range: n.range,
1291
1289
  rowInfo: u
1292
1290
  };
1293
- }, Te = {
1291
+ }, Pe = {
1294
1292
  id: "sheet.mutation.remove-rows",
1295
1293
  type: v.MUTATION,
1296
1294
  handler: (n, e) => {
@@ -1331,40 +1329,35 @@ const Ye = {
1331
1329
  const r = e.range, a = o.getColumnManager().getColumnData(), u = r.endColumn - r.startColumn + 1;
1332
1330
  return Bo(r.startColumn, u, a), o.setColumnCount(o.getColumnCount() - u), o.getCellMatrix().removeColumns(r.startColumn, u), !0;
1333
1331
  }
1334
- }, ye = (n, e) => {
1335
- const s = n.get(M).getUniverSheetInstance(e.unitId);
1336
- if (s == null)
1337
- throw new Error("universheet is null error!");
1338
- const o = s.getSheetBySheetId(e.subUnitId);
1339
- if (o == null)
1340
- throw new Error("worksheet is null error!");
1341
- const i = o.getConfig().mergeData, a = e.ranges, u = [];
1342
- for (let l = 0; l < a.length; l++)
1343
- for (let c = i.length - 1; c >= 0; c--) {
1344
- const d = i[c], h = a[l];
1345
- O.intersects(d, h) && u.push(i[c]);
1332
+ }, be = (n, e) => {
1333
+ const t = ye(n.get(M), e);
1334
+ if (!t)
1335
+ throw new Error("Workbook or worksheet is null error!");
1336
+ const { worksheet: s } = t, r = s.getConfig().mergeData, i = e.ranges, a = [];
1337
+ for (let u = 0; u < i.length; u++)
1338
+ for (let l = r.length - 1; l >= 0; l--) {
1339
+ const c = r[l], d = i[u];
1340
+ O.intersects(c, d) && a.push(r[l]);
1346
1341
  }
1347
1342
  return {
1348
1343
  unitId: e.unitId,
1349
1344
  subUnitId: e.subUnitId,
1350
- ranges: u
1345
+ ranges: a
1351
1346
  };
1352
1347
  }, se = {
1353
1348
  id: "sheet.mutation.remove-worksheet-merge",
1354
1349
  type: v.MUTATION,
1355
1350
  handler: (n, e) => {
1356
- const s = n.get(M).getUniverSheetInstance(e.unitId);
1357
- if (s == null)
1358
- throw new Error("universheet is null error!");
1359
- const o = s.getSheetBySheetId(e.subUnitId);
1360
- if (!o) return !1;
1361
- const i = o.getConfig().mergeData, a = e.ranges;
1362
- for (let u = 0; u < a.length; u++)
1363
- for (let l = i.length - 1; l >= 0; l--) {
1364
- const c = i[l], d = a[u];
1365
- O.intersects(c, d) && i.splice(l, 1);
1351
+ const t = ye(n.get(M), e);
1352
+ if (!t)
1353
+ throw new Error("Workbook or worksheet is null error!");
1354
+ const { worksheet: s } = t, r = s.getConfig().mergeData, i = e.ranges;
1355
+ for (let a = 0; a < i.length; a++)
1356
+ for (let u = r.length - 1; u >= 0; u--) {
1357
+ const l = r[u], c = i[a];
1358
+ O.intersects(l, c) && r.splice(u, 1);
1366
1359
  }
1367
- return o.getSpanModel().rebuild(i), !0;
1360
+ return s.getSpanModel().rebuild(r), !0;
1368
1361
  }
1369
1362
  }, qa = (n) => {
1370
1363
  const { order: e } = n, t = {};
@@ -1596,7 +1589,7 @@ function ru(n) {
1596
1589
  function iu(n) {
1597
1590
  return n == null ? null : (n.f === void 0 && (n.f = null), n.si === void 0 && (n.si = null), n.p === void 0 && (n.p = null), n.v === void 0 && (n.v = null), n.t === void 0 && (n.t = null), n.s === void 0 && (n.s = null), n.custom === void 0 && (n.custom = null), n);
1598
1591
  }
1599
- const xe = (n, e) => {
1592
+ const $e = (n, e) => {
1600
1593
  const { unitId: t, subUnitId: s, cellValue: o } = e, i = n.get(M).getUniverSheetInstance(t);
1601
1594
  if (i == null)
1602
1595
  throw new Error("workbook is null error!");
@@ -1753,7 +1746,7 @@ const cu = (n, e) => {
1753
1746
  return !0;
1754
1747
  }
1755
1748
  }, gu = (n, e) => {
1756
- const t = tt(n.get(M), e);
1749
+ const t = ye(n.get(M), e);
1757
1750
  if (!t)
1758
1751
  throw new Error("[SetWorksheetColumnCountUndoMutationFactory]: worksheet is null error!");
1759
1752
  return {
@@ -1765,7 +1758,7 @@ const cu = (n, e) => {
1765
1758
  id: "sheet.mutation.set-worksheet-column-count",
1766
1759
  type: v.MUTATION,
1767
1760
  handler: (n, e) => {
1768
- const t = n.get(M), s = tt(t, e);
1761
+ const t = n.get(M), s = ye(t, e);
1769
1762
  return s ? (s.worksheet.setColumnCount(e.columnCount), !0) : !1;
1770
1763
  }
1771
1764
  }, en = {
@@ -1778,7 +1771,7 @@ const cu = (n, e) => {
1778
1771
  return s.setDefaultCellStyle(o), !0;
1779
1772
  }
1780
1773
  }, mu = (n, e) => {
1781
- const t = tt(n.get(M), e);
1774
+ const t = ye(n.get(M), e);
1782
1775
  if (!t)
1783
1776
  throw new Error("[SetWorksheetDefaultStyleMutationFactory]: worksheet is null error!");
1784
1777
  const { worksheet: s } = t;
@@ -1788,7 +1781,7 @@ const cu = (n, e) => {
1788
1781
  defaultStyle: s.getDefaultCellStyle()
1789
1782
  };
1790
1783
  }, fu = (n, e) => {
1791
- const t = tt(n.get(M), e);
1784
+ const t = ye(n.get(M), e);
1792
1785
  if (!t)
1793
1786
  throw new Error("[SetWorksheetRowCountUndoMutationFactory]: worksheet is null error!");
1794
1787
  return {
@@ -1800,7 +1793,7 @@ const cu = (n, e) => {
1800
1793
  id: "sheet.mutation.set-worksheet-row-count",
1801
1794
  type: v.MUTATION,
1802
1795
  handler: (n, e) => {
1803
- const t = n.get(M), s = tt(t, e);
1796
+ const t = n.get(M), s = ye(t, e);
1804
1797
  return s ? (s.worksheet.setRowCount(e.rowCount), !0) : !1;
1805
1798
  }
1806
1799
  }, or = (n, e) => {
@@ -1854,7 +1847,7 @@ const cu = (n, e) => {
1854
1847
  typeof s == "number" ? a.setRowHeight(c, s) : D.isDefine(s[c]) && a.setRowHeight(c, s[c]);
1855
1848
  return !0;
1856
1849
  }
1857
- }, Be = {
1850
+ }, je = {
1858
1851
  id: "sheet.mutation.set-worksheet-row-is-auto-height",
1859
1852
  type: v.MUTATION,
1860
1853
  handler: (n, e) => {
@@ -1907,20 +1900,20 @@ const cu = (n, e) => {
1907
1900
  var Ru = /* @__PURE__ */ ((n) => (n.SET_WORKSHEET_ROW_HEIGHT = "sheet.mutation.set-worksheet-row-height", n.SET_WORKSHEET_ROW_IS_AUTO_HEIGHT = "sheet.mutation.set-worksheet-row-is-auto-height", n.SET_WORKSHEET_ROW_AUTO_HEIGHT = "sheet.mutation.set-worksheet-row-auto-height", n.SET_WORKSHEET_COL_WIDTH = "sheet.mutation.set-worksheet-col-width", n.SET_WORKSHEET_ACTIVE = "sheet.operation.set-worksheet-active", n.MOVE_ROWS = "sheet.mutation.move-rows", n.MOVE_COLUMNS = "sheet.mutation.move-columns", n.SET_COL_HIDDEN = "sheet.mutation.set-col-hidden", n.SET_COL_VISIBLE = "sheet.mutation.set-col-visible", n.SET_ROW_HIDDEN = "sheet.mutation.set-row-hidden", n.SET_ROW_VISIBLE = "sheet.mutation.set-row-visible", n.INSERT_COL = "sheet.mutation.insert-col", n.INSERT_ROW = "sheet.mutation.insert-row", n.REMOVE_COL = "sheet.mutation.remove-col", n.REMOVE_ROW = "sheet.mutation.remove-rows", n.TOGGLE_GRIDLINES = "sheet.mutation.toggle-gridlines", n.SET_GRIDLINES_COLOR = "sheet.mutation.set-gridlines-color", n))(Ru || {}), Cu = /* @__PURE__ */ ((n) => (n.SET_RANGE_VALUES = "sheet.mutation.set-range-values", n.MOVE_RANGE = "sheet.mutation.move-range", n.REMOVE_WORKSHEET_MERGE = "sheet.mutation.remove-worksheet-merge", n.ADD_WORKSHEET_MERGE = "sheet.mutation.add-worksheet-merge", n.REORDER_RANGE = "sheet.mutation.reorder-range", n.SET_WORKSHEET_DEFAULT_STYLE = "sheet.mutation.set-worksheet-default-style", n.SET_ROW_DATA = "sheet.mutation.set-row-data", n.SET_COL_DATA = "sheet.mutation.set-col-data", n.SET_WORKSHEET_RANGE_THEME_STYLE = "sheet.mutation.set-worksheet-range-theme-style", n.DELETE_WORKSHEET_RANGE_THEME_STYLE = "sheet.mutation.delete-worksheet-range-theme-style", n))(Cu || {});
1908
1901
  const Vh = [
1909
1902
  ot.id,
1910
- Be.id,
1903
+ je.id,
1911
1904
  rr.id,
1912
1905
  Ct.id,
1913
1906
  jt.id,
1914
- qe.id,
1915
1907
  Ye.id,
1908
+ Xe.id,
1916
1909
  ln.id,
1917
1910
  cn.id,
1918
1911
  Ot.id,
1919
1912
  Nt.id,
1920
- ke.id,
1913
+ Te.id,
1921
1914
  Ue.id,
1922
1915
  Me.id,
1923
- Te.id,
1916
+ Pe.id,
1924
1917
  nn.id,
1925
1918
  Xt.id,
1926
1919
  tn.id,
@@ -2503,8 +2496,8 @@ function Eu(n) {
2503
2496
  endColumn: u
2504
2497
  };
2505
2498
  }
2506
- var Uu = /* @__PURE__ */ ((n) => (n[n.Tab = 1] = "Tab", n[n.Comma = 2] = "Comma", n[n.Semicolon = 4] = "Semicolon", n[n.Space = 8] = "Space", n[n.Custom = 16] = "Custom", n))(Uu || {});
2507
- class ku {
2499
+ var ku = /* @__PURE__ */ ((n) => (n[n.Tab = 1] = "Tab", n[n.Comma = 2] = "Comma", n[n.Semicolon = 4] = "Semicolon", n[n.Space = 8] = "Space", n[n.Custom = 16] = "Custom", n))(ku || {});
2500
+ class Uu {
2508
2501
  constructor() {
2509
2502
  R(this, "_tabCount", 0);
2510
2503
  R(this, "_commaCount", 0);
@@ -2567,7 +2560,7 @@ function Du(n, e, t, s, o = !1) {
2567
2560
  throw new Error("The range must be in the same column.");
2568
2561
  if (t && (t & 16) > 0 && (s === void 0 || s.length !== 1))
2569
2562
  throw new Error("The custom delimiter must a character.");
2570
- const c = t === void 0, d = c ? new ku() : null, h = [];
2563
+ const c = t === void 0, d = c ? new Uu() : null, h = [];
2571
2564
  for (let S = a; S <= l; S++) {
2572
2565
  const w = n.getCell(S, i), y = Ou(w);
2573
2566
  h.push(y), d && d.update(y);
@@ -2694,9 +2687,9 @@ class fe {
2694
2687
  * Map<unitId, Map<subUnitId, Map<ruleId, IRangeProtectionRule>>>
2695
2688
  */
2696
2689
  R(this, "_model", /* @__PURE__ */ new Map());
2697
- R(this, "_ruleChange$", new Ae());
2690
+ R(this, "_ruleChange$", new xe());
2698
2691
  R(this, "ruleChange$", this._ruleChange$.asObservable());
2699
- R(this, "_ruleRefresh$", new Ae());
2692
+ R(this, "_ruleRefresh$", new xe());
2700
2693
  R(this, "ruleRefresh$", this._ruleRefresh$.asObservable());
2701
2694
  R(this, "_rangeRuleInitStateChange", new Rt(!1));
2702
2695
  R(this, "rangeRuleInitStateChange$", this._rangeRuleInitStateChange.asObservable());
@@ -2787,7 +2780,7 @@ class fe {
2787
2780
  }
2788
2781
  const qh = (n, e) => {
2789
2782
  const t = n.get(fe), s = e.ruleIds.map((r) => t.getRule(e.unitId, e.subUnitId, r)).filter((r) => !!r);
2790
- return { id: je.id, params: { subUnitId: e.subUnitId, unitId: e.unitId, rules: s } };
2783
+ return { id: ze.id, params: { subUnitId: e.subUnitId, unitId: e.unitId, rules: s } };
2791
2784
  }, at = {
2792
2785
  id: "sheet.mutation.delete-range-protection",
2793
2786
  type: v.MUTATION,
@@ -2800,7 +2793,7 @@ const qh = (n, e) => {
2800
2793
  }, Yh = (n) => {
2801
2794
  const e = { ...n, ruleIds: n.rules.map((t) => t.id) };
2802
2795
  return { id: at.id, params: e };
2803
- }, je = {
2796
+ }, ze = {
2804
2797
  id: "sheet.mutation.add-range-protection",
2805
2798
  type: v.MUTATION,
2806
2799
  handler: (n, e) => {
@@ -2815,7 +2808,7 @@ const qh = (n, e) => {
2815
2808
  async handler(n, e) {
2816
2809
  if (!e)
2817
2810
  return !1;
2818
- const t = n.get(U), s = n.get(V), o = n.get(fe), { rule: r, permissionId: i } = e, { unitId: a, subUnitId: u, ranges: l, description: c, viewState: d, editState: h } = r, g = [{
2811
+ const t = n.get(k), s = n.get(V), o = n.get(fe), { rule: r, permissionId: i } = e, { unitId: a, subUnitId: u, ranges: l, description: c, viewState: d, editState: h } = r, g = [{
2819
2812
  ranges: l,
2820
2813
  permissionId: i,
2821
2814
  id: o.createRuleId(a, u),
@@ -2826,12 +2819,12 @@ const qh = (n, e) => {
2826
2819
  viewState: d,
2827
2820
  editState: h
2828
2821
  }];
2829
- if (await t.executeCommand(je.id, {
2822
+ if (await t.executeCommand(ze.id, {
2830
2823
  unitId: a,
2831
2824
  subUnitId: u,
2832
2825
  rules: g
2833
2826
  })) {
2834
- const f = [{ id: je.id, params: { unitId: a, subUnitId: u, rules: g } }], C = [{ id: at.id, params: { unitId: a, subUnitId: u, ruleIds: g.map((p) => p.id) } }];
2827
+ const f = [{ id: ze.id, params: { unitId: a, subUnitId: u, rules: g } }], C = [{ id: at.id, params: { unitId: a, subUnitId: u, ruleIds: g.map((p) => p.id) } }];
2835
2828
  s.pushUndoRedo({
2836
2829
  unitID: a,
2837
2830
  redoMutations: f,
@@ -2849,9 +2842,10 @@ class ju extends ae {
2849
2842
  * Selection data model for each worksheet.
2850
2843
  */
2851
2844
  R(this, "_worksheetSelections", /* @__PURE__ */ new Map());
2852
- R(this, "_selectionMoveStart$", new Ae());
2845
+ R(this, "_worksheetLastSelectionPrimaryCell", /* @__PURE__ */ new Map());
2846
+ R(this, "_selectionMoveStart$", new xe());
2853
2847
  R(this, "selectionMoveStart$", this._selectionMoveStart$.asObservable());
2854
- R(this, "_selectionMoving$", new Ae());
2848
+ R(this, "_selectionMoving$", new xe());
2855
2849
  R(this, "selectionMoving$", this._selectionMoving$.asObservable());
2856
2850
  R(this, "_selectionMoveEnd$", new Rt([]));
2857
2851
  R(this, "selectionMoveEnd$", this._selectionMoveEnd$.asObservable());
@@ -2863,7 +2857,7 @@ class ju extends ae {
2863
2857
  this._workbook = t, this.selectionChanged$ = qt(this._selectionMoveEnd$, this._selectionSet$);
2864
2858
  }
2865
2859
  dispose() {
2866
- super.dispose(), this._beforeSelectionMoveEnd$.complete(), this._selectionMoveEnd$.complete(), this._selectionMoving$.complete(), this._selectionMoveStart$.complete(), this._selectionSet$.complete(), this._workbook = null;
2860
+ super.dispose(), this._beforeSelectionMoveEnd$.complete(), this._selectionMoveEnd$.complete(), this._selectionMoving$.complete(), this._selectionMoveStart$.complete(), this._selectionSet$.complete(), this._workbook = null, this.clear();
2867
2861
  }
2868
2862
  addSelections(t, s) {
2869
2863
  const o = this.getSelectionsOfWorksheet(t);
@@ -2909,15 +2903,19 @@ class ju extends ae {
2909
2903
  getSelectionsOfWorksheet(t) {
2910
2904
  return this._worksheetSelections.has(t) || this._worksheetSelections.set(t, []), this._worksheetSelections.get(t);
2911
2905
  }
2906
+ getLastSelectionPrimaryCellOfWorksheet(t) {
2907
+ var s;
2908
+ return (s = this._worksheetLastSelectionPrimaryCell.get(t)) != null ? s : null;
2909
+ }
2912
2910
  setSelectionsOfWorksheet(t, s) {
2913
- this._worksheetSelections.set(t, [...s]);
2911
+ this._worksheetSelections.set(t, [...s]), s.length > 0 && s[s.length - 1].primary && this._worksheetLastSelectionPrimaryCell.set(t, s[s.length - 1].primary);
2914
2912
  }
2915
2913
  deleteSheetSelection(t) {
2916
- this._worksheetSelections.set(t, []);
2914
+ this._worksheetSelections.set(t, []), this._worksheetLastSelectionPrimaryCell.delete(t);
2917
2915
  }
2918
2916
  /** Clear all selections in this workbook. */
2919
2917
  clear() {
2920
- this._worksheetSelections.clear(), this._selectionSet$.next([]);
2918
+ this._worksheetSelections.clear(), this._worksheetLastSelectionPrimaryCell.clear(), this._selectionSet$.next([]);
2921
2919
  }
2922
2920
  _getCurrentSelections() {
2923
2921
  return this.getSelectionsOfWorksheet(this._workbook.getActiveSheet().getSheetId());
@@ -3003,6 +3001,13 @@ let F = class extends jo {
3003
3001
  const e = this._getCurrentSelections();
3004
3002
  return e == null ? void 0 : e[e.length - 1];
3005
3003
  }
3004
+ getCurrentLastSelectionPrimaryCell() {
3005
+ const e = this._currentSelectionPos;
3006
+ if (!e)
3007
+ return null;
3008
+ const { unitId: t, sheetId: s } = e;
3009
+ return this._ensureWorkbookSelection(t).getLastSelectionPrimaryCellOfWorksheet(s);
3010
+ }
3006
3011
  addSelections(e, t, s) {
3007
3012
  if (typeof e == "string") {
3008
3013
  this._ensureWorkbookSelection(e).addSelections(t, s);
@@ -3115,7 +3120,7 @@ const Xh = "DISABLE_NORMAL_SELECTIONS", Zh = "SELECTIONS_ENABLED", Ju = "REF_SEL
3115
3120
  type: v.COMMAND,
3116
3121
  handler: (n, e) => {
3117
3122
  var S;
3118
- const t = n.get(M), s = n.get(U), o = n.get(F), r = n.get(V), i = n.get(j), a = t.getCurrentUnitForType(B.UNIVER_SHEET);
3123
+ const t = n.get(M), s = n.get(k), o = n.get(F), r = n.get(V), i = n.get(j), a = t.getCurrentUnitForType(B.UNIVER_SHEET);
3119
3124
  if (!a) return !1;
3120
3125
  const u = (e == null ? void 0 : e.unitId) || a.getUnitId(), l = a.getActiveSheet();
3121
3126
  if (!l) return !1;
@@ -3126,7 +3131,7 @@ const Xh = "DISABLE_NORMAL_SELECTIONS", Zh = "SELECTIONS_ENABLED", Ju = "REF_SEL
3126
3131
  subUnitId: c,
3127
3132
  unitId: u,
3128
3133
  cellValue: ur(h)
3129
- }, C = xe(
3134
+ }, C = $e(
3130
3135
  n,
3131
3136
  f
3132
3137
  );
@@ -3151,7 +3156,7 @@ const Xh = "DISABLE_NORMAL_SELECTIONS", Zh = "SELECTIONS_ENABLED", Ju = "REF_SEL
3151
3156
  type: v.COMMAND,
3152
3157
  handler: (n, e) => {
3153
3158
  var S;
3154
- const t = n.get(M), s = n.get(U), o = n.get(F), r = n.get(V), i = n.get(j), a = t.getCurrentUnitForType(B.UNIVER_SHEET);
3159
+ const t = n.get(M), s = n.get(k), o = n.get(F), r = n.get(V), i = n.get(j), a = t.getCurrentUnitForType(B.UNIVER_SHEET);
3155
3160
  if (!a) return !1;
3156
3161
  const u = (e == null ? void 0 : e.unitId) || a.getUnitId(), l = a.getActiveSheet();
3157
3162
  if (!l) return !1;
@@ -3162,7 +3167,7 @@ const Xh = "DISABLE_NORMAL_SELECTIONS", Zh = "SELECTIONS_ENABLED", Ju = "REF_SEL
3162
3167
  subUnitId: c,
3163
3168
  unitId: u,
3164
3169
  cellValue: Vu(h)
3165
- }, C = xe(
3170
+ }, C = $e(
3166
3171
  n,
3167
3172
  f
3168
3173
  );
@@ -3278,7 +3283,7 @@ function qu(n) {
3278
3283
  forOperableEach: e
3279
3284
  };
3280
3285
  }
3281
- const So = (n) => n.id !== Qo;
3286
+ const So = (n) => n.id !== er;
3282
3287
  function It(n, e, t, s, o, r, i) {
3283
3288
  const a = {};
3284
3289
  for (let u = e; u <= t; u++)
@@ -3320,7 +3325,7 @@ let wo = class extends F {
3320
3325
  this._ensureWorkbookSelection(t.getUnitId()), e.next([...e.getValue(), t]);
3321
3326
  })), this.disposeWithMe(this._instanceSrv.getTypeOfUnitDisposed$(B.UNIVER_SHEET).subscribe((t) => {
3322
3327
  this._removeWorkbookSelection(t.getUnitId()), e.next(e.getValue().filter((s) => s !== t));
3323
- })), e.pipe(ks((t) => t.map((s) => this._ensureWorkbookSelection(s.getUnitId()))));
3328
+ })), e.pipe(Us((t) => t.map((s) => this._ensureWorkbookSelection(s.getUnitId()))));
3324
3329
  }
3325
3330
  };
3326
3331
  wo = Xu([
@@ -3343,7 +3348,7 @@ const ie = {
3343
3348
  type: v.COMMAND,
3344
3349
  handler: (n, e) => {
3345
3350
  if (!e) return !1;
3346
- const { unitId: t, subUnit: s, range: o } = e, r = n.get(U), i = P(n.get(M), e);
3351
+ const { unitId: t, subUnit: s, range: o } = e, r = n.get(k), i = P(n.get(M), e);
3347
3352
  if (!i) return !1;
3348
3353
  const a = [{
3349
3354
  range: o,
@@ -3356,14 +3361,14 @@ const ie = {
3356
3361
  selections: a
3357
3362
  });
3358
3363
  }
3359
- }, lr = "sheet.command.move-range", Ut = {
3364
+ }, lr = "sheet.command.move-range", kt = {
3360
3365
  type: v.COMMAND,
3361
3366
  id: lr,
3362
3367
  // eslint-disable-next-line max-lines-per-function
3363
3368
  handler: async (n, e) => {
3364
3369
  var I, S;
3365
- const t = n.get(U), s = n.get(V), o = n.get(M), r = n.get(Bt), i = n.get(Qe), a = n.get(j), u = P(o);
3366
- if (!u || !await a.beforeCommandExecute({ id: Ut.id, params: e }))
3370
+ const t = n.get(k), s = n.get(V), o = n.get(M), r = n.get(Bt), i = n.get(et), a = n.get(j), u = P(o);
3371
+ if (!u || !await a.beforeCommandExecute({ id: kt.id, params: e }))
3367
3372
  return !1;
3368
3373
  const { worksheet: c, subUnitId: d, unitId: h } = u, g = js(
3369
3374
  n,
@@ -3373,7 +3378,7 @@ const ie = {
3373
3378
  if (g === null)
3374
3379
  return r.emit(i.t("sheets.info.acrossMergedCell")), !1;
3375
3380
  const m = a.onCommandExecute({
3376
- id: Ut.id,
3381
+ id: kt.id,
3377
3382
  params: e
3378
3383
  }), f = [
3379
3384
  ...(I = m.preRedos) != null ? I : [],
@@ -3408,7 +3413,7 @@ const ie = {
3408
3413
  subUnitId: d,
3409
3414
  ranges: [e.fromRange, e.toRange]
3410
3415
  }), b = a.afterCommandExecute({
3411
- id: Ut.id,
3416
+ id: kt.id,
3412
3417
  params: e
3413
3418
  });
3414
3419
  return L([...b.redos, ...y], t), s.pushUndoRedo({
@@ -3427,19 +3432,19 @@ function js(n, e, t, s = !1) {
3427
3432
  if (!O.equals(l, p) && !s)
3428
3433
  return null;
3429
3434
  const I = new q(), S = new q(), w = new q();
3430
- Y.foreach(i, (k, E) => {
3431
- const A = C.getValue(k, E);
3432
- if (I.setValue(k, E, D.deepClone(A)), A) {
3435
+ Y.foreach(i, (U, E) => {
3436
+ const A = C.getValue(U, E);
3437
+ if (I.setValue(U, E, D.deepClone(A)), A) {
3433
3438
  const X = h == null ? void 0 : h.getStyles().get(A.s);
3434
- w.setValue(k, E, D.deepClone(X));
3439
+ w.setValue(U, E, D.deepClone(X));
3435
3440
  }
3436
- S.setValue(k, E, null);
3441
+ S.setValue(U, E, null);
3437
3442
  });
3438
3443
  const y = new q(), b = new q();
3439
- Y.foreach(l, (k, E) => {
3440
- y.setValue(k, E, D.deepClone(f.getValue(k, E)));
3441
- }), Y.foreach(i, (k, E) => {
3442
- const A = Go(k, E), X = O.getRelativeRange(A, i), z = O.getPositionRange(X, l), G = D.deepClone(w.getValue(k, E)), K = D.deepClone(I.getValue(k, E));
3444
+ Y.foreach(l, (U, E) => {
3445
+ y.setValue(U, E, D.deepClone(f.getValue(U, E)));
3446
+ }), Y.foreach(i, (U, E) => {
3447
+ const A = Go(U, E), X = O.getRelativeRange(A, i), z = O.getPositionRange(X, l), G = D.deepClone(w.getValue(U, E)), K = D.deepClone(I.getValue(U, E));
3443
3448
  K && G && (K.s = G), b.setValue(z.startRow, z.startColumn, K);
3444
3449
  });
3445
3450
  const N = {
@@ -3483,7 +3488,7 @@ function nl(n, e, t) {
3483
3488
  return i;
3484
3489
  }
3485
3490
  var $n = /* @__PURE__ */ ((n) => (n[n.UNIVER_UNKNOWN = 0] = "UNIVER_UNKNOWN", n[n.UNIVER_DOC = 1] = "UNIVER_DOC", n[n.UNIVER_SHEET = 2] = "UNIVER_SHEET", n[n.UNIVER_SLIDE = 3] = "UNIVER_SLIDE", n[n.UNIVER_PROJECT = 4] = "UNIVER_PROJECT", n[n.UNRECOGNIZED = -1] = "UNRECOGNIZED", n))($n || {}), _ = /* @__PURE__ */ ((n) => (n[n.View = 0] = "View", n[n.Edit = 1] = "Edit", n[n.ManageCollaborator = 2] = "ManageCollaborator", n[n.Print = 3] = "Print", n[n.Duplicate = 4] = "Duplicate", n[n.Comment = 5] = "Comment", n[n.Copy = 6] = "Copy", n[n.Share = 7] = "Share", n[n.Export = 8] = "Export", n[n.MoveWorksheet = 9] = "MoveWorksheet", n[n.DeleteWorksheet = 10] = "DeleteWorksheet", n[n.HideWorksheet = 11] = "HideWorksheet", n[n.RenameWorksheet = 12] = "RenameWorksheet", n[n.CreateWorksheet = 13] = "CreateWorksheet", n[n.SetWorksheetStyle = 14] = "SetWorksheetStyle", n[n.EditWorksheetCell = 15] = "EditWorksheetCell", n[n.InsertHyperlink = 16] = "InsertHyperlink", n[n.Sort = 17] = "Sort", n[n.Filter = 18] = "Filter", n[n.PivotTable = 19] = "PivotTable", n[n.FloatImg = 20] = "FloatImg", n[n.History = 21] = "History", n[n.RwHgtClWdt = 22] = "RwHgtClWdt", n[n.ViemRwHgtClWdt = 23] = "ViemRwHgtClWdt", n[n.ViewFilter = 24] = "ViewFilter", n[n.MoveSheet = 25] = "MoveSheet", n[n.DeleteSheet = 26] = "DeleteSheet", n[n.HideSheet = 27] = "HideSheet", n[n.CopySheet = 28] = "CopySheet", n[n.RenameSheet = 29] = "RenameSheet", n[n.CreateSheet = 30] = "CreateSheet", n[n.SelectProtectedCells = 31] = "SelectProtectedCells", n[n.SelectUnProtectedCells = 32] = "SelectUnProtectedCells", n[n.SetCellStyle = 33] = "SetCellStyle", n[n.SetCellValue = 34] = "SetCellValue", n[n.SetRowStyle = 35] = "SetRowStyle", n[n.SetColumnStyle = 36] = "SetColumnStyle", n[n.InsertRow = 37] = "InsertRow", n[n.InsertColumn = 38] = "InsertColumn", n[n.DeleteRow = 39] = "DeleteRow", n[n.DeleteColumn = 40] = "DeleteColumn", n[n.EditExtraObject = 41] = "EditExtraObject", n[n.Delete = 42] = "Delete", n[n.RecoverHistory = 43] = "RecoverHistory", n[n.ViewHistory = 44] = "ViewHistory", n[n.CreatePermissionObject = 45] = "CreatePermissionObject", n[n.UNRECOGNIZED = -1] = "UNRECOGNIZED", n))(_ || {}), x = /* @__PURE__ */ ((n) => (n[n.Unkonwn = 0] = "Unkonwn", n[n.Workbook = 1] = "Workbook", n[n.Worksheet = 2] = "Worksheet", n[n.SelectRange = 3] = "SelectRange", n[n.Document = 4] = "Document", n[n.Slide = 5] = "Slide", n[n.UNRECOGNIZED = -1] = "UNRECOGNIZED", n))(x || {});
3486
- class Le {
3491
+ class He {
3487
3492
  constructor(e, t, s) {
3488
3493
  R(this, "type", x.SelectRange);
3489
3494
  R(this, "subType", _.Edit);
@@ -3599,7 +3604,7 @@ class fr {
3599
3604
  this.unitId = e, this.unitId = e, this.id = `${this.type}.${_.Duplicate}_${e}`;
3600
3605
  }
3601
3606
  }
3602
- class Ne {
3607
+ class Oe {
3603
3608
  constructor(e) {
3604
3609
  R(this, "id");
3605
3610
  R(this, "value", !0);
@@ -3779,7 +3784,7 @@ class yr {
3779
3784
  this.unitId = e, this.subUnitId = t, this.id = `${this.type}.${_.DeleteRow}_${e}_${t}`;
3780
3785
  }
3781
3786
  }
3782
- class He {
3787
+ class Fe {
3783
3788
  constructor(e, t) {
3784
3789
  R(this, "value", !0);
3785
3790
  R(this, "type", x.Worksheet);
@@ -3809,7 +3814,7 @@ class Er {
3809
3814
  this.unitId = e, this.subUnitId = t, this.id = `${this.type}.${_.Filter}_${e}_${t}`;
3810
3815
  }
3811
3816
  }
3812
- class Ur {
3817
+ class kr {
3813
3818
  constructor(e, t) {
3814
3819
  R(this, "value", !0);
3815
3820
  R(this, "type", x.Worksheet);
@@ -3819,7 +3824,7 @@ class Ur {
3819
3824
  this.unitId = e, this.subUnitId = t, this.id = `${this.type}.${_.InsertColumn}_${e}_${t}`;
3820
3825
  }
3821
3826
  }
3822
- class kr {
3827
+ class Ur {
3823
3828
  constructor(e, t) {
3824
3829
  R(this, "value", !0);
3825
3830
  R(this, "type", x.Worksheet);
@@ -3944,10 +3949,10 @@ const vn = {
3944
3949
  type: v.COMMAND,
3945
3950
  handler: (n, e) => {
3946
3951
  var X;
3947
- const t = n.get(U), s = n.get(V), o = n.get(M), r = n.get(F), i = n.get(j), a = n.get(et), u = P(o, e);
3952
+ const t = n.get(k), s = n.get(V), o = n.get(M), r = n.get(F), i = n.get(j), a = n.get(tt), u = P(o, e);
3948
3953
  if (!u) return !1;
3949
3954
  const { subUnitId: l, unitId: c, workbook: d, worksheet: h } = u, { value: g, range: m, redoUndoId: f } = e, C = m ? [m] : (X = r.getCurrentSelections()) == null ? void 0 : X.map((z) => z.range);
3950
- if (!C || !C.length || !a.getPermissionPoint(new He(c, l).id)) return !1;
3955
+ if (!C || !C.length || !a.getPermissionPoint(new Fe(c, l).id)) return !1;
3951
3956
  const p = new q();
3952
3957
  let I;
3953
3958
  if (D.isArray(g))
@@ -3966,12 +3971,12 @@ const vn = {
3966
3971
  }
3967
3972
  else
3968
3973
  I = g;
3969
- const S = { subUnitId: l, unitId: c, cellValue: I != null ? I : p.getMatrix() }, w = xe(n, S), y = Ai(S.cellValue, (z, G) => h.getCellHeight(z, G) || void 0);
3974
+ const S = { subUnitId: l, unitId: c, cellValue: I != null ? I : p.getMatrix() }, w = $e(n, S), y = Ai(S.cellValue, (z, G) => h.getCellHeight(z, G) || void 0);
3970
3975
  if (!t.syncExecuteCommand(ee.id, S)) return !1;
3971
3976
  const { undos: N, redos: T } = i.onCommandExecute({
3972
3977
  id: vn.id,
3973
3978
  params: S
3974
- }), { undos: k, redos: E } = i.generateMutationsOfAutoHeight({
3979
+ }), { undos: U, redos: E } = i.generateMutationsOfAutoHeight({
3975
3980
  unitId: c,
3976
3981
  subUnitId: l,
3977
3982
  ranges: C,
@@ -3984,7 +3989,7 @@ const vn = {
3984
3989
  undoMutations: [
3985
3990
  { id: ee.id, params: w },
3986
3991
  ...N,
3987
- ...k,
3992
+ ...U,
3988
3993
  z
3989
3994
  ],
3990
3995
  redoMutations: [
@@ -4008,8 +4013,8 @@ function Ar(n, e) {
4008
4013
  if (a === pe.COLUMNS) {
4009
4014
  const b = Math.min(i.endRow, m.endRow);
4010
4015
  let N = 0;
4011
- for (let k = i.startRow; k <= b; k++) {
4012
- const E = g.getRow(k), A = E ? Jo(E) - 1 : 0;
4016
+ for (let U = i.startRow; U <= b; U++) {
4017
+ const E = g.getRow(U), A = E ? Jo(E) - 1 : 0;
4013
4018
  N = Math.max(N, A);
4014
4019
  }
4015
4020
  S = {
@@ -4059,7 +4064,7 @@ function Ar(n, e) {
4059
4064
  subUnitId: r,
4060
4065
  unitId: o,
4061
4066
  cellValue: u
4062
- }, C = xe(
4067
+ }, C = $e(
4063
4068
  n,
4064
4069
  f
4065
4070
  ), { undos: p, redos: I } = c.onCommandExecute({
@@ -4080,7 +4085,7 @@ function xr(n, e) {
4080
4085
  subUnitId: r,
4081
4086
  unitId: o,
4082
4087
  cellValue: ur([i])
4083
- }, f = xe(
4088
+ }, f = $e(
4084
4089
  n,
4085
4090
  m
4086
4091
  ), C = l.onCommandExecute({
@@ -4189,7 +4194,7 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4189
4194
  id: $r,
4190
4195
  handler: async (n, e) => {
4191
4196
  var w, y, b;
4192
- const t = n.get(U), s = n.get(V), o = n.get(M), r = n.get(F), i = n.get(j), a = P(o);
4197
+ const t = n.get(k), s = n.get(V), o = n.get(M), r = n.get(F), i = n.get(j), a = P(o);
4193
4198
  if (!a) return !1;
4194
4199
  const { worksheet: u, workbook: l, subUnitId: c, unitId: d } = a;
4195
4200
  let h = e == null ? void 0 : e.range;
@@ -4226,7 +4231,7 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4226
4231
  id: Wr,
4227
4232
  handler: async (n, e) => {
4228
4233
  var w, y, b;
4229
- const t = n.get(U), s = n.get(V), o = n.get(M), r = n.get(F), i = n.get(j), a = P(o);
4234
+ const t = n.get(k), s = n.get(V), o = n.get(M), r = n.get(F), i = n.get(j), a = P(o);
4230
4235
  if (!a) return !1;
4231
4236
  const { unitId: u, subUnitId: l, workbook: c, worksheet: d } = a;
4232
4237
  let h = e == null ? void 0 : e.range;
@@ -4264,7 +4269,7 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4264
4269
  // eslint-disable-next-line max-lines-per-function
4265
4270
  handler: async (n, e) => {
4266
4271
  var X, z, G;
4267
- const t = n.get(U), s = n.get(V), o = n.get(M), r = n.get(F), i = n.get(j), a = n.get(Bt), u = n.get(Qe);
4272
+ const t = n.get(k), s = n.get(V), o = n.get(M), r = n.get(F), i = n.get(j), a = n.get(Bt), u = n.get(et);
4268
4273
  if (r.isOverlapping())
4269
4274
  return a.emit(u.t("sheets.info.overlappingSelections")), !1;
4270
4275
  const l = P(o);
@@ -4296,7 +4301,7 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4296
4301
  n,
4297
4302
  oe
4298
4303
  );
4299
- C.push({ id: Te.id, params: le });
4304
+ C.push({ id: Pe.id, params: le });
4300
4305
  }
4301
4306
  const b = {};
4302
4307
  Y.foreach(m, (K, ue) => {
@@ -4309,11 +4314,11 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4309
4314
  unitId: c,
4310
4315
  shiftDimension: pe.ROWS,
4311
4316
  cellValue: b
4312
- }, { redo: T, undo: k } = Ar(
4317
+ }, { redo: T, undo: U } = Ar(
4313
4318
  n,
4314
4319
  N
4315
4320
  );
4316
- f.push(...T), C.push(...k);
4321
+ f.push(...T), C.push(...U);
4317
4322
  const E = i.onCommandExecute({
4318
4323
  id: Dt.id,
4319
4324
  params: { range: m }
@@ -4339,7 +4344,7 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4339
4344
  // eslint-disable-next-line max-lines-per-function
4340
4345
  handler: async (n, e) => {
4341
4346
  var X, z, G;
4342
- const t = n.get(U), s = n.get(V), o = n.get(M), r = n.get(F), i = n.get(j), a = n.get(Bt), u = n.get(Qe);
4347
+ const t = n.get(k), s = n.get(V), o = n.get(M), r = n.get(F), i = n.get(j), a = n.get(Bt), u = n.get(et);
4343
4348
  if (r.isOverlapping())
4344
4349
  return a.emit(u.t("sheets.info.overlappingSelections")), !1;
4345
4350
  const l = P(o);
@@ -4367,7 +4372,7 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4367
4372
  }))
4368
4373
  };
4369
4374
  f.push({
4370
- id: ke.id,
4375
+ id: Te.id,
4371
4376
  params: oe
4372
4377
  });
4373
4378
  const le = ds(
@@ -4387,11 +4392,11 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4387
4392
  unitId: h,
4388
4393
  shiftDimension: pe.COLUMNS,
4389
4394
  cellValue: b
4390
- }, { redo: T, undo: k } = Ar(
4395
+ }, { redo: T, undo: U } = Ar(
4391
4396
  n,
4392
4397
  N
4393
4398
  );
4394
- f.push(...T), C.push(...k);
4399
+ f.push(...T), C.push(...U);
4395
4400
  const E = i.onCommandExecute({
4396
4401
  id: dn.id,
4397
4402
  params: { range: m }
@@ -4411,13 +4416,13 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4411
4416
  }
4412
4417
  // all subsequent mutations should succeed in order to make the whole process succeed
4413
4418
  // Promise.all([]).then(() => true),
4414
- }, Vr = "sheet.command.insert-row", Xe = {
4419
+ }, Vr = "sheet.command.insert-row", Ze = {
4415
4420
  type: v.COMMAND,
4416
4421
  id: Vr,
4417
4422
  handler: async (n, e) => {
4418
- const t = n.get(U), s = n.get(j), { range: o, direction: r, unitId: i, subUnitId: a, cellValue: u } = e;
4423
+ const t = n.get(k), s = n.get(j), { range: o, direction: r, unitId: i, subUnitId: a, cellValue: u } = e;
4419
4424
  return await s.beforeCommandExecute({
4420
- id: Xe.id,
4425
+ id: Ze.id,
4421
4426
  params: e
4422
4427
  }) ? t.syncExecuteCommand(Lr.id, {
4423
4428
  range: o,
@@ -4431,8 +4436,8 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4431
4436
  type: v.COMMAND,
4432
4437
  id: "sheet.command.insert-row-by-range",
4433
4438
  handler: (n, e) => {
4434
- var T, k, E, A;
4435
- const t = n.get(U), s = n.get(V), o = n.get(M), r = n.get(j), i = P(o, e);
4439
+ var T, U, E, A;
4440
+ const t = n.get(k), s = n.get(V), o = n.get(M), r = n.get(j), i = P(o, e);
4436
4441
  if (!i) return !1;
4437
4442
  const { workbook: a, worksheet: u } = i, { range: l, direction: c, unitId: d, subUnitId: h, cellValue: g } = e, { startRow: m, endRow: f } = l;
4438
4443
  l.rangeType = H.ROW;
@@ -4448,7 +4453,7 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4448
4453
  }, S = Ls(
4449
4454
  n,
4450
4455
  I
4451
- ), w = [{ id: Ue.id, params: I }], y = [{ id: Te.id, params: S }];
4456
+ ), w = [{ id: Ue.id, params: I }], y = [{ id: Pe.id, params: S }];
4452
4457
  g && Object.keys(g).length > 0 && w.push({
4453
4458
  id: ee.id,
4454
4459
  params: {
@@ -4458,12 +4463,12 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4458
4463
  }
4459
4464
  });
4460
4465
  const b = r.onCommandExecute({
4461
- id: Xe.id,
4466
+ id: Ze.id,
4462
4467
  params: e
4463
4468
  });
4464
- if (w.unshift(...(T = b.preRedos) != null ? T : []), w.push(...(k = b.redos) != null ? k : []), w.push(ct(l, a, u)), y.unshift(...(E = b.preUndos) != null ? E : []), y.push(...(A = b.undos) != null ? A : []), L(w, t).result) {
4469
+ if (w.unshift(...(T = b.preRedos) != null ? T : []), w.push(...(U = b.redos) != null ? U : []), w.push(ct(l, a, u)), y.unshift(...(E = b.preUndos) != null ? E : []), y.push(...(A = b.undos) != null ? A : []), L(w, t).result) {
4465
4470
  const X = r.afterCommandExecute({
4466
- id: Xe.id,
4471
+ id: Ze.id,
4467
4472
  params: e
4468
4473
  });
4469
4474
  return L(X.redos, t), w.push(...X.redos), y.push(...X.undos), s.pushUndoRedo({
@@ -4500,7 +4505,7 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4500
4505
  // copy styles from the row above
4501
4506
  cellValue: It(a, d, h, g, m, !0, d - 1)
4502
4507
  };
4503
- return n.get(U).executeCommand(Xe.id, f);
4508
+ return n.get(k).executeCommand(Ze.id, f);
4504
4509
  }
4505
4510
  }, dl = {
4506
4511
  type: v.COMMAND,
@@ -4529,7 +4534,7 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4529
4534
  // copy styles from the row below
4530
4535
  cellValue: It(i, c, d, h, g, !0, s.endRow)
4531
4536
  };
4532
- return n.get(U).executeCommand(Xe.id, m);
4537
+ return n.get(k).executeCommand(Ze.id, m);
4533
4538
  }
4534
4539
  }, hl = {
4535
4540
  type: v.COMMAND,
@@ -4558,7 +4563,7 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4558
4563
  // copy styles from the row above
4559
4564
  cellValue: f
4560
4565
  };
4561
- return n.get(U).executeCommand(Xe.id, C);
4566
+ return n.get(k).executeCommand(Ze.id, C);
4562
4567
  }
4563
4568
  }, gl = {
4564
4569
  type: v.COMMAND,
@@ -4587,15 +4592,15 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4587
4592
  // copy styles from the row below
4588
4593
  cellValue: It(a, d, h, g, m, !0, o.endRow)
4589
4594
  };
4590
- return n.get(U).executeCommand(Xe.id, f);
4595
+ return n.get(k).executeCommand(Ze.id, f);
4591
4596
  }
4592
- }, Hr = "sheet.command.insert-col", Ze = {
4597
+ }, Hr = "sheet.command.insert-col", Qe = {
4593
4598
  type: v.COMMAND,
4594
4599
  id: Hr,
4595
4600
  handler: async (n, e) => {
4596
- const t = n.get(U), s = n.get(j), { range: o, direction: r, subUnitId: i, unitId: a, cellValue: u } = e;
4601
+ const t = n.get(k), s = n.get(j), { range: o, direction: r, subUnitId: i, unitId: a, cellValue: u } = e;
4597
4602
  return await s.beforeCommandExecute({
4598
- id: Ze.id,
4603
+ id: Qe.id,
4599
4604
  params: e
4600
4605
  }) ? t.syncExecuteCommand(Fr.id, {
4601
4606
  range: o,
@@ -4609,8 +4614,8 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4609
4614
  type: v.COMMAND,
4610
4615
  id: "sheet.command.insert-col-by-range",
4611
4616
  handler: (n, e) => {
4612
- var N, T, k, E;
4613
- const t = n.get(U), s = n.get(V), o = n.get(M), r = n.get(j), { range: i, direction: a, subUnitId: u, unitId: l, cellValue: c } = e, { startColumn: d, endColumn: h } = e.range;
4617
+ var N, T, U, E;
4618
+ const t = n.get(k), s = n.get(V), o = n.get(M), r = n.get(j), { range: i, direction: a, subUnitId: u, unitId: l, cellValue: c } = e, { startColumn: d, endColumn: h } = e.range;
4614
4619
  i.rangeType = H.COLUMN;
4615
4620
  const g = o.getUniverSheetInstance(e.unitId), m = g.getSheetBySheetId(e.subUnitId), f = a === me.LEFT ? d : d - 1, C = m.getColumnWidth(f), p = {
4616
4621
  unitId: l,
@@ -4623,7 +4628,7 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4623
4628
  }, I = ds(
4624
4629
  n,
4625
4630
  p
4626
- ), S = [{ id: ke.id, params: p }], w = [{ id: Me.id, params: I }];
4631
+ ), S = [{ id: Te.id, params: p }], w = [{ id: Me.id, params: I }];
4627
4632
  c && S.push({
4628
4633
  id: ee.id,
4629
4634
  params: {
@@ -4633,12 +4638,12 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4633
4638
  }
4634
4639
  });
4635
4640
  const y = r.onCommandExecute({
4636
- id: Ze.id,
4641
+ id: Qe.id,
4637
4642
  params: e
4638
4643
  });
4639
- if (S.unshift(...(N = y.preRedos) != null ? N : []), S.push(...(T = y.redos) != null ? T : []), S.push(ct(i, g, m)), w.unshift(...(k = y.preUndos) != null ? k : []), w.push(...(E = y.undos) != null ? E : []), L(S, t).result) {
4644
+ if (S.unshift(...(N = y.preRedos) != null ? N : []), S.push(...(T = y.redos) != null ? T : []), S.push(ct(i, g, m)), w.unshift(...(U = y.preUndos) != null ? U : []), w.push(...(E = y.undos) != null ? E : []), L(S, t).result) {
4640
4645
  const A = r.afterCommandExecute({
4641
- id: Ze.id,
4646
+ id: Qe.id,
4642
4647
  params: e
4643
4648
  });
4644
4649
  return L(A.redos, t), S.push(...A.redos), w.push(...A.undos), s.pushUndoRedo({
@@ -4675,7 +4680,7 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4675
4680
  // copy styles from the column before
4676
4681
  cellValue: It(a, g, m, d, h, !1, d - 1)
4677
4682
  };
4678
- return n.get(U).executeCommand(Ze.id, f);
4683
+ return n.get(k).executeCommand(Qe.id, f);
4679
4684
  }
4680
4685
  }, fl = {
4681
4686
  type: v.COMMAND,
@@ -4702,7 +4707,7 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4702
4707
  // copy styles from the column after
4703
4708
  cellValue: It(i, h, g, c, d, !1, s.endColumn)
4704
4709
  };
4705
- return n.get(U).executeCommand(Ze.id, m);
4710
+ return n.get(k).executeCommand(Qe.id, m);
4706
4711
  }
4707
4712
  }, Rl = {
4708
4713
  type: v.COMMAND,
@@ -4730,7 +4735,7 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4730
4735
  // copy styles from the column before
4731
4736
  cellValue: It(a, g, m, d, h, !1, d - 1)
4732
4737
  };
4733
- return n.get(U).executeCommand(Ze.id, f);
4738
+ return n.get(k).executeCommand(Qe.id, f);
4734
4739
  }
4735
4740
  }, Cl = {
4736
4741
  type: v.COMMAND,
@@ -4757,7 +4762,7 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4757
4762
  // copy styles from the column after
4758
4763
  cellValue: It(a, g, m, d, h, !1, o.endColumn)
4759
4764
  };
4760
- return n.get(U).executeCommand(Ze.id, f);
4765
+ return n.get(k).executeCommand(Qe.id, f);
4761
4766
  }
4762
4767
  }, Vn = "sheet.command.remove-row", Br = {
4763
4768
  type: v.COMMAND,
@@ -4777,17 +4782,17 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4777
4782
  }, N = Ka(
4778
4783
  b,
4779
4784
  r
4780
- ), T = r.getCellMatrix().getSlice(S.startRow, S.endRow, 0, r.getColumnCount() - 1), k = {
4785
+ ), T = r.getCellMatrix().getSlice(S.startRow, S.endRow, 0, r.getColumnCount() - 1), U = {
4781
4786
  unitId: u,
4782
4787
  subUnitId: l,
4783
4788
  cellValue: T.getMatrix()
4784
4789
  };
4785
- y.push({ id: Te.id, params: b }), w.push({ id: Ue.id, params: N }), w.push({ id: ee.id, params: k }), h.push(...y), d.unshift(...w);
4790
+ y.push({ id: Pe.id, params: b }), w.push({ id: Ue.id, params: N }), w.push({ id: ee.id, params: U }), h.push(...y), d.unshift(...w);
4786
4791
  });
4787
4792
  const g = i.onCommandExecute({
4788
4793
  id: Vn,
4789
4794
  params: { range: a }
4790
- }), m = n.get(U);
4795
+ }), m = n.get(k);
4791
4796
  if (L(
4792
4797
  [
4793
4798
  ...(C = g.preRedos) != null ? C : [],
@@ -4824,7 +4829,7 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4824
4829
  id: Vn,
4825
4830
  handler: async (n, e) => {
4826
4831
  var h;
4827
- const t = n.get(F), s = n.get(j), o = n.get(U);
4832
+ const t = n.get(F), s = n.get(j), o = n.get(k);
4828
4833
  let r = e == null ? void 0 : e.range;
4829
4834
  if (r || (r = (h = t.getCurrentLastSelection()) == null ? void 0 : h.range), !r) return !1;
4830
4835
  const i = n.get(M), a = P(i);
@@ -4863,7 +4868,7 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4863
4868
  }, m = i.onCommandExecute({
4864
4869
  id: Ln,
4865
4870
  params: { range: a }
4866
- }), f = n.get(U);
4871
+ }), f = n.get(k);
4867
4872
  if (L(
4868
4873
  [
4869
4874
  ...(p = m.preRedos) != null ? p : [],
@@ -4881,7 +4886,7 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4881
4886
  unitID: u,
4882
4887
  undoMutations: [
4883
4888
  ...(I = m.preUndos) != null ? I : [],
4884
- { id: ke.id, params: d },
4889
+ { id: Te.id, params: d },
4885
4890
  { id: ee.id, params: g },
4886
4891
  ...m.undos,
4887
4892
  ...w.undos
@@ -4901,7 +4906,7 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4901
4906
  id: Ln,
4902
4907
  handler: async (n, e) => {
4903
4908
  var h;
4904
- const t = n.get(F), s = n.get(j), o = n.get(U);
4909
+ const t = n.get(F), s = n.get(j), o = n.get(k);
4905
4910
  let r = e == null ? void 0 : e.range;
4906
4911
  if (r || (r = (h = t.getCurrentLastSelection()) == null ? void 0 : h.range), !r) return !1;
4907
4912
  const i = n.get(M), a = P(i);
@@ -4921,7 +4926,7 @@ const $r = "sheet.command.delete-range-move-left", _t = {
4921
4926
  }) : !1;
4922
4927
  }
4923
4928
  }, pl = (n, e) => {
4924
- const t = n.get(M), { subUnitId: s, unitId: o } = e, r = tt(t, e);
4929
+ const t = n.get(M), { subUnitId: s, unitId: o } = e, r = ye(t, e);
4925
4930
  if (!r)
4926
4931
  throw new Error("[RemoveSheetUndoMutationFactory]: Worksheet is null error!");
4927
4932
  const { workbook: i, worksheet: a } = r, u = a.getConfig();
@@ -4961,7 +4966,7 @@ const zr = "sheet.command.move-rows", hn = {
4961
4966
  return !1;
4962
4967
  const u = n.get(j), l = n.get(M), c = P(l, e);
4963
4968
  if (!c) return !1;
4964
- const { workbook: d, worksheet: h } = c, g = d.getUnitId(), m = h.getSheetId(), f = n.get(Bt), C = n.get(Qe), p = a[0].range, I = a[0].primary, S = gs(p, h, !1);
4969
+ const { workbook: d, worksheet: h } = c, g = d.getUnitId(), m = h.getSheetId(), f = n.get(Bt), C = n.get(et), p = a[0].range, I = a[0].primary, S = gs(p, h, !1);
4965
4970
  if (!O.equals(p, S))
4966
4971
  return f.emit(C.t("sheets.info.partOfCell")), !1;
4967
4972
  if (Sl(o, h))
@@ -4975,12 +4980,12 @@ const zr = "sheet.command.move-rows", hn = {
4975
4980
  subUnitId: m,
4976
4981
  sourceRange: p,
4977
4982
  targetRange: w
4978
- }, b = za(n, y), N = n.get(U), T = u.onCommandExecute({ id: hn.id, params: e }), k = [
4983
+ }, b = za(n, y), N = n.get(k), T = u.onCommandExecute({ id: hn.id, params: e }), U = [
4979
4984
  ...(X = T.preRedos) != null ? X : [],
4980
- { id: qe.id, params: y }
4985
+ { id: Ye.id, params: y }
4981
4986
  ], E = [
4982
4987
  ...(z = T.preUndos) != null ? z : [],
4983
- { id: qe.id, params: b }
4988
+ { id: Ye.id, params: b }
4984
4989
  ];
4985
4990
  if (I) {
4986
4991
  const K = o - s < 0, ue = p.endRow - p.startRow + 1, oe = K ? w : {
@@ -5002,17 +5007,17 @@ const zr = "sheet.command.move-rows", hn = {
5002
5007
  type: Ce.MOVE_END,
5003
5008
  selections: [{ range: p, primary: I, style: null }]
5004
5009
  };
5005
- k.push({ id: ie.id, params: le }), E.push({ id: ie.id, params: we });
5010
+ U.push({ id: ie.id, params: le }), E.push({ id: ie.id, params: we });
5006
5011
  }
5007
- if (k.push(...T.redos), E.push(...T.undos), L(k, N).result) {
5012
+ if (U.push(...T.redos), E.push(...T.undos), L(U, N).result) {
5008
5013
  const G = u.afterCommandExecute({
5009
5014
  id: hn.id,
5010
5015
  params: e
5011
5016
  });
5012
- return L(G.redos, N), k.push(...G.redos), E.push(...G.undos), n.get(V).pushUndoRedo({
5017
+ return L(G.redos, N), U.push(...G.redos), E.push(...G.undos), n.get(V).pushUndoRedo({
5013
5018
  unitID: g,
5014
5019
  undoMutations: E,
5015
- redoMutations: k
5020
+ redoMutations: U
5016
5021
  }), !0;
5017
5022
  }
5018
5023
  return !1;
@@ -5034,7 +5039,7 @@ const zr = "sheet.command.move-rows", hn = {
5034
5039
  return !1;
5035
5040
  const u = n.get(j), l = n.get(M), c = P(l, e);
5036
5041
  if (!c) return !1;
5037
- const { workbook: d, worksheet: h } = c, g = d.getUnitId(), m = h.getSheetId(), f = n.get(Bt), C = n.get(Qe), p = a[0].range, I = a[0].primary, S = gs(p, h, !1);
5042
+ const { workbook: d, worksheet: h } = c, g = d.getUnitId(), m = h.getSheetId(), f = n.get(Bt), C = n.get(et), p = a[0].range, I = a[0].primary, S = gs(p, h, !1);
5038
5043
  if (!O.equals(p, S))
5039
5044
  return f.emit(C.t("sheets.info.partOfCell")), !1;
5040
5045
  if (wl(o, h))
@@ -5048,12 +5053,12 @@ const zr = "sheet.command.move-rows", hn = {
5048
5053
  subUnitId: m,
5049
5054
  sourceRange: p,
5050
5055
  targetRange: w
5051
- }, b = Ga(n, y), N = n.get(U), T = u.onCommandExecute({ id: gn.id, params: e }), k = [
5056
+ }, b = Ga(n, y), N = n.get(k), T = u.onCommandExecute({ id: gn.id, params: e }), U = [
5052
5057
  ...(X = T.preRedos) != null ? X : [],
5053
- { id: Ye.id, params: y }
5058
+ { id: Xe.id, params: y }
5054
5059
  ], E = [
5055
5060
  ...(z = T.preUndos) != null ? z : [],
5056
- { id: Ye.id, params: b }
5061
+ { id: Xe.id, params: b }
5057
5062
  ];
5058
5063
  if (I) {
5059
5064
  const G = p.endColumn - p.startColumn + 1, oe = o - s < 0 ? w : {
@@ -5071,17 +5076,17 @@ const zr = "sheet.command.move-rows", hn = {
5071
5076
  type: Ce.MOVE_END,
5072
5077
  selections: [{ range: p, primary: I, style: null }]
5073
5078
  };
5074
- k.push({ id: ie.id, params: le }), E.push({ id: ie.id, params: we });
5079
+ U.push({ id: ie.id, params: le }), E.push({ id: ie.id, params: we });
5075
5080
  }
5076
- if (k.push(...T.redos), E.push(...T.undos), L(k, N).result) {
5081
+ if (U.push(...T.redos), E.push(...T.undos), L(U, N).result) {
5077
5082
  const G = u.afterCommandExecute({
5078
5083
  id: gn.id,
5079
5084
  params: e
5080
5085
  });
5081
- return L(G.redos, N), k.push(...G.redos), E.push(...G.undos), n.get(V).pushUndoRedo({
5086
+ return L(G.redos, N), U.push(...G.redos), E.push(...G.undos), n.get(V).pushUndoRedo({
5082
5087
  unitID: g,
5083
5088
  undoMutations: E,
5084
- redoMutations: k
5089
+ redoMutations: U
5085
5090
  }), !0;
5086
5091
  }
5087
5092
  return !1;
@@ -5175,7 +5180,7 @@ const Jr = "sheet.command.reorder-range", Ts = {
5175
5180
  type: v.COMMAND,
5176
5181
  handler: (n, e) => {
5177
5182
  var S, w;
5178
- const { subUnitId: t, unitId: s, range: o, order: r } = e, i = n.get(U), a = {
5183
+ const { subUnitId: t, unitId: s, range: o, order: r } = e, i = n.get(k), a = {
5179
5184
  id: xn.id,
5180
5185
  params: {
5181
5186
  unitId: s,
@@ -5222,10 +5227,10 @@ const Jr = "sheet.command.reorder-range", Ts = {
5222
5227
  ReorderRangeCommandId: Jr
5223
5228
  };
5224
5229
  var Q = /* @__PURE__ */ ((n) => (n[n.Set = 0] = "Set", n[n.Delete = 1] = "Delete", n[n.HorizontalMove = 2] = "HorizontalMove", n[n.VerticalMove = 3] = "VerticalMove", n[n.Unknown = 4] = "Unknown", n))(Q || {});
5225
- const En = Number.MAX_SAFE_INTEGER, Je = (n) => {
5230
+ const En = Number.MAX_SAFE_INTEGER, qe = (n) => {
5226
5231
  const e = { ...n }, t = Number.isNaN(e.startRow) && Number.isNaN(e.endRow) && !Number.isNaN(e.startColumn) && !Number.isNaN(e.endColumn), s = Number.isNaN(e.startColumn) && Number.isNaN(e.endColumn) && !Number.isNaN(e.startRow) && !Number.isNaN(e.endRow);
5227
5232
  return (e.rangeType === H.COLUMN || t) && (e.startRow = 0, e.endRow = En), (e.rangeType === H.ROW || s) && (e.startColumn = 0, e.endColumn = En), e.rangeType === H.ALL && (e.startColumn = 0, e.endColumn = En, e.startRow = 0, e.endRow = En), e;
5228
- }, De = (n) => {
5233
+ }, Ae = (n) => {
5229
5234
  let e = n.rangeType;
5230
5235
  return n.rangeType === H.COLUMN ? e = H.ROW : n.rangeType === H.ROW && (e = H.COLUMN), {
5231
5236
  startRow: n.startColumn,
@@ -5268,7 +5273,7 @@ const En = Number.MAX_SAFE_INTEGER, Je = (n) => {
5268
5273
  const { fromRange: t, toRange: s } = n.params || {};
5269
5274
  if (!s || !t)
5270
5275
  return [];
5271
- const o = Je(t), r = Je(s), i = Je(e), a = Hn(
5276
+ const o = qe(t), r = qe(s), i = qe(e), a = Hn(
5272
5277
  { start: o.startRow, end: o.endRow },
5273
5278
  { start: r.startRow, end: r.endRow },
5274
5279
  { start: i.startRow, end: i.endRow }
@@ -5314,7 +5319,7 @@ const En = Number.MAX_SAFE_INTEGER, Je = (n) => {
5314
5319
  const { fromRange: t, toRange: s } = n.params || {};
5315
5320
  if (!s || !t)
5316
5321
  return [];
5317
- const o = Je(t), r = Je(s), i = Je(e), a = Hn(
5322
+ const o = qe(t), r = qe(s), i = qe(e), a = Hn(
5318
5323
  { start: o.startColumn, end: o.endColumn },
5319
5324
  { start: r.startColumn, end: r.endColumn },
5320
5325
  { start: i.startColumn, end: i.endColumn }
@@ -5330,7 +5335,7 @@ const En = Number.MAX_SAFE_INTEGER, Je = (n) => {
5330
5335
  length: a.length || 0
5331
5336
  }
5332
5337
  ];
5333
- }, Ul = (n, e) => {
5338
+ }, kl = (n, e) => {
5334
5339
  const { fromRange: t, toRange: s } = n.params || {};
5335
5340
  if (!t || !s)
5336
5341
  return [e];
@@ -5338,7 +5343,7 @@ const En = Number.MAX_SAFE_INTEGER, Je = (n) => {
5338
5343
  return Y.foreach(e, (u, l) => {
5339
5344
  a.setValue(u, l, 1);
5340
5345
  }), a.moveColumns(o, r, i), lt(a, (u) => u === 1);
5341
- }, kl = (n, e) => {
5346
+ }, Ul = (n, e) => {
5342
5347
  var r, i;
5343
5348
  const t = (r = n.params) == null ? void 0 : r.toRange, s = (i = n.params) == null ? void 0 : i.fromRange;
5344
5349
  if (!t || !s)
@@ -5390,7 +5395,7 @@ const En = Number.MAX_SAFE_INTEGER, Je = (n) => {
5390
5395
  o.setValue(f, C, (p = r.getValue(g, m)) != null ? p : 0);
5391
5396
  }), lt(o, (g) => g === 1);
5392
5397
  }, At = (n, e) => {
5393
- const t = Je(n), s = Je(e), o = (i) => i.endColumn - i.startColumn + 1, r = (i) => i.endRow - i.startRow + 1;
5398
+ const t = qe(n), s = qe(e), o = (i) => i.endColumn - i.startColumn + 1, r = (i) => i.endRow - i.startRow + 1;
5394
5399
  if (t.startRow <= s.startRow && t.endRow >= s.endRow) {
5395
5400
  if (
5396
5401
  // 2
@@ -5461,7 +5466,7 @@ const En = Number.MAX_SAFE_INTEGER, Je = (n) => {
5461
5466
  } else
5462
5467
  r(s);
5463
5468
  function r(a) {
5464
- const u = At(De(a), De(e));
5469
+ const u = At(Ae(a), Ae(e));
5465
5470
  if (!u)
5466
5471
  o.push({ type: Q.Delete });
5467
5472
  else {
@@ -5493,7 +5498,7 @@ const En = Number.MAX_SAFE_INTEGER, Je = (n) => {
5493
5498
  }
5494
5499
  return [];
5495
5500
  }, xt = (n, e) => {
5496
- const t = Je(n), s = Je(e), o = (r) => r.endColumn - r.startColumn + 1;
5501
+ const t = qe(n), s = qe(e), o = (r) => r.endColumn - r.startColumn + 1;
5497
5502
  return t.startRow <= s.startRow && t.endRow >= s.endRow ? (
5498
5503
  // 2
5499
5504
  // Case 2: Overlap on the left side
@@ -5548,7 +5553,7 @@ const Dl = (n, e) => {
5548
5553
  const t = (a = n.params) == null ? void 0 : a.range;
5549
5554
  if (!t)
5550
5555
  return [];
5551
- const s = [], o = xt(De(t), De(e)), { step: r, length: i } = o;
5556
+ const s = [], o = xt(Ae(t), Ae(e)), { step: r, length: i } = o;
5552
5557
  return s.push({
5553
5558
  type: Q.VerticalMove,
5554
5559
  step: r,
@@ -5570,7 +5575,7 @@ const Dl = (n, e) => {
5570
5575
  const t = (a = n.params) == null ? void 0 : a.range;
5571
5576
  if (!t)
5572
5577
  return [];
5573
- const s = [], o = xt(De(t), De(e)), { step: r, length: i } = o;
5578
+ const s = [], o = xt(Ae(t), Ae(e)), { step: r, length: i } = o;
5574
5579
  return s.push({
5575
5580
  type: Q.VerticalMove,
5576
5581
  step: r,
@@ -5672,7 +5677,7 @@ const Dl = (n, e) => {
5672
5677
  const t = (r = n.params) == null ? void 0 : r.range;
5673
5678
  if (!t)
5674
5679
  return [];
5675
- const s = [], o = At(De(t), De(e));
5680
+ const s = [], o = At(Ae(t), Ae(e));
5676
5681
  if (!o)
5677
5682
  s.push({ type: Q.Delete });
5678
5683
  else {
@@ -5829,7 +5834,7 @@ const Dl = (n, e) => {
5829
5834
  break;
5830
5835
  }
5831
5836
  case W.MoveRangeCommandId: {
5832
- t = kl(e, n);
5837
+ t = Ul(e, n);
5833
5838
  break;
5834
5839
  }
5835
5840
  case W.MoveRowsCommandId: {
@@ -5866,7 +5871,7 @@ const Dl = (n, e) => {
5866
5871
  case W.InsertRowCommandId:
5867
5872
  return zl(e, n);
5868
5873
  case W.MoveColsCommandId:
5869
- return Ul(e, n);
5874
+ return kl(e, n);
5870
5875
  case W.MoveRangeCommandId:
5871
5876
  return Tl(e, n);
5872
5877
  case W.MoveRowsCommandId:
@@ -5894,14 +5899,14 @@ function Kl(n, e) {
5894
5899
  case pt.id:
5895
5900
  o.type = Q.Delete;
5896
5901
  break;
5897
- case qe.id:
5902
+ case Ye.id:
5898
5903
  o = Hn(
5899
5904
  { start: s.sourceRange.startRow, end: s.sourceRange.endRow },
5900
5905
  { start: s.targetRange.startRow, end: s.targetRange.endRow },
5901
5906
  { start: n.startRow, end: n.endRow }
5902
5907
  ), o.type = Q.VerticalMove;
5903
5908
  break;
5904
- case Ye.id:
5909
+ case Xe.id:
5905
5910
  o = Hn(
5906
5911
  { start: s.sourceRange.startColumn, end: s.sourceRange.endColumn },
5907
5912
  { start: s.targetRange.startColumn, end: s.targetRange.endColumn },
@@ -5911,13 +5916,13 @@ function Kl(n, e) {
5911
5916
  case Me.id:
5912
5917
  o = At(s.range, n), o ? o.type = Q.HorizontalMove : o = { step: 0, length: 0, type: Q.Delete };
5913
5918
  break;
5914
- case Te.id:
5915
- o = At(De(s.range), De(n)), o ? o.type = Q.VerticalMove : o = { step: 0, length: 0, type: Q.Delete };
5919
+ case Pe.id:
5920
+ o = At(Ae(s.range), Ae(n)), o ? o.type = Q.VerticalMove : o = { step: 0, length: 0, type: Q.Delete };
5916
5921
  break;
5917
5922
  case Ue.id:
5918
- o = xt(De(s.range), De(n)), o.type = Q.VerticalMove;
5923
+ o = xt(Ae(s.range), Ae(n)), o.type = Q.VerticalMove;
5919
5924
  break;
5920
- case ke.id:
5925
+ case Te.id:
5921
5926
  o = xt(s.range, n), o.type = Q.HorizontalMove;
5922
5927
  break;
5923
5928
  case Mt.id:
@@ -6012,7 +6017,7 @@ function Zr(n, e) {
6012
6017
  }
6013
6018
  function Jl(n) {
6014
6019
  switch (n.id) {
6015
- case Ye.id: {
6020
+ case Xe.id: {
6016
6021
  const e = n.params;
6017
6022
  return [
6018
6023
  e.sourceRange,
@@ -6023,7 +6028,7 @@ function Jl(n) {
6023
6028
  }
6024
6029
  ];
6025
6030
  }
6026
- case qe.id: {
6031
+ case Ye.id: {
6027
6032
  const e = n.params;
6028
6033
  return [
6029
6034
  e.sourceRange,
@@ -6038,7 +6043,7 @@ function Jl(n) {
6038
6043
  const e = n.params;
6039
6044
  return [new q(e.from.value).getRange(), new q(e.to.value).getRange()];
6040
6045
  }
6041
- case ke.id: {
6046
+ case Te.id: {
6042
6047
  const t = n.params.range;
6043
6048
  return [
6044
6049
  {
@@ -6060,7 +6065,7 @@ function Jl(n) {
6060
6065
  }
6061
6066
  case Me.id:
6062
6067
  return [n.params.range];
6063
- case Te.id:
6068
+ case Pe.id:
6064
6069
  return [n.params.range];
6065
6070
  }
6066
6071
  }
@@ -6242,8 +6247,8 @@ var ql = Object.getOwnPropertyDescriptor, Yl = (n, e, t, s) => {
6242
6247
  for (var o = s > 1 ? void 0 : s ? ql(e, t) : e, r = n.length - 1, i; r >= 0; r--)
6243
6248
  (i = n[r]) && (o = i(o) || o);
6244
6249
  return o;
6245
- }, Un = (n, e) => (t, s) => e(t, s, n);
6246
- const Xl = St("MERGE_REDO"), Zl = St("MERGE_UNDO"), Pe = Math.floor(Number.MAX_SAFE_INTEGER / 10);
6250
+ }, kn = (n, e) => (t, s) => e(t, s, n);
6251
+ const Xl = St("MERGE_REDO"), Zl = St("MERGE_UNDO"), Ne = Math.floor(Number.MAX_SAFE_INTEGER / 10);
6247
6252
  class Ql extends ae {
6248
6253
  constructor(e, t, s, o, r = !1) {
6249
6254
  super(), this._unitId = e, this._subUnitId = t, this._range = s, this._callback = o, this._skipIntersects = r;
@@ -6294,7 +6299,7 @@ let Wt = class extends ae {
6294
6299
  case W.MoveColsCommandId: {
6295
6300
  const h = e.params, g = Math.min(h.fromRange.startColumn, h.toRange.startColumn);
6296
6301
  return this._checkRange(
6297
- [{ ...h.fromRange, startColumn: g, endColumn: Pe }],
6302
+ [{ ...h.fromRange, startColumn: g, endColumn: Ne }],
6298
6303
  s,
6299
6304
  o
6300
6305
  );
@@ -6302,7 +6307,7 @@ let Wt = class extends ae {
6302
6307
  case W.MoveRowsCommandId: {
6303
6308
  const h = e.params, g = Math.min(h.fromRange.startRow, h.toRange.startRow);
6304
6309
  return this._checkRange(
6305
- [{ ...h.fromRange, startRow: g, endRow: Pe }],
6310
+ [{ ...h.fromRange, startRow: g, endRow: Ne }],
6306
6311
  s,
6307
6312
  o
6308
6313
  );
@@ -6318,9 +6323,9 @@ let Wt = class extends ae {
6318
6323
  case W.InsertRowCommandId: {
6319
6324
  const g = e.params.range.startRow, m = {
6320
6325
  startRow: Math.max(0, g - 1),
6321
- endRow: Pe,
6326
+ endRow: Ne,
6322
6327
  startColumn: 0,
6323
- endColumn: Pe,
6328
+ endColumn: Ne,
6324
6329
  rangeType: H.ROW
6325
6330
  };
6326
6331
  return this._checkRange([m], s, o);
@@ -6328,9 +6333,9 @@ let Wt = class extends ae {
6328
6333
  case W.InsertColCommandId: {
6329
6334
  const g = e.params.range.startColumn, m = {
6330
6335
  startRow: 0,
6331
- endRow: Pe,
6336
+ endRow: Ne,
6332
6337
  startColumn: Math.max(0, g - 1),
6333
- endColumn: Pe,
6338
+ endColumn: Ne,
6334
6339
  rangeType: H.COLUMN
6335
6340
  };
6336
6341
  return this._checkRange([m], s, o);
@@ -6338,9 +6343,9 @@ let Wt = class extends ae {
6338
6343
  case W.RemoveRowCommandId: {
6339
6344
  const m = {
6340
6345
  startRow: e.params.range.startRow,
6341
- endRow: Pe,
6346
+ endRow: Ne,
6342
6347
  startColumn: 0,
6343
- endColumn: Pe,
6348
+ endColumn: Ne,
6344
6349
  rangeType: H.ROW
6345
6350
  };
6346
6351
  return this._checkRange([m], s, o);
@@ -6348,9 +6353,9 @@ let Wt = class extends ae {
6348
6353
  case W.RemoveColCommandId: {
6349
6354
  const g = e.params.range.startColumn, m = {
6350
6355
  startRow: 0,
6351
- endRow: Pe,
6356
+ endRow: Ne,
6352
6357
  startColumn: g,
6353
- endColumn: Pe,
6358
+ endColumn: Ne,
6354
6359
  rangeType: H.COLUMN
6355
6360
  };
6356
6361
  return this._checkRange([m], s, o);
@@ -6361,7 +6366,7 @@ let Wt = class extends ae {
6361
6366
  startRow: g.startRow,
6362
6367
  startColumn: g.startColumn,
6363
6368
  endColumn: g.endColumn,
6364
- endRow: Pe
6369
+ endRow: Ne
6365
6370
  };
6366
6371
  return this._checkRange([m], s, o);
6367
6372
  }
@@ -6370,7 +6375,7 @@ let Wt = class extends ae {
6370
6375
  const g = e.params.range || yo(this._selectionManagerService)[0], m = {
6371
6376
  startRow: g.startRow,
6372
6377
  startColumn: g.startColumn,
6373
- endColumn: Pe,
6378
+ endColumn: Ne,
6374
6379
  endRow: g.endRow
6375
6380
  };
6376
6381
  return this._checkRange([m], s, o);
@@ -6447,13 +6452,13 @@ let Wt = class extends ae {
6447
6452
  R(this, "registerRefRange", (e, t, s, o) => {
6448
6453
  const r = s || Mo(this._univerInstanceService), i = o || _o(this._univerInstanceService);
6449
6454
  if (!r || !i)
6450
- return Oe(() => {
6455
+ return De(() => {
6451
6456
  });
6452
6457
  const a = bo(r, i), u = this._serializer.serialize(e);
6453
6458
  let l = this._refRangeManagerMap.get(a);
6454
6459
  l || (l = /* @__PURE__ */ new Map(), this._refRangeManagerMap.set(a, l));
6455
6460
  const c = l.get(u);
6456
- return c ? c.add(t) : l.set(u, /* @__PURE__ */ new Set([t])), Oe(() => {
6461
+ return c ? c.add(t) : l.set(u, /* @__PURE__ */ new Set([t])), De(() => {
6457
6462
  const d = l.get(u);
6458
6463
  d && (d.delete(t), d.size || (l.delete(u), l.size || this._refRangeManagerMap.delete(a)));
6459
6464
  });
@@ -6475,19 +6480,19 @@ let Wt = class extends ae {
6475
6480
  }));
6476
6481
  const a = new Ql(e, t, s, o, r);
6477
6482
  this._watchRanges.add(a);
6478
- const u = Oe(() => {
6483
+ const u = De(() => {
6479
6484
  this._watchRanges.delete(a), this._watchRanges.size === 0 && (i == null || i.dispose(), i = null);
6480
6485
  }), l = this.disposeWithMe(u);
6481
- return Oe(() => {
6486
+ return De(() => {
6482
6487
  l.dispose(), u.dispose();
6483
6488
  });
6484
6489
  }
6485
6490
  };
6486
6491
  Wt = Yl([
6487
- Un(0, U),
6488
- Un(1, $(j)),
6489
- Un(2, $(M)),
6490
- Un(3, $(F))
6492
+ kn(0, k),
6493
+ kn(1, $(j)),
6494
+ kn(2, $(M)),
6495
+ kn(3, $(F))
6491
6496
  ], Wt);
6492
6497
  function Mo(n) {
6493
6498
  return n.getCurrentUnitForType(B.UNIVER_SHEET).getUnitId();
@@ -6530,7 +6535,7 @@ var tc = Object.getOwnPropertyDescriptor, nc = (n, e, t, s) => {
6530
6535
  (i = n[r]) && (o = i(o) || o);
6531
6536
  return o;
6532
6537
  }, Et = (n, e) => (t, s) => e(t, s, n);
6533
- const sc = [ke.id, Ue.id, Me.id, Te.id], oc = [qe.id, Ye.id];
6538
+ const sc = [Te.id, Ue.id, Me.id, Pe.id], oc = [Ye.id, Xe.id];
6534
6539
  function Qr(n, e) {
6535
6540
  let t = n;
6536
6541
  if (e !== void 0) {
@@ -6589,7 +6594,7 @@ let Fn = class extends ae {
6589
6594
  unitId: r,
6590
6595
  subUnitId: a,
6591
6596
  ranges: l
6592
- }, h = ye(e._injector, d), g = [
6597
+ }, h = be(e._injector, d), g = [
6593
6598
  { id: se.id, params: d }
6594
6599
  ], m = [
6595
6600
  { id: ne.id, params: h }
@@ -6637,11 +6642,11 @@ let Fn = class extends ae {
6637
6642
  const o = e.params;
6638
6643
  return this._handleMoveRowsCommand(o, t, s);
6639
6644
  }
6640
- case Xe.id: {
6645
+ case Ze.id: {
6641
6646
  const o = e.params, r = o.unitId || t, i = o.subUnitId || s;
6642
6647
  return this._handleInsertRowCommand(o, r, i);
6643
6648
  }
6644
- case Ze.id: {
6649
+ case Qe.id: {
6645
6650
  const o = e.params, r = o.unitId || t, i = o.subUnitId || s;
6646
6651
  return this._handleInsertColCommand(o, r, i);
6647
6652
  }
@@ -6653,7 +6658,7 @@ let Fn = class extends ae {
6653
6658
  const o = e.params;
6654
6659
  return this._handleRemoveRowCommand(o, t, s);
6655
6660
  }
6656
- case Ut.id: {
6661
+ case kt.id: {
6657
6662
  const o = e.params;
6658
6663
  return this._handleMoveRangeCommand(o, t, s);
6659
6664
  }
@@ -6711,10 +6716,10 @@ let Fn = class extends ae {
6711
6716
  });
6712
6717
  }
6713
6718
  _handleMoveRowsCommand(e, t, s) {
6714
- const o = $e(this._univerInstanceService, t);
6719
+ const o = We(this._univerInstanceService, t);
6715
6720
  if (!o)
6716
6721
  return this._handleNull();
6717
- const r = We(o, s);
6722
+ const r = Ve(o, s);
6718
6723
  if (!r)
6719
6724
  return this._handleNull();
6720
6725
  const i = [...r.getMergeData()], a = { unitId: t, subUnitId: s, ranges: [] }, u = { unitId: t, subUnitId: s, ranges: [] }, { fromRange: l } = e, { startRow: c, endRow: d } = l;
@@ -6726,7 +6731,7 @@ let Fn = class extends ae {
6726
6731
  }
6727
6732
  }), a.ranges.length === 0)
6728
6733
  return this._handleNull();
6729
- const h = ye(this._injector, a), g = Ve(this._injector, u);
6734
+ const h = be(this._injector, a), g = Le(this._injector, u);
6730
6735
  return {
6731
6736
  preRedos: [{ id: se.id, params: a }],
6732
6737
  redos: [{ id: ne.id, params: u }],
@@ -6735,10 +6740,10 @@ let Fn = class extends ae {
6735
6740
  };
6736
6741
  }
6737
6742
  _handleMoveColsCommand(e, t, s) {
6738
- const o = $e(this._univerInstanceService, t);
6743
+ const o = We(this._univerInstanceService, t);
6739
6744
  if (!o)
6740
6745
  return this._handleNull();
6741
- const r = We(o, s);
6746
+ const r = Ve(o, s);
6742
6747
  if (!r)
6743
6748
  return this._handleNull();
6744
6749
  const i = [...r.getMergeData()], a = { unitId: t, subUnitId: s, ranges: [] }, u = { unitId: t, subUnitId: s, ranges: [] }, { fromRange: l } = e, { startColumn: c, endColumn: d } = l;
@@ -6750,7 +6755,7 @@ let Fn = class extends ae {
6750
6755
  }
6751
6756
  }), a.ranges.length === 0)
6752
6757
  return this._handleNull();
6753
- const h = ye(this._injector, a), g = Ve(this._injector, u);
6758
+ const h = be(this._injector, a), g = Le(this._injector, u);
6754
6759
  return {
6755
6760
  preRedos: [{ id: se.id, params: a }],
6756
6761
  redos: [{ id: ne.id, params: u }],
@@ -6759,10 +6764,10 @@ let Fn = class extends ae {
6759
6764
  };
6760
6765
  }
6761
6766
  _handleMoveRangeCommand(e, t, s) {
6762
- const o = $e(this._univerInstanceService, t);
6767
+ const o = We(this._univerInstanceService, t);
6763
6768
  if (!o)
6764
6769
  return this._handleNull();
6765
- const r = We(o, s);
6770
+ const r = Ve(o, s);
6766
6771
  if (!r)
6767
6772
  return this._handleNull();
6768
6773
  const i = r.getMergeData(), a = i.filter((g) => O.intersects(g, e.fromRange)), u = i.filter((g) => O.intersects(g, e.toRange)), l = a.map((g) => O.getRelativeRange(g, e.fromRange)).map((g) => O.getPositionRange(g, e.toRange)), c = Qr(l).filter(
@@ -6821,10 +6826,10 @@ let Fn = class extends ae {
6821
6826
  return { redos: d, undos: h };
6822
6827
  }
6823
6828
  _handleInsertRowCommand(e, t, s) {
6824
- const o = $e(this._univerInstanceService, t);
6829
+ const o = We(this._univerInstanceService, t);
6825
6830
  if (!o)
6826
6831
  return this._handleNull();
6827
- const r = We(o, s);
6832
+ const r = Ve(o, s);
6828
6833
  if (!r)
6829
6834
  return this._handleNull();
6830
6835
  const { range: i } = e, { startRow: a, endRow: u } = i, l = D.deepClone(r.getMergeData()).reduce((p, I) => (a > I.startRow && a <= I.endRow && p.push(I), p), []);
@@ -6840,14 +6845,14 @@ let Fn = class extends ae {
6840
6845
  unitId: t,
6841
6846
  subUnitId: s,
6842
6847
  ranges: l
6843
- }, h = ye(
6848
+ }, h = be(
6844
6849
  this._injector,
6845
6850
  d
6846
6851
  ), g = {
6847
6852
  unitId: t,
6848
6853
  subUnitId: s,
6849
6854
  ranges: c
6850
- }, m = Ve(
6855
+ }, m = Le(
6851
6856
  this._injector,
6852
6857
  g
6853
6858
  ), f = [
@@ -6860,10 +6865,10 @@ let Fn = class extends ae {
6860
6865
  return { redos: f, undos: C };
6861
6866
  }
6862
6867
  _handleInsertColCommand(e, t, s) {
6863
- const { range: o } = e, r = $e(this._univerInstanceService, t);
6868
+ const { range: o } = e, r = We(this._univerInstanceService, t);
6864
6869
  if (!r)
6865
6870
  return this._handleNull();
6866
- const i = We(r, s);
6871
+ const i = Ve(r, s);
6867
6872
  if (!i)
6868
6873
  return this._handleNull();
6869
6874
  const { startColumn: a, endColumn: u } = o, l = D.deepClone(i.getMergeData()).reduce((p, I) => (a > I.startColumn && a <= I.endColumn && p.push(I), p), []);
@@ -6879,14 +6884,14 @@ let Fn = class extends ae {
6879
6884
  unitId: t,
6880
6885
  subUnitId: s,
6881
6886
  ranges: l
6882
- }, h = ye(
6887
+ }, h = be(
6883
6888
  this._injector,
6884
6889
  d
6885
6890
  ), g = {
6886
6891
  unitId: t,
6887
6892
  subUnitId: s,
6888
6893
  ranges: c
6889
- }, m = Ve(
6894
+ }, m = Le(
6890
6895
  this._injector,
6891
6896
  g
6892
6897
  ), f = [
@@ -6899,10 +6904,10 @@ let Fn = class extends ae {
6899
6904
  return { redos: f, undos: C };
6900
6905
  }
6901
6906
  _handleRemoveColCommand(e, t, s) {
6902
- const o = $e(this._univerInstanceService, t);
6907
+ const o = We(this._univerInstanceService, t);
6903
6908
  if (!o)
6904
6909
  return this._handleNull();
6905
- const r = We(o, s);
6910
+ const r = Ve(o, s);
6906
6911
  if (!r)
6907
6912
  return this._handleNull();
6908
6913
  const { range: i } = e, { startColumn: a, endColumn: u } = i, l = D.deepClone(r.getMergeData()).reduce((S, w) => (O.intersects(i, w) && S.push(w), S), []);
@@ -6919,24 +6924,24 @@ let Fn = class extends ae {
6919
6924
  unitId: t,
6920
6925
  subUnitId: s,
6921
6926
  ranges: l
6922
- }, h = ye(
6927
+ }, h = be(
6923
6928
  this._injector,
6924
6929
  d
6925
6930
  ), g = {
6926
6931
  unitId: t,
6927
6932
  subUnitId: s,
6928
6933
  ranges: c
6929
- }, m = Ve(
6934
+ }, m = Le(
6930
6935
  this._injector,
6931
6936
  g
6932
6937
  ), f = [{ id: se.id, params: d }], C = [{ id: ne.id, params: g }], p = [{ id: se.id, params: m }], I = [{ id: ne.id, params: h }];
6933
6938
  return { preUndos: p, undos: I, preRedos: f, redos: C };
6934
6939
  }
6935
6940
  _handleRemoveRowCommand(e, t, s) {
6936
- const { range: o } = e, r = $e(this._univerInstanceService, t);
6941
+ const { range: o } = e, r = We(this._univerInstanceService, t);
6937
6942
  if (!r)
6938
6943
  return this._handleNull();
6939
- const i = We(r, s);
6944
+ const i = Ve(r, s);
6940
6945
  if (!i)
6941
6946
  return this._handleNull();
6942
6947
  const { startRow: a, endRow: u } = o, l = D.deepClone(i.getMergeData()).reduce((S, w) => (O.intersects(o, w) && S.push(w), S), []);
@@ -6953,24 +6958,24 @@ let Fn = class extends ae {
6953
6958
  unitId: t,
6954
6959
  subUnitId: s,
6955
6960
  ranges: l
6956
- }, h = ye(
6961
+ }, h = be(
6957
6962
  this._injector,
6958
6963
  d
6959
6964
  ), g = {
6960
6965
  unitId: t,
6961
6966
  subUnitId: s,
6962
6967
  ranges: c
6963
- }, m = Ve(
6968
+ }, m = Le(
6964
6969
  this._injector,
6965
6970
  g
6966
6971
  ), f = [{ id: se.id, params: d }], C = [{ id: ne.id, params: g }], p = [{ id: se.id, params: m }], I = [{ id: ne.id, params: h }];
6967
6972
  return { preUndos: p, undos: I, preRedos: f, redos: C };
6968
6973
  }
6969
6974
  _handleInsertRangeMoveRightCommand(e, t, s) {
6970
- const o = $e(this._univerInstanceService, t);
6975
+ const o = We(this._univerInstanceService, t);
6971
6976
  if (!o)
6972
6977
  return this._handleNull();
6973
- const r = We(o, s);
6978
+ const r = Ve(o, s);
6974
6979
  if (!r)
6975
6980
  return this._handleNull();
6976
6981
  const i = e.range, a = r.getMaxColumns() - 1, u = r.getMergeData(), l = [], c = [];
@@ -7006,14 +7011,14 @@ let Fn = class extends ae {
7006
7011
  unitId: t,
7007
7012
  subUnitId: s,
7008
7013
  ranges: l
7009
- }, h = ye(
7014
+ }, h = be(
7010
7015
  this._injector,
7011
7016
  d
7012
7017
  ), g = {
7013
7018
  unitId: t,
7014
7019
  subUnitId: s,
7015
7020
  ranges: c
7016
- }, m = Ve(
7021
+ }, m = Le(
7017
7022
  this._injector,
7018
7023
  g
7019
7024
  );
@@ -7039,10 +7044,10 @@ let Fn = class extends ae {
7039
7044
  };
7040
7045
  }
7041
7046
  _handleInsertRangeMoveDownCommand(e, t, s) {
7042
- const o = $e(this._univerInstanceService, t);
7047
+ const o = We(this._univerInstanceService, t);
7043
7048
  if (!o)
7044
7049
  return this._handleNull();
7045
- const r = We(o, s);
7050
+ const r = Ve(o, s);
7046
7051
  if (!r)
7047
7052
  return this._handleNull();
7048
7053
  const i = e.range, a = r.getMaxRows() - 1, u = r.getMergeData(), l = [], c = [];
@@ -7062,14 +7067,14 @@ let Fn = class extends ae {
7062
7067
  unitId: t,
7063
7068
  subUnitId: s,
7064
7069
  ranges: l
7065
- }, h = ye(
7070
+ }, h = be(
7066
7071
  this._injector,
7067
7072
  d
7068
7073
  ), g = {
7069
7074
  unitId: t,
7070
7075
  subUnitId: s,
7071
7076
  ranges: c
7072
- }, m = Ve(
7077
+ }, m = Le(
7073
7078
  this._injector,
7074
7079
  g
7075
7080
  ), f = [
@@ -7096,10 +7101,10 @@ let Fn = class extends ae {
7096
7101
  return { redos: C, undos: I, preRedos: f, preUndos: p };
7097
7102
  }
7098
7103
  _handleDeleteRangeMoveUpCommand(e, t, s) {
7099
- const o = $e(this._univerInstanceService, t);
7104
+ const o = We(this._univerInstanceService, t);
7100
7105
  if (!o)
7101
7106
  return this._handleNull();
7102
- const r = We(o, s);
7107
+ const r = Ve(o, s);
7103
7108
  if (!r)
7104
7109
  return this._handleNull();
7105
7110
  const i = e.range, a = r.getMaxRows() - 1, u = r.getMergeData(), l = [], c = [];
@@ -7114,14 +7119,14 @@ let Fn = class extends ae {
7114
7119
  unitId: t,
7115
7120
  subUnitId: s,
7116
7121
  ranges: l
7117
- }, h = ye(
7122
+ }, h = be(
7118
7123
  this._injector,
7119
7124
  d
7120
7125
  ), g = {
7121
7126
  unitId: t,
7122
7127
  subUnitId: s,
7123
7128
  ranges: c
7124
- }, m = Ve(
7129
+ }, m = Le(
7125
7130
  this._injector,
7126
7131
  g
7127
7132
  ), f = [
@@ -7148,10 +7153,10 @@ let Fn = class extends ae {
7148
7153
  return { redos: C, undos: I, preRedos: f, preUndos: p };
7149
7154
  }
7150
7155
  _handleDeleteRangeMoveLeftCommand(e, t, s) {
7151
- const o = $e(this._univerInstanceService, t);
7156
+ const o = We(this._univerInstanceService, t);
7152
7157
  if (!o)
7153
7158
  return this._handleNull();
7154
- const r = We(o, s);
7159
+ const r = Ve(o, s);
7155
7160
  if (!r)
7156
7161
  return this._handleNull();
7157
7162
  const i = e.range, a = r.getMaxColumns() - 1, u = r.getMergeData(), l = [], c = [];
@@ -7187,11 +7192,11 @@ let Fn = class extends ae {
7187
7192
  unitId: t,
7188
7193
  subUnitId: s,
7189
7194
  ranges: l
7190
- }, h = ye(this._injector, d), g = {
7195
+ }, h = be(this._injector, d), g = {
7191
7196
  unitId: t,
7192
7197
  subUnitId: s,
7193
7198
  ranges: c
7194
- }, m = Ve(this._injector, g);
7199
+ }, m = Le(this._injector, g);
7195
7200
  return {
7196
7201
  preRedos: [
7197
7202
  { id: se.id, params: d }
@@ -7258,17 +7263,17 @@ let Fn = class extends ae {
7258
7263
  }
7259
7264
  };
7260
7265
  Fn = nc([
7261
- Et(0, $(U)),
7266
+ Et(0, $(k)),
7262
7267
  Et(1, $(Wt)),
7263
7268
  Et(2, $(M)),
7264
7269
  Et(3, $(cs)),
7265
7270
  Et(4, $(j)),
7266
7271
  Et(5, $(F))
7267
7272
  ], Fn);
7268
- function $e(n, e) {
7273
+ function We(n, e) {
7269
7274
  return e ? n.getUniverSheetInstance(e) : n.getCurrentUnitForType(B.UNIVER_SHEET);
7270
7275
  }
7271
- function We(n, e) {
7276
+ function Ve(n, e) {
7272
7277
  return e ? n.getSheetBySheetId(e) : n.getActiveSheet();
7273
7278
  }
7274
7279
  const ic = (n, e, t) => {
@@ -7346,7 +7351,7 @@ function cc(n, e, t, s) {
7346
7351
  unitId: e,
7347
7352
  subUnitId: i,
7348
7353
  cellValue: u.getData()
7349
- }, c = xe(
7354
+ }, c = $e(
7350
7355
  n,
7351
7356
  l
7352
7357
  );
@@ -7371,9 +7376,9 @@ const zt = {
7371
7376
  handler: async (n, e) => {
7372
7377
  const t = n.get(M), s = P(t, e);
7373
7378
  if (!s) return !1;
7374
- const { worksheet: o } = s, { unitId: r, subUnitId: i, selections: a } = e, u = n.get(U), l = n.get(V), c = Qr(a, e.value), d = uc(o, c);
7379
+ const { worksheet: o } = s, { unitId: r, subUnitId: i, selections: a } = e, u = n.get(k), l = n.get(V), c = Qr(a, e.value), d = uc(o, c);
7375
7380
  if (d && !e.defaultMerge) {
7376
- const N = n.get(xi), T = n.get(Qe);
7381
+ const N = n.get(xi), T = n.get(et);
7377
7382
  if (!await N.confirm({
7378
7383
  id: "merge.confirm.add-worksheet-merge",
7379
7384
  title: {
@@ -7394,7 +7399,7 @@ const zt = {
7394
7399
  unitId: r,
7395
7400
  subUnitId: i,
7396
7401
  ranges: D.deepClone(c)
7397
- }, C = ye(n, m), p = Ve(n, f);
7402
+ }, C = be(n, m), p = Le(n, f);
7398
7403
  if (C.ranges.length > 0 && h.push({ id: se.id, params: C }), h.push({ id: ne.id, params: f }), g.push({ id: se.id, params: p }), C.ranges.length > 0 && g.push({ id: ne.id, params: C }), d) {
7399
7404
  const N = cc(n, r, o, c);
7400
7405
  h.unshift(...N.redos), g.push(...N.undos);
@@ -7424,7 +7429,7 @@ const zt = {
7424
7429
  const o = n.get(M), r = P(o);
7425
7430
  if (!r) return !1;
7426
7431
  const { worksheet: i } = r, a = i.getUnitId(), u = i.getSheetId();
7427
- return n.get(U).executeCommand(zt.id, {
7432
+ return n.get(k).executeCommand(zt.id, {
7428
7433
  selections: s,
7429
7434
  unitId: a,
7430
7435
  subUnitId: u
@@ -7441,7 +7446,7 @@ const zt = {
7441
7446
  const o = n.get(M), r = P(o);
7442
7447
  if (!r) return !1;
7443
7448
  const { worksheet: i } = r, a = i.getUnitId(), u = i.getSheetId();
7444
- return n.get(U).executeCommand(zt.id, {
7449
+ return n.get(k).executeCommand(zt.id, {
7445
7450
  value: pe.COLUMNS,
7446
7451
  selections: s,
7447
7452
  unitId: a,
@@ -7459,7 +7464,7 @@ const zt = {
7459
7464
  const o = n.get(M), r = P(o);
7460
7465
  if (!r) return !1;
7461
7466
  const { workbook: i, worksheet: a } = r, u = i.getUnitId(), l = a.getSheetId();
7462
- return n.get(U).executeCommand(zt.id, {
7467
+ return n.get(k).executeCommand(zt.id, {
7463
7468
  value: pe.ROWS,
7464
7469
  selections: s,
7465
7470
  unitId: u,
@@ -7473,7 +7478,7 @@ function lg(n, e, t, s, o) {
7473
7478
  const { worksheet: a } = i;
7474
7479
  if (a.getMergeData().some((d) => s.some((h) => O.intersects(h, d))))
7475
7480
  throw new Error("The ranges to be merged overlap with the existing merged cells");
7476
- n.get(U).executeCommand(zt.id, {
7481
+ n.get(k).executeCommand(zt.id, {
7477
7482
  unitId: e,
7478
7483
  subUnitId: t,
7479
7484
  selections: s,
@@ -7490,9 +7495,9 @@ class dt {
7490
7495
  * Map<unitId, Map<subUnitId, Map<subUnitId, IWorksheetProtectionRule>>>
7491
7496
  */
7492
7497
  R(this, "_model", /* @__PURE__ */ new Map());
7493
- R(this, "_ruleChange", new Ae());
7494
- R(this, "_ruleRefresh", new Ae());
7495
- R(this, "_resetOrder", new Ae());
7498
+ R(this, "_ruleChange", new xe());
7499
+ R(this, "_ruleRefresh", new xe());
7500
+ R(this, "_resetOrder", new xe());
7496
7501
  R(this, "ruleChange$", this._ruleChange.asObservable());
7497
7502
  R(this, "ruleRefresh$", this._ruleRefresh.asObservable());
7498
7503
  R(this, "resetOrder$", this._resetOrder.asObservable());
@@ -7585,7 +7590,7 @@ const bt = {
7585
7590
  async handler(n, e) {
7586
7591
  if (!e)
7587
7592
  return !1;
7588
- const t = n.get(U), s = n.get(V), { rule: o, unitId: r } = e, i = o.subUnitId;
7593
+ const t = n.get(k), s = n.get(V), { rule: o, unitId: r } = e, i = o.subUnitId;
7589
7594
  if (await t.executeCommand(bt.id, {
7590
7595
  unitId: r,
7591
7596
  rule: o,
@@ -7604,7 +7609,7 @@ const bt = {
7604
7609
  type: v.COMMAND,
7605
7610
  id: "sheet.command.set-worksheet-range-theme-style",
7606
7611
  handler: (n, e) => {
7607
- const t = n.get(U), s = n.get(V), { unitId: o } = e, r = Ba(n, e);
7612
+ const t = n.get(k), s = n.get(V), { unitId: o } = e, r = Ba(n, e);
7608
7613
  return t.syncExecuteCommand(an.id, e) ? (s.pushUndoRedo({
7609
7614
  unitID: o,
7610
7615
  undoMutations: [{ id: un.id, params: r }],
@@ -7615,11 +7620,11 @@ const bt = {
7615
7620
  type: v.COMMAND,
7616
7621
  id: Cc,
7617
7622
  handler: (n, e) => {
7618
- const t = n.get(U), s = n.get(V), { unitId: o, subUnitId: r, cellValue: i, insertRowNums: a, insertColumnNums: u, maxRows: l, maxColumns: c } = e, d = {
7623
+ const t = n.get(k), s = n.get(V), { unitId: o, subUnitId: r, cellValue: i, insertRowNums: a, insertColumnNums: u, maxRows: l, maxColumns: c } = e, d = {
7619
7624
  unitId: o,
7620
7625
  subUnitId: r,
7621
7626
  cellValue: i
7622
- }, h = xe(
7627
+ }, h = $e(
7623
7628
  n,
7624
7629
  d
7625
7630
  ), g = [{ id: ee.id, params: d }], m = [{ id: ee.id, params: h }];
@@ -7637,7 +7642,7 @@ const bt = {
7637
7642
  n,
7638
7643
  C
7639
7644
  );
7640
- g.unshift({ id: Ue.id, params: C }), m.push({ id: Te.id, params: p });
7645
+ g.unshift({ id: Ue.id, params: C }), m.push({ id: Pe.id, params: p });
7641
7646
  }
7642
7647
  if (u) {
7643
7648
  const C = {
@@ -7653,7 +7658,7 @@ const bt = {
7653
7658
  n,
7654
7659
  C
7655
7660
  );
7656
- g.unshift({ id: ke.id, params: C }), m.push({ id: Me.id, params: p });
7661
+ g.unshift({ id: Te.id, params: C }), m.push({ id: Me.id, params: p });
7657
7662
  }
7658
7663
  return L(g, t).result ? (s.pushUndoRedo({
7659
7664
  unitID: o,
@@ -7666,7 +7671,7 @@ const bt = {
7666
7671
  type: v.COMMAND,
7667
7672
  handler: (n, e) => {
7668
7673
  var S;
7669
- const t = n.get(M), s = n.get(U), o = n.get(F), r = n.get(V), i = n.get(j), a = t.getCurrentUnitForType(B.UNIVER_SHEET);
7674
+ const t = n.get(M), s = n.get(k), o = n.get(F), r = n.get(V), i = n.get(j), a = t.getCurrentUnitForType(B.UNIVER_SHEET);
7670
7675
  if (!a) return !1;
7671
7676
  const u = (e == null ? void 0 : e.unitId) || a.getUnitId(), l = a.getActiveSheet();
7672
7677
  if (!l) return !1;
@@ -7677,7 +7682,7 @@ const bt = {
7677
7682
  subUnitId: c,
7678
7683
  unitId: u,
7679
7684
  cellValue: Wu(h)
7680
- }, m = xe(
7685
+ }, m = $e(
7681
7686
  n,
7682
7687
  g
7683
7688
  ), f = i.onCommandExecute({ id: Qs.id }), C = [{ id: ee.id, params: g }, ...f.redos], p = [...f.undos, { id: ee.id, params: m }];
@@ -7697,7 +7702,7 @@ var Sc = Object.getOwnPropertyDescriptor, wc = (n, e, t, s) => {
7697
7702
  for (var o = s > 1 ? void 0 : s ? Sc(e, t) : e, r = n.length - 1, i; r >= 0; r--)
7698
7703
  (i = n[r]) && (o = i(o) || o);
7699
7704
  return o;
7700
- }, Uo = (n, e) => (t, s) => e(t, s, n);
7705
+ }, ko = (n, e) => (t, s) => e(t, s, n);
7701
7706
  let Bn = class extends ae {
7702
7707
  constructor(e, t) {
7703
7708
  super();
@@ -7796,8 +7801,8 @@ let Bn = class extends ae {
7796
7801
  }
7797
7802
  };
7798
7803
  Bn = wc([
7799
- Uo(0, U),
7800
- Uo(1, M)
7804
+ ko(0, k),
7805
+ ko(1, M)
7801
7806
  ], Bn);
7802
7807
  const ti = {
7803
7808
  id: "sheet.mutation.copy-worksheet-end",
@@ -7857,7 +7862,7 @@ function Mc(n, e, t, s, o, r, i) {
7857
7862
  const h = e.getSheetIndex(t), { cellData: g } = c, f = Ic(g) >= l.largeSheetCellCountThreshold;
7858
7863
  let C, p = [];
7859
7864
  if (f) {
7860
- const { firstChunkCellData: T, remainingMutations: k } = vc(
7865
+ const { firstChunkCellData: T, remainingMutations: U } = vc(
7861
7866
  s,
7862
7867
  d,
7863
7868
  g,
@@ -7867,7 +7872,7 @@ function Mc(n, e, t, s, o, r, i) {
7867
7872
  index: h + 1,
7868
7873
  sheet: E,
7869
7874
  unitId: s
7870
- }, p = k;
7875
+ }, p = U;
7871
7876
  } else
7872
7877
  C = {
7873
7878
  index: h + 1,
@@ -7902,7 +7907,7 @@ const _c = {
7902
7907
  type: v.COMMAND,
7903
7908
  id: si,
7904
7909
  handler: (n, e) => {
7905
- const t = n.get(U), s = n.get(V), o = n.get(M), r = n.get(j), i = n.get(Qe), a = n.get(Bn), u = P(o, e);
7910
+ const t = n.get(k), s = n.get(V), o = n.get(M), r = n.get(j), i = n.get(et), a = n.get(Bn), u = P(o, e);
7906
7911
  if (!u)
7907
7912
  return !1;
7908
7913
  const { workbook: l, worksheet: c, unitId: d, subUnitId: h } = u, { redos: g, undos: m, newSheetId: f, isSplit: C, scheduledMutations: p } = Mc(
@@ -7949,7 +7954,7 @@ const bc = {
7949
7954
  async handler(n, e) {
7950
7955
  if (!e)
7951
7956
  return !1;
7952
- const t = n.get(U), s = n.get(V), { unitId: o, subUnitId: r, rule: i } = e, a = {
7957
+ const t = n.get(k), s = n.get(V), { unitId: o, subUnitId: r, rule: i } = e, a = {
7953
7958
  unitId: o,
7954
7959
  subUnitId: r,
7955
7960
  ruleIds: [i.id]
@@ -7957,7 +7962,7 @@ const bc = {
7957
7962
  return await t.executeCommand(at.id, a) && s.pushUndoRedo({
7958
7963
  unitID: o,
7959
7964
  redoMutations: [{ id: at.id, params: a }],
7960
- undoMutations: [{ id: je.id, params: { unitId: o, subUnitId: r, rules: [i] } }]
7965
+ undoMutations: [{ id: ze.id, params: { unitId: o, subUnitId: r, rules: [i] } }]
7961
7966
  }), !0;
7962
7967
  }
7963
7968
  }, Ec = {
@@ -7966,7 +7971,7 @@ const bc = {
7966
7971
  handler(n, e) {
7967
7972
  if (!e)
7968
7973
  return !1;
7969
- const t = n.get(U), s = n.get(V), { rule: o, unitId: r, subUnitId: i } = e;
7974
+ const t = n.get(k), s = n.get(V), { rule: o, unitId: r, subUnitId: i } = e;
7970
7975
  t.executeCommand(Vt.id, {
7971
7976
  unitId: r,
7972
7977
  subUnitId: i
@@ -7978,22 +7983,22 @@ const bc = {
7978
7983
  undoMutations: u
7979
7984
  }), !0;
7980
7985
  }
7981
- }, Uc = {
7986
+ }, kc = {
7982
7987
  type: v.COMMAND,
7983
7988
  id: "sheet.command.remove-worksheet-range-theme-style",
7984
7989
  handler: (n, e) => {
7985
- const t = n.get(U), s = n.get(V), { unitId: o } = e, r = ja(n, e);
7990
+ const t = n.get(k), s = n.get(V), { unitId: o } = e, r = ja(n, e);
7986
7991
  return t.syncExecuteCommand(un.id, e) ? (s.pushUndoRedo({
7987
7992
  unitID: o,
7988
7993
  undoMutations: [{ id: an.id, params: r }],
7989
7994
  redoMutations: [{ id: un.id, params: e }]
7990
7995
  }), !0) : !1;
7991
7996
  }
7992
- }, kc = {
7997
+ }, Uc = {
7993
7998
  id: "sheet.command.insert-defined-name",
7994
7999
  type: v.COMMAND,
7995
8000
  handler: (n, e) => {
7996
- const t = n.get(U), s = n.get(V);
8001
+ const t = n.get(k), s = n.get(V);
7997
8002
  if (!e) return !1;
7998
8003
  const o = {
7999
8004
  ...e
@@ -8009,7 +8014,7 @@ const bc = {
8009
8014
  type: v.COMMAND,
8010
8015
  handler: (n, e) => {
8011
8016
  var C;
8012
- const t = n.get(U), s = n.get(V), o = n.get(M), r = n.get(Qe), i = tr(o, { unitId: e == null ? void 0 : e.unitId });
8017
+ const t = n.get(k), s = n.get(V), o = n.get(M), r = n.get(et), i = Qo(o, { unitId: e == null ? void 0 : e.unitId });
8013
8018
  if (!i) return !1;
8014
8019
  const { unitId: a, workbook: u } = i;
8015
8020
  let l = u.getSheets().length;
@@ -8051,7 +8056,7 @@ const bc = {
8051
8056
  handler: (n, e) => {
8052
8057
  if (!e)
8053
8058
  return !1;
8054
- const { unitId: t, rangeThemeStyle: s } = e, o = n.get(M), r = n.get(U), i = n.get(V);
8059
+ const { unitId: t, rangeThemeStyle: s } = e, o = n.get(M), r = n.get(k), i = n.get(V);
8055
8060
  if (!P(o, e)) return !1;
8056
8061
  const u = {
8057
8062
  unitId: t,
@@ -8072,7 +8077,7 @@ const bc = {
8072
8077
  type: v.COMMAND,
8073
8078
  handler: (n, e) => {
8074
8079
  var c, d;
8075
- const t = n.get(U), s = n.get(V), o = n.get(j);
8080
+ const t = n.get(k), s = n.get(V), o = n.get(j);
8076
8081
  if (!e) return !1;
8077
8082
  const r = {
8078
8083
  ...e
@@ -8096,7 +8101,7 @@ const bc = {
8096
8101
  type: v.COMMAND,
8097
8102
  handler: (n, e) => {
8098
8103
  var b, N;
8099
- const t = n.get(U), s = n.get(V), o = n.get(M), r = n.get(j), i = n.get(In), a = P(o, e);
8104
+ const t = n.get(k), s = n.get(V), o = n.get(M), r = n.get(j), i = n.get(In), a = P(o, e);
8100
8105
  if (!a) return !1;
8101
8106
  const { unitId: u, subUnitId: l, workbook: c, worksheet: d } = a;
8102
8107
  if (c.getSheets().length <= 1) return !1;
@@ -8123,7 +8128,7 @@ const bc = {
8123
8128
  // eslint-disable-next-line max-lines-per-function
8124
8129
  handler: (n, e) => {
8125
8130
  var T;
8126
- const t = n.get(F), s = n.get(U), o = n.get(V), r = n.get(M), i = (e == null ? void 0 : e.ranges) || ((T = t.getCurrentSelections()) == null ? void 0 : T.map((k) => k.range));
8131
+ const t = n.get(F), s = n.get(k), o = n.get(V), r = n.get(M), i = (e == null ? void 0 : e.ranges) || ((T = t.getCurrentSelections()) == null ? void 0 : T.map((U) => U.range));
8127
8132
  if (!(i != null && i.length)) return !1;
8128
8133
  const a = P(r);
8129
8134
  if (!a) return !1;
@@ -8131,15 +8136,15 @@ const bc = {
8131
8136
  unitId: l,
8132
8137
  subUnitId: u,
8133
8138
  ranges: i
8134
- }, g = c.getConfig().mergeData.filter((k) => i.some((E) => O.intersects(E, k)));
8139
+ }, g = c.getConfig().mergeData.filter((U) => i.some((E) => O.intersects(E, U)));
8135
8140
  if (!g.length) return !1;
8136
- const m = ye(
8141
+ const m = be(
8137
8142
  n,
8138
8143
  d
8139
8144
  ), f = t.getCurrentSelections(), C = D.deepClone(f), p = D.deepClone(f);
8140
8145
  if (f.length) {
8141
- const k = p[p.length - 1], { startRow: E, startColumn: A } = k.range;
8142
- k.primary = {
8146
+ const U = p[p.length - 1], { startRow: E, startColumn: A } = U.range;
8147
+ U.primary = {
8143
8148
  startRow: E,
8144
8149
  startColumn: A,
8145
8150
  endRow: E,
@@ -8329,7 +8334,7 @@ function Ac(n, e, t) {
8329
8334
  rightRangeOut: b,
8330
8335
  topRange: N,
8331
8336
  leftRange: T,
8332
- bottomRange: k,
8337
+ bottomRange: U,
8333
8338
  rightRange: E
8334
8339
  } = Dc(I), A = new q(), { worksheet: X, unitId: z, subUnitId: G } = e;
8335
8340
  return {
@@ -8357,7 +8362,7 @@ function Ac(n, e, t) {
8357
8362
  rightRangeOut: b,
8358
8363
  topRange: N,
8359
8364
  leftRange: T,
8360
- bottomRange: k,
8365
+ bottomRange: U,
8361
8366
  rightRange: E,
8362
8367
  range: I,
8363
8368
  mr: A,
@@ -8441,16 +8446,16 @@ const Wc = (n) => {
8441
8446
  };
8442
8447
  e && (m(d, { b: null }), m(a, { t: D.deepClone(r) }, !0)), o && (m(c, { t: null }), m(i, { b: D.deepClone(r) }, !0)), t && (m(h, { r: null }), m(u, { l: D.deepClone(r) }, !0)), s && (m(g, { l: null }), m(l, { r: D.deepClone(r) }, !0));
8443
8448
  }, Vc = (n) => {
8444
- const { range: e, worksheet: t, mr: s, top: o, bottom: r, left: i, right: a, vertical: u, horizontal: l, tl_br: c, tl_bc: d, tl_mr: h, bl_tr: g, ml_tr: m, bc_tr: f, topRange: C, bottomRange: p, leftRange: I, rightRange: S, topRangeOut: w, bottomRangeOut: y, leftRangeOut: b, rightRangeOut: N } = n, T = (k, E, A) => {
8445
- no(n, k, E, A);
8449
+ const { range: e, worksheet: t, mr: s, top: o, bottom: r, left: i, right: a, vertical: u, horizontal: l, tl_br: c, tl_bc: d, tl_mr: h, bl_tr: g, ml_tr: m, bc_tr: f, topRange: C, bottomRange: p, leftRange: I, rightRange: S, topRangeOut: w, bottomRangeOut: y, leftRangeOut: b, rightRangeOut: N } = n, T = (U, E, A) => {
8450
+ no(n, U, E, A);
8446
8451
  };
8447
- !o && !r && !i && !a && !u && !l && !c && !d && !h && !g && !m && !f && (jn(e, (k, E) => {
8452
+ !o && !r && !i && !a && !u && !l && !c && !d && !h && !g && !m && !f && (jn(e, (U, E) => {
8448
8453
  var X, z, G, K, ue, oe, le, we;
8449
- const A = t.getMergedCell(k, E);
8454
+ const A = t.getMergedCell(U, E);
8450
8455
  if (A) {
8451
8456
  if (A.endColumn !== e.endColumn) {
8452
8457
  const Z = (X = s.getValue(A.startRow, A.startColumn)) == null ? void 0 : X.s;
8453
- s.setValue(k, E, {
8458
+ s.setValue(U, E, {
8454
8459
  s: {
8455
8460
  bd: Z != null && Z.bd ? Object.assign(Z.bd, { r: null }) : { r: null }
8456
8461
  }
@@ -8458,7 +8463,7 @@ const Wc = (n) => {
8458
8463
  }
8459
8464
  if (A.startColumn !== e.startColumn) {
8460
8465
  const Z = (z = s.getValue(A.startRow, A.startColumn)) == null ? void 0 : z.s;
8461
- s.setValue(k, E, {
8466
+ s.setValue(U, E, {
8462
8467
  s: {
8463
8468
  bd: Z != null && Z.bd ? Object.assign(Z.bd, { l: null }) : { l: null }
8464
8469
  }
@@ -8466,7 +8471,7 @@ const Wc = (n) => {
8466
8471
  }
8467
8472
  if (A.endRow !== e.endRow) {
8468
8473
  const Z = (G = s.getValue(A.startRow, A.startColumn)) == null ? void 0 : G.s;
8469
- s.setValue(k, E, {
8474
+ s.setValue(U, E, {
8470
8475
  s: {
8471
8476
  bd: Z != null && Z.bd ? Object.assign(Z.bd, { b: null }) : { b: null }
8472
8477
  }
@@ -8474,7 +8479,7 @@ const Wc = (n) => {
8474
8479
  }
8475
8480
  if (A.startRow !== e.startRow) {
8476
8481
  const Z = (K = s.getValue(A.startRow, A.startColumn)) == null ? void 0 : K.s;
8477
- s.setValue(k, E, {
8482
+ s.setValue(U, E, {
8478
8483
  s: {
8479
8484
  bd: Z != null && Z.bd ? Object.assign(Z.bd, { t: null }) : { t: null }
8480
8485
  }
@@ -8482,32 +8487,32 @@ const Wc = (n) => {
8482
8487
  }
8483
8488
  } else {
8484
8489
  if (E !== e.endColumn) {
8485
- const Z = (ue = s.getValue(k, E)) == null ? void 0 : ue.s;
8486
- s.setValue(k, E, {
8490
+ const Z = (ue = s.getValue(U, E)) == null ? void 0 : ue.s;
8491
+ s.setValue(U, E, {
8487
8492
  s: {
8488
8493
  bd: Z != null && Z.bd ? Object.assign(Z.bd, { r: null }) : { r: null }
8489
8494
  }
8490
8495
  });
8491
8496
  }
8492
8497
  if (E !== e.startColumn) {
8493
- const Z = (oe = s.getValue(k, E)) == null ? void 0 : oe.s;
8494
- s.setValue(k, E, {
8498
+ const Z = (oe = s.getValue(U, E)) == null ? void 0 : oe.s;
8499
+ s.setValue(U, E, {
8495
8500
  s: {
8496
8501
  bd: Z != null && Z.bd ? Object.assign(Z.bd, { l: null }) : { l: null }
8497
8502
  }
8498
8503
  });
8499
8504
  }
8500
- if (k !== e.endRow) {
8501
- const Z = (le = s.getValue(k, E)) == null ? void 0 : le.s;
8502
- s.setValue(k, E, {
8505
+ if (U !== e.endRow) {
8506
+ const Z = (le = s.getValue(U, E)) == null ? void 0 : le.s;
8507
+ s.setValue(U, E, {
8503
8508
  s: {
8504
8509
  bd: Z != null && Z.bd ? Object.assign(Z.bd, { b: null }) : { b: null }
8505
8510
  }
8506
8511
  });
8507
8512
  }
8508
- if (k !== e.startRow) {
8509
- const Z = (we = s.getValue(k, E)) == null ? void 0 : we.s;
8510
- s.setValue(k, E, {
8513
+ if (U !== e.startRow) {
8514
+ const Z = (we = s.getValue(U, E)) == null ? void 0 : we.s;
8515
+ s.setValue(U, E, {
8511
8516
  s: {
8512
8517
  bd: Z != null && Z.bd ? Object.assign(Z.bd, { t: null }) : { t: null }
8513
8518
  }
@@ -8520,7 +8525,7 @@ const Wc = (n) => {
8520
8525
  type: v.COMMAND,
8521
8526
  handler: (n, e) => {
8522
8527
  var p;
8523
- const t = n.get(U), s = n.get(V), o = n.get(M), r = n.get(F), i = n.get(Gt), a = P(o, e);
8528
+ const t = n.get(k), s = n.get(V), o = n.get(M), r = n.get(F), i = n.get(Gt), a = P(o, e);
8524
8529
  if (!a) return !1;
8525
8530
  const u = (e == null ? void 0 : e.ranges) || ((p = r.getCurrentSelections()) == null ? void 0 : p.map((I) => I.range));
8526
8531
  if (!(u != null && u.length))
@@ -8533,7 +8538,7 @@ const Wc = (n) => {
8533
8538
  unitId: d,
8534
8539
  subUnitId: h,
8535
8540
  cellValue: g.getData()
8536
- }, f = xe(
8541
+ }, f = $e(
8537
8542
  n,
8538
8543
  m
8539
8544
  );
@@ -8548,28 +8553,28 @@ const Wc = (n) => {
8548
8553
  type: v.COMMAND,
8549
8554
  handler: (n, e) => {
8550
8555
  if (!e.value) return !1;
8551
- const t = n.get(U);
8556
+ const t = n.get(k);
8552
8557
  return n.get(Gt).setType(e.value), t.syncExecuteCommand(_n.id);
8553
8558
  }
8554
8559
  }, Hc = {
8555
8560
  id: "sheet.command.set-border-style",
8556
8561
  type: v.COMMAND,
8557
8562
  handler: (n, e) => {
8558
- const t = n.get(U);
8563
+ const t = n.get(k);
8559
8564
  return n.get(Gt).setStyle(e.value), t.syncExecuteCommand(_n.id);
8560
8565
  }
8561
8566
  }, Fc = {
8562
8567
  id: "sheet.command.set-border-color",
8563
8568
  type: v.COMMAND,
8564
8569
  handler: (n, e) => {
8565
- const t = n.get(U);
8570
+ const t = n.get(k);
8566
8571
  return n.get(Gt).setColor(e.value), t.syncExecuteCommand(_n.id);
8567
8572
  }
8568
8573
  }, Bc = {
8569
8574
  id: "sheet.command.set-border-basic",
8570
8575
  type: v.COMMAND,
8571
8576
  handler: (n, e) => {
8572
- const { unitId: t, subUnitId: s, value: o, ranges: r } = e, { type: i, color: a, style: u } = o, l = n.get(U), c = n.get(Gt);
8577
+ const { unitId: t, subUnitId: s, value: o, ranges: r } = e, { type: i, color: a, style: u } = o, l = n.get(k), c = n.get(Gt);
8573
8578
  return c.setType(i), a && c.setColor(a), c.setStyle(u), l.syncExecuteCommand(_n.id, {
8574
8579
  unitId: t,
8575
8580
  subUnitId: s,
@@ -8580,7 +8585,7 @@ const Wc = (n) => {
8580
8585
  type: v.COMMAND,
8581
8586
  id: "sheet.command.set-col-data",
8582
8587
  handler: (n, e) => {
8583
- const t = n.get(U), s = n.get(V), o = n.get(M), r = P(o, e);
8588
+ const t = n.get(k), s = n.get(V), o = n.get(M), r = P(o, e);
8584
8589
  if (!r) return !1;
8585
8590
  const { columnData: i } = e, { unitId: a, subUnitId: u, worksheet: l } = r, c = {
8586
8591
  subUnitId: u,
@@ -8598,7 +8603,7 @@ const Wc = (n) => {
8598
8603
  id: "sheet.command.set-col-visible-on-cols",
8599
8604
  handler: (n, e) => {
8600
8605
  var p, I;
8601
- const { unitId: t, subUnitId: s, ranges: o } = e, r = n.get(j), i = n.get(U), a = n.get(M), u = P(a, { unitId: t, subUnitId: s });
8606
+ const { unitId: t, subUnitId: s, ranges: o } = e, r = n.get(j), i = n.get(k), a = n.get(M), u = P(a, { unitId: t, subUnitId: s });
8602
8607
  if (!u) return !1;
8603
8608
  const { worksheet: l } = u, c = {
8604
8609
  unitId: t,
@@ -8653,7 +8658,7 @@ const Wc = (n) => {
8653
8658
  id: "sheet.command.set-selected-cols-visible",
8654
8659
  handler: (n) => {
8655
8660
  var l;
8656
- const e = n.get(F), t = n.get(U), s = (l = e.getCurrentSelections()) == null ? void 0 : l.map((c) => c.range).filter((c) => c.rangeType === H.COLUMN);
8661
+ const e = n.get(F), t = n.get(k), s = (l = e.getCurrentSelections()) == null ? void 0 : l.map((c) => c.range).filter((c) => c.rangeType === H.COLUMN);
8657
8662
  if (!(s != null && s.length)) return !1;
8658
8663
  const o = P(n.get(M));
8659
8664
  if (!o) return !1;
@@ -8669,7 +8674,7 @@ const Wc = (n) => {
8669
8674
  id: "sheet.command.set-col-hidden",
8670
8675
  handler: (n, e) => {
8671
8676
  var I, S, w, y;
8672
- const t = n.get(F), s = n.get(j), o = n.get(M), r = n.get(U);
8677
+ const t = n.get(F), s = n.get(j), o = n.get(M), r = n.get(k);
8673
8678
  let i = (I = e == null ? void 0 : e.ranges) != null && I.length ? e.ranges : (S = t.getCurrentSelections()) == null ? void 0 : S.map((b) => b.range).filter((b) => b.rangeType === H.COLUMN);
8674
8679
  if (!(i != null && i.length)) return !1;
8675
8680
  const a = P(o, e);
@@ -8764,7 +8769,7 @@ const ai = {
8764
8769
  type: v.COMMAND,
8765
8770
  handler: (n, e) => {
8766
8771
  var d, h;
8767
- const t = n.get(U), s = n.get(V), o = n.get(j);
8772
+ const t = n.get(k), s = n.get(V), o = n.get(j);
8768
8773
  if (!e) return !1;
8769
8774
  const r = {
8770
8775
  ...e
@@ -8814,7 +8819,7 @@ const ai = {
8814
8819
  type: v.COMMAND,
8815
8820
  id: "sheet.command.set-frozen",
8816
8821
  handler: (n, e) => {
8817
- const t = n.get(U), s = n.get(V), o = n.get(M), r = P(o, { unitId: e.unitId, subUnitId: e.subUnitId });
8822
+ const t = n.get(k), s = n.get(V), o = n.get(M), r = P(o, { unitId: e.unitId, subUnitId: e.subUnitId });
8818
8823
  if (!r) return !1;
8819
8824
  const { unitId: i, subUnitId: a, worksheet: u } = r, { startColumn: l, startRow: c, xSplit: d, ySplit: h } = e;
8820
8825
  if (c >= u.getRowCount() || l >= u.getColumnCount() || d >= u.getColumnCount() || h >= u.getRowCount())
@@ -8834,7 +8839,7 @@ const ai = {
8834
8839
  type: v.COMMAND,
8835
8840
  id: "sheet.command.cancel-frozen",
8836
8841
  handler: (n, e) => {
8837
- const t = n.get(U), s = n.get(M), o = n.get(V), r = P(s, { unitId: e == null ? void 0 : e.unitId, subUnitId: e == null ? void 0 : e.subUnitId });
8842
+ const t = n.get(k), s = n.get(M), o = n.get(V), r = P(s, { unitId: e == null ? void 0 : e.unitId, subUnitId: e == null ? void 0 : e.subUnitId });
8838
8843
  if (!r) return !1;
8839
8844
  const { unitId: i, subUnitId: a } = r, u = {
8840
8845
  unitId: i,
@@ -8854,7 +8859,7 @@ const ai = {
8854
8859
  type: v.COMMAND,
8855
8860
  id: "sheet.command.set-gridlines-color",
8856
8861
  handler: (n, e) => {
8857
- const t = n.get(U), s = n.get(V), o = n.get(M), r = P(o, e);
8862
+ const t = n.get(k), s = n.get(V), o = n.get(M), r = P(o, e);
8858
8863
  if (!r) return !1;
8859
8864
  const { worksheet: i } = r, a = i.getConfig().gridlinesColor;
8860
8865
  if (a === (e == null ? void 0 : e.color)) return !1;
@@ -8889,7 +8894,7 @@ const ai = {
8889
8894
  rule: i
8890
8895
  }
8891
8896
  } : null;
8892
- }, kt = {
8897
+ }, Ut = {
8893
8898
  id: "sheet.mutation.set-worksheet-protection",
8894
8899
  type: v.MUTATION,
8895
8900
  handler: (n, e) => {
@@ -8902,8 +8907,8 @@ const ai = {
8902
8907
  async handler(n, e) {
8903
8908
  if (!e)
8904
8909
  return !1;
8905
- const t = n.get(U), s = n.get(V), o = n.get(fe), { rule: r, oldRule: i } = e, { unitId: a, subUnitId: u } = r, l = [], c = [];
8906
- return (i == null ? void 0 : i.unitType) === r.unitType ? r.unitType === x.Worksheet ? (l.push({ id: kt.id, params: { unitId: a, subUnitId: u, rule: r } }), c.push({ id: kt.id, params: { unitId: a, subUnitId: u, rule: i } })) : (l.push({ id: Re.id, params: { unitId: a, subUnitId: u, rule: r, ruleId: r.id } }), c.push({ id: Re.id, params: { unitId: a, subUnitId: u, ruleId: i.id, rule: i } })) : (i && (i.unitType === x.Worksheet ? (l.push({ id: Vt.id, params: { unitId: a, subUnitId: u } }), c.push({ id: bt.id, params: { unitId: a, rule: i, subUnitId: i.subUnitId } })) : i.unitType === x.SelectRange && (l.push({ id: at.id, params: { unitId: a, subUnitId: u, ruleIds: [i.id] } }), c.push({ id: je.id, params: { unitId: a, subUnitId: u, rules: [i] } }))), r.unitType === x.Worksheet ? (l.push({ id: bt.id, params: { unitId: a, rule: r, subUnitId: r.subUnitId } }), c.unshift({ id: Vt.id, params: { unitId: a, subUnitId: u } })) : r.unitType === x.SelectRange && (r.id = o.createRuleId(a, u), l.push({ id: je.id, params: { unitId: a, subUnitId: u, rules: [r] } }), c.unshift({ id: at.id, params: { unitId: a, subUnitId: u, ruleIds: [r.id] } }))), L(l, t) && s.pushUndoRedo({
8910
+ const t = n.get(k), s = n.get(V), o = n.get(fe), { rule: r, oldRule: i } = e, { unitId: a, subUnitId: u } = r, l = [], c = [];
8911
+ return (i == null ? void 0 : i.unitType) === r.unitType ? r.unitType === x.Worksheet ? (l.push({ id: Ut.id, params: { unitId: a, subUnitId: u, rule: r } }), c.push({ id: Ut.id, params: { unitId: a, subUnitId: u, rule: i } })) : (l.push({ id: Re.id, params: { unitId: a, subUnitId: u, rule: r, ruleId: r.id } }), c.push({ id: Re.id, params: { unitId: a, subUnitId: u, ruleId: i.id, rule: i } })) : (i && (i.unitType === x.Worksheet ? (l.push({ id: Vt.id, params: { unitId: a, subUnitId: u } }), c.push({ id: bt.id, params: { unitId: a, rule: i, subUnitId: i.subUnitId } })) : i.unitType === x.SelectRange && (l.push({ id: at.id, params: { unitId: a, subUnitId: u, ruleIds: [i.id] } }), c.push({ id: ze.id, params: { unitId: a, subUnitId: u, rules: [i] } }))), r.unitType === x.Worksheet ? (l.push({ id: bt.id, params: { unitId: a, rule: r, subUnitId: r.subUnitId } }), c.unshift({ id: Vt.id, params: { unitId: a, subUnitId: u } })) : r.unitType === x.SelectRange && (r.id = o.createRuleId(a, u), l.push({ id: ze.id, params: { unitId: a, subUnitId: u, rules: [r] } }), c.unshift({ id: at.id, params: { unitId: a, subUnitId: u, ruleIds: [r.id] } }))), L(l, t) && s.pushUndoRedo({
8907
8912
  unitID: a,
8908
8913
  undoMutations: c,
8909
8914
  redoMutations: l
@@ -8913,7 +8918,7 @@ const ai = {
8913
8918
  type: v.COMMAND,
8914
8919
  id: "sheet.command.set-row-data",
8915
8920
  handler: (n, e) => {
8916
- const t = n.get(U), s = n.get(V), o = n.get(M), r = P(o, e);
8921
+ const t = n.get(k), s = n.get(V), o = n.get(M), r = P(o, e);
8917
8922
  if (!r) return !1;
8918
8923
  const { rowData: i } = e, { unitId: a, subUnitId: u, worksheet: l } = r, c = {
8919
8924
  subUnitId: u,
@@ -8931,7 +8936,7 @@ const ai = {
8931
8936
  id: "sheet.command.set-specific-rows-visible",
8932
8937
  handler: (n, e) => {
8933
8938
  var p, I, S;
8934
- const { unitId: t, subUnitId: s, ranges: o } = e, r = n.get(U), i = n.get(V), a = n.get(j), u = P(n.get(M), { unitId: t, subUnitId: s });
8939
+ const { unitId: t, subUnitId: s, ranges: o } = e, r = n.get(k), i = n.get(V), a = n.get(j), u = P(n.get(M), { unitId: t, subUnitId: s });
8935
8940
  if (!u) return !1;
8936
8941
  const { worksheet: l } = u, c = { unitId: t, subUnitId: s, ranges: o }, d = {
8937
8942
  unitId: t,
@@ -8990,7 +8995,7 @@ const ai = {
8990
8995
  id: "sheet.command.set-selected-rows-visible",
8991
8996
  handler: async (n) => {
8992
8997
  var c;
8993
- const e = n.get(F), t = n.get(M), s = n.get(U), o = (c = e.getCurrentSelections()) == null ? void 0 : c.map((d) => d.range).filter((d) => d.rangeType === H.ROW);
8998
+ const e = n.get(F), t = n.get(M), s = n.get(k), o = (c = e.getCurrentSelections()) == null ? void 0 : c.map((d) => d.range).filter((d) => d.rangeType === H.ROW);
8994
8999
  if (!(o != null && o.length)) return !1;
8995
9000
  const r = P(t);
8996
9001
  if (!r) return !1;
@@ -9006,7 +9011,7 @@ const ai = {
9006
9011
  id: "sheet.command.set-rows-hidden",
9007
9012
  handler: (n, e) => {
9008
9013
  var I, S, w, y, b, N;
9009
- const t = n.get(F), s = n.get(U), o = n.get(V), r = n.get(M), i = n.get(j);
9014
+ const t = n.get(F), s = n.get(k), o = n.get(V), r = n.get(M), i = n.get(j);
9010
9015
  let a = (I = e == null ? void 0 : e.ranges) != null && I.length ? e.ranges : (S = t.getCurrentSelections()) == null ? void 0 : S.map((T) => T.range).filter((T) => T.rangeType === H.ROW);
9011
9016
  if (!(a != null && a.length)) return !1;
9012
9017
  const u = P(r, e);
@@ -9100,10 +9105,10 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9100
9105
  id: "sheet.command.set-style",
9101
9106
  // eslint-disable-next-line max-lines-per-function
9102
9107
  handler: (n, e) => {
9103
- var k;
9108
+ var U;
9104
9109
  const t = n.get(M), s = P(t, e);
9105
9110
  if (!s) return !1;
9106
- const { unitId: o, subUnitId: r, worksheet: i } = s, { range: a, style: u } = e, l = n.get(U), c = n.get(V), d = n.get(F), h = a ? [a] : (k = d.getCurrentSelections()) == null ? void 0 : k.map((E) => E.range);
9111
+ const { unitId: o, subUnitId: r, worksheet: i } = s, { range: a, style: u } = e, l = n.get(k), c = n.get(V), d = n.get(F), h = a ? [a] : (U = d.getCurrentSelections()) == null ? void 0 : U.map((E) => E.range);
9107
9112
  if (!(h != null && h.length))
9108
9113
  return !1;
9109
9114
  const g = new q(), m = qu(i);
@@ -9129,7 +9134,7 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9129
9134
  subUnitId: r,
9130
9135
  unitId: o,
9131
9136
  cellValue: g.getMatrix()
9132
- }, C = n.get(ut).getSkeleton(o, r), p = xe(
9137
+ }, C = n.get(ut).getSkeleton(o, r), p = $e(
9133
9138
  n,
9134
9139
  f
9135
9140
  ), I = l.syncExecuteCommand(
@@ -9172,7 +9177,7 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9172
9177
  value: s.getRange(o, r).getFontWeight() === Vi.BOLD ? te.FALSE : te.TRUE
9173
9178
  }
9174
9179
  };
9175
- return n.get(U).syncExecuteCommand(Se.id, a);
9180
+ return n.get(k).syncExecuteCommand(Se.id, a);
9176
9181
  }
9177
9182
  }, hg = {
9178
9183
  type: v.COMMAND,
@@ -9194,7 +9199,7 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9194
9199
  value: o ? te.FALSE : te.TRUE
9195
9200
  }
9196
9201
  };
9197
- return n.get(U).syncExecuteCommand(Se.id, r);
9202
+ return n.get(k).syncExecuteCommand(Se.id, r);
9198
9203
  }
9199
9204
  }, gg = {
9200
9205
  type: v.COMMAND,
@@ -9215,7 +9220,7 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9215
9220
  }
9216
9221
  }
9217
9222
  };
9218
- return n.get(U).syncExecuteCommand(Se.id, r);
9223
+ return n.get(k).syncExecuteCommand(Se.id, r);
9219
9224
  }
9220
9225
  }, mg = {
9221
9226
  type: v.COMMAND,
@@ -9234,7 +9239,7 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9234
9239
  value: { s: o ? te.FALSE : te.TRUE }
9235
9240
  }
9236
9241
  };
9237
- return n.get(U).syncExecuteCommand(Se.id, r);
9242
+ return n.get(k).syncExecuteCommand(Se.id, r);
9238
9243
  }
9239
9244
  }, fg = {
9240
9245
  type: v.COMMAND,
@@ -9255,7 +9260,7 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9255
9260
  }
9256
9261
  }
9257
9262
  };
9258
- return n.get(U).syncExecuteCommand(Se.id, r);
9263
+ return n.get(k).syncExecuteCommand(Se.id, r);
9259
9264
  }
9260
9265
  }, Rg = {
9261
9266
  type: v.COMMAND,
@@ -9263,7 +9268,7 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9263
9268
  handler: (n, e) => {
9264
9269
  if (!e)
9265
9270
  return !1;
9266
- const t = n.get(U), s = {
9271
+ const t = n.get(k), s = {
9267
9272
  style: {
9268
9273
  type: "ff",
9269
9274
  value: e.value
@@ -9277,7 +9282,7 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9277
9282
  handler: (n, e) => {
9278
9283
  if (!e)
9279
9284
  return !1;
9280
- const t = n.get(U), s = {
9285
+ const t = n.get(k), s = {
9281
9286
  style: {
9282
9287
  type: "fs",
9283
9288
  value: e.value
@@ -9291,7 +9296,7 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9291
9296
  handler: (n, e) => {
9292
9297
  if (!e)
9293
9298
  return !1;
9294
- const t = n.get(U), s = {
9299
+ const t = n.get(k), s = {
9295
9300
  style: {
9296
9301
  type: "cl",
9297
9302
  value: {
@@ -9305,7 +9310,7 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9305
9310
  type: v.COMMAND,
9306
9311
  id: "sheet.command.reset-text-color",
9307
9312
  handler: (n) => {
9308
- const e = n.get(U), t = {
9313
+ const e = n.get(k), t = {
9309
9314
  style: {
9310
9315
  type: "cl",
9311
9316
  value: {
@@ -9322,7 +9327,7 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9322
9327
  handler: (n, e) => {
9323
9328
  if (!e || !e.value)
9324
9329
  return !1;
9325
- const t = n.get(U), s = {
9330
+ const t = n.get(k), s = {
9326
9331
  style: {
9327
9332
  type: "bg",
9328
9333
  value: {
@@ -9336,7 +9341,7 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9336
9341
  type: v.COMMAND,
9337
9342
  id: "sheet.command.reset-background-color",
9338
9343
  handler: (n) => {
9339
- const e = n.get(U), t = {
9344
+ const e = n.get(k), t = {
9340
9345
  style: {
9341
9346
  type: "bg",
9342
9347
  value: {
@@ -9353,7 +9358,7 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9353
9358
  handler: (n, e) => {
9354
9359
  if (!e)
9355
9360
  return !1;
9356
- const t = n.get(U), s = {
9361
+ const t = n.get(k), s = {
9357
9362
  unitId: e.unitId,
9358
9363
  subUnitId: e.subUnitId,
9359
9364
  range: e.range,
@@ -9370,7 +9375,7 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9370
9375
  handler: (n, e) => {
9371
9376
  if (!e)
9372
9377
  return !1;
9373
- const t = n.get(U), s = {
9378
+ const t = n.get(k), s = {
9374
9379
  unitId: e.unitId,
9375
9380
  subUnitId: e.subUnitId,
9376
9381
  range: e.range,
@@ -9387,7 +9392,7 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9387
9392
  handler: (n, e) => {
9388
9393
  if (!e)
9389
9394
  return !1;
9390
- const t = n.get(U), s = {
9395
+ const t = n.get(k), s = {
9391
9396
  unitId: e.unitId,
9392
9397
  subUnitId: e.subUnitId,
9393
9398
  range: e.range,
@@ -9404,7 +9409,7 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9404
9409
  handler: (n, e) => {
9405
9410
  if (!e)
9406
9411
  return !1;
9407
- const t = typeof e.value == "number" ? { a: e.value } : { a: 0, v: te.TRUE }, s = n.get(U), o = {
9412
+ const t = typeof e.value == "number" ? { a: e.value } : { a: 0, v: te.TRUE }, s = n.get(k), o = {
9408
9413
  unitId: e.unitId,
9409
9414
  subUnitId: e.subUnitId,
9410
9415
  range: e.range,
@@ -9434,7 +9439,7 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9434
9439
  type: v.COMMAND,
9435
9440
  id: "sheet.command.set-tab-color",
9436
9441
  handler: (n, e) => {
9437
- const t = n.get(U), s = n.get(V), o = P(n.get(M));
9442
+ const t = n.get(k), s = n.get(V), o = P(n.get(M));
9438
9443
  if (!o) return !1;
9439
9444
  const { unitId: r, subUnitId: i } = o, a = {
9440
9445
  color: e.value,
@@ -9459,8 +9464,8 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9459
9464
  id: "sheet.command.set-workbook-name",
9460
9465
  handler: (n, e) => {
9461
9466
  var u;
9462
- const t = n.get(U), s = n.get(j);
9463
- if (!tr(n.get(M), e)) return !1;
9467
+ const t = n.get(k), s = n.get(j);
9468
+ if (!Qo(n.get(M), e)) return !1;
9464
9469
  const r = s.onCommandExecute({
9465
9470
  id: hi.id,
9466
9471
  params: e
@@ -9478,7 +9483,7 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9478
9483
  type: v.COMMAND,
9479
9484
  id: "sheet.command.set-worksheet-activate",
9480
9485
  handler: (n, e, t) => {
9481
- const s = n.get(U), o = P(n.get(M), e);
9486
+ const s = n.get(k), o = P(n.get(M), e);
9482
9487
  if (!o) return !1;
9483
9488
  const { unitId: r, subUnitId: i } = o;
9484
9489
  return new Promise((a) => {
@@ -9499,7 +9504,7 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9499
9504
  const s = n.get(F).getCurrentSelections();
9500
9505
  if (!(s != null && s.length))
9501
9506
  return !1;
9502
- const o = n.get(U), r = n.get(V), i = P(n.get(M));
9507
+ const o = n.get(k), r = n.get(V), i = P(n.get(M));
9503
9508
  if (!i) return !1;
9504
9509
  const { worksheet: a, unitId: u, subUnitId: l } = i, { anchorCol: c, deltaX: d } = e, g = a.getColumnWidth(c) + d, m = s.length === 1 && s[0].range.rangeType === H.ALL, f = s.filter((K) => K.range.rangeType === H.COLUMN), C = m ? H.ALL : f.some(({ range: K }) => {
9505
9510
  const { startColumn: ue, endColumn: oe } = K;
@@ -9542,7 +9547,7 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9542
9547
  }), T = sr(
9543
9548
  p,
9544
9549
  a
9545
- ), k = o.syncExecuteCommand(
9550
+ ), U = o.syncExecuteCommand(
9546
9551
  Ct.id,
9547
9552
  p
9548
9553
  ), { undos: E, redos: A } = y.generateMutationsOfAutoHeight({
@@ -9555,7 +9560,7 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9555
9560
  id: zn.id,
9556
9561
  params: p
9557
9562
  }), G = L([...N, ...z, ...A], o);
9558
- return k && G.result && r.pushUndoRedo({
9563
+ return U && G.result && r.pushUndoRedo({
9559
9564
  unitID: u,
9560
9565
  undoMutations: [{ id: Ct.id, params: T }, ...b, ...X, ...E],
9561
9566
  redoMutations: [{ id: Ct.id, params: p }, ...N, ...z, ...A]
@@ -9566,7 +9571,7 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9566
9571
  id: "sheet.command.set-worksheet-col-width",
9567
9572
  handler: (n, e) => {
9568
9573
  var y, b, N, T;
9569
- const t = n.get(F), s = n.get(U), o = n.get(V), r = n.get(j), i = (y = e == null ? void 0 : e.ranges) != null && y.length ? e.ranges : (b = t.getCurrentSelections()) == null ? void 0 : b.map((k) => k.range);
9574
+ const t = n.get(F), s = n.get(k), o = n.get(V), r = n.get(j), i = (y = e == null ? void 0 : e.ranges) != null && y.length ? e.ranges : (b = t.getCurrentSelections()) == null ? void 0 : b.map((U) => U.range);
9570
9575
  if (!(i != null && i.length)) return !1;
9571
9576
  const a = P(n.get(M), e);
9572
9577
  if (!a) return !1;
@@ -9588,24 +9593,24 @@ const ed = ["ff", "fs", "tr", "tb"], Se = {
9588
9593
  params: h
9589
9594
  }), w = L([...S.redos, ...I], s);
9590
9595
  if (C && w.result) {
9591
- const k = r.afterCommandExecute({
9596
+ const U = r.afterCommandExecute({
9592
9597
  id: Gn.id,
9593
9598
  params: h
9594
9599
  });
9595
- return L(k.redos, s), o.pushUndoRedo({
9600
+ return L(U.redos, s), o.pushUndoRedo({
9596
9601
  unitID: l,
9597
9602
  undoMutations: [
9598
9603
  ...(N = S.preUndos) != null ? N : [],
9599
9604
  { id: Ct.id, params: f },
9600
9605
  ...S.undos,
9601
- ...k.undos,
9606
+ ...U.undos,
9602
9607
  ...p
9603
9608
  ],
9604
9609
  redoMutations: [
9605
9610
  ...(T = S.preRedos) != null ? T : [],
9606
9611
  { id: Ct.id, params: h },
9607
9612
  ...S.redos,
9608
- ...k.redos,
9613
+ ...U.redos,
9609
9614
  ...I
9610
9615
  ]
9611
9616
  }), !0;
@@ -9618,7 +9623,7 @@ const hd = {
9618
9623
  type: v.COMMAND,
9619
9624
  id: "sheet.command.set-worksheet-column-count",
9620
9625
  handler: (n, e) => {
9621
- const { unitId: t, subUnitId: s, columnCount: o } = e, r = n.get(U), i = n.get(V), a = n.get(M);
9626
+ const { unitId: t, subUnitId: s, columnCount: o } = e, r = n.get(k), i = n.get(V), a = n.get(M);
9622
9627
  if (!P(a, e)) return !1;
9623
9628
  const l = {
9624
9629
  unitId: t,
@@ -9635,7 +9640,7 @@ const hd = {
9635
9640
  type: v.COMMAND,
9636
9641
  id: "sheet.command.set-worksheet-default-style",
9637
9642
  handler: (n, e) => {
9638
- const t = n.get(U), s = n.get(V), { unitId: o } = e, r = mu(n, e);
9643
+ const t = n.get(k), s = n.get(V), { unitId: o } = e, r = mu(n, e);
9639
9644
  return t.syncExecuteCommand(en.id, e) ? (s.pushUndoRedo({
9640
9645
  unitID: o,
9641
9646
  undoMutations: [{ id: en.id, params: r }],
@@ -9643,7 +9648,7 @@ const hd = {
9643
9648
  }), !0) : !1;
9644
9649
  }
9645
9650
  }, mi = (n, e) => {
9646
- const t = tt(n.get(M), e);
9651
+ const t = ye(n.get(M), e);
9647
9652
  if (!t)
9648
9653
  throw new Error("[SetWorksheetHideMutationFactory]: worksheet is null error!");
9649
9654
  const { worksheet: s } = t;
@@ -9666,7 +9671,7 @@ const hd = {
9666
9671
  type: v.COMMAND,
9667
9672
  id: "sheet.command.set-worksheet-hidden",
9668
9673
  handler: (n, e) => {
9669
- const t = n.get(U), s = n.get(V), o = n.get(Bt), r = n.get(Qe), i = P(n.get(M), e);
9674
+ const t = n.get(k), s = n.get(V), o = n.get(Bt), r = n.get(et), i = P(n.get(M), e);
9670
9675
  if (!i) return !1;
9671
9676
  const { workbook: a, worksheet: u, unitId: l, subUnitId: c } = i;
9672
9677
  if (u.getConfig().hidden === te.TRUE) return !1;
@@ -9682,7 +9687,7 @@ const hd = {
9682
9687
  }), !0) : !1;
9683
9688
  }
9684
9689
  }, fd = (n, e) => {
9685
- const t = tt(n.get(M), e);
9690
+ const t = ye(n.get(M), e);
9686
9691
  if (!t)
9687
9692
  throw new Error("[SetWorksheetNameMutationFactory]: worksheet is null error!");
9688
9693
  const { worksheet: s } = t;
@@ -9706,7 +9711,7 @@ const hd = {
9706
9711
  id: "sheet.command.set-worksheet-name",
9707
9712
  handler: (n, e) => {
9708
9713
  var m, f;
9709
- const t = n.get(U), s = n.get(V), o = n.get(j), r = P(n.get(M), e);
9714
+ const t = n.get(k), s = n.get(V), o = n.get(j), r = P(n.get(M), e);
9710
9715
  if (!r) return !1;
9711
9716
  const { unitId: i, subUnitId: a } = r, u = {
9712
9717
  subUnitId: a,
@@ -9750,7 +9755,7 @@ const hd = {
9750
9755
  type: v.COMMAND,
9751
9756
  id: "sheet.command.set-worksheet-order",
9752
9757
  handler: (n, e) => {
9753
- const t = n.get(U), s = n.get(V), o = P(n.get(M), e);
9758
+ const t = n.get(k), s = n.get(V), o = P(n.get(M), e);
9754
9759
  if (!o) return !1;
9755
9760
  const { workbook: r, unitId: i, subUnitId: a } = o, l = {
9756
9761
  fromOrder: r.getConfig().sheetOrder.indexOf(a),
@@ -9768,7 +9773,7 @@ const hd = {
9768
9773
  class yn {
9769
9774
  constructor() {
9770
9775
  R(this, "_model", /* @__PURE__ */ new Map());
9771
- R(this, "_pointChange", new Ae());
9776
+ R(this, "_pointChange", new xe());
9772
9777
  R(this, "pointChange$", this._pointChange.asObservable());
9773
9778
  }
9774
9779
  addRule(e) {
@@ -9846,11 +9851,11 @@ class Ci {
9846
9851
  this.unitId = e, this.subUnitId = t, this.permissionId = s, this.id = `${x.SelectRange}.${_.ManageCollaborator}.${s}`;
9847
9852
  }
9848
9853
  }
9849
- const Ee = () => [zs, Le, Ci, Ri], vt = [_.Edit, _.View, _.ManageCollaborator, _.Delete], pg = (n = "unitId", e = "subUnitId", t = "permissionId") => Ee().reduce((s, o) => {
9854
+ const ke = () => [zs, He, Ci, Ri], vt = [_.Edit, _.View, _.ManageCollaborator, _.Delete], pg = (n = "unitId", e = "subUnitId", t = "permissionId") => ke().reduce((s, o) => {
9850
9855
  const r = new o(n, e, t);
9851
9856
  return s[r.subType] = r.value, s;
9852
9857
  }, {}), Cn = () => [
9853
- Ne,
9858
+ Oe,
9854
9859
  Cr,
9855
9860
  cr,
9856
9861
  wr,
@@ -9895,20 +9900,20 @@ const Ee = () => [zs, Le, Ci, Ri], vt = [_.Edit, _.View, _.ManageCollaborator, _
9895
9900
  _.InsertColumn,
9896
9901
  _.DeleteRow,
9897
9902
  _.DeleteColumn
9898
- ], be = () => [
9899
- He,
9903
+ ], Ee = () => [
9904
+ Fe,
9900
9905
  ms,
9901
9906
  Pr,
9902
9907
  _r
9903
- ], Fe = () => [
9908
+ ], Be = () => [
9904
9909
  vr,
9905
9910
  Mr,
9906
9911
  yr,
9907
9912
  br,
9908
9913
  Er,
9909
- Ur,
9910
- Tr,
9911
9914
  kr,
9915
+ Tr,
9916
+ Ur,
9912
9917
  Nr,
9913
9918
  Or,
9914
9919
  Wn,
@@ -9945,7 +9950,7 @@ let Jn = class extends jo {
9945
9950
  const n = (e) => {
9946
9951
  const t = e.getUnitId(), s = (o) => {
9947
9952
  const r = o.getSheetId();
9948
- [...be(), ...Fe()].forEach((i) => {
9953
+ [...Ee(), ...Be()].forEach((i) => {
9949
9954
  const a = new i(t, r);
9950
9955
  this._permissionService.addPermissionPoint(a);
9951
9956
  }), this._logService.debug("[WorksheetPermissionService]", "Initialization completed", t, r);
@@ -9957,11 +9962,11 @@ let Jn = class extends jo {
9957
9962
  }), e.sheetDisposed$.subscribe((o) => {
9958
9963
  const r = o.getSheetId();
9959
9964
  this._rangeProtectionRuleModel.getSubunitRuleList(t, r).forEach((a) => {
9960
- [...Ee()].forEach((u) => {
9965
+ [...ke()].forEach((u) => {
9961
9966
  const l = new u(t, r, a.permissionId);
9962
9967
  this._permissionService.deletePermissionPoint(l.id);
9963
9968
  });
9964
- }), [...be(), ...Fe()].forEach((a) => {
9969
+ }), [...Ee(), ...Be()].forEach((a) => {
9965
9970
  const u = new a(t, r);
9966
9971
  this._permissionService.deletePermissionPoint(u.id);
9967
9972
  });
@@ -9972,7 +9977,7 @@ let Jn = class extends jo {
9972
9977
  }), this._univerInstanceService.getTypeOfUnitAdded$(B.UNIVER_SHEET).pipe(uo(this.dispose$)).subscribe(n), this._univerInstanceService.getTypeOfUnitDisposed$(B.UNIVER_SHEET).pipe(uo(this.dispose$)).subscribe((e) => {
9973
9978
  e.getSheets().forEach((t) => {
9974
9979
  const s = e.getUnitId(), o = t.getSheetId();
9975
- be().forEach((r) => {
9980
+ Ee().forEach((r) => {
9976
9981
  const i = new r(s, o);
9977
9982
  this._permissionService.deletePermissionPoint(i.id);
9978
9983
  });
@@ -9986,14 +9991,14 @@ let Jn = class extends jo {
9986
9991
  case "add":
9987
9992
  break;
9988
9993
  case "delete": {
9989
- be().forEach((e) => {
9994
+ Ee().forEach((e) => {
9990
9995
  const t = new e(n.unitId, n.subUnitId);
9991
9996
  this._permissionService.updatePermissionPoint(t.id, !0);
9992
9997
  });
9993
9998
  break;
9994
9999
  }
9995
10000
  case "set": {
9996
- be().forEach((e) => {
10001
+ Ee().forEach((e) => {
9997
10002
  const t = new e(n.unitId, n.subUnitId);
9998
10003
  this._permissionService.updatePermissionPoint(t.id, n.rule);
9999
10004
  });
@@ -10024,7 +10029,7 @@ let Jn = class extends jo {
10024
10029
  businesses: [$n.UNIVER_SHEET],
10025
10030
  onLoad: (t, s) => {
10026
10031
  this._worksheetProtectionRuleModel.fromObject(s), Object.keys(s).forEach((o) => {
10027
- be().forEach((r) => {
10032
+ Ee().forEach((r) => {
10028
10033
  const i = new r(t, o);
10029
10034
  i.value = !1, this._permissionService.addPermissionPoint(i);
10030
10035
  });
@@ -10034,7 +10039,7 @@ let Jn = class extends jo {
10034
10039
  const s = this._univerInstanceService.getUnit(t);
10035
10040
  s && (s.getSheets().forEach((o) => {
10036
10041
  const r = o.getSheetId();
10037
- [...be(), ...Fe()].forEach((i) => {
10042
+ [...Ee(), ...Be()].forEach((i) => {
10038
10043
  const a = new i(t, r);
10039
10044
  this._permissionService.deletePermissionPoint(a.id);
10040
10045
  });
@@ -10067,7 +10072,7 @@ let Jn = class extends jo {
10067
10072
  businesses: [$n.UNIVER_SHEET],
10068
10073
  onLoad: (t, s) => {
10069
10074
  this._worksheetProtectionPointRuleModel.fromObject(s), Object.keys(s).forEach((o) => {
10070
- Fe().forEach((r) => {
10075
+ Be().forEach((r) => {
10071
10076
  const i = new r(t, o);
10072
10077
  this._permissionService.addPermissionPoint(i);
10073
10078
  });
@@ -10081,7 +10086,7 @@ let Jn = class extends jo {
10081
10086
  }
10082
10087
  };
10083
10088
  Jn = Sd([
10084
- ht(0, $(et)),
10089
+ ht(0, $(tt)),
10085
10090
  ht(1, $(M)),
10086
10091
  ht(2, $(cs)),
10087
10092
  ht(3, $(dt)),
@@ -10103,7 +10108,7 @@ const oo = {
10103
10108
  async handler(n, e) {
10104
10109
  if (!e)
10105
10110
  return !1;
10106
- const t = n.get(U), { rule: s } = e;
10111
+ const t = n.get(k), { rule: s } = e;
10107
10112
  return t.executeCommand(oo.id, {
10108
10113
  rule: s,
10109
10114
  unitId: s.unitId,
@@ -10116,13 +10121,13 @@ const oo = {
10116
10121
  async handler(n, e) {
10117
10122
  if (!e)
10118
10123
  return !1;
10119
- const t = n.get(U), s = n.get(V), { rule: o, permissionId: r, oldRule: i } = e, { unitId: a, subUnitId: u } = o, l = { ...o, permissionId: r };
10120
- if (await t.executeCommand(kt.id, {
10124
+ const t = n.get(k), s = n.get(V), { rule: o, permissionId: r, oldRule: i } = e, { unitId: a, subUnitId: u } = o, l = { ...o, permissionId: r };
10125
+ if (await t.executeCommand(Ut.id, {
10121
10126
  unitId: a,
10122
10127
  subUnitId: u,
10123
10128
  newRule: l
10124
10129
  })) {
10125
- const d = [{ id: kt.id, params: { unitId: a, subUnitId: u, newRule: l } }], h = [{ id: kt.id, params: { unitId: a, subUnitId: u, rule: i } }];
10130
+ const d = [{ id: Ut.id, params: { unitId: a, subUnitId: u, newRule: l } }], h = [{ id: Ut.id, params: { unitId: a, subUnitId: u, rule: i } }];
10126
10131
  s.pushUndoRedo({
10127
10132
  unitID: a,
10128
10133
  redoMutations: d,
@@ -10153,7 +10158,7 @@ const oo = {
10153
10158
  id: "sheet.command.set-worksheet-right-to-left",
10154
10159
  handler: async (n, e) => {
10155
10160
  var d;
10156
- const t = n.get(U), s = n.get(V), o = P(n.get(M), e);
10161
+ const t = n.get(k), s = n.get(V), o = P(n.get(M), e);
10157
10162
  if (!o) return !1;
10158
10163
  const { unitId: r, subUnitId: i } = o;
10159
10164
  let a = te.FALSE;
@@ -10181,7 +10186,7 @@ const oo = {
10181
10186
  type: v.COMMAND,
10182
10187
  id: "sheet.command.set-worksheet-row-count",
10183
10188
  handler: (n, e) => {
10184
- const { unitId: t, subUnitId: s, rowCount: o } = e, r = n.get(U), i = n.get(V), a = n.get(M);
10189
+ const { unitId: t, subUnitId: s, rowCount: o } = e, r = n.get(k), i = n.get(V), a = n.get(M);
10185
10190
  if (!P(a, e)) return !1;
10186
10191
  const l = {
10187
10192
  unitId: t,
@@ -10199,7 +10204,7 @@ const oo = {
10199
10204
  id: "sheet.command.delta-row-height",
10200
10205
  // eslint-disable-next-line max-lines-per-function
10201
10206
  handler: async (n, e) => {
10202
- var k, E;
10207
+ var U, E;
10203
10208
  const s = n.get(F).getCurrentSelections(), o = n.get(j);
10204
10209
  if (!(s != null && s.length))
10205
10210
  return !1;
@@ -10243,7 +10248,7 @@ const oo = {
10243
10248
  subUnitId: a,
10244
10249
  ranges: C.ranges,
10245
10250
  autoHeightInfo: te.FALSE
10246
- }, S = Hs(I, i), w = n.get(U), y = n.get(V), b = o.onCommandExecute({
10251
+ }, S = Hs(I, i), w = n.get(k), y = n.get(V), b = o.onCommandExecute({
10247
10252
  id: qn.id,
10248
10253
  params: C
10249
10254
  }), N = L([
@@ -10252,7 +10257,7 @@ const oo = {
10252
10257
  params: C
10253
10258
  },
10254
10259
  {
10255
- id: Be.id,
10260
+ id: je.id,
10256
10261
  params: I
10257
10262
  }
10258
10263
  ], w), T = L([...b.redos], w);
@@ -10264,13 +10269,13 @@ const oo = {
10264
10269
  return L(A.redos, w), y.pushUndoRedo({
10265
10270
  unitID: u,
10266
10271
  undoMutations: [
10267
- ...(k = b.preUndos) != null ? k : [],
10272
+ ...(U = b.preUndos) != null ? U : [],
10268
10273
  {
10269
10274
  id: ot.id,
10270
10275
  params: p
10271
10276
  },
10272
10277
  {
10273
- id: Be.id,
10278
+ id: je.id,
10274
10279
  params: S
10275
10280
  },
10276
10281
  ...b.undos,
@@ -10283,7 +10288,7 @@ const oo = {
10283
10288
  params: C
10284
10289
  },
10285
10290
  {
10286
- id: Be.id,
10291
+ id: je.id,
10287
10292
  params: I
10288
10293
  },
10289
10294
  ...b.redos,
@@ -10299,7 +10304,7 @@ const oo = {
10299
10304
  // eslint-disable-next-line max-lines-per-function
10300
10305
  handler: (n, e) => {
10301
10306
  var S, w, y, b;
10302
- const t = n.get(F), s = n.get(U), o = n.get(V), r = n.get(M), i = n.get(j), a = (S = e == null ? void 0 : e.ranges) != null && S.length ? e.ranges : (w = t.getCurrentSelections()) == null ? void 0 : w.map((N) => N.range);
10307
+ const t = n.get(F), s = n.get(k), o = n.get(V), r = n.get(M), i = n.get(j), a = (S = e == null ? void 0 : e.ranges) != null && S.length ? e.ranges : (w = t.getCurrentSelections()) == null ? void 0 : w.map((N) => N.range);
10303
10308
  if (!(a != null && a.length))
10304
10309
  return !1;
10305
10310
  const u = P(r, e);
@@ -10320,7 +10325,7 @@ const oo = {
10320
10325
  params: h
10321
10326
  },
10322
10327
  {
10323
- id: Be.id,
10328
+ id: je.id,
10324
10329
  params: m
10325
10330
  }
10326
10331
  ], s), p = i.onCommandExecute({
@@ -10341,7 +10346,7 @@ const oo = {
10341
10346
  params: g
10342
10347
  },
10343
10348
  {
10344
- id: Be.id,
10349
+ id: je.id,
10345
10350
  params: f
10346
10351
  },
10347
10352
  ...p.undos,
@@ -10354,7 +10359,7 @@ const oo = {
10354
10359
  params: h
10355
10360
  },
10356
10361
  {
10357
- id: Be.id,
10362
+ id: je.id,
10358
10363
  params: m
10359
10364
  },
10360
10365
  ...p.redos,
@@ -10369,9 +10374,9 @@ const oo = {
10369
10374
  id: "sheet.command.set-row-is-auto-height",
10370
10375
  handler: (n, e) => {
10371
10376
  var N, T;
10372
- const t = n.get(U), s = n.get(V), o = n.get(F), r = n.get(M), i = P(r, e);
10377
+ const t = n.get(k), s = n.get(V), o = n.get(F), r = n.get(M), i = P(r, e);
10373
10378
  if (!i) return !1;
10374
- const { unitId: a, subUnitId: u, worksheet: l } = i, c = (N = e == null ? void 0 : e.ranges) != null && N.length ? e.ranges : (T = o.getCurrentSelections()) == null ? void 0 : T.map((k) => k.range);
10379
+ const { unitId: a, subUnitId: u, worksheet: l } = i, c = (N = e == null ? void 0 : e.ranges) != null && N.length ? e.ranges : (T = o.getCurrentSelections()) == null ? void 0 : T.map((U) => U.range);
10375
10380
  if (!(c != null && c.length))
10376
10381
  return !1;
10377
10382
  const d = {
@@ -10381,7 +10386,7 @@ const oo = {
10381
10386
  autoHeightInfo: te.TRUE
10382
10387
  // Hard code first, maybe it will change by the menu item in the future.
10383
10388
  }, h = Hs(d, l), g = t.syncExecuteCommand(
10384
- Be.id,
10389
+ je.id,
10385
10390
  d
10386
10391
  ), m = n.get(ut).getSkeleton(a, u), { suitableRanges: f, remainingRanges: C } = Mn(d.ranges, m), p = n.get(j), { undos: I, redos: S } = p.generateMutationsOfAutoHeight({
10387
10392
  unitId: a,
@@ -10395,8 +10400,8 @@ const oo = {
10395
10400
  }), b = L([...y, ...S], t);
10396
10401
  return g && b.result ? (s.pushUndoRedo({
10397
10402
  unitID: a,
10398
- undoMutations: [{ id: Be.id, params: h }, ...w, ...I],
10399
- redoMutations: [{ id: Be.id, params: d }, ...y, ...S]
10403
+ undoMutations: [{ id: je.id, params: h }, ...w, ...I],
10404
+ redoMutations: [{ id: je.id, params: d }, ...y, ...S]
10400
10405
  }), !0) : !1;
10401
10406
  }
10402
10407
  }, pi = {
@@ -10407,7 +10412,7 @@ const oo = {
10407
10412
  if (!t) return !1;
10408
10413
  const { unitId: s, subUnitId: o, worksheet: r } = t;
10409
10414
  if (r.getConfig().hidden === te.FALSE) return !1;
10410
- const a = n.get(U), u = n.get(V), l = {
10415
+ const a = n.get(k), u = n.get(V), l = {
10411
10416
  unitId: s,
10412
10417
  subUnitId: o,
10413
10418
  hidden: te.FALSE
@@ -10440,9 +10445,9 @@ const oo = {
10440
10445
  const { unitId: s, subUnitId: o, worksheet: r } = t, { range: i, delimiter: a, customDelimiter: u, treatMultipleDelimitersAsOne: l } = e, { lastRow: c, rs: d, maxLength: h } = Du(r, i, a, u, l), g = r.getColumnCount(), { startColumn: m } = Y.transformRange(i, r);
10441
10446
  if (i.startColumn !== i.endColumn)
10442
10447
  return !1;
10443
- const f = n.get(U), C = n.get(V), p = [], I = [], S = m + h + 1 - g;
10448
+ const f = n.get(k), C = n.get(V), p = [], I = [], S = m + h + 1 - g;
10444
10449
  if (S > 0) {
10445
- const k = {
10450
+ const U = {
10446
10451
  unitId: s,
10447
10452
  subUnitId: o,
10448
10453
  range: {
@@ -10453,12 +10458,12 @@ const oo = {
10453
10458
  }
10454
10459
  };
10455
10460
  p.push({
10456
- id: ke.id,
10457
- params: k
10461
+ id: Te.id,
10462
+ params: U
10458
10463
  });
10459
10464
  const E = ds(
10460
10465
  n,
10461
- k
10466
+ U
10462
10467
  );
10463
10468
  I.push({ id: Me.id, params: E });
10464
10469
  }
@@ -10468,10 +10473,10 @@ const oo = {
10468
10473
  startColumn: m,
10469
10474
  endColumn: m + h
10470
10475
  }, y = new q();
10471
- for (let k = w.startRow; k <= w.endRow; k++)
10476
+ for (let U = w.startRow; U <= w.endRow; U++)
10472
10477
  for (let E = w.startColumn; E <= w.endColumn; E++) {
10473
- const A = d[k - w.startRow];
10474
- E === 0 && (A == null ? void 0 : A.length) === 1 ? y.setValue(k, E, r.getCell(k, E)) : y.setValue(k, E, {
10478
+ const A = d[U - w.startRow];
10479
+ E === 0 && (A == null ? void 0 : A.length) === 1 ? y.setValue(U, E, r.getCell(U, E)) : y.setValue(U, E, {
10475
10480
  v: (A == null ? void 0 : A[E - w.startColumn]) || null,
10476
10481
  p: null,
10477
10482
  f: null,
@@ -10483,7 +10488,7 @@ const oo = {
10483
10488
  unitId: s,
10484
10489
  subUnitId: o,
10485
10490
  cellValue: y.clone()
10486
- }, N = xe(n, b);
10491
+ }, N = $e(n, b);
10487
10492
  return p.push({
10488
10493
  id: ee.id,
10489
10494
  params: b
@@ -10502,7 +10507,7 @@ const oo = {
10502
10507
  handler: (n, e) => {
10503
10508
  if (!e)
10504
10509
  return !1;
10505
- const { unitId: t, subUnitId: s, row: o, col: r, paragraphIndex: i } = e, u = n.get(M).getUnit(t, B.UNIVER_SHEET), l = u == null ? void 0 : u.getSheetBySheetId(s), c = n.get(V), d = n.get(U);
10510
+ const { unitId: t, subUnitId: s, row: o, col: r, paragraphIndex: i } = e, u = n.get(M).getUnit(t, B.UNIVER_SHEET), l = u == null ? void 0 : u.getSheetBySheetId(s), c = n.get(V), d = n.get(k);
10506
10511
  if (!l)
10507
10512
  return !1;
10508
10513
  const h = l.getCell(o, r);
@@ -10529,7 +10534,7 @@ const oo = {
10529
10534
  }, p = {
10530
10535
  id: ee.id,
10531
10536
  params: C
10532
- }, I = xe(n, C), S = {
10537
+ }, I = $e(n, C), S = {
10533
10538
  id: ee.id,
10534
10539
  params: I
10535
10540
  }, w = [p], y = [S];
@@ -10539,11 +10544,11 @@ const oo = {
10539
10544
  unitID: t
10540
10545
  }), d.syncExecuteCommand(p.id, p.params);
10541
10546
  }
10542
- }, Ud = {
10547
+ }, kd = {
10543
10548
  type: v.COMMAND,
10544
10549
  id: "sheet.command.toggle-gridlines",
10545
10550
  handler: (n, e) => {
10546
- const t = n.get(U), s = n.get(V), o = P(n.get(M), e);
10551
+ const t = n.get(k), s = n.get(V), o = P(n.get(M), e);
10547
10552
  if (!o) return !1;
10548
10553
  const { worksheet: r } = o, i = r.getConfig().showGridlines;
10549
10554
  if (i === (e == null ? void 0 : e.showGridlines)) return !1;
@@ -10562,13 +10567,13 @@ const oo = {
10562
10567
  redoMutations: [{ id: nn.id, params: l }]
10563
10568
  }), !0) : !1;
10564
10569
  }
10565
- }, kd = {
10570
+ }, Ud = {
10566
10571
  id: "sheet.command.unregister-worksheet-range-theme-style",
10567
10572
  type: v.COMMAND,
10568
10573
  handler: (n, e) => {
10569
10574
  var d;
10570
10575
  if (!e || !P(n.get(M), e)) return !1;
10571
- const s = n.get(U), o = n.get(V), r = n.get(ve), { unitId: i, themeName: a } = e, u = {
10576
+ const s = n.get(k), o = n.get(V), r = n.get(ve), { unitId: i, themeName: a } = e, u = {
10572
10577
  unitId: i,
10573
10578
  themeName: a
10574
10579
  }, l = {
@@ -10718,7 +10723,7 @@ var Vd = Object.getOwnPropertyDescriptor, Ld = (n, e, t, s) => {
10718
10723
  for (var o = s > 1 ? void 0 : s ? Vd(e, t) : e, r = n.length - 1, i; r >= 0; r--)
10719
10724
  (i = n[r]) && (o = i(o) || o);
10720
10725
  return o;
10721
- }, ko = (n, e) => (t, s) => e(t, s, n);
10726
+ }, Uo = (n, e) => (t, s) => e(t, s, n);
10722
10727
  const Hd = "SHEET_DEFINED_NAME_PLUGIN", vg = "AllDefaultWorkbook";
10723
10728
  let Xn = class extends ae {
10724
10729
  constructor(n, e) {
@@ -10757,8 +10762,8 @@ let Xn = class extends ae {
10757
10762
  }
10758
10763
  };
10759
10764
  Xn = Ld([
10760
- ko(0, Zo),
10761
- ko(1, wn)
10765
+ Uo(0, Zo),
10766
+ Uo(1, wn)
10762
10767
  ], Xn);
10763
10768
  var Fd = Object.getOwnPropertyDescriptor, Bd = (n, e, t, s) => {
10764
10769
  for (var o = s > 1 ? void 0 : s ? Fd(e, t) : e, r = n.length - 1, i; r >= 0; r--)
@@ -10769,11 +10774,11 @@ const jd = [
10769
10774
  rt.id
10770
10775
  ], zd = [
10771
10776
  Ue.id,
10772
- ke.id,
10773
10777
  Te.id,
10778
+ Pe.id,
10774
10779
  Me.id,
10775
- qe.id,
10776
- Ye.id
10780
+ Ye.id,
10781
+ Xe.id
10777
10782
  ];
10778
10783
  let Zn = class extends ae {
10779
10784
  constructor(e, t, s) {
@@ -10800,7 +10805,7 @@ let Zn = class extends ae {
10800
10805
  this._commandService.onCommandExecuted((e, t) => {
10801
10806
  if (zd.includes(e.id) && (t != null && t.fromCollab)) {
10802
10807
  const { id: s, params: o } = e;
10803
- s === Ue.id ? this._handleInsertRowMutation(o, t) : s === ke.id ? this._handleInsertColMutation(o, t) : s === Te.id ? this._handleRemoveRowMutation(o, t) : s === Me.id ? this._handleRemoveColMutation(o, t) : s === qe.id ? this._handleMoveRowsMutation(o, t) : s === Ye.id && this._handleMoveColsMutation(o, t);
10808
+ s === Ue.id ? this._handleInsertRowMutation(o, t) : s === Te.id ? this._handleInsertColMutation(o, t) : s === Pe.id ? this._handleRemoveRowMutation(o, t) : s === Me.id ? this._handleRemoveColMutation(o, t) : s === Ye.id ? this._handleMoveRowsMutation(o, t) : s === Xe.id && this._handleMoveColsMutation(o, t);
10804
10809
  }
10805
10810
  })
10806
10811
  );
@@ -10891,19 +10896,19 @@ let Zn = class extends ae {
10891
10896
  };
10892
10897
  Zn = Bd([
10893
10898
  _s(0, $(M)),
10894
- _s(1, U),
10899
+ _s(1, k),
10895
10900
  _s(2, In)
10896
10901
  ], Zn);
10897
10902
  var Gd = Object.getOwnPropertyDescriptor, Kd = (n, e, t, s) => {
10898
10903
  for (var o = s > 1 ? void 0 : s ? Gd(e, t) : e, r = n.length - 1, i; r >= 0; r--)
10899
10904
  (i = n[r]) && (o = i(o) || o);
10900
10905
  return o;
10901
- }, Ge = (n, e) => (t, s) => e(t, s, n);
10906
+ }, Ke = (n, e) => (t, s) => e(t, s, n);
10902
10907
  let Qn = class extends ae {
10903
10908
  constructor(e, t, s, o, r, i, a, u, l, c) {
10904
10909
  super();
10905
10910
  R(this, "disposableCollection", new Tt());
10906
- R(this, "_triggerPermissionUIEvent$", new Ae());
10911
+ R(this, "_triggerPermissionUIEvent$", new xe());
10907
10912
  R(this, "triggerPermissionUIEvent$", this._triggerPermissionUIEvent$.asObservable());
10908
10913
  this._commandService = e, this._univerInstanceService = t, this._permissionService = s, this._selectionManagerService = o, this._rangeProtectionRuleModel = r, this._worksheetProtectionRuleModel = i, this._localeService = a, this._lexerTreeBuilder = u, this._contextService = l, this._definedNamesService = c, this._initialize();
10909
10914
  }
@@ -10915,17 +10920,17 @@ let Qn = class extends ae {
10915
10920
  switch (e) {
10916
10921
  case vn.id:
10917
10922
  Ko(t.value) && t.value.f ? (s = this._permissionCheckWithFormula(t), o = this._localeService.t("permission.dialog.formulaErr")) : s = this._permissionCheckBySetRangeValue({
10918
- workbookTypes: [Ne],
10919
- rangeTypes: [Le],
10920
- worksheetTypes: [Wn, He]
10923
+ workbookTypes: [Oe],
10924
+ rangeTypes: [He],
10925
+ worksheetTypes: [Wn, Fe]
10921
10926
  }, t);
10922
10927
  break;
10923
10928
  case Qs.id:
10924
10929
  s = this.permissionCheckWithRanges(
10925
10930
  {
10926
- workbookTypes: [Ne],
10927
- rangeTypes: [Le],
10928
- worksheetTypes: [Wn, He]
10931
+ workbookTypes: [Oe],
10932
+ rangeTypes: [He],
10933
+ worksheetTypes: [Wn, Fe]
10929
10934
  },
10930
10935
  t == null ? void 0 : t.ranges,
10931
10936
  t == null ? void 0 : t.unitId,
@@ -10949,27 +10954,27 @@ let Qn = class extends ae {
10949
10954
  case hn.id:
10950
10955
  s = this._permissionCheckByMoveCommand(t), o = this._localeService.t("permission.dialog.moveRowColErr");
10951
10956
  break;
10952
- case Ut.id:
10957
+ case kt.id:
10953
10958
  s = this._permissionCheckByMoveRangeCommand(t), o = this._localeService.t("permission.dialog.moveRangeErr");
10954
10959
  break;
10955
10960
  case fi.id:
10956
- s = this._permissionCheckByWorksheetCommand([Ne, Js]), o = this._localeService.t("permission.dialog.operatorSheetErr"), s === !1 && this._worksheetProtectionRuleModel.resetOrder();
10961
+ s = this._permissionCheckByWorksheetCommand([Oe, Js]), o = this._localeService.t("permission.dialog.operatorSheetErr"), s === !1 && this._worksheetProtectionRuleModel.resetOrder();
10957
10962
  break;
10958
10963
  case so.id:
10959
- s = this._permissionCheckByWorksheetCommand([Ne, qs]), o = this._localeService.t("permission.dialog.operatorSheetErr"), s === !1 && this._worksheetProtectionRuleModel.resetOrder();
10964
+ s = this._permissionCheckByWorksheetCommand([Oe, qs]), o = this._localeService.t("permission.dialog.operatorSheetErr"), s === !1 && this._worksheetProtectionRuleModel.resetOrder();
10960
10965
  break;
10961
10966
  case pi.id:
10962
10967
  {
10963
10968
  const { unitId: r, subUnitId: i } = t;
10964
- s = this._permissionCheckByWorksheetCommand([Ne, Gs], r, i), o = this._localeService.t("permission.dialog.operatorSheetErr"), s === !1 && this._worksheetProtectionRuleModel.resetOrder();
10969
+ s = this._permissionCheckByWorksheetCommand([Oe, Gs], r, i), o = this._localeService.t("permission.dialog.operatorSheetErr"), s === !1 && this._worksheetProtectionRuleModel.resetOrder();
10965
10970
  }
10966
10971
  break;
10967
10972
  case fn.id:
10968
10973
  s = this.permissionCheckWithRanges(
10969
10974
  {
10970
- workbookTypes: [Ne],
10971
- rangeTypes: [Le],
10972
- worksheetTypes: [He, sn]
10975
+ workbookTypes: [Oe],
10976
+ rangeTypes: [He],
10977
+ worksheetTypes: [Fe, sn]
10973
10978
  },
10974
10979
  t.ranges,
10975
10980
  t.unitId,
@@ -10979,9 +10984,9 @@ let Qn = class extends ae {
10979
10984
  case Rn.id:
10980
10985
  s = this.permissionCheckWithRanges(
10981
10986
  {
10982
- workbookTypes: [Ne],
10983
- rangeTypes: [Le],
10984
- worksheetTypes: [He, on]
10987
+ workbookTypes: [Oe],
10988
+ rangeTypes: [He],
10989
+ worksheetTypes: [Fe, on]
10985
10990
  },
10986
10991
  t.ranges,
10987
10992
  t.unitId,
@@ -10990,16 +10995,16 @@ let Qn = class extends ae {
10990
10995
  break;
10991
10996
  case ri.id:
10992
10997
  s = this.permissionCheckWithRanges({
10993
- workbookTypes: [Ne],
10994
- rangeTypes: [Le],
10995
- worksheetTypes: [He, sn]
10998
+ workbookTypes: [Oe],
10999
+ rangeTypes: [He],
11000
+ worksheetTypes: [Fe, sn]
10996
11001
  }), o = this._localeService.t("permission.dialog.setRowColStyleErr");
10997
11002
  break;
10998
11003
  case li.id:
10999
11004
  s = this.permissionCheckWithRanges({
11000
- workbookTypes: [Ne],
11001
- rangeTypes: [Le],
11002
- worksheetTypes: [He, on]
11005
+ workbookTypes: [Oe],
11006
+ rangeTypes: [He],
11007
+ worksheetTypes: [Fe, on]
11003
11008
  }), o = this._localeService.t("permission.dialog.setRowColStyleErr");
11004
11009
  break;
11005
11010
  case dn.id:
@@ -11072,7 +11077,7 @@ let Qn = class extends ae {
11072
11077
  const I = new p(o, r);
11073
11078
  return ((y = (w = this._permissionService.getPermissionPoint(I.id)) == null ? void 0 : w.value) != null ? y : !1) === !1;
11074
11079
  }) === !0 || d && d.some((p) => {
11075
- var b, N, T, k, E;
11080
+ var b, N, T, U, E;
11076
11081
  const I = (N = (b = s.getCell(a, u)) == null ? void 0 : b.selectionProtection) == null ? void 0 : N[0];
11077
11082
  if (!(I != null && I.ruleId))
11078
11083
  return !1;
@@ -11080,7 +11085,7 @@ let Qn = class extends ae {
11080
11085
  if (!S)
11081
11086
  return !1;
11082
11087
  const w = new p(o, r, S);
11083
- return ((E = (k = this._permissionService.getPermissionPoint(w.id)) == null ? void 0 : k.value) != null ? E : !1) === !1;
11088
+ return ((E = (U = this._permissionService.getPermissionPoint(w.id)) == null ? void 0 : U.value) != null ? E : !1) === !1;
11084
11089
  }) === !0);
11085
11090
  }
11086
11091
  permissionCheckWithRanges(e, t, s, o) {
@@ -11148,8 +11153,8 @@ let Qn = class extends ae {
11148
11153
  return !0;
11149
11154
  const { startRow: w, endRow: y, startColumn: b, endColumn: N } = I.range;
11150
11155
  for (let T = w; T <= y; T++)
11151
- for (let k = b; k <= N; k++) {
11152
- const E = (a = (i = S.getCell(T, k)) == null ? void 0 : i.selectionProtection) == null ? void 0 : a[0];
11156
+ for (let U = b; U <= N; U++) {
11157
+ const E = (a = (i = S.getCell(T, U)) == null ? void 0 : i.selectionProtection) == null ? void 0 : a[0];
11153
11158
  if ((E == null ? void 0 : E[_.View]) === !1)
11154
11159
  return !1;
11155
11160
  }
@@ -11176,9 +11181,9 @@ let Qn = class extends ae {
11176
11181
  }
11177
11182
  if (!w)
11178
11183
  return !0;
11179
- const { startRow: b, endRow: N, startColumn: T, endColumn: k } = I.range;
11184
+ const { startRow: b, endRow: N, startColumn: T, endColumn: U } = I.range;
11180
11185
  for (let E = b; E <= N; E++)
11181
- for (let A = T; A <= k; A++) {
11186
+ for (let A = T; A <= U; A++) {
11182
11187
  const X = (l = (u = w.getCell(E, A)) == null ? void 0 : u.selectionProtection) == null ? void 0 : l[0];
11183
11188
  if ((X == null ? void 0 : X[_.View]) === !1)
11184
11189
  return !1;
@@ -11190,7 +11195,7 @@ let Qn = class extends ae {
11190
11195
  if (s) {
11191
11196
  const c = P(this._univerInstanceService, e);
11192
11197
  if (!c) return !1;
11193
- const { unitId: d, subUnitId: h } = c, m = this._rangeProtectionRuleModel.getSubunitRuleList(d, h).filter((C) => C.ranges.some((p) => O.intersects(p, s))).map((C) => new Le(d, h, C.permissionId).id);
11198
+ const { unitId: d, subUnitId: h } = c, m = this._rangeProtectionRuleModel.getSubunitRuleList(d, h).filter((C) => C.ranges.some((p) => O.intersects(p, s))).map((C) => new He(d, h, C.permissionId).id);
11194
11199
  if (!this._permissionService.composePermission(m).every((C) => C.value))
11195
11200
  return !1;
11196
11201
  }
@@ -11198,16 +11203,16 @@ let Qn = class extends ae {
11198
11203
  }
11199
11204
  };
11200
11205
  Qn = Kd([
11201
- Ge(0, U),
11202
- Ge(1, M),
11203
- Ge(2, et),
11204
- Ge(3, $(F)),
11205
- Ge(4, $(fe)),
11206
- Ge(5, $(dt)),
11207
- Ge(6, $(Qe)),
11208
- Ge(7, $(aa)),
11209
- Ge(8, zo),
11210
- Ge(9, Zo)
11206
+ Ke(0, k),
11207
+ Ke(1, M),
11208
+ Ke(2, tt),
11209
+ Ke(3, $(F)),
11210
+ Ke(4, $(fe)),
11211
+ Ke(5, $(dt)),
11212
+ Ke(6, $(et)),
11213
+ Ke(7, $(aa)),
11214
+ Ke(8, zo),
11215
+ Ke(9, Zo)
11211
11216
  ], Qn);
11212
11217
  var Jd = Object.getOwnPropertyDescriptor, qd = (n, e, t, s) => {
11213
11218
  for (var o = s > 1 ? void 0 : s ? Jd(e, t) : e, r = n.length - 1, i; r >= 0; r--)
@@ -11238,11 +11243,11 @@ let pn = class extends ae {
11238
11243
  t.getSheets().forEach((o) => {
11239
11244
  const r = o.getSheetId();
11240
11245
  this._rangeProtectionRuleModel.getSubunitRuleList(s, r).forEach((a) => {
11241
- [...Ee()].forEach((u) => {
11246
+ [...ke()].forEach((u) => {
11242
11247
  const l = new u(s, r, a.permissionId);
11243
11248
  this._permissionService.deletePermissionPoint(l.id);
11244
11249
  });
11245
- }), [...be(), ...Fe()].forEach((a) => {
11250
+ }), [...Ee(), ...Be()].forEach((a) => {
11246
11251
  const u = new a(s, r);
11247
11252
  this._permissionService.deletePermissionPoint(u.id);
11248
11253
  });
@@ -11257,7 +11262,7 @@ let pn = class extends ae {
11257
11262
  }
11258
11263
  };
11259
11264
  pn = qd([
11260
- Kt(0, $(et)),
11265
+ Kt(0, $(tt)),
11261
11266
  Kt(1, $(M)),
11262
11267
  Kt(2, $(fe)),
11263
11268
  Kt(3, $(dt)),
@@ -11267,7 +11272,7 @@ var Yd = Object.getOwnPropertyDescriptor, Xd = (n, e, t, s) => {
11267
11272
  for (var o = s > 1 ? void 0 : s ? Yd(e, t) : e, r = n.length - 1, i; r >= 0; r--)
11268
11273
  (i = n[r]) && (o = i(o) || o);
11269
11274
  return o;
11270
- }, Ke = (n, e) => (t, s) => e(t, s, n);
11275
+ }, Je = (n, e) => (t, s) => e(t, s, n);
11271
11276
  let es = class extends ae {
11272
11277
  constructor(n, e, t, s, o, r, i, a, u, l) {
11273
11278
  super(), this._univerInstanceService = n, this._permissionService = e, this._authzIoService = t, this._rangeProtectionRuleModel = s, this._worksheetProtectionRuleModel = o, this._userManagerService = r, this._worksheetProtectionPointRuleModel = i, this._workbookPermissionService = a, this._undoRedoService = u, this._commandService = l;
@@ -11301,7 +11306,7 @@ let es = class extends ae {
11301
11306
  if (u) {
11302
11307
  if (!this._rangeProtectionRuleModel.getRule(s, u.subUnitId, u.id))
11303
11308
  return;
11304
- Ee().forEach((c) => {
11309
+ ke().forEach((c) => {
11305
11310
  const d = new c(s, u.subUnitId, a.objectID), h = d.subType, g = a.actions.find((m) => m.action === h);
11306
11311
  (g == null ? void 0 : g.allowed) !== void 0 && this._permissionService.updatePermissionPoint(d.id, g.allowed);
11307
11312
  });
@@ -11320,7 +11325,7 @@ let es = class extends ae {
11320
11325
  objectType: x.SelectRange,
11321
11326
  actions: vt
11322
11327
  }).then((e) => {
11323
- this._rangeProtectionRuleModel.getRule(n.unitId, n.subUnitId, n.rule.id) && (Ee().forEach((s) => {
11328
+ this._rangeProtectionRuleModel.getRule(n.unitId, n.subUnitId, n.rule.id) && (ke().forEach((s) => {
11324
11329
  if (n.type === "set") {
11325
11330
  const { rule: u, oldRule: l } = n;
11326
11331
  if (u.permissionId === (l == null ? void 0 : l.permissionId))
@@ -11329,7 +11334,7 @@ let es = class extends ae {
11329
11334
  const o = n.rule, r = new s(o.unitId, o.subUnitId, o.permissionId), i = r.subType, a = e.find((u) => u.action === i);
11330
11335
  a && this._permissionService.updatePermissionPoint(r.id, a.allowed);
11331
11336
  }), this._rangeProtectionRuleModel.ruleRefresh(n.rule.permissionId));
11332
- }) : this._rangeProtectionRuleModel.getSubunitRuleList(n.unitId, n.subUnitId).length === 0 && (this._worksheetProtectionPointRuleModel.deleteRule(n.unitId, n.subUnitId), [...Fe()].forEach((t) => {
11337
+ }) : this._rangeProtectionRuleModel.getSubunitRuleList(n.unitId, n.subUnitId).length === 0 && (this._worksheetProtectionPointRuleModel.deleteRule(n.unitId, n.subUnitId), [...Be()].forEach((t) => {
11333
11338
  const s = new t(n.unitId, n.subUnitId);
11334
11339
  this._permissionService.updatePermissionPoint(s.id, s.value);
11335
11340
  }));
@@ -11365,11 +11370,11 @@ let es = class extends ae {
11365
11370
  actions: vt
11366
11371
  }).then((e) => {
11367
11372
  const t = this._worksheetProtectionRuleModel.getRule(n.unitId, n.subUnitId);
11368
- !t || t.permissionId !== n.rule.permissionId || (be().forEach((s) => {
11373
+ !t || t.permissionId !== n.rule.permissionId || (Ee().forEach((s) => {
11369
11374
  const o = new s(n.unitId, n.subUnitId), r = o.subType, i = e.find((a) => a.action === r);
11370
11375
  i && this._permissionService.updatePermissionPoint(o.id, i.allowed);
11371
11376
  }), this._worksheetProtectionRuleModel.ruleRefresh(n.rule.permissionId));
11372
- }) : ([...be(), ...Fe()].forEach((e) => {
11377
+ }) : ([...Ee(), ...Be()].forEach((e) => {
11373
11378
  const t = new e(n.unitId, n.subUnitId);
11374
11379
  this._permissionService.updatePermissionPoint(t.id, !0);
11375
11380
  }), this._worksheetProtectionPointRuleModel.deleteRule(n.unitId, n.subUnitId));
@@ -11386,7 +11391,7 @@ let es = class extends ae {
11386
11391
  actions: vs
11387
11392
  }).then((e) => {
11388
11393
  const t = this._worksheetProtectionPointRuleModel.getRule(n.unitId, n.subUnitId);
11389
- !t || t.permissionId !== n.permissionId || Fe().forEach((s) => {
11394
+ !t || t.permissionId !== n.permissionId || Be().forEach((s) => {
11390
11395
  const o = new s(n.unitId, n.subUnitId), r = o.subType, i = e.find((a) => a.action === r);
11391
11396
  i && this._permissionService.updatePermissionPoint(o.id, i.allowed);
11392
11397
  });
@@ -11423,7 +11428,7 @@ let es = class extends ae {
11423
11428
  const l = this._worksheetProtectionRuleModel.getRule(s, u.subUnitId) || this._worksheetProtectionPointRuleModel.getRule(s, u.subUnitId);
11424
11429
  if (!l || l.permissionId !== a.objectID)
11425
11430
  return;
11426
- [...be(), ...Fe()].forEach((c) => {
11431
+ [...Ee(), ...Be()].forEach((c) => {
11427
11432
  const d = new c(s, u.subUnitId), h = d.subType, g = a.actions.find((m) => m.action === h);
11428
11433
  (g == null ? void 0 : g.allowed) !== void 0 && this._permissionService.updatePermissionPoint(d.id, g.allowed);
11429
11434
  });
@@ -11445,11 +11450,11 @@ let es = class extends ae {
11445
11450
  n.has(r.id) && (r = n.get(r.id)), this._permissionService.addPermissionPoint(r);
11446
11451
  }), t.getSheets().forEach((o) => {
11447
11452
  const r = o.getSheetId();
11448
- [...be(), ...Fe()].forEach((a) => {
11453
+ [...Ee(), ...Be()].forEach((a) => {
11449
11454
  let u = new a(s, r);
11450
11455
  n.has(u.id) && (u = n.get(u.id)), this._permissionService.addPermissionPoint(u);
11451
11456
  }), this._rangeProtectionRuleModel.getSubunitRuleList(s, r).forEach((a) => {
11452
- Ee().forEach((u) => {
11457
+ ke().forEach((u) => {
11453
11458
  let l = new u(s, r, a.permissionId);
11454
11459
  n.has(l.id) && (l = n.get(l.id)), this._permissionService.addPermissionPoint(l);
11455
11460
  });
@@ -11473,7 +11478,7 @@ let es = class extends ae {
11473
11478
  if (!this._worksheetProtectionRuleModel.getTargetByPermissionId(n, e))
11474
11479
  return;
11475
11480
  let c = "";
11476
- be().forEach((d) => {
11481
+ Ee().forEach((d) => {
11477
11482
  var f;
11478
11483
  const h = new d(n, a), g = h.subType, m = u.find((C) => C.action === g);
11479
11484
  m && (((f = this._permissionService.getPermissionPoint(h.id)) == null ? void 0 : f.value) !== m.allowed && (s = !0), this._permissionService.updatePermissionPoint(h.id, m.allowed), c += `${m.action}_${m.allowed}`);
@@ -11489,7 +11494,7 @@ let es = class extends ae {
11489
11494
  objectType: x.Worksheet,
11490
11495
  actions: vs
11491
11496
  }).then((u) => {
11492
- this._worksheetProtectionPointRuleModel.getTargetByPermissionId(n, e) && (Fe().forEach((c) => {
11497
+ this._worksheetProtectionPointRuleModel.getTargetByPermissionId(n, e) && (Be().forEach((c) => {
11493
11498
  var m;
11494
11499
  const d = new c(n, a), h = d.subType, g = u.find((f) => f.action === h);
11495
11500
  g && (((m = this._permissionService.getPermissionPoint(d.id)) == null ? void 0 : m.value) !== g.allowed && (s = !0), this._permissionService.updatePermissionPoint(d.id, g.allowed));
@@ -11508,7 +11513,7 @@ let es = class extends ae {
11508
11513
  if (!this._rangeProtectionRuleModel.getTargetByPermissionId(n, e))
11509
11514
  return;
11510
11515
  let c = "";
11511
- Ee().forEach((d) => {
11516
+ ke().forEach((d) => {
11512
11517
  var f;
11513
11518
  const h = new d(n, a, e), g = h.subType, m = u.find((C) => C.action === g);
11514
11519
  m && (((f = this._permissionService.getPermissionPoint(h.id)) == null ? void 0 : f.value) !== m.allowed && (s = !0), this._permissionService.updatePermissionPoint(h.id, m.allowed), c += `${m.action}_${m.allowed}`);
@@ -11519,7 +11524,7 @@ let es = class extends ae {
11519
11524
  _refreshPermissionByCollaCreate() {
11520
11525
  this.disposeWithMe(
11521
11526
  this._commandService.onCommandExecuted((n, e) => {
11522
- if (e != null && e.fromCollab && (n.id === je.id || n.id === bt.id || n.id === oo.id)) {
11527
+ if (e != null && e.fromCollab && (n.id === ze.id || n.id === bt.id || n.id === oo.id)) {
11523
11528
  const t = n.params;
11524
11529
  this._undoRedoService.clearUndoRedo(t.unitId);
11525
11530
  }
@@ -11528,16 +11533,16 @@ let es = class extends ae {
11528
11533
  }
11529
11534
  };
11530
11535
  es = Xd([
11531
- Ke(0, M),
11532
- Ke(1, et),
11533
- Ke(2, zi),
11534
- Ke(3, $(fe)),
11535
- Ke(4, $(dt)),
11536
- Ke(5, $(Gi)),
11537
- Ke(6, $(yn)),
11538
- Ke(7, $(pn)),
11539
- Ke(8, $(V)),
11540
- Ke(9, $(U))
11536
+ Je(0, M),
11537
+ Je(1, tt),
11538
+ Je(2, zi),
11539
+ Je(3, $(fe)),
11540
+ Je(4, $(dt)),
11541
+ Je(5, $(Gi)),
11542
+ Je(6, $(yn)),
11543
+ Je(7, $(pn)),
11544
+ Je(8, $(V)),
11545
+ Je(9, $(k))
11541
11546
  ], es);
11542
11547
  var Zd = Object.getOwnPropertyDescriptor, Qd = (n, e, t, s) => {
11543
11548
  for (var o = s > 1 ? void 0 : s ? Zd(e, t) : e, r = n.length - 1, i; r >= 0; r--)
@@ -11547,7 +11552,7 @@ var Zd = Object.getOwnPropertyDescriptor, Qd = (n, e, t, s) => {
11547
11552
  let ts = class extends ae {
11548
11553
  constructor(e, t, s) {
11549
11554
  super();
11550
- R(this, "_zebraCacheUpdateSubject", new Ae());
11555
+ R(this, "_zebraCacheUpdateSubject", new xe());
11551
11556
  this._commandService = e, this._sheetRangeThemeModel = t, this._univerInstanceService = s, this._init();
11552
11557
  }
11553
11558
  _init() {
@@ -11584,7 +11589,7 @@ let ts = class extends ae {
11584
11589
  s = r.unitId, o = r.subUnitId;
11585
11590
  }
11586
11591
  break;
11587
- case Te.id:
11592
+ case Pe.id:
11588
11593
  {
11589
11594
  const r = e.params;
11590
11595
  s = r.unitId, o = r.subUnitId;
@@ -11609,7 +11614,7 @@ let ts = class extends ae {
11609
11614
  }
11610
11615
  };
11611
11616
  ts = Qd([
11612
- ys(0, $(U)),
11617
+ ys(0, $(k)),
11613
11618
  ys(1, $(ve)),
11614
11619
  ys(2, $(M))
11615
11620
  ], ts);
@@ -11626,7 +11631,7 @@ let Sn = class {
11626
11631
  _init() {
11627
11632
  this._permissionService.permissionPointUpdate$.pipe(
11628
11633
  lo((n) => n.type === x.SelectRange),
11629
- lo((n) => Ee().some((e) => n instanceof e)),
11634
+ lo((n) => ke().some((e) => n instanceof e)),
11630
11635
  Ra((n) => n)
11631
11636
  ).subscribe((n) => {
11632
11637
  const e = this._selectionProtectionRuleModel.getSubunitRuleList(n.unitId, n.subUnitId);
@@ -11665,7 +11670,7 @@ let Sn = class {
11665
11670
  const u = [];
11666
11671
  for (const l of o)
11667
11672
  if (l.ranges.some((c) => c.startRow <= t && c.endRow >= t && c.startColumn <= s && c.endColumn >= s)) {
11668
- const c = Ee().reduce((d, h) => {
11673
+ const c = ke().reduce((d, h) => {
11669
11674
  var f;
11670
11675
  const g = new h(n, e, l.permissionId), m = this._permissionService.getPermissionPoint(g.id);
11671
11676
  return d[g.subType] = (f = m == null ? void 0 : m.value) != null ? f : g.value, d;
@@ -11680,7 +11685,7 @@ let Sn = class {
11680
11685
  };
11681
11686
  Sn = th([
11682
11687
  To(0, $(fe)),
11683
- To(1, $(et))
11688
+ To(1, $(tt))
11684
11689
  ], Sn);
11685
11690
  var nh = Object.getOwnPropertyDescriptor, sh = (n, e, t, s) => {
11686
11691
  for (var o = s > 1 ? void 0 : s ? nh(e, t) : e, r = n.length - 1, i; r >= 0; r--)
@@ -11709,7 +11714,7 @@ let Ft = class extends ae {
11709
11714
  _initUpdateCellInfoCache() {
11710
11715
  this._permissionService.permissionPointUpdate$.pipe(
11711
11716
  ao((e) => e.type === x.SelectRange),
11712
- ks((e) => e)
11717
+ Us((e) => e)
11713
11718
  ).subscribe((e) => {
11714
11719
  const { subUnitId: t, unitId: s, permissionId: o } = e, r = this._permissionIdCache.get(o);
11715
11720
  if (!r)
@@ -11782,7 +11787,7 @@ let Ft = class extends ae {
11782
11787
  }
11783
11788
  _getSelectionActions(e, t, s) {
11784
11789
  var l, c, d, h, g, m, f, C, p, I, S, w;
11785
- const o = (d = (c = this._permissionService.getPermissionPoint((l = new Le(e, t, s.permissionId)) == null ? void 0 : l.id)) == null ? void 0 : c.value) != null ? d : !1, r = (m = (g = this._permissionService.getPermissionPoint((h = new zs(e, t, s.permissionId)) == null ? void 0 : h.id)) == null ? void 0 : g.value) != null ? m : !1, i = (p = (C = this._permissionService.getPermissionPoint((f = new Ci(e, t, s.permissionId)) == null ? void 0 : f.id)) == null ? void 0 : C.value) != null ? p : !1, a = (w = (S = this._permissionService.getPermissionPoint((I = new Ri(e, t, s.permissionId)) == null ? void 0 : I.id)) == null ? void 0 : S.value) != null ? w : !1;
11790
+ const o = (d = (c = this._permissionService.getPermissionPoint((l = new He(e, t, s.permissionId)) == null ? void 0 : l.id)) == null ? void 0 : c.value) != null ? d : !1, r = (m = (g = this._permissionService.getPermissionPoint((h = new zs(e, t, s.permissionId)) == null ? void 0 : h.id)) == null ? void 0 : g.value) != null ? m : !1, i = (p = (C = this._permissionService.getPermissionPoint((f = new Ci(e, t, s.permissionId)) == null ? void 0 : f.id)) == null ? void 0 : C.value) != null ? p : !1, a = (w = (S = this._permissionService.getPermissionPoint((I = new Ri(e, t, s.permissionId)) == null ? void 0 : I.id)) == null ? void 0 : S.value) != null ? w : !1;
11786
11791
  return {
11787
11792
  [_.Edit]: o,
11788
11793
  [_.View]: r,
@@ -11843,7 +11848,7 @@ let Ft = class extends ae {
11843
11848
  _initUpdateRowColInfoCache() {
11844
11849
  this._permissionService.permissionPointUpdate$.pipe(
11845
11850
  ao((e) => e.type === x.SelectRange),
11846
- ks((e) => e)
11851
+ Us((e) => e)
11847
11852
  ).subscribe({
11848
11853
  next: (e) => {
11849
11854
  const { subUnitId: t, unitId: s, permissionId: o } = e, r = this._permissionIdCache.get(o);
@@ -11913,7 +11918,7 @@ let Ft = class extends ae {
11913
11918
  };
11914
11919
  Ft = sh([
11915
11920
  bs(0, $(fe)),
11916
- bs(1, $(et)),
11921
+ bs(1, $(tt)),
11917
11922
  bs(2, $(M))
11918
11923
  ], Ft);
11919
11924
  var oh = Object.getOwnPropertyDescriptor, rh = (n, e, t, s) => {
@@ -11991,7 +11996,7 @@ let ns = class extends ae {
11991
11996
  }
11992
11997
  };
11993
11998
  ns = rh([
11994
- Po(0, U),
11999
+ Po(0, k),
11995
12000
  Po(1, M)
11996
12001
  ], ns);
11997
12002
  function No(n, e) {
@@ -12022,14 +12027,14 @@ let ss = class extends ae {
12022
12027
  var o;
12023
12028
  super(), this._commandService = n, this._configService = e, this._dataSyncPrimaryController = t, [
12024
12029
  ee,
12025
- ke,
12030
+ Te,
12026
12031
  Ue,
12027
12032
  Lt,
12028
12033
  Mt,
12029
- qe,
12030
12034
  Ye,
12035
+ Xe,
12031
12036
  Me,
12032
- Te,
12037
+ Pe,
12033
12038
  pt,
12034
12039
  se,
12035
12040
  Si,
@@ -12048,7 +12053,7 @@ let ss = class extends ae {
12048
12053
  ].forEach((r) => {
12049
12054
  var i;
12050
12055
  this._commandService.registerCommand(r), (i = this._dataSyncPrimaryController) == null || i.registerSyncingMutations(r);
12051
- }), ((o = this._configService.getConfig(wi)) != null ? o : !1) || [
12056
+ }), (o = this._configService.getConfig(wi)) != null && o || [
12052
12057
  zt,
12053
12058
  hc,
12054
12059
  gc,
@@ -12067,7 +12072,7 @@ let ss = class extends ae {
12067
12072
  Rl,
12068
12073
  Cl,
12069
12074
  Fr,
12070
- Ze,
12075
+ Qe,
12071
12076
  Dt,
12072
12077
  dn,
12073
12078
  dl,
@@ -12075,10 +12080,10 @@ let ss = class extends ae {
12075
12080
  gl,
12076
12081
  hl,
12077
12082
  Lr,
12078
- Xe,
12083
+ Ze,
12079
12084
  Tc,
12080
12085
  gn,
12081
- Ut,
12086
+ kt,
12082
12087
  hn,
12083
12088
  Br,
12084
12089
  Rs,
@@ -12132,7 +12137,7 @@ let ss = class extends ae {
12132
12137
  rr,
12133
12138
  ot,
12134
12139
  ro,
12135
- Be,
12140
+ je,
12136
12141
  Ct,
12137
12142
  // SetWorksheetColIsAutoWidthCommand,
12138
12143
  yd,
@@ -12142,18 +12147,18 @@ let ss = class extends ae {
12142
12147
  tl,
12143
12148
  ie,
12144
12149
  xd,
12145
- kc,
12150
+ Uc,
12146
12151
  oi,
12147
12152
  ai,
12148
12153
  pi,
12149
- Ud,
12154
+ kd,
12150
12155
  nn,
12151
12156
  qc,
12152
12157
  Xt,
12153
12158
  // permissions range protection
12154
12159
  vd,
12155
12160
  bt,
12156
- kt,
12161
+ Ut,
12157
12162
  Vt,
12158
12163
  oo,
12159
12164
  Bu,
@@ -12162,7 +12167,7 @@ let ss = class extends ae {
12162
12167
  fc,
12163
12168
  Ec,
12164
12169
  Md,
12165
- je,
12170
+ ze,
12166
12171
  at,
12167
12172
  Re,
12168
12173
  Ed,
@@ -12174,10 +12179,10 @@ let ss = class extends ae {
12174
12179
  an,
12175
12180
  eo,
12176
12181
  mn,
12177
- kd,
12182
+ Ud,
12178
12183
  Pc,
12179
12184
  Rc,
12180
- Uc,
12185
+ kc,
12181
12186
  Td,
12182
12187
  Ad,
12183
12188
  Dd
@@ -12185,7 +12190,7 @@ let ss = class extends ae {
12185
12190
  }
12186
12191
  };
12187
12192
  ss = ah([
12188
- Es(0, U),
12193
+ Es(0, k),
12189
12194
  Es(1, In),
12190
12195
  Es(2, Ji(Ca))
12191
12196
  ], ss);
@@ -12250,7 +12255,7 @@ let os = class extends ae {
12250
12255
  };
12251
12256
  os = lh([
12252
12257
  Oo(0, $(M)),
12253
- Oo(1, U)
12258
+ Oo(1, k)
12254
12259
  ], os);
12255
12260
  var ch = Object.getOwnPropertyDescriptor, dh = (n, e, t, s) => {
12256
12261
  for (var o = s > 1 ? void 0 : s ? ch(e, t) : e, r = n.length - 1, i; r >= 0; r--)
@@ -12287,7 +12292,7 @@ var gh = Object.getOwnPropertyDescriptor, mh = (n, e, t, s) => {
12287
12292
  for (var o = s > 1 ? void 0 : s ? gh(e, t) : e, r = n.length - 1, i; r >= 0; r--)
12288
12293
  (i = n[r]) && (o = i(o) || o);
12289
12294
  return o;
12290
- }, kn = (n, e) => (t, s) => e(t, s, n);
12295
+ }, Un = (n, e) => (t, s) => e(t, s, n);
12291
12296
  let is = class extends ae {
12292
12297
  constructor(n, e, t, s) {
12293
12298
  super(), this._permissionService = n, this._worksheetProtectionRuleModel = e, this._sheetInterceptorService = t, this._rangeProtectionCache = s, this._initViewModelByRangeInterceptor(), this._initViewModelBySheetInterceptor();
@@ -12318,7 +12323,7 @@ let is = class extends ae {
12318
12323
  if (r != null && r.permissionId) {
12319
12324
  const d = [{
12320
12325
  [_.View]: (a = (i = this._permissionService.getPermissionPoint(new ms(s, o).id)) == null ? void 0 : i.value) != null ? a : !1,
12321
- [_.Edit]: (l = (u = this._permissionService.getPermissionPoint(new He(s, o).id)) == null ? void 0 : u.value) != null ? l : !1
12326
+ [_.Edit]: (l = (u = this._permissionService.getPermissionPoint(new Fe(s, o).id)) == null ? void 0 : u.value) != null ? l : !1
12322
12327
  }], h = !((c = d[0]) != null && c[_.View]), g = !n || n === e.rawData ? { ...n } : n;
12323
12328
  return g.hasWorksheetRule = !0, g.selectionProtection = d, h ? (delete g.s, delete g.v, delete g.p, g) : t(g);
12324
12329
  }
@@ -12328,10 +12333,10 @@ let is = class extends ae {
12328
12333
  }
12329
12334
  };
12330
12335
  is = mh([
12331
- kn(0, et),
12332
- kn(1, $(dt)),
12333
- kn(2, $(j)),
12334
- kn(3, $(Ft))
12336
+ Un(0, tt),
12337
+ Un(1, $(dt)),
12338
+ Un(2, $(j)),
12339
+ Un(3, $(Ft))
12335
12340
  ], is);
12336
12341
  const Do = Vs("univer.exclusive-range-service");
12337
12342
  class fh extends ae {
@@ -12341,7 +12346,7 @@ class fh extends ae {
12341
12346
  * Exclusive range data structure is as follows: unitId -> sheetId -> feature -> range
12342
12347
  */
12343
12348
  R(this, "_exclusiveRanges", /* @__PURE__ */ new Map());
12344
- R(this, "_exclusiveRangesChange$", new Ae());
12349
+ R(this, "_exclusiveRangesChange$", new xe());
12345
12350
  R(this, "exclusiveRangesChange$", this._exclusiveRangesChange$.asObservable());
12346
12351
  }
12347
12352
  _ensureUnitMap(t) {
@@ -12401,7 +12406,7 @@ var Rh = Object.getOwnPropertyDescriptor, Ch = (n, e, t, s) => {
12401
12406
  for (var o = s > 1 ? void 0 : s ? Rh(e, t) : e, r = n.length - 1, i; r >= 0; r--)
12402
12407
  (i = n[r]) && (o = i(o) || o);
12403
12408
  return o;
12404
- }, Us = (n, e) => (t, s) => e(t, s, n);
12409
+ }, ks = (n, e) => (t, s) => e(t, s, n);
12405
12410
  let Ds = class extends ae {
12406
12411
  constructor(n, e, t) {
12407
12412
  super(), this._resourceManagerService = n, this._univerInstanceService = e, this._logService = t;
@@ -12466,16 +12471,16 @@ let Ds = class extends ae {
12466
12471
  }
12467
12472
  };
12468
12473
  Ds = Ch([
12469
- Us(0, wn),
12470
- Us(1, M),
12471
- Us(2, Yo)
12474
+ ks(0, wn),
12475
+ ks(1, M),
12476
+ ks(2, Yo)
12472
12477
  ], Ds);
12473
12478
  var ph = Object.getOwnPropertyDescriptor, Sh = (n, e, t, s) => {
12474
12479
  for (var o = s > 1 ? void 0 : s ? ph(e, t) : e, r = n.length - 1, i; r >= 0; r--)
12475
12480
  (i = n[r]) && (o = i(o) || o);
12476
12481
  return o;
12477
12482
  }, gt = (n, e) => (t, s) => e(t, s, n);
12478
- const Ao = [ke.id, Ue.id, Me.id, Te.id], xo = [qe.id, Ye.id];
12483
+ const Ao = [Te.id, Ue.id, Me.id, Pe.id], xo = [Ye.id, Xe.id];
12479
12484
  let as = class extends ae {
12480
12485
  constructor(e, t, s, o, r, i, a, u) {
12481
12486
  super();
@@ -12501,7 +12506,7 @@ let as = class extends ae {
12501
12506
  return;
12502
12507
  e(i, r);
12503
12508
  }
12504
- if (s.id === Re.id || s.id === je.id) {
12509
+ if (s.id === Re.id || s.id === ze.id) {
12505
12510
  const o = s.params, r = o.subUnitId, i = o.unitId;
12506
12511
  if (!r || !i)
12507
12512
  return;
@@ -12522,9 +12527,9 @@ let as = class extends ae {
12522
12527
  return this._getRefRangeMutationsByMoveRows(e.params, t, s);
12523
12528
  case gn.id:
12524
12529
  return this._getRefRangeMutationsByMoveCols(e.params, t, s);
12525
- case Xe.id:
12526
- return this._getRefRangeMutationsByInsertRows(e.params, t, s);
12527
12530
  case Ze.id:
12531
+ return this._getRefRangeMutationsByInsertRows(e.params, t, s);
12532
+ case Qe.id:
12528
12533
  return this._getRefRangeMutationsByInsertCols(e.params, t, s);
12529
12534
  case Rs.id:
12530
12535
  return this._getRefRangeMutationsByDeleteCols(e.params, t, s);
@@ -12547,7 +12552,7 @@ let as = class extends ae {
12547
12552
  }
12548
12553
  return d;
12549
12554
  }, []);
12550
- l.ranges = c, l.ranges.length ? (i.push({ id: Re.id, params: { unitId: t, subUnitId: s, rule: l, ruleId: u.id } }), a.push({ id: Re.id, params: { unitId: t, subUnitId: s, rule: u, ruleId: u.id } })) : (i.push({ id: at.id, params: { unitId: t, subUnitId: s, ruleIds: [u.id] } }), a.push({ id: je.id, params: { unitId: t, subUnitId: s, name: "", rules: [u] } }));
12555
+ l.ranges = c, l.ranges.length ? (i.push({ id: Re.id, params: { unitId: t, subUnitId: s, rule: l, ruleId: u.id } }), a.push({ id: Re.id, params: { unitId: t, subUnitId: s, rule: u, ruleId: u.id } })) : (i.push({ id: at.id, params: { unitId: t, subUnitId: s, ruleIds: [u.id] } }), a.push({ id: ze.id, params: { unitId: t, subUnitId: s, name: "", rules: [u] } }));
12551
12556
  }), { redos: i, undos: a };
12552
12557
  }
12553
12558
  return { undos: [], redos: [] };
@@ -12688,7 +12693,7 @@ let as = class extends ae {
12688
12693
  const i = e.params, a = [], u = [];
12689
12694
  this._rangeProtectionRuleModel.getSubunitRuleList(i.unitId, i.subUnitId).forEach((l) => {
12690
12695
  a.push(l.id), u.push(l);
12691
- }), a.length && u.length && (o.push({ id: at.id, params: { unitId: i.unitId, subUnitId: i.subUnitId, ruleIds: a } }), t.push({ id: je.id, params: { unitId: i.unitId, subUnitId: i.subUnitId, name: "", rules: u } }));
12696
+ }), a.length && u.length && (o.push({ id: at.id, params: { unitId: i.unitId, subUnitId: i.subUnitId, ruleIds: a } }), t.push({ id: ze.id, params: { unitId: i.unitId, subUnitId: i.subUnitId, name: "", rules: u } }));
12692
12697
  }
12693
12698
  return {
12694
12699
  redos: s,
@@ -12704,7 +12709,7 @@ let as = class extends ae {
12704
12709
  as = Sh([
12705
12710
  gt(0, $(fe)),
12706
12711
  gt(1, $(M)),
12707
- gt(2, U),
12712
+ gt(2, k),
12708
12713
  gt(3, $(Wt)),
12709
12714
  gt(4, $(Sn)),
12710
12715
  gt(5, $(Ft)),
@@ -12726,21 +12731,21 @@ let us = class extends ae {
12726
12731
  this._selectionProtectionRuleModel.ruleChange$.subscribe((n) => {
12727
12732
  switch (n.type) {
12728
12733
  case "add": {
12729
- Ee().forEach((e) => {
12734
+ ke().forEach((e) => {
12730
12735
  const t = new e(n.unitId, n.subUnitId, n.rule.permissionId);
12731
12736
  this._permissionService.addPermissionPoint(t);
12732
12737
  });
12733
12738
  break;
12734
12739
  }
12735
12740
  case "delete": {
12736
- Ee().forEach((e) => {
12741
+ ke().forEach((e) => {
12737
12742
  const t = new e(n.unitId, n.subUnitId, n.rule.permissionId);
12738
12743
  this._permissionService.deletePermissionPoint(t.id);
12739
12744
  });
12740
12745
  break;
12741
12746
  }
12742
12747
  case "set": {
12743
- n.oldRule.permissionId !== n.rule.permissionId && Ee().forEach((e) => {
12748
+ n.oldRule.permissionId !== n.rule.permissionId && ke().forEach((e) => {
12744
12749
  const t = new e(n.unitId, n.subUnitId, n.oldRule.permissionId);
12745
12750
  this._permissionService.deletePermissionPoint(t.id);
12746
12751
  const s = new e(n.unitId, n.subUnitId, n.rule.permissionId);
@@ -12785,7 +12790,7 @@ let us = class extends ae {
12785
12790
  actions: vt
12786
12791
  });
12787
12792
  }), a.forEach((u) => {
12788
- Ee().forEach((l) => {
12793
+ ke().forEach((l) => {
12789
12794
  const c = new l(t, i, u.permissionId);
12790
12795
  c.value = !1, this._permissionService.addPermissionPoint(c);
12791
12796
  });
@@ -12801,7 +12806,7 @@ let us = class extends ae {
12801
12806
  };
12802
12807
  us = Ih([
12803
12808
  Jt(0, $(fe)),
12804
- Jt(1, $(et)),
12809
+ Jt(1, $(tt)),
12805
12810
  Jt(2, $(wn)),
12806
12811
  Jt(3, $(Ft)),
12807
12812
  Jt(4, $(M))
@@ -12860,11 +12865,11 @@ let As = class extends ae {
12860
12865
  As = _h([
12861
12866
  yh(0, $(ve))
12862
12867
  ], As);
12863
- var bh = Object.defineProperty, Eh = Object.getOwnPropertyDescriptor, Uh = (n, e, t) => e in n ? bh(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, kh = (n, e, t, s) => {
12868
+ var bh = Object.defineProperty, Eh = Object.getOwnPropertyDescriptor, kh = (n, e, t) => e in n ? bh(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, Uh = (n, e, t, s) => {
12864
12869
  for (var o = s > 1 ? void 0 : s ? Eh(e, t) : e, r = n.length - 1, i; r >= 0; r--)
12865
12870
  (i = n[r]) && (o = i(o) || o);
12866
12871
  return o;
12867
- }, $o = (n, e) => (t, s) => e(t, s, n), Ii = (n, e, t) => Uh(n, typeof e != "symbol" ? e + "" : e, t);
12872
+ }, $o = (n, e) => (t, s) => e(t, s, n), Ii = (n, e, t) => kh(n, typeof e != "symbol" ? e + "" : e, t);
12868
12873
  const Th = "SHEET_PLUGIN";
12869
12874
  let ls = class extends Xi {
12870
12875
  constructor(n = Eo, e, t) {
@@ -12961,7 +12966,7 @@ let ls = class extends Xi {
12961
12966
  };
12962
12967
  Ii(ls, "pluginName", Th);
12963
12968
  Ii(ls, "type", B.UNIVER_SHEET);
12964
- ls = kh([
12969
+ ls = Uh([
12965
12970
  Yi(fa),
12966
12971
  $o(1, $(cs)),
12967
12972
  $o(2, In)
@@ -12994,7 +12999,7 @@ const Mg = {
12994
12999
  /**
12995
13000
  * The permission point for editing workbook content
12996
13001
  */
12997
- WorkbookEditablePermission: Ne,
13002
+ WorkbookEditablePermission: Oe,
12998
13003
  /**
12999
13004
  * The permission point for exporting workbook data
13000
13005
  */
@@ -13062,7 +13067,7 @@ const Mg = {
13062
13067
  /**
13063
13068
  * The permission point for editing the content of a worksheet
13064
13069
  */
13065
- WorksheetEditPermission: He,
13070
+ WorksheetEditPermission: Fe,
13066
13071
  /**
13067
13072
  * The permission point for applying filters in a worksheet
13068
13073
  */
@@ -13070,11 +13075,11 @@ const Mg = {
13070
13075
  /**
13071
13076
  * The permission point for inserting columns into a worksheet
13072
13077
  */
13073
- WorksheetInsertColumnPermission: Ur,
13078
+ WorksheetInsertColumnPermission: kr,
13074
13079
  /**
13075
13080
  * The permission point for inserting hyperlinks in a worksheet
13076
13081
  */
13077
- WorksheetInsertHyperlinkPermission: kr,
13082
+ WorksheetInsertHyperlinkPermission: Ur,
13078
13083
  /**
13079
13084
  * The permission point for inserting rows into a worksheet
13080
13085
  */
@@ -13114,21 +13119,21 @@ const Mg = {
13114
13119
  /**
13115
13120
  * The permission point for editing the range protection settings
13116
13121
  */
13117
- RangeProtectionPermissionEditPoint: Le,
13122
+ RangeProtectionPermissionEditPoint: He,
13118
13123
  /**
13119
13124
  * The permission point for viewing the range protection settings
13120
13125
  */
13121
13126
  RangeProtectionPermissionViewPoint: zs
13122
13127
  }, _g = (n, e, t, s) => {
13123
- const o = n.get(et), r = n.get(fe), i = o.getPermissionPoint(new Ne(e).id);
13128
+ const o = n.get(tt), r = n.get(fe), i = o.getPermissionPoint(new Oe(e).id);
13124
13129
  if (!(i != null && i.value))
13125
13130
  return !1;
13126
- const a = o.getPermissionPoint(new He(e, t).id);
13131
+ const a = o.getPermissionPoint(new Fe(e, t).id);
13127
13132
  if (!(a != null && a.value))
13128
13133
  return !1;
13129
13134
  const l = r.getSubunitRuleList(e, t).filter((c) => c.ranges.some((d) => s.some((h) => O.intersects(d, h))));
13130
13135
  return l.length ? l.every((c) => {
13131
- const d = c.permissionId, h = o.getPermissionPoint(new Le(e, t, d).id);
13136
+ const d = c.permissionId, h = o.getPermissionPoint(new He(e, t, d).id);
13132
13137
  return !!(h != null && h.value);
13133
13138
  }) : !0;
13134
13139
  }, vi = (n, e, t, s = 1, o = !0, r = !0) => {
@@ -13247,10 +13252,10 @@ const Ph = (n, e, t, s, o = 1) => {
13247
13252
  export {
13248
13253
  Ss as AFTER_CELL_EDIT,
13249
13254
  ic as AddMergeRedoSelectionsOperationFactory,
13250
- Ve as AddMergeUndoMutationFactory,
13255
+ Le as AddMergeUndoMutationFactory,
13251
13256
  ac as AddMergeUndoSelectionsOperationFactory,
13252
13257
  Bu as AddRangeProtectionCommand,
13253
- je as AddRangeProtectionMutation,
13258
+ ze as AddRangeProtectionMutation,
13254
13259
  Td as AddRangeThemeMutation,
13255
13260
  hc as AddWorksheetMergeAllCommand,
13256
13261
  zt as AddWorksheetMergeCommand,
@@ -13279,7 +13284,7 @@ export {
13279
13284
  at as DeleteRangeProtectionMutation,
13280
13285
  Ec as DeleteWorksheetProtectionCommand,
13281
13286
  Vt as DeleteWorksheetProtectionMutation,
13282
- Uc as DeleteWorksheetRangeThemeStyleCommand,
13287
+ kc as DeleteWorksheetRangeThemeStyleCommand,
13283
13288
  un as DeleteWorksheetRangeThemeStyleMutation,
13284
13289
  ja as DeleteWorksheetRangeThemeStyleMutationFactory,
13285
13290
  zn as DeltaColumnWidthCommand,
@@ -13298,10 +13303,10 @@ export {
13298
13303
  fl as InsertColAfterCommand,
13299
13304
  ml as InsertColBeforeCommand,
13300
13305
  Fr as InsertColByRangeCommand,
13301
- Ze as InsertColCommand,
13302
- ke as InsertColMutation,
13306
+ Qe as InsertColCommand,
13307
+ Te as InsertColMutation,
13303
13308
  ds as InsertColMutationUndoFactory,
13304
- kc as InsertDefinedNameCommand,
13309
+ Uc as InsertDefinedNameCommand,
13305
13310
  Rl as InsertMultiColsLeftCommand,
13306
13311
  Cl as InsertMultiColsRightCommand,
13307
13312
  hl as InsertMultiRowsAboveCommand,
@@ -13311,7 +13316,7 @@ export {
13311
13316
  dl as InsertRowAfterCommand,
13312
13317
  cl as InsertRowBeforeCommand,
13313
13318
  Lr as InsertRowByRangeCommand,
13314
- Xe as InsertRowCommand,
13319
+ Ze as InsertRowCommand,
13315
13320
  Ue as InsertRowMutation,
13316
13321
  Ls as InsertRowMutationUndoFactory,
13317
13322
  Tc as InsertSheetCommand,
@@ -13323,12 +13328,12 @@ export {
13323
13328
  Nd as MarkDirtyRowAutoHeightMutation,
13324
13329
  Fn as MergeCellController,
13325
13330
  gn as MoveColsCommand,
13326
- Ye as MoveColsMutation,
13331
+ Xe as MoveColsMutation,
13327
13332
  Ga as MoveColsMutationUndoFactory,
13328
- Ut as MoveRangeCommand,
13333
+ kt as MoveRangeCommand,
13329
13334
  Mt as MoveRangeMutation,
13330
13335
  hn as MoveRowsCommand,
13331
- qe as MoveRowsMutation,
13336
+ Ye as MoveRowsMutation,
13332
13337
  za as MoveRowsMutationUndoFactory,
13333
13338
  Ds as NumfmtService,
13334
13339
  Q as OperatorType,
@@ -13337,7 +13342,7 @@ export {
13337
13342
  jh as RangeMergeUtil,
13338
13343
  Ft as RangeProtectionCache,
13339
13344
  Ri as RangeProtectionPermissionDeleteProtectionPoint,
13340
- Le as RangeProtectionPermissionEditPoint,
13345
+ He as RangeProtectionPermissionEditPoint,
13341
13346
  Ci as RangeProtectionPermissionManageCollaPoint,
13342
13347
  zs as RangeProtectionPermissionViewPoint,
13343
13348
  as as RangeProtectionRefRangeService,
@@ -13353,12 +13358,12 @@ export {
13353
13358
  Rs as RemoveColCommand,
13354
13359
  Me as RemoveColMutation,
13355
13360
  oi as RemoveDefinedNameCommand,
13356
- ye as RemoveMergeUndoMutationFactory,
13361
+ be as RemoveMergeUndoMutationFactory,
13357
13362
  Si as RemoveNumfmtMutation,
13358
13363
  Dd as RemoveRangeThemeMutation,
13359
13364
  Br as RemoveRowByRangeCommand,
13360
13365
  fs as RemoveRowCommand,
13361
- Te as RemoveRowMutation,
13366
+ Pe as RemoveRowMutation,
13362
13367
  to as RemoveSheetCommand,
13363
13368
  pt as RemoveSheetMutation,
13364
13369
  pl as RemoveSheetUndoMutationFactory,
@@ -13408,7 +13413,7 @@ export {
13408
13413
  Ad as SetRangeThemeMutation,
13409
13414
  vn as SetRangeValuesCommand,
13410
13415
  ee as SetRangeValuesMutation,
13411
- xe as SetRangeValuesUndoMutationFactory,
13416
+ $e as SetRangeValuesUndoMutationFactory,
13412
13417
  Xc as SetRowDataCommand,
13413
13418
  Zt as SetRowDataMutation,
13414
13419
  cu as SetRowDataMutationFactory,
@@ -13451,7 +13456,7 @@ export {
13451
13456
  vd as SetWorksheetPermissionPointsCommand,
13452
13457
  oo as SetWorksheetPermissionPointsMutation,
13453
13458
  Md as SetWorksheetProtectionCommand,
13454
- kt as SetWorksheetProtectionMutation,
13459
+ Ut as SetWorksheetProtectionMutation,
13455
13460
  Rc as SetWorksheetRangeThemeStyleCommand,
13456
13461
  an as SetWorksheetRangeThemeStyleMutation,
13457
13462
  Ba as SetWorksheetRangeThemeStyleMutationFactory,
@@ -13464,7 +13469,7 @@ export {
13464
13469
  fu as SetWorksheetRowCountUndoMutationFactory,
13465
13470
  ot as SetWorksheetRowHeightMutation,
13466
13471
  ro as SetWorksheetRowIsAutoHeightCommand,
13467
- Be as SetWorksheetRowIsAutoHeightMutation,
13472
+ je as SetWorksheetRowIsAutoHeightMutation,
13468
13473
  pi as SetWorksheetShowCommand,
13469
13474
  j as SheetInterceptorService,
13470
13475
  Bn as SheetLazyExecuteScheduleService,
@@ -13477,15 +13482,15 @@ export {
13477
13482
  Cu as SheetValueChangeType,
13478
13483
  Zn as SheetsFreezeSyncController,
13479
13484
  F as SheetsSelectionsService,
13480
- Uu as SplitDelimiterEnum,
13485
+ ku as SplitDelimiterEnum,
13481
13486
  bd as SplitTextToColumnsCommand,
13482
13487
  Ed as ToggleCellCheckboxCommand,
13483
- Ud as ToggleGridlinesCommand,
13488
+ kd as ToggleGridlinesCommand,
13484
13489
  nn as ToggleGridlinesMutation,
13485
13490
  _ as UnitAction,
13486
13491
  x as UnitObject,
13487
13492
  ls as UniverSheetsPlugin,
13488
- kd as UnregisterWorksheetRangeThemeStyleCommand,
13493
+ Ud as UnregisterWorksheetRangeThemeStyleCommand,
13489
13494
  eo as UnregisterWorksheetRangeThemeStyleMutation,
13490
13495
  ws as VALIDATE_CELL,
13491
13496
  Hu as ViewStateEnum,
@@ -13498,7 +13503,7 @@ export {
13498
13503
  rl as WorkbookDeleteRowPermission,
13499
13504
  mr as WorkbookDeleteSheetPermission,
13500
13505
  fr as WorkbookDuplicatePermission,
13501
- Ne as WorkbookEditablePermission,
13506
+ Oe as WorkbookEditablePermission,
13502
13507
  Rr as WorkbookExportPermission,
13503
13508
  Gs as WorkbookHideSheetPermission,
13504
13509
  il as WorkbookHistoryPermission,
@@ -13519,10 +13524,10 @@ export {
13519
13524
  _r as WorksheetDeleteProtectionPermission,
13520
13525
  yr as WorksheetDeleteRowPermission,
13521
13526
  br as WorksheetEditExtraObjectPermission,
13522
- He as WorksheetEditPermission,
13527
+ Fe as WorksheetEditPermission,
13523
13528
  Er as WorksheetFilterPermission,
13524
- Ur as WorksheetInsertColumnPermission,
13525
- kr as WorksheetInsertHyperlinkPermission,
13529
+ kr as WorksheetInsertColumnPermission,
13530
+ Ur as WorksheetInsertHyperlinkPermission,
13526
13531
  Tr as WorksheetInsertRowPermission,
13527
13532
  Pr as WorksheetManageCollaboratorPermission,
13528
13533
  Jn as WorksheetPermissionService,
@@ -13562,10 +13567,10 @@ export {
13562
13567
  ur as generateNullCell,
13563
13568
  Wu as generateNullCellValue,
13564
13569
  Qr as getAddMergeMutationRangeByType,
13565
- Ee as getAllRangePermissionPoint,
13570
+ ke as getAllRangePermissionPoint,
13566
13571
  Cn as getAllWorkbookPermissionPoint,
13567
- be as getAllWorksheetPermissionPoint,
13568
- Fe as getAllWorksheetPermissionPointByPointPanel,
13572
+ Ee as getAllWorksheetPermissionPoint,
13573
+ Be as getAllWorksheetPermissionPointByPointPanel,
13569
13574
  Qh as getCellAtRowCol,
13570
13575
  dc as getClearContentMutationParamForRange,
13571
13576
  cc as getClearContentMutationParamsForRanges,
@@ -13578,8 +13583,8 @@ export {
13578
13583
  el as getSelectionsService,
13579
13584
  ug as getSeparateEffectedRangesOnCommand,
13580
13585
  P as getSheetCommandTarget,
13581
- tr as getSheetCommandTargetWorkbook,
13582
- tt as getSheetMutationTarget,
13586
+ Qo as getSheetCommandTargetWorkbook,
13587
+ ye as getSheetMutationTarget,
13583
13588
  Fh as getSkeletonChangedEffectedRange,
13584
13589
  Hh as getValueChangedEffectedRange,
13585
13590
  hs as getVisibleRanges,
@@ -13601,12 +13606,12 @@ export {
13601
13606
  og as handleInsertRangeMutation,
13602
13607
  Dl as handleInsertRow,
13603
13608
  Yr as handleMoveCols,
13604
- kl as handleMoveRange,
13609
+ Ul as handleMoveRange,
13605
13610
  qr as handleMoveRows,
13606
13611
  tg as isSingleCellSelection,
13607
13612
  ar as rangeMerge,
13608
13613
  Lu as rangeToDiscreteRange,
13609
- De as rotateRange,
13614
+ Ae as rotateRange,
13610
13615
  $t as runRefRangeMutations,
13611
13616
  eg as setEndForRange,
13612
13617
  Du as splitRangeText,