@odoo/o-spreadsheet 18.0.68 → 18.0.70

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.
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 18.0.68
6
- * @date 2026-05-12T12:16:54.199Z
7
- * @hash a0763ab
5
+ * @version 18.0.70
6
+ * @date 2026-06-06T06:20:39.985Z
7
+ * @hash 3ff29f6
8
8
  */
9
9
 
10
10
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
@@ -15,7 +15,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
15
15
  var __getOwnPropNames = Object.getOwnPropertyNames;
16
16
  var __getProtoOf = Object.getPrototypeOf;
17
17
  var __hasOwnProp = Object.prototype.hasOwnProperty;
18
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
18
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
19
19
  var __exportAll = (all, no_symbols) => {
20
20
  let target = {};
21
21
  for (var name in all) {
@@ -337,22 +337,6 @@ const FORBIDDEN_SHEETNAME_CHARS = [
337
337
  "]"
338
338
  ];
339
339
  const FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX = /'|\*|\?|\/|\\|\[|\]/;
340
- let ComponentsImportance = /* @__PURE__ */ function(ComponentsImportance) {
341
- ComponentsImportance[ComponentsImportance["Grid"] = 0] = "Grid";
342
- ComponentsImportance[ComponentsImportance["Highlight"] = 5] = "Highlight";
343
- ComponentsImportance[ComponentsImportance["HeaderGroupingButton"] = 6] = "HeaderGroupingButton";
344
- ComponentsImportance[ComponentsImportance["Figure"] = 10] = "Figure";
345
- ComponentsImportance[ComponentsImportance["ScrollBar"] = 15] = "ScrollBar";
346
- ComponentsImportance[ComponentsImportance["GridPopover"] = 19] = "GridPopover";
347
- ComponentsImportance[ComponentsImportance["GridComposer"] = 20] = "GridComposer";
348
- ComponentsImportance[ComponentsImportance["Dropdown"] = 21] = "Dropdown";
349
- ComponentsImportance[ComponentsImportance["IconPicker"] = 25] = "IconPicker";
350
- ComponentsImportance[ComponentsImportance["TopBarComposer"] = 30] = "TopBarComposer";
351
- ComponentsImportance[ComponentsImportance["Popover"] = 35] = "Popover";
352
- ComponentsImportance[ComponentsImportance["FigureAnchor"] = 1e3] = "FigureAnchor";
353
- ComponentsImportance[ComponentsImportance["FigureSnapLine"] = 1001] = "FigureSnapLine";
354
- return ComponentsImportance;
355
- }({});
356
340
  let DEFAULT_SHEETVIEW_SIZE = 0;
357
341
  function getDefaultSheetViewSize() {
358
342
  return DEFAULT_SHEETVIEW_SIZE;
@@ -833,7 +817,8 @@ var TokenizingChars = class {
833
817
  }
834
818
  shift() {
835
819
  const current = this.current;
836
- this.current = this.text[++this.currentIndex];
820
+ const next = this.text[++this.currentIndex];
821
+ this.current = next;
837
822
  return current;
838
823
  }
839
824
  advanceBy(length) {
@@ -1268,6 +1253,7 @@ function getColorsPalette(quantity) {
1268
1253
  else return COLORS_XL;
1269
1254
  }
1270
1255
  var ColorGenerator = class {
1256
+ preferredColors;
1271
1257
  currentColorIndex = 0;
1272
1258
  palette;
1273
1259
  constructor(paletteSize, preferredColors = []) {
@@ -1685,6 +1671,7 @@ const _t = function(s, ...values) {
1685
1671
  return sprintf(_translate(s), ...values);
1686
1672
  };
1687
1673
  var LazyTranslatedString = class extends String {
1674
+ values;
1688
1675
  constructor(str, values) {
1689
1676
  super(str);
1690
1677
  this.values = values;
@@ -2785,25 +2772,6 @@ function percentile(values, percent, isInclusive) {
2785
2772
  return sortedValues[indexSup] * (percentIndex - indexLow) + sortedValues[indexLow] * (indexSup - percentIndex);
2786
2773
  }
2787
2774
 
2788
- //#endregion
2789
- //#region src/types/cells.ts
2790
- let CellValueType = /* @__PURE__ */ function(CellValueType) {
2791
- CellValueType["boolean"] = "boolean";
2792
- CellValueType["number"] = "number";
2793
- CellValueType["text"] = "text";
2794
- CellValueType["empty"] = "empty";
2795
- CellValueType["error"] = "error";
2796
- return CellValueType;
2797
- }({});
2798
-
2799
- //#endregion
2800
- //#region src/types/clipboard.ts
2801
- let ClipboardMIMEType = /* @__PURE__ */ function(ClipboardMIMEType) {
2802
- ClipboardMIMEType["PlainText"] = "text/plain";
2803
- ClipboardMIMEType["Html"] = "text/html";
2804
- return ClipboardMIMEType;
2805
- }({});
2806
-
2807
2775
  //#endregion
2808
2776
  //#region src/types/commands.ts
2809
2777
  function isSheetDependent(cmd) {
@@ -2965,7 +2933,7 @@ var DispatchResult = class {
2965
2933
  constructor(results = []) {
2966
2934
  if (!Array.isArray(results)) results = [results];
2967
2935
  results = [...new Set(results)];
2968
- this.reasons = results.filter((result) => result !== CommandResult.Success);
2936
+ this.reasons = results.filter((result) => result !== "Success");
2969
2937
  }
2970
2938
  /**
2971
2939
  * Static helper which returns a successful DispatchResult
@@ -3149,13 +3117,6 @@ const borderStyles = [
3149
3117
  function isMatrix(x) {
3150
3118
  return Array.isArray(x) && Array.isArray(x[0]);
3151
3119
  }
3152
- let DIRECTION = /* @__PURE__ */ function(DIRECTION) {
3153
- DIRECTION["UP"] = "up";
3154
- DIRECTION["DOWN"] = "down";
3155
- DIRECTION["LEFT"] = "left";
3156
- DIRECTION["RIGHT"] = "right";
3157
- return DIRECTION;
3158
- }({});
3159
3120
 
3160
3121
  //#endregion
3161
3122
  //#region src/types/rendering.ts
@@ -3194,6 +3155,8 @@ const CellErrorType = {
3194
3155
  };
3195
3156
  const errorTypes = new Set(Object.values(CellErrorType));
3196
3157
  var EvaluationError = class {
3158
+ message;
3159
+ value;
3197
3160
  constructor(message = _t("Error"), value = CellErrorType.GenericError) {
3198
3161
  this.message = message;
3199
3162
  this.value = value;
@@ -3892,7 +3855,7 @@ urlRegistry.add("sheet_URL", {
3892
3855
  if (env.model.dispatch("ACTIVATE_SHEET", {
3893
3856
  sheetIdFrom: env.model.getters.getActiveSheetId(),
3894
3857
  sheetIdTo: sheetId
3895
- }).isCancelledBecause(CommandResult.SheetIsHidden)) env.notifyUser({
3858
+ }).isCancelledBecause("SheetIsHidden")) env.notifyUser({
3896
3859
  type: "warning",
3897
3860
  sticky: false,
3898
3861
  text: _t("Cannot open the link because the linked sheet is hidden.")
@@ -3927,6 +3890,7 @@ function detectLink(value) {
3927
3890
  //#endregion
3928
3891
  //#region src/helpers/format/format_tokenizer.ts
3929
3892
  function tokenizeFormat(str) {
3893
+ str = str.replace(/\s/g, " ");
3930
3894
  const chars = new TokenizingChars(str);
3931
3895
  const result = [];
3932
3896
  let currentFormatPart = [];
@@ -4864,7 +4828,7 @@ function textCell(value, format, formattedValue) {
4864
4828
  value,
4865
4829
  format,
4866
4830
  formattedValue,
4867
- type: CellValueType.text,
4831
+ type: "text",
4868
4832
  isAutoSummable: true,
4869
4833
  defaultAlign: "left"
4870
4834
  };
@@ -4874,7 +4838,7 @@ function numberCell(value, format, formattedValue) {
4874
4838
  value: value || 0,
4875
4839
  format,
4876
4840
  formattedValue,
4877
- type: CellValueType.number,
4841
+ type: "number",
4878
4842
  isAutoSummable: true,
4879
4843
  defaultAlign: "right"
4880
4844
  };
@@ -4884,7 +4848,7 @@ const emptyCell = memoize(function emptyCell(format) {
4884
4848
  value: null,
4885
4849
  format,
4886
4850
  formattedValue: "",
4887
- type: CellValueType.empty,
4851
+ type: "empty",
4888
4852
  isAutoSummable: true,
4889
4853
  defaultAlign: "left"
4890
4854
  };
@@ -4894,7 +4858,7 @@ function dateTimeCell(value, format, formattedValue) {
4894
4858
  value,
4895
4859
  format,
4896
4860
  formattedValue,
4897
- type: CellValueType.number,
4861
+ type: "number",
4898
4862
  isAutoSummable: false,
4899
4863
  defaultAlign: "right"
4900
4864
  };
@@ -4904,7 +4868,7 @@ function booleanCell(value, format, formattedValue) {
4904
4868
  value,
4905
4869
  format,
4906
4870
  formattedValue,
4907
- type: CellValueType.boolean,
4871
+ type: "boolean",
4908
4872
  isAutoSummable: false,
4909
4873
  defaultAlign: "center"
4910
4874
  };
@@ -4914,7 +4878,7 @@ function errorCell(value, message) {
4914
4878
  value,
4915
4879
  formattedValue: value,
4916
4880
  message,
4917
- type: CellValueType.error,
4881
+ type: "error",
4918
4882
  isAutoSummable: false,
4919
4883
  defaultAlign: "center"
4920
4884
  };
@@ -5057,6 +5021,7 @@ function getFullReference(sheetName, xc) {
5057
5021
  //#endregion
5058
5022
  //#region src/helpers/range.ts
5059
5023
  var RangeImpl = class RangeImpl {
5024
+ getSheetSize;
5060
5025
  _zone;
5061
5026
  parts;
5062
5027
  invalidXc;
@@ -5688,10 +5653,10 @@ function getPasteZones(target, content) {
5688
5653
  return target.map((t) => splitZoneForPaste(t, width, height)).flat();
5689
5654
  }
5690
5655
  function parseOSClipboardContent(content) {
5691
- if (!content[ClipboardMIMEType.Html]) return { text: content[ClipboardMIMEType.PlainText] };
5692
- const htmlDocument = new DOMParser().parseFromString(content[ClipboardMIMEType.Html], "text/html");
5656
+ if (!content["text/html"]) return { text: content["text/plain"] };
5657
+ const htmlDocument = new DOMParser().parseFromString(content["text/html"], "text/html");
5693
5658
  return {
5694
- text: content[ClipboardMIMEType.PlainText],
5659
+ text: content["text/plain"],
5695
5660
  data: getOSheetDataFromHTML(htmlDocument)
5696
5661
  };
5697
5662
  }
@@ -5758,6 +5723,8 @@ const selectPastedZone = (selection, sourceZones, pastedZones) => {
5758
5723
  //#endregion
5759
5724
  //#region src/clipboard_handlers/abstract_clipboard_handler.ts
5760
5725
  var ClipboardHandler = class {
5726
+ getters;
5727
+ dispatch;
5761
5728
  constructor(getters, dispatch) {
5762
5729
  this.getters = getters;
5763
5730
  this.dispatch = dispatch;
@@ -5765,10 +5732,10 @@ var ClipboardHandler = class {
5765
5732
  copy(data, mode = "copyPaste") {}
5766
5733
  paste(target, clippedContent, options) {}
5767
5734
  isPasteAllowed(sheetId, target, content, option) {
5768
- return CommandResult.Success;
5735
+ return "Success";
5769
5736
  }
5770
5737
  isCutAllowed(data) {
5771
- return CommandResult.Success;
5738
+ return "Success";
5772
5739
  }
5773
5740
  getPasteTarget(sheetId, target, content, options) {
5774
5741
  return {
@@ -7219,8 +7186,8 @@ function addIndentAndAlignToPivotHeader(pivot, domain, functionResult) {
7219
7186
  //#region src/clipboard_handlers/cell_clipboard.ts
7220
7187
  var CellClipboardHandler = class extends AbstractCellClipboardHandler {
7221
7188
  isCutAllowed(data) {
7222
- if (data.zones.length !== 1) return CommandResult.WrongCutSelection;
7223
- return CommandResult.Success;
7189
+ if (data.zones.length !== 1) return "WrongCutSelection";
7190
+ return "Success";
7224
7191
  }
7225
7192
  copy(data, mode = "copyPaste") {
7226
7193
  const sheetId = data.sheetId;
@@ -7288,17 +7255,17 @@ var CellClipboardHandler = class extends AbstractCellClipboardHandler {
7288
7255
  };
7289
7256
  }
7290
7257
  isPasteAllowed(sheetId, target, content, clipboardOptions) {
7291
- if (!content.cells) return CommandResult.Success;
7292
- if (clipboardOptions?.isCutOperation && clipboardOptions?.pasteOption !== void 0) return CommandResult.WrongPasteOption;
7258
+ if (!content.cells) return "Success";
7259
+ if (clipboardOptions?.isCutOperation && clipboardOptions?.pasteOption !== void 0) return "WrongPasteOption";
7293
7260
  if (target.length > 1) {
7294
- if (content.cells.length > 1 || content.cells[0].length > 1) return CommandResult.WrongPasteSelection;
7261
+ if (content.cells.length > 1 || content.cells[0].length > 1) return "WrongPasteSelection";
7295
7262
  }
7296
7263
  const clipboardHeight = content.cells.length;
7297
7264
  const clipboardWidth = content.cells[0].length;
7298
7265
  for (const zone of getPasteZones(target, content.cells)) if (this.getters.doesIntersectMerge(sheetId, zone)) {
7299
- if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return CommandResult.WillRemoveExistingMerge;
7266
+ if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return "WillRemoveExistingMerge";
7300
7267
  }
7301
- return CommandResult.Success;
7268
+ return "Success";
7302
7269
  }
7303
7270
  /**
7304
7271
  * Paste the clipboard content in the given target
@@ -7480,9 +7447,9 @@ var ChartClipboardHandler = class extends AbstractFigureClipboardHandler {
7480
7447
  this.dispatch("SELECT_FIGURE", { id: figureId });
7481
7448
  }
7482
7449
  isPasteAllowed(sheetId, target, content, option) {
7483
- if (target.length === 0) return CommandResult.EmptyTarget;
7484
- if (option?.pasteOption !== void 0) return CommandResult.WrongFigurePasteOption;
7485
- return CommandResult.Success;
7450
+ if (target.length === 0) return "EmptyTarget";
7451
+ if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
7452
+ return "Success";
7486
7453
  }
7487
7454
  };
7488
7455
 
@@ -7781,9 +7748,9 @@ var ImageClipboardHandler = class extends AbstractFigureClipboardHandler {
7781
7748
  this.dispatch("SELECT_FIGURE", { id: figureId });
7782
7749
  }
7783
7750
  isPasteAllowed(sheetId, target, content, option) {
7784
- if (target.length === 0) return CommandResult.EmptyTarget;
7785
- if (option?.pasteOption !== void 0) return CommandResult.WrongFigurePasteOption;
7786
- return CommandResult.Success;
7751
+ if (target.length === 0) return "EmptyTarget";
7752
+ if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
7753
+ return "Success";
7787
7754
  }
7788
7755
  };
7789
7756
 
@@ -7878,10 +7845,10 @@ var ReferenceClipboardHandler = class extends AbstractCellClipboardHandler {
7878
7845
  //#region src/clipboard_handlers/sheet_clipboard.ts
7879
7846
  var SheetClipboardHandler = class extends AbstractCellClipboardHandler {
7880
7847
  isPasteAllowed(sheetId, target, content, options) {
7881
- if (!("cells" in content)) return CommandResult.Success;
7848
+ if (!("cells" in content)) return "Success";
7882
7849
  const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
7883
- for (const zone of getPasteZones(target, content.cells)) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return CommandResult.FrozenPaneOverlap;
7884
- return CommandResult.Success;
7850
+ for (const zone of getPasteZones(target, content.cells)) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return "FrozenPaneOverlap";
7851
+ return "Success";
7885
7852
  }
7886
7853
  };
7887
7854
 
@@ -8133,6 +8100,7 @@ var DependencyContainer = class extends EventBus {
8133
8100
  }
8134
8101
  };
8135
8102
  var StoreFactory = class {
8103
+ get;
8136
8104
  pendingBuilds = /* @__PURE__ */ new Set();
8137
8105
  constructor(get) {
8138
8106
  this.get = get;
@@ -8177,6 +8145,7 @@ stores.inject(MyMetaStore, storeInstance);
8177
8145
  return MetaStore;
8178
8146
  }
8179
8147
  var DisposableStore = class {
8148
+ get;
8180
8149
  disposeCallbacks = [];
8181
8150
  constructor(get) {
8182
8151
  this.get = get;
@@ -8554,16 +8523,16 @@ function chartFontColor(backgroundColor) {
8554
8523
  }
8555
8524
  function checkDataset(definition) {
8556
8525
  if (definition.dataSets) {
8557
- if (definition.dataSets.find((range) => !rangeReference.test(range.dataRange)) !== void 0) return CommandResult.InvalidDataSet;
8558
- if (definition.dataSets.map((ds) => toUnboundedZone(ds.dataRange)).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return CommandResult.InvalidDataSet;
8526
+ if (definition.dataSets.find((range) => !rangeReference.test(range.dataRange)) !== void 0) return "InvalidDataSet";
8527
+ if (definition.dataSets.map((ds) => toUnboundedZone(ds.dataRange)).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return "InvalidDataSet";
8559
8528
  }
8560
- return CommandResult.Success;
8529
+ return "Success";
8561
8530
  }
8562
8531
  function checkLabelRange(definition) {
8563
8532
  if (definition.labelRange) {
8564
- if (!rangeReference.test(definition.labelRange || "")) return CommandResult.InvalidLabelRange;
8533
+ if (!rangeReference.test(definition.labelRange || "")) return "InvalidLabelRange";
8565
8534
  }
8566
- return CommandResult.Success;
8535
+ return "Success";
8567
8536
  }
8568
8537
  function shouldRemoveFirstLabel(labelRange, dataset, dataSetsHaveTitle) {
8569
8538
  if (!dataSetsHaveTitle) return false;
@@ -8880,6 +8849,7 @@ function getNextNonEmptyBar(bars, startIndex) {
8880
8849
  * Represent a raw XML string
8881
8850
  */
8882
8851
  var XMLString = class {
8852
+ xmlString;
8883
8853
  /**
8884
8854
  * @param xmlString should be a well formed, properly escaped XML string
8885
8855
  */
@@ -8993,6 +8963,10 @@ const FORCE_DEFAULT_ARGS_FUNCTIONS = {
8993
8963
  ROUNDDOWN: [{
8994
8964
  type: "NUMBER",
8995
8965
  value: 0
8966
+ }],
8967
+ IFERROR: [{
8968
+ type: "NUMBER",
8969
+ value: 0
8996
8970
  }]
8997
8971
  };
8998
8972
  /**
@@ -9433,30 +9407,6 @@ function prefixFormulaWithEqual(formula) {
9433
9407
 
9434
9408
  //#endregion
9435
9409
  //#region src/xlsx/helpers/xlsx_parser_error_manager.ts
9436
- /**
9437
- * Map of the different types of conversions warnings and their name in error messages
9438
- */
9439
- let WarningTypes = /* @__PURE__ */ function(WarningTypes) {
9440
- WarningTypes["DiagonalBorderNotSupported"] = "Diagonal Borders";
9441
- WarningTypes["BorderStyleNotSupported"] = "Border style";
9442
- WarningTypes["FillStyleNotSupported"] = "Fill Style";
9443
- WarningTypes["FontNotSupported"] = "Font";
9444
- WarningTypes["HorizontalAlignmentNotSupported"] = "Horizontal Alignment";
9445
- WarningTypes["VerticalAlignmentNotSupported"] = "Vertical Alignments";
9446
- WarningTypes["MultipleRulesCfNotSupported"] = "Multiple rules conditional formats";
9447
- WarningTypes["CfTypeNotSupported"] = "Conditional format type";
9448
- WarningTypes["CfFormatBorderNotSupported"] = "Borders in conditional formats";
9449
- WarningTypes["CfFormatAlignmentNotSupported"] = "Alignment in conditional formats";
9450
- WarningTypes["CfFormatNumFmtNotSupported"] = "Num formats in conditional formats";
9451
- WarningTypes["CfIconSetEmptyIconNotSupported"] = "IconSets with empty icons";
9452
- WarningTypes["BadlyFormattedHyperlink"] = "Badly formatted hyperlink";
9453
- WarningTypes["NumFmtIdNotSupported"] = "Number format";
9454
- WarningTypes["TimeDataValidationNotSupported"] = "Time data validation rules";
9455
- WarningTypes["TextLengthDataValidationNotSupported"] = "Text length data validation rules";
9456
- WarningTypes["WholeNumberDataValidationNotSupported"] = "Whole number data validation rules";
9457
- WarningTypes["NotEqualDateDataValidationNotSupported"] = "Not equal date data validation rules";
9458
- return WarningTypes;
9459
- }({});
9460
9410
  var XLSXImportWarningManager = class {
9461
9411
  _parsingWarnings = /* @__PURE__ */ new Set();
9462
9412
  _conversionWarnings = /* @__PURE__ */ new Set();
@@ -9945,7 +9895,7 @@ function convertXlsxFormat(numFmtId, formats, warningManager) {
9945
9895
  if (isXlsxDateFormat(convertedFormat)) convertedFormat = convertDateFormat$1(convertedFormat);
9946
9896
  if (isFormatSupported(convertedFormat)) return convertedFormat;
9947
9897
  } catch (e) {}
9948
- warningManager.generateNotSupportedWarning(WarningTypes.NumFmtIdNotSupported, format || `nmFmtId ${numFmtId}`);
9898
+ warningManager.generateNotSupportedWarning("Number format", format || `nmFmtId ${numFmtId}`);
9949
9899
  }
9950
9900
  function isFormatSupported(format) {
9951
9901
  try {
@@ -10029,20 +9979,20 @@ function convertFormats(data, warningManager) {
10029
9979
  return arrayToObject(formats, 1);
10030
9980
  }
10031
9981
  function addStyleWarnings(font, fill, warningManager) {
10032
- if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning(WarningTypes.FontNotSupported, font.name, SUPPORTED_FONTS);
10033
- if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning(WarningTypes.FillStyleNotSupported, fill.patternType, SUPPORTED_FILL_PATTERNS);
9982
+ if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning("Font", font.name, SUPPORTED_FONTS);
9983
+ if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning("Fill Style", fill.patternType, SUPPORTED_FILL_PATTERNS);
10034
9984
  }
10035
9985
  function addBorderDescrWarnings(borderDescr, warningManager) {
10036
- if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning(WarningTypes.BorderStyleNotSupported, borderDescr.style, SUPPORTED_BORDER_STYLES);
9986
+ if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning("Border style", borderDescr.style, SUPPORTED_BORDER_STYLES);
10037
9987
  }
10038
9988
  function addBorderWarnings(border, warningManager) {
10039
- if (border.diagonal) warningManager.generateNotSupportedWarning(WarningTypes.DiagonalBorderNotSupported);
9989
+ if (border.diagonal) warningManager.generateNotSupportedWarning("Diagonal Borders");
10040
9990
  }
10041
9991
  function addHorizontalAlignmentWarnings(alignment, warningManager) {
10042
- if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(WarningTypes.HorizontalAlignmentNotSupported, alignment, SUPPORTED_HORIZONTAL_ALIGNMENTS);
9992
+ if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Horizontal Alignment", alignment, SUPPORTED_HORIZONTAL_ALIGNMENTS);
10043
9993
  }
10044
9994
  function addVerticalAlignmentWarnings(alignment, warningManager) {
10045
- if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(WarningTypes.VerticalAlignmentNotSupported, alignment, SUPPORTED_VERTICAL_ALIGNMENTS);
9995
+ if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Vertical Alignments", alignment, SUPPORTED_VERTICAL_ALIGNMENTS);
10046
9996
  }
10047
9997
 
10048
9998
  //#endregion
@@ -10182,7 +10132,7 @@ function convertIconSet(id, xlsxCf, warningManager) {
10182
10132
  lower: icons.upper
10183
10133
  };
10184
10134
  for (const key of Object.keys(icons)) if (!icons[key]) {
10185
- warningManager.generateNotSupportedWarning(WarningTypes.CfIconSetEmptyIconNotSupported);
10135
+ warningManager.generateNotSupportedWarning("IconSets with empty icons");
10186
10136
  switch (key) {
10187
10137
  case "upper":
10188
10138
  icons[key] = ICON_SETS.dots.good;
@@ -10218,13 +10168,13 @@ function convertIcons(xlsxIconSet, index) {
10218
10168
  return index === 0 ? ICON_SETS[iconSet].bad : index === 1 ? ICON_SETS[iconSet].neutral : ICON_SETS[iconSet].good;
10219
10169
  }
10220
10170
  function addCfConversionWarnings(cf, dxfs, warningManager) {
10221
- if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning(WarningTypes.MultipleRulesCfNotSupported);
10222
- if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning(WarningTypes.CfTypeNotSupported, cf.cfRules[0].type);
10171
+ if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning("Multiple rules conditional formats");
10172
+ if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning("Conditional format type", cf.cfRules[0].type);
10223
10173
  if (cf.cfRules[0].dxfId) {
10224
10174
  const dxf = dxfs[cf.cfRules[0].dxfId];
10225
- if (dxf.border) warningManager.generateNotSupportedWarning(WarningTypes.CfFormatBorderNotSupported);
10226
- if (dxf.alignment) warningManager.generateNotSupportedWarning(WarningTypes.CfFormatAlignmentNotSupported);
10227
- if (dxf.numFmt) warningManager.generateNotSupportedWarning(WarningTypes.CfFormatNumFmtNotSupported);
10175
+ if (dxf.border) warningManager.generateNotSupportedWarning("Borders in conditional formats");
10176
+ if (dxf.alignment) warningManager.generateNotSupportedWarning("Alignment in conditional formats");
10177
+ if (dxf.numFmt) warningManager.generateNotSupportedWarning("Num formats in conditional formats");
10228
10178
  }
10229
10179
  }
10230
10180
 
@@ -10564,13 +10514,13 @@ function convertDataValidationRules(xlsxDataValidations, warningManager) {
10564
10514
  if (!dv) continue;
10565
10515
  switch (dv.type) {
10566
10516
  case "time":
10567
- warningManager.generateNotSupportedWarning(WarningTypes.TimeDataValidationNotSupported);
10517
+ warningManager.generateNotSupportedWarning("Time data validation rules");
10568
10518
  break;
10569
10519
  case "textLength":
10570
- warningManager.generateNotSupportedWarning(WarningTypes.TextLengthDataValidationNotSupported);
10520
+ warningManager.generateNotSupportedWarning("Text length data validation rules");
10571
10521
  break;
10572
10522
  case "whole":
10573
- warningManager.generateNotSupportedWarning(WarningTypes.WholeNumberDataValidationNotSupported);
10523
+ warningManager.generateNotSupportedWarning("Whole number data validation rules");
10574
10524
  break;
10575
10525
  case "decimal":
10576
10526
  const decimalRule = convertDecimalRule(dvId++, dv);
@@ -10582,7 +10532,7 @@ function convertDataValidationRules(xlsxDataValidations, warningManager) {
10582
10532
  break;
10583
10533
  case "date":
10584
10534
  if (dv.operator === "notEqual") {
10585
- warningManager.generateNotSupportedWarning(WarningTypes.NotEqualDateDataValidationNotSupported);
10535
+ warningManager.generateNotSupportedWarning("Not equal date data validation rules");
10586
10536
  break;
10587
10537
  }
10588
10538
  const dateRule = convertDateRule(dvId++, dv);
@@ -10888,7 +10838,7 @@ function getCellValue(cell, hyperLinksMap, sharedStrings, warningManager) {
10888
10838
  }
10889
10839
  function convertHyperlink(link, cellValue, warningManager) {
10890
10840
  const label = link.display || cellValue;
10891
- if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning(WarningTypes.BadlyFormattedHyperlink);
10841
+ if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning("Badly formatted hyperlink");
10892
10842
  return markdownLink(label, link.relTarget ? link.relTarget : buildSheetLink(splitReference(link.location).sheetName));
10893
10843
  }
10894
10844
  function getSheetDims(sheet) {
@@ -13173,46 +13123,6 @@ var XlsxReader = class {
13173
13123
 
13174
13124
  //#endregion
13175
13125
  //#region src/formulas/range_tokenizer.ts
13176
- var State = /* @__PURE__ */ function(State) {
13177
- /**
13178
- * Initial state.
13179
- * Expecting any reference for the left part of a range
13180
- * e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
13181
- */
13182
- State[State["LeftRef"] = 0] = "LeftRef";
13183
- /**
13184
- * Expecting any reference for the right part of a range
13185
- * e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
13186
- */
13187
- State[State["RightRef"] = 1] = "RightRef";
13188
- /**
13189
- * Expecting the separator without any constraint on the right part
13190
- */
13191
- State[State["Separator"] = 2] = "Separator";
13192
- /**
13193
- * Expecting the separator for a full column range
13194
- */
13195
- State[State["FullColumnSeparator"] = 3] = "FullColumnSeparator";
13196
- /**
13197
- * Expecting the separator for a full row range
13198
- */
13199
- State[State["FullRowSeparator"] = 4] = "FullRowSeparator";
13200
- /**
13201
- * Expecting the right part of a full column range
13202
- * e.g. "1", "A1"
13203
- */
13204
- State[State["RightColumnRef"] = 5] = "RightColumnRef";
13205
- /**
13206
- * Expecting the right part of a full row range
13207
- * e.g. "A", "A1"
13208
- */
13209
- State[State["RightRowRef"] = 6] = "RightRowRef";
13210
- /**
13211
- * Final state. A range has been matched
13212
- */
13213
- State[State["Found"] = 7] = "Found";
13214
- return State;
13215
- }(State || {});
13216
13126
  const goTo = (state, guard = () => true) => [{
13217
13127
  goTo: state,
13218
13128
  guard
@@ -13222,41 +13132,41 @@ const goToMulti = (state, guard = () => true) => ({
13222
13132
  guard
13223
13133
  });
13224
13134
  const machine = {
13225
- [State.LeftRef]: {
13226
- REFERENCE: goTo(State.Separator),
13227
- NUMBER: goTo(State.FullRowSeparator),
13228
- SYMBOL: [goToMulti(State.FullColumnSeparator, (token) => isColReference(token.value)), goToMulti(State.FullRowSeparator, (token) => isRowReference(token.value))]
13229
- },
13230
- [State.FullColumnSeparator]: {
13231
- SPACE: goTo(State.FullColumnSeparator),
13232
- OPERATOR: goTo(State.RightColumnRef, (token) => token.value === ":")
13233
- },
13234
- [State.FullRowSeparator]: {
13235
- SPACE: goTo(State.FullRowSeparator),
13236
- OPERATOR: goTo(State.RightRowRef, (token) => token.value === ":")
13237
- },
13238
- [State.Separator]: {
13239
- SPACE: goTo(State.Separator),
13240
- OPERATOR: goTo(State.RightRef, (token) => token.value === ":")
13241
- },
13242
- [State.RightRef]: {
13243
- SPACE: goTo(State.RightRef),
13244
- NUMBER: goTo(State.Found),
13245
- REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value)),
13246
- SYMBOL: goTo(State.Found, (token) => isColHeader(token.value) || isRowHeader(token.value))
13247
- },
13248
- [State.RightColumnRef]: {
13249
- SPACE: goTo(State.RightColumnRef),
13250
- SYMBOL: goTo(State.Found, (token) => isColHeader(token.value)),
13251
- REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value))
13252
- },
13253
- [State.RightRowRef]: {
13254
- SPACE: goTo(State.RightRowRef),
13255
- NUMBER: goTo(State.Found),
13256
- REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value)),
13257
- SYMBOL: goTo(State.Found, (token) => isRowHeader(token.value))
13258
- },
13259
- [State.Found]: {}
13135
+ [0]: {
13136
+ REFERENCE: goTo(2),
13137
+ NUMBER: goTo(4),
13138
+ SYMBOL: [goToMulti(3, (token) => isColReference(token.value)), goToMulti(4, (token) => isRowReference(token.value))]
13139
+ },
13140
+ [3]: {
13141
+ SPACE: goTo(3),
13142
+ OPERATOR: goTo(5, (token) => token.value === ":")
13143
+ },
13144
+ [4]: {
13145
+ SPACE: goTo(4),
13146
+ OPERATOR: goTo(6, (token) => token.value === ":")
13147
+ },
13148
+ [2]: {
13149
+ SPACE: goTo(2),
13150
+ OPERATOR: goTo(1, (token) => token.value === ":")
13151
+ },
13152
+ [1]: {
13153
+ SPACE: goTo(1),
13154
+ NUMBER: goTo(7),
13155
+ REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
13156
+ SYMBOL: goTo(7, (token) => isColHeader(token.value) || isRowHeader(token.value))
13157
+ },
13158
+ [5]: {
13159
+ SPACE: goTo(5),
13160
+ SYMBOL: goTo(7, (token) => isColHeader(token.value)),
13161
+ REFERENCE: goTo(7, (token) => isSingleCellReference(token.value))
13162
+ },
13163
+ [6]: {
13164
+ SPACE: goTo(6),
13165
+ NUMBER: goTo(7),
13166
+ REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
13167
+ SYMBOL: goTo(7, (token) => isRowHeader(token.value))
13168
+ },
13169
+ [7]: {}
13260
13170
  };
13261
13171
  /**
13262
13172
  * Check if the list of tokens starts with a sequence of tokens representing
@@ -13266,7 +13176,7 @@ const machine = {
13266
13176
  */
13267
13177
  function matchReference(tokens) {
13268
13178
  let head = 0;
13269
- let transitions = machine[State.LeftRef];
13179
+ let transitions = machine[0];
13270
13180
  let matchedTokens = "";
13271
13181
  while (transitions !== void 0) {
13272
13182
  const token = tokens[head++];
@@ -13275,7 +13185,7 @@ function matchReference(tokens) {
13275
13185
  const nextState = transition ? transition.goTo : void 0;
13276
13186
  switch (nextState) {
13277
13187
  case void 0: return null;
13278
- case State.Found:
13188
+ case 7:
13279
13189
  matchedTokens += token.value;
13280
13190
  tokens.splice(0, head);
13281
13191
  return {
@@ -13980,10 +13890,10 @@ const PasteInteractiveContent = {
13980
13890
  };
13981
13891
  function handlePasteResult(env, result) {
13982
13892
  if (!result.isSuccessful) {
13983
- if (result.reasons.includes(CommandResult.WrongPasteSelection)) env.raiseError(PasteInteractiveContent.wrongPasteSelection);
13984
- else if (result.reasons.includes(CommandResult.WillRemoveExistingMerge)) env.raiseError(PasteInteractiveContent.willRemoveExistingMerge);
13985
- else if (result.reasons.includes(CommandResult.WrongFigurePasteOption)) env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
13986
- else if (result.reasons.includes(CommandResult.FrozenPaneOverlap)) env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
13893
+ if (result.reasons.includes("WrongPasteSelection")) env.raiseError(PasteInteractiveContent.wrongPasteSelection);
13894
+ else if (result.reasons.includes("WillRemoveExistingMerge")) env.raiseError(PasteInteractiveContent.willRemoveExistingMerge);
13895
+ else if (result.reasons.includes("WrongFigurePasteOption")) env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
13896
+ else if (result.reasons.includes("FrozenPaneOverlap")) env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
13987
13897
  }
13988
13898
  }
13989
13899
  function interactivePaste(env, target, pasteOption) {
@@ -14009,25 +13919,25 @@ function interactivePasteFromOS(env, target, clipboardContent, pasteOption) {
14009
13919
  //#region src/components/translations_terms.ts
14010
13920
  const CfTerms = {
14011
13921
  Errors: {
14012
- [CommandResult.InvalidRange]: _t("The range is invalid"),
14013
- [CommandResult.FirstArgMissing]: _t("The argument is missing. Please provide a value"),
14014
- [CommandResult.SecondArgMissing]: _t("The second argument is missing. Please provide a value"),
14015
- [CommandResult.MinNaN]: _t("The minpoint must be a number"),
14016
- [CommandResult.MidNaN]: _t("The midpoint must be a number"),
14017
- [CommandResult.MaxNaN]: _t("The maxpoint must be a number"),
14018
- [CommandResult.ValueUpperInflectionNaN]: _t("The first value must be a number"),
14019
- [CommandResult.ValueLowerInflectionNaN]: _t("The second value must be a number"),
14020
- [CommandResult.MinBiggerThanMax]: _t("Minimum must be smaller then Maximum"),
14021
- [CommandResult.MinBiggerThanMid]: _t("Minimum must be smaller then Midpoint"),
14022
- [CommandResult.MidBiggerThanMax]: _t("Midpoint must be smaller then Maximum"),
14023
- [CommandResult.LowerBiggerThanUpper]: _t("Lower inflection point must be smaller than upper inflection point"),
14024
- [CommandResult.MinInvalidFormula]: _t("Invalid Minpoint formula"),
14025
- [CommandResult.MaxInvalidFormula]: _t("Invalid Maxpoint formula"),
14026
- [CommandResult.MidInvalidFormula]: _t("Invalid Midpoint formula"),
14027
- [CommandResult.ValueUpperInvalidFormula]: _t("Invalid upper inflection point formula"),
14028
- [CommandResult.ValueLowerInvalidFormula]: _t("Invalid lower inflection point formula"),
14029
- [CommandResult.EmptyRange]: _t("A range needs to be defined"),
14030
- [CommandResult.ValueCellIsInvalidFormula]: _t("At least one of the provided values is an invalid formula"),
13922
+ ["InvalidRange"]: _t("The range is invalid"),
13923
+ ["FirstArgMissing"]: _t("The argument is missing. Please provide a value"),
13924
+ ["SecondArgMissing"]: _t("The second argument is missing. Please provide a value"),
13925
+ ["MinNaN"]: _t("The minpoint must be a number"),
13926
+ ["MidNaN"]: _t("The midpoint must be a number"),
13927
+ ["MaxNaN"]: _t("The maxpoint must be a number"),
13928
+ ["ValueUpperInflectionNaN"]: _t("The first value must be a number"),
13929
+ ["ValueLowerInflectionNaN"]: _t("The second value must be a number"),
13930
+ ["MinBiggerThanMax"]: _t("Minimum must be smaller then Maximum"),
13931
+ ["MinBiggerThanMid"]: _t("Minimum must be smaller then Midpoint"),
13932
+ ["MidBiggerThanMax"]: _t("Midpoint must be smaller then Maximum"),
13933
+ ["LowerBiggerThanUpper"]: _t("Lower inflection point must be smaller than upper inflection point"),
13934
+ ["MinInvalidFormula"]: _t("Invalid Minpoint formula"),
13935
+ ["MaxInvalidFormula"]: _t("Invalid Maxpoint formula"),
13936
+ ["MidInvalidFormula"]: _t("Invalid Midpoint formula"),
13937
+ ["ValueUpperInvalidFormula"]: _t("Invalid upper inflection point formula"),
13938
+ ["ValueLowerInvalidFormula"]: _t("Invalid lower inflection point formula"),
13939
+ ["EmptyRange"]: _t("A range needs to be defined"),
13940
+ ["ValueCellIsInvalidFormula"]: _t("At least one of the provided values is an invalid formula"),
14031
13941
  Unexpected: _t("The rule is invalid for an unknown reason")
14032
13942
  },
14033
13943
  ColorScale: _t("Color scale"),
@@ -14062,18 +13972,18 @@ const ChartTerms = {
14062
13972
  AggregatedChart: _t("Aggregate"),
14063
13973
  Errors: {
14064
13974
  Unexpected: _t("The chart definition is invalid for an unknown reason"),
14065
- [CommandResult.InvalidDataSet]: _t("The dataset is invalid"),
14066
- [CommandResult.InvalidLabelRange]: _t("Labels are invalid"),
14067
- [CommandResult.InvalidScorecardKeyValue]: _t("The key value is invalid"),
14068
- [CommandResult.InvalidScorecardBaseline]: _t("The baseline value is invalid"),
14069
- [CommandResult.InvalidGaugeDataRange]: _t("The data range is invalid"),
14070
- [CommandResult.EmptyGaugeRangeMin]: _t("A minimum range limit value is needed"),
14071
- [CommandResult.GaugeRangeMinNaN]: _t("The minimum range limit value must be a number"),
14072
- [CommandResult.EmptyGaugeRangeMax]: _t("A maximum range limit value is needed"),
14073
- [CommandResult.GaugeRangeMaxNaN]: _t("The maximum range limit value must be a number"),
14074
- [CommandResult.GaugeRangeMinBiggerThanRangeMax]: _t("Minimum range limit must be smaller than maximum range limit"),
14075
- [CommandResult.GaugeLowerInflectionPointNaN]: _t("The lower inflection point value must be a number"),
14076
- [CommandResult.GaugeUpperInflectionPointNaN]: _t("The upper inflection point value must be a number")
13975
+ ["InvalidDataSet"]: _t("The dataset is invalid"),
13976
+ ["InvalidLabelRange"]: _t("Labels are invalid"),
13977
+ ["InvalidScorecardKeyValue"]: _t("The key value is invalid"),
13978
+ ["InvalidScorecardBaseline"]: _t("The baseline value is invalid"),
13979
+ ["InvalidGaugeDataRange"]: _t("The data range is invalid"),
13980
+ ["EmptyGaugeRangeMin"]: _t("A minimum range limit value is needed"),
13981
+ ["GaugeRangeMinNaN"]: _t("The minimum range limit value must be a number"),
13982
+ ["EmptyGaugeRangeMax"]: _t("A maximum range limit value is needed"),
13983
+ ["GaugeRangeMaxNaN"]: _t("The maximum range limit value must be a number"),
13984
+ ["GaugeRangeMinBiggerThanRangeMax"]: _t("Minimum range limit must be smaller than maximum range limit"),
13985
+ ["GaugeLowerInflectionPointNaN"]: _t("The lower inflection point value must be a number"),
13986
+ ["GaugeUpperInflectionPointNaN"]: _t("The upper inflection point value must be a number")
14077
13987
  }
14078
13988
  };
14079
13989
  const CustomCurrencyTerms = { Custom: _t("Custom") };
@@ -14081,16 +13991,16 @@ const MergeErrorMessage = _t("Merged cells are preventing this operation. Unmerg
14081
13991
  const TableHeaderMoveErrorMessage = _t("The header row of a table can't be moved.");
14082
13992
  const SplitToColumnsTerms = { Errors: {
14083
13993
  Unexpected: _t("Cannot split the selection for an unknown reason"),
14084
- [CommandResult.NoSplitSeparatorInSelection]: _t("There is no match for the selected separator in the selection"),
14085
- [CommandResult.MoreThanOneColumnSelected]: _t("Only a selection from a single column can be split"),
14086
- [CommandResult.SplitWillOverwriteContent]: _t("Splitting will overwrite existing content")
13994
+ ["NoSplitSeparatorInSelection"]: _t("There is no match for the selected separator in the selection"),
13995
+ ["MoreThanOneColumnSelected"]: _t("Only a selection from a single column can be split"),
13996
+ ["SplitWillOverwriteContent"]: _t("Splitting will overwrite existing content")
14087
13997
  } };
14088
13998
  const RemoveDuplicateTerms = { Errors: {
14089
13999
  Unexpected: _t("Cannot remove duplicates for an unknown reason"),
14090
- [CommandResult.MoreThanOneRangeSelected]: _t("Please select only one range of cells"),
14091
- [CommandResult.EmptyTarget]: _t("Please select a range of cells containing values."),
14092
- [CommandResult.NoColumnsProvided]: _t("Please select at latest one column to analyze."),
14093
- [CommandResult.WillRemoveExistingMerge]: PasteInteractiveContent.willRemoveExistingMerge
14000
+ ["MoreThanOneRangeSelected"]: _t("Please select only one range of cells"),
14001
+ ["EmptyTarget"]: _t("Please select a range of cells containing values."),
14002
+ ["NoColumnsProvided"]: _t("Please select at latest one column to analyze."),
14003
+ ["WillRemoveExistingMerge"]: PasteInteractiveContent.willRemoveExistingMerge
14094
14004
  } };
14095
14005
  const DVTerms = {
14096
14006
  DateIs: {
@@ -14119,10 +14029,10 @@ const DVTerms = {
14119
14029
  const TableTerms = {
14120
14030
  Errors: {
14121
14031
  Unexpected: _t("The table zone is invalid for an unknown reason"),
14122
- [CommandResult.TableOverlap]: _t("You cannot create overlapping tables."),
14123
- [CommandResult.NonContinuousTargets]: _t("A table can only be created on a continuous selection."),
14124
- [CommandResult.InvalidRange]: _t("The range is invalid"),
14125
- [CommandResult.TargetOutOfSheet]: _t("The range is out of the sheet")
14032
+ ["TableOverlap"]: _t("You cannot create overlapping tables."),
14033
+ ["NonContinuousTargets"]: _t("A table can only be created on a continuous selection."),
14034
+ ["InvalidRange"]: _t("The range is invalid"),
14035
+ ["TargetOutOfSheet"]: _t("The range is out of the sheet")
14126
14036
  },
14127
14037
  Checkboxes: {
14128
14038
  hasFilters: _t("Filter button"),
@@ -14566,7 +14476,7 @@ var AbstractChart = class {
14566
14476
  //#region src/helpers/figures/charts/scorecard_chart.ts
14567
14477
  function getBaselineText(baseline, keyValue, baselineMode, humanize, locale) {
14568
14478
  if (!baseline) return "";
14569
- else if (baselineMode === "text" || keyValue?.type !== CellValueType.number || baseline.type !== CellValueType.number) {
14479
+ else if (baselineMode === "text" || keyValue?.type !== "number" || baseline.type !== "number") {
14570
14480
  if (humanize) return humanizeNumber(baseline, locale);
14571
14481
  return baseline.formattedValue;
14572
14482
  }
@@ -14595,23 +14505,23 @@ function getKeyValueText(keyValueCell, humanize, locale) {
14595
14505
  return keyValueCell.formattedValue ?? String(keyValueCell.value ?? "");
14596
14506
  }
14597
14507
  function getBaselineColor(baseline, baselineMode, keyValue, colorUp, colorDown) {
14598
- if (baselineMode === "text" || baselineMode === "progress" || baseline?.type !== CellValueType.number || keyValue?.type !== CellValueType.number) return;
14508
+ if (baselineMode === "text" || baselineMode === "progress" || baseline?.type !== "number" || keyValue?.type !== "number") return;
14599
14509
  const diff = keyValue.value - baseline.value;
14600
14510
  if (diff > 0) return colorUp;
14601
14511
  else if (diff < 0) return colorDown;
14602
14512
  }
14603
14513
  function getBaselineArrowDirection(baseline, keyValue, baselineMode) {
14604
- if (baselineMode === "text" || baseline?.type !== CellValueType.number || keyValue?.type !== CellValueType.number) return "neutral";
14514
+ if (baselineMode === "text" || baseline?.type !== "number" || keyValue?.type !== "number") return "neutral";
14605
14515
  const diff = keyValue.value - baseline.value;
14606
14516
  if (diff > 0) return "up";
14607
14517
  else if (diff < 0) return "down";
14608
14518
  return "neutral";
14609
14519
  }
14610
14520
  function checkKeyValue(definition) {
14611
- return definition.keyValue && !rangeReference.test(definition.keyValue) ? CommandResult.InvalidScorecardKeyValue : CommandResult.Success;
14521
+ return definition.keyValue && !rangeReference.test(definition.keyValue) ? "InvalidScorecardKeyValue" : "Success";
14612
14522
  }
14613
14523
  function checkBaseline(definition) {
14614
- return definition.baseline && !rangeReference.test(definition.baseline) ? CommandResult.InvalidScorecardBaseline : CommandResult.Success;
14524
+ return definition.baseline && !rangeReference.test(definition.baseline) ? "InvalidScorecardBaseline" : "Success";
14615
14525
  }
14616
14526
  const arrowDownPath = new window.Path2D("M8.6 4.8a.5.5 0 0 1 0 .75l-3.9 3.9a.5 .5 0 0 1 -.75 0l-3.8 -3.9a.5 .5 0 0 1 0 -.75l.4-.4a.5.5 0 0 1 .75 0l2.3 2.4v-5.7c0-.25.25-.5.5-.5h.6c.25 0 .5.25.5.5v5.8l2.3 -2.4a.5.5 0 0 1 .75 0z");
14617
14527
  const arrowUpPath = new window.Path2D("M8.7 5.5a.5.5 0 0 0 0-.75l-3.8-4a.5.5 0 0 0-.75 0l-3.8 4a.5.5 0 0 0 0 .75l.4.4a.5.5 0 0 0 .75 0l2.3-2.4v5.8c0 .25.25.5.5.5h.6c.25 0 .5-.25.5-.5v-5.8l2.2 2.4a.5.5 0 0 0 .75 0z");
@@ -14841,6 +14751,7 @@ function getScorecardConfiguration({ width, height }, runtime) {
14841
14751
  }, runtime).computeDesign();
14842
14752
  }
14843
14753
  var ScorecardChartConfigBuilder = class {
14754
+ runtime;
14844
14755
  context;
14845
14756
  width;
14846
14757
  height;
@@ -15321,7 +15232,8 @@ var ChartJsComponent = class extends _odoo_owl.Component {
15321
15232
  }
15322
15233
  createChart(chartData) {
15323
15234
  const ctx = this.canvas.el.getContext("2d");
15324
- this.chart = new (getChartJSConstructor())(ctx, chartData);
15235
+ const Chart = getChartJSConstructor();
15236
+ this.chart = new Chart(ctx, chartData);
15325
15237
  }
15326
15238
  updateChartJs(chartRuntime) {
15327
15239
  const chartData = chartRuntime.chartJsConfig;
@@ -17908,15 +17820,15 @@ const DATEDIF = {
17908
17820
  const jsEndDate = numberToJsDate(_endDate);
17909
17821
  assert(() => _endDate >= _startDate, _t("start_date (%s) should be on or before end_date (%s).", jsStartDate.toLocaleDateString(), jsEndDate.toLocaleDateString()));
17910
17822
  switch (_unit) {
17911
- case TIME_UNIT.WHOLE_YEARS: return getTimeDifferenceInWholeYears(jsStartDate, jsEndDate);
17912
- case TIME_UNIT.WHOLE_MONTHS: return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate);
17913
- case TIME_UNIT.WHOLE_DAYS: return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
17914
- case TIME_UNIT.MONTH_WITHOUT_WHOLE_YEARS: return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate) - getTimeDifferenceInWholeYears(jsStartDate, jsEndDate) * 12;
17915
- case TIME_UNIT.DAYS_WITHOUT_WHOLE_MONTHS:
17823
+ case "Y": return getTimeDifferenceInWholeYears(jsStartDate, jsEndDate);
17824
+ case "M": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate);
17825
+ case "D": return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
17826
+ case "YM": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate) - getTimeDifferenceInWholeYears(jsStartDate, jsEndDate) * 12;
17827
+ case "MD":
17916
17828
  let days = jsEndDate.getDate() - jsStartDate.getDate();
17917
17829
  if (days < 0) days = getDaysInMonth(new DateTime(jsEndDate.getFullYear(), jsEndDate.getMonth() - 1, 1)) - Math.abs(days);
17918
17830
  return days;
17919
- case TIME_UNIT.DAYS_BETWEEN_NO_MORE_THAN_ONE_YEAR: {
17831
+ case "YD": {
17920
17832
  if (areTwoDatesWithinOneYear(_startDate, _endDate)) return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
17921
17833
  const endDateWithinOneYear = new DateTime(jsStartDate.getFullYear(), jsEndDate.getMonth(), jsEndDate.getDate());
17922
17834
  let days = getTimeDifferenceInWholeDays(jsStartDate, endDateWithinOneYear);
@@ -18412,18 +18324,18 @@ const DELTA = {
18412
18324
  //#endregion
18413
18325
  //#region src/helpers/sort.ts
18414
18326
  const SORT_TYPES = [
18415
- CellValueType.number,
18416
- CellValueType.error,
18417
- CellValueType.text,
18418
- CellValueType.boolean
18327
+ "number",
18328
+ "error",
18329
+ "text",
18330
+ "boolean"
18419
18331
  ];
18420
18332
  function cellsSortingCriterion(sortingOrder) {
18421
18333
  const inverse = sortingOrder === "ascending" ? 1 : -1;
18422
18334
  return (left, right) => {
18423
- if (left.type === CellValueType.empty) return right.type === CellValueType.empty ? 0 : 1;
18424
- else if (right.type === CellValueType.empty) return -1;
18335
+ if (left.type === "empty") return right.type === "empty" ? 0 : 1;
18336
+ else if (right.type === "empty") return -1;
18425
18337
  let typeOrder = SORT_TYPES.indexOf(left.type) - SORT_TYPES.indexOf(right.type);
18426
- if (typeOrder === 0) if (left.type === CellValueType.text || left.type === CellValueType.error) typeOrder = left.value.localeCompare(right.value);
18338
+ if (typeOrder === 0) if (left.type === "text" || left.type === "error") typeOrder = left.value.localeCompare(right.value);
18427
18339
  else typeOrder = left.value - right.value;
18428
18340
  return inverse * typeOrder;
18429
18341
  };
@@ -18434,9 +18346,9 @@ function sortCells(cells, sortDirection, emptyCellAsZero) {
18434
18346
  type: cell.type,
18435
18347
  value: cell.value
18436
18348
  }));
18437
- return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type === CellValueType.empty ? {
18349
+ return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type === "empty" ? {
18438
18350
  ...cell,
18439
- type: CellValueType.number,
18351
+ type: "number",
18440
18352
  value: 0
18441
18353
  } : cell) : cellsWithIndex).sort(cellsSortingCriterion(sortDirection));
18442
18354
  }
@@ -18498,7 +18410,7 @@ function interactiveSortSelection(env, sheetId, anchor, zone, sortDirection) {
18498
18410
  });
18499
18411
  });
18500
18412
  }
18501
- if (result.isCancelledBecause(CommandResult.InvalidSortZone)) {
18413
+ if (result.isCancelledBecause("InvalidSortZone")) {
18502
18414
  const { col, row } = anchor;
18503
18415
  env.model.selection.selectZone({
18504
18416
  cell: {
@@ -18551,11 +18463,11 @@ function sortMatrix(matrix, locale, ...criteria) {
18551
18463
  const right = sortColumn[b];
18552
18464
  const leftCell = {
18553
18465
  value: left,
18554
- type: left === null ? CellValueType.empty : typeof left === "string" ? CellValueType.text : typeof left
18466
+ type: left === null ? "empty" : typeof left === "string" ? "text" : typeof left
18555
18467
  };
18556
18468
  const rightCell = {
18557
18469
  value: right,
18558
- type: right === null ? CellValueType.empty : typeof right === "string" ? CellValueType.text : typeof right
18470
+ type: right === null ? "empty" : typeof right === "string" ? "text" : typeof right
18559
18471
  };
18560
18472
  const result = sortingCriteria[sortingOrders[i]](leftCell, rightCell);
18561
18473
  if (result !== 0) return result;
@@ -20969,8 +20881,8 @@ const CELL = {
20969
20881
  row: range.zone.top
20970
20882
  };
20971
20883
  const type = this.getters.getEvaluatedCell(position).type;
20972
- if (type === CellValueType.empty) return "b";
20973
- else if (type === CellValueType.text) return "l";
20884
+ if (type === "empty") return "b";
20885
+ else if (type === "text") return "l";
20974
20886
  else return "v";
20975
20887
  }
20976
20888
  }
@@ -24174,6 +24086,7 @@ var Composer = class extends _odoo_owl.Component {
24174
24086
  //#endregion
24175
24087
  //#region src/formulas/code_builder.ts
24176
24088
  var FunctionCodeBuilder = class {
24089
+ scope;
24177
24090
  code = "";
24178
24091
  constructor(scope = new Scope()) {
24179
24092
  this.scope = scope;
@@ -24189,6 +24102,8 @@ var FunctionCodeBuilder = class {
24189
24102
  }
24190
24103
  };
24191
24104
  var FunctionCodeImpl = class {
24105
+ scope;
24106
+ returnExpression;
24192
24107
  code;
24193
24108
  constructor(scope, code, returnExpression) {
24194
24109
  this.scope = scope;
@@ -24564,6 +24479,9 @@ function extractFormulaIdFromToken(tokenAtCursor) {
24564
24479
  function getFirstPivotFunction(tokens) {
24565
24480
  return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS)[0];
24566
24481
  }
24482
+ function getPivotFunctions(tokens) {
24483
+ return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS);
24484
+ }
24567
24485
  /**
24568
24486
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
24569
24487
  * present in the given formula.
@@ -24935,19 +24853,19 @@ autofillModifiersRegistry.add("ALPHANUMERIC_INCREMENT_MODIFIER", { apply: (rule,
24935
24853
  let x = 0;
24936
24854
  let y = 0;
24937
24855
  switch (direction) {
24938
- case DIRECTION.UP:
24856
+ case "up":
24939
24857
  x = 0;
24940
24858
  y = -rule.current;
24941
24859
  break;
24942
- case DIRECTION.DOWN:
24860
+ case "down":
24943
24861
  x = 0;
24944
24862
  y = rule.current;
24945
24863
  break;
24946
- case DIRECTION.LEFT:
24864
+ case "left":
24947
24865
  x = -rule.current;
24948
24866
  y = 0;
24949
24867
  break;
24950
- case DIRECTION.RIGHT:
24868
+ case "right":
24951
24869
  x = rule.current;
24952
24870
  y = 0;
24953
24871
  break;
@@ -25073,12 +24991,12 @@ autofillRulesRegistry.add("simple_value_copy", {
25073
24991
  },
25074
24992
  sequence: 10
25075
24993
  }).add("increment_alphanumeric_value", {
25076
- condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === CellValueType.text && alphaNumericValueRegExp.test(cell.content),
24994
+ condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "text" && alphaNumericValueRegExp.test(cell.content),
25077
24995
  generateRule: (cell, cells, direction) => {
25078
24996
  const numberPostfix = parseInt(cell.content.match(numberPostfixRegExp)[0]);
25079
24997
  const prefix = cell.content.match(stringPrefixRegExp)[0];
25080
24998
  const numberPostfixLength = cell.content.length - prefix.length;
25081
- const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === CellValueType.text && alphaNumericValueRegExp.test(evaluatedCell.value)).filter((cell) => prefix === (cell.value ?? "").toString().match(stringPrefixRegExp)[0]).map((cell) => parseInt((cell.value ?? "").toString().match(numberPostfixRegExp)[0]));
24999
+ const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "text" && alphaNumericValueRegExp.test(evaluatedCell.value)).filter((cell) => prefix === (cell.value ?? "").toString().match(stringPrefixRegExp)[0]).map((cell) => parseInt((cell.value ?? "").toString().match(numberPostfixRegExp)[0]));
25082
25000
  let increment = calculateIncrementBasedOnGroup(group);
25083
25001
  if (["up", "left"].includes(direction) && group.length === 1) increment = -increment;
25084
25002
  return {
@@ -25091,7 +25009,7 @@ autofillRulesRegistry.add("simple_value_copy", {
25091
25009
  },
25092
25010
  sequence: 15
25093
25011
  }).add("copy_text", {
25094
- condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === CellValueType.text,
25012
+ condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "text",
25095
25013
  generateRule: () => {
25096
25014
  return { type: "COPY_MODIFIER" };
25097
25015
  },
@@ -25108,10 +25026,10 @@ autofillRulesRegistry.add("simple_value_copy", {
25108
25026
  sequence: 30
25109
25027
  }).add("increment_dates", {
25110
25028
  condition: (cell, cells) => {
25111
- return !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === CellValueType.number && !!cell.format && isDateTimeFormat(cell.format);
25029
+ return !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "number" && !!cell.format && isDateTimeFormat(cell.format);
25112
25030
  },
25113
25031
  generateRule: (cell, cells) => {
25114
- const increment = calculateDateIncrementBasedOnGroup(getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === CellValueType.number && !!evaluatedCell.format && isDateTimeFormat(evaluatedCell.format)).map((cell) => Number(cell.value)));
25032
+ const increment = calculateDateIncrementBasedOnGroup(getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number" && !!evaluatedCell.format && isDateTimeFormat(evaluatedCell.format)).map((cell) => Number(cell.value)));
25115
25033
  if (increment === void 0) return { type: "COPY_MODIFIER" };
25116
25034
  /** requires to detect the current date (requires to be an integer value with the right format)
25117
25035
  * detect if year or if month or if day then extrapolate increment required (+1 month, +1 year + 1 day)
@@ -25120,26 +25038,26 @@ autofillRulesRegistry.add("simple_value_copy", {
25120
25038
  if (typeof increment === "object") return {
25121
25039
  type: "DATE_INCREMENT_MODIFIER",
25122
25040
  increment,
25123
- current: evaluation.type === CellValueType.number ? evaluation.value : 0
25041
+ current: evaluation.type === "number" ? evaluation.value : 0
25124
25042
  };
25125
25043
  return {
25126
25044
  type: "INCREMENT_MODIFIER",
25127
25045
  increment,
25128
- current: evaluation.type === CellValueType.number ? evaluation.value : 0
25046
+ current: evaluation.type === "number" ? evaluation.value : 0
25129
25047
  };
25130
25048
  },
25131
25049
  sequence: 25
25132
25050
  }).add("increment_number", {
25133
- condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === CellValueType.number,
25051
+ condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "number",
25134
25052
  generateRule: (cell, cells, direction) => {
25135
- const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === CellValueType.number && !isDateTimeFormat(evaluatedCell.format || "")).map((cell) => Number(cell.value));
25053
+ const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number" && !isDateTimeFormat(evaluatedCell.format || "")).map((cell) => Number(cell.value));
25136
25054
  let increment = calculateIncrementBasedOnGroup(group);
25137
25055
  if (["up", "left"].includes(direction) && group.length === 1) increment = -increment;
25138
25056
  const evaluation = evaluateLiteral(cell, { locale: DEFAULT_LOCALE });
25139
25057
  return {
25140
25058
  type: "INCREMENT_MODIFIER",
25141
25059
  increment,
25142
- current: evaluation.type === CellValueType.number ? evaluation.value : 0
25060
+ current: evaluation.type === "number" ? evaluation.value : 0
25143
25061
  };
25144
25062
  },
25145
25063
  sequence: 40
@@ -26043,47 +25961,47 @@ function createComboChartRuntime(chart, getters) {
26043
25961
  //#endregion
26044
25962
  //#region src/helpers/figures/charts/gauge_chart.ts
26045
25963
  function isDataRangeValid(definition) {
26046
- return definition.dataRange && !rangeReference.test(definition.dataRange) ? CommandResult.InvalidGaugeDataRange : CommandResult.Success;
25964
+ return definition.dataRange && !rangeReference.test(definition.dataRange) ? "InvalidGaugeDataRange" : "Success";
26047
25965
  }
26048
25966
  function checkRangeLimits(check, batchValidations) {
26049
25967
  return batchValidations((definition) => {
26050
25968
  if (definition.sectionRule) return check(definition.sectionRule.rangeMin, "rangeMin");
26051
- return CommandResult.Success;
25969
+ return "Success";
26052
25970
  }, (definition) => {
26053
25971
  if (definition.sectionRule) return check(definition.sectionRule.rangeMax, "rangeMax");
26054
- return CommandResult.Success;
25972
+ return "Success";
26055
25973
  });
26056
25974
  }
26057
25975
  function checkInflectionPointsValue(check, batchValidations) {
26058
25976
  return batchValidations((definition) => {
26059
25977
  if (definition.sectionRule) return check(definition.sectionRule.lowerInflectionPoint.value, "lowerInflectionPointValue");
26060
- return CommandResult.Success;
25978
+ return "Success";
26061
25979
  }, (definition) => {
26062
25980
  if (definition.sectionRule) return check(definition.sectionRule.upperInflectionPoint.value, "upperInflectionPointValue");
26063
- return CommandResult.Success;
25981
+ return "Success";
26064
25982
  });
26065
25983
  }
26066
25984
  function checkRangeMinBiggerThanRangeMax(definition) {
26067
25985
  if (definition.sectionRule) {
26068
- if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) return CommandResult.GaugeRangeMinBiggerThanRangeMax;
25986
+ if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) return "GaugeRangeMinBiggerThanRangeMax";
26069
25987
  }
26070
- return CommandResult.Success;
25988
+ return "Success";
26071
25989
  }
26072
25990
  function checkEmpty(value, valueName) {
26073
25991
  if (value === "") switch (valueName) {
26074
- case "rangeMin": return CommandResult.EmptyGaugeRangeMin;
26075
- case "rangeMax": return CommandResult.EmptyGaugeRangeMax;
25992
+ case "rangeMin": return "EmptyGaugeRangeMin";
25993
+ case "rangeMax": return "EmptyGaugeRangeMax";
26076
25994
  }
26077
- return CommandResult.Success;
25995
+ return "Success";
26078
25996
  }
26079
25997
  function checkNaN(value, valueName) {
26080
25998
  if (isNaN(value)) switch (valueName) {
26081
- case "rangeMin": return CommandResult.GaugeRangeMinNaN;
26082
- case "rangeMax": return CommandResult.GaugeRangeMaxNaN;
26083
- case "lowerInflectionPointValue": return CommandResult.GaugeLowerInflectionPointNaN;
26084
- case "upperInflectionPointValue": return CommandResult.GaugeUpperInflectionPointNaN;
25999
+ case "rangeMin": return "GaugeRangeMinNaN";
26000
+ case "rangeMax": return "GaugeRangeMaxNaN";
26001
+ case "lowerInflectionPointValue": return "GaugeLowerInflectionPointNaN";
26002
+ case "upperInflectionPointValue": return "GaugeUpperInflectionPointNaN";
26085
26003
  }
26086
- return CommandResult.Success;
26004
+ return "Success";
26087
26005
  }
26088
26006
  var GaugeChart = class GaugeChart extends AbstractChart {
26089
26007
  dataRange;
@@ -26179,7 +26097,7 @@ function createGaugeChartRuntime(chart, getters) {
26179
26097
  col: dataRange.zone.left,
26180
26098
  row: dataRange.zone.top
26181
26099
  });
26182
- if (cell.type === CellValueType.number) {
26100
+ if (cell.type === "number") {
26183
26101
  gaugeValue = cell.value;
26184
26102
  formattedValue = cell.formattedValue;
26185
26103
  format = cell.format;
@@ -27688,7 +27606,7 @@ var MenuItemRegistry = class extends Registry {
27688
27606
  function interactiveCut(env) {
27689
27607
  const result = env.model.dispatch("CUT");
27690
27608
  if (!result.isSuccessful) {
27691
- if (result.isCancelledBecause(CommandResult.WrongCutSelection)) env.raiseError(_t("This operation is not allowed with multiple selections."));
27609
+ if (result.isCancelledBecause("WrongCutSelection")) env.raiseError(_t("This operation is not allowed with multiple selections."));
27692
27610
  }
27693
27611
  }
27694
27612
 
@@ -27703,8 +27621,8 @@ function interactiveAddMerge(env, sheetId, target) {
27703
27621
  sheetId,
27704
27622
  target
27705
27623
  });
27706
- if (result.isCancelledBecause(CommandResult.MergeInTable)) env.raiseError(AddMergeInteractiveContent.MergeInFilter);
27707
- else if (result.isCancelledBecause(CommandResult.MergeIsDestructive)) env.askConfirmation(AddMergeInteractiveContent.MergeIsDestructive, () => {
27624
+ if (result.isCancelledBecause("MergeInTable")) env.raiseError(AddMergeInteractiveContent.MergeInFilter);
27625
+ else if (result.isCancelledBecause("MergeIsDestructive")) env.askConfirmation(AddMergeInteractiveContent.MergeIsDestructive, () => {
27708
27626
  env.model.dispatch("ADD_MERGE", {
27709
27627
  sheetId,
27710
27628
  target,
@@ -27745,7 +27663,7 @@ var ErrorToolTip = class extends _odoo_owl.Component {
27745
27663
  const ErrorToolTipPopoverBuilder = { onHover: (position, getters) => {
27746
27664
  const cell = getters.getEvaluatedCell(position);
27747
27665
  const errors = [];
27748
- if (cell.type === CellValueType.error && !!cell.message) errors.push({
27666
+ if (cell.type === "error" && !!cell.message) errors.push({
27749
27667
  title: _t("Error"),
27750
27668
  message: cell.message
27751
27669
  });
@@ -28454,7 +28372,7 @@ function zoneToRect(zone) {
28454
28372
  css`
28455
28373
  .o-popover {
28456
28374
  position: absolute;
28457
- z-index: ${ComponentsImportance.Popover};
28375
+ z-index: ${35};
28458
28376
  overflow: auto;
28459
28377
  box-shadow: 1px 2px 5px 2px rgb(51 51 51 / 15%);
28460
28378
  width: fit-content;
@@ -28509,7 +28427,7 @@ var Popover = class extends _odoo_owl.Component {
28509
28427
  onMouseWheel: () => {},
28510
28428
  onPopoverMoved: () => {},
28511
28429
  onPopoverHidden: () => {},
28512
- zIndex: ComponentsImportance.Popover
28430
+ zIndex: 35
28513
28431
  };
28514
28432
  popoverRef = (0, _odoo_owl.useRef)("popover");
28515
28433
  currentPosition = void 0;
@@ -28555,6 +28473,10 @@ var Popover = class extends _odoo_owl.Component {
28555
28473
  }
28556
28474
  };
28557
28475
  var PopoverPositionContext = class {
28476
+ anchorRect;
28477
+ containerRect;
28478
+ propsMaxSize;
28479
+ spreadsheetOffset;
28558
28480
  constructor(anchorRect, containerRect, propsMaxSize, spreadsheetOffset) {
28559
28481
  this.anchorRect = anchorRect;
28560
28482
  this.containerRect = containerRect;
@@ -29129,7 +29051,7 @@ function getSmartChartDefinition(zone, getters) {
29129
29051
  const dataSetsHaveTitle = !!getters.getEvaluatedCellsInZone(sheetId, {
29130
29052
  ...dataSetZone,
29131
29053
  bottom: dataSetZone.top
29132
- }).find((cell) => cell.type !== CellValueType.empty && cell.type !== CellValueType.number);
29054
+ }).find((cell) => cell.type !== "empty" && cell.type !== "number");
29133
29055
  let labelRangeXc;
29134
29056
  if (!singleColumn) labelRangeXc = zoneToXc({
29135
29057
  ...zone,
@@ -29192,8 +29114,8 @@ function interactiveCreateTable(env, sheetId, tableConfig) {
29192
29114
  config: tableConfig,
29193
29115
  tableType: isDynamic ? "dynamic" : "static"
29194
29116
  });
29195
- if (result.isCancelledBecause(CommandResult.TableOverlap)) env.raiseError(TableTerms.Errors.TableOverlap);
29196
- else if (result.isCancelledBecause(CommandResult.NonContinuousTargets)) env.raiseError(TableTerms.Errors.NonContinuousTargets);
29117
+ if (result.isCancelledBecause("TableOverlap")) env.raiseError(TableTerms.Errors.TableOverlap);
29118
+ else if (result.isCancelledBecause("NonContinuousTargets")) env.raiseError(TableTerms.Errors.NonContinuousTargets);
29197
29119
  return result;
29198
29120
  }
29199
29121
 
@@ -29224,7 +29146,7 @@ async function paste$1(env, pasteOption) {
29224
29146
  const target = env.model.getters.getSelectedZones();
29225
29147
  if (env.model.getters.getClipboardId() !== clipboardId) interactivePasteFromOS(env, target, clipboardContent, pasteOption);
29226
29148
  else interactivePaste(env, target, pasteOption);
29227
- if (env.model.getters.isCutOperation() && pasteOption !== "asValue") await env.clipboard.write({ [ClipboardMIMEType.PlainText]: "" });
29149
+ if (env.model.getters.isCutOperation() && pasteOption !== "asValue") await env.clipboard.write({ ["text/plain"]: "" });
29228
29150
  break;
29229
29151
  case "notImplemented":
29230
29152
  env.raiseError(_t("Pasting from the context menu is not supported in this browser. Use keyboard shortcuts ctrl+c / ctrl+v instead."));
@@ -29606,11 +29528,10 @@ const INSERT_TABLE = (env) => {
29606
29528
  if (interactiveCreateTable(env, env.model.getters.getActiveSheetId()).isSuccessful) env.openSidePanel("TableSidePanel", {});
29607
29529
  };
29608
29530
  const DELETE_SELECTED_TABLE = (env) => {
29609
- const position = env.model.getters.getActivePosition();
29610
- const table = env.model.getters.getTable(position);
29531
+ const table = env.model.getters.getFirstTableInSelection();
29611
29532
  if (!table) return;
29612
29533
  env.model.dispatch("REMOVE_TABLE", {
29613
- sheetId: position.sheetId,
29534
+ sheetId: env.model.getters.getActiveSheetId(),
29614
29535
  target: [table.range.zone]
29615
29536
  });
29616
29537
  };
@@ -30164,7 +30085,7 @@ const FIX_FORMULAS = {
30164
30085
  if (!pivotId) return false;
30165
30086
  const pivot = env.model.getters.getPivot(pivotId);
30166
30087
  const cell = env.model.getters.getEvaluatedCell(position);
30167
- return pivot.isValid() && env.model.getters.isSpillPivotFormula(position) && cell.type !== CellValueType.error;
30088
+ return pivot.isValid() && env.model.getters.isSpillPivotFormula(position) && cell.type !== "error";
30168
30089
  },
30169
30090
  icon: "o-spreadsheet-Icon.PIVOT"
30170
30091
  };
@@ -30749,7 +30670,7 @@ function interactiveFreezeColumnsRows(env, dimension, base) {
30749
30670
  if (env.model.dispatch(cmd, {
30750
30671
  sheetId,
30751
30672
  quantity: base
30752
- }).isCancelledBecause(CommandResult.MergeOverlap)) env.raiseError(MergeErrorMessage);
30673
+ }).isCancelledBecause("MergeOverlap")) env.raiseError(MergeErrorMessage);
30753
30674
  }
30754
30675
 
30755
30676
  //#endregion
@@ -31275,7 +31196,7 @@ function getVisiblePivotCellPositions(getters, pivotId) {
31275
31196
  col,
31276
31197
  row
31277
31198
  };
31278
- if (pivotId === getters.getPivotIdFromPosition(position)) positions.push(position);
31199
+ if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
31279
31200
  }
31280
31201
  return positions;
31281
31202
  }
@@ -31841,6 +31762,9 @@ var FocusStore = class {
31841
31762
  * This plugin handles this internal state.
31842
31763
  */
31843
31764
  var SelectionInputStore = class extends SpreadsheetStore {
31765
+ initialRanges;
31766
+ inputHasSingleRange;
31767
+ colors;
31844
31768
  mutators = [
31845
31769
  "resetWithRanges",
31846
31770
  "focusById",
@@ -32437,10 +32361,10 @@ var GenericChartConfigPanel = class extends _odoo_owl.Component {
32437
32361
  return [...this.state.datasetDispatchResult?.reasons || [], ...this.state.labelsDispatchResult?.reasons || []].map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
32438
32362
  }
32439
32363
  get isDatasetInvalid() {
32440
- return !!this.state.datasetDispatchResult?.isCancelledBecause(CommandResult.InvalidDataSet);
32364
+ return !!this.state.datasetDispatchResult?.isCancelledBecause("InvalidDataSet");
32441
32365
  }
32442
32366
  get isLabelInvalid() {
32443
- return !!this.state.labelsDispatchResult?.isCancelledBecause(CommandResult.InvalidLabelRange);
32367
+ return !!this.state.labelsDispatchResult?.isCancelledBecause("InvalidLabelRange");
32444
32368
  }
32445
32369
  get dataSetsHaveTitleLabel() {
32446
32370
  return _t("Use row %s as headers", this.calculateHeaderPosition() || "");
@@ -33777,7 +33701,7 @@ var GaugeChartConfigPanel = class extends _odoo_owl.Component {
33777
33701
  return [...this.state.dataRangeDispatchResult?.reasons || []].map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
33778
33702
  }
33779
33703
  get isDataRangeInvalid() {
33780
- return !!this.state.dataRangeDispatchResult?.isCancelledBecause(CommandResult.InvalidGaugeDataRange);
33704
+ return !!this.state.dataRangeDispatchResult?.isCancelledBecause("InvalidGaugeDataRange");
33781
33705
  }
33782
33706
  onDataRangeChanged(ranges) {
33783
33707
  this.dataRange = ranges[0];
@@ -33863,16 +33787,16 @@ var GaugeChartDesignPanel = class extends _odoo_owl.Component {
33863
33787
  return [...this.state.sectionRuleDispatchResult?.reasons || []].map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
33864
33788
  }
33865
33789
  isRangeMinInvalid() {
33866
- return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(CommandResult.EmptyGaugeRangeMin) || this.state.sectionRuleDispatchResult?.isCancelledBecause(CommandResult.GaugeRangeMinNaN) || this.state.sectionRuleDispatchResult?.isCancelledBecause(CommandResult.GaugeRangeMinBiggerThanRangeMax));
33790
+ return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("EmptyGaugeRangeMin") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMinNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMinBiggerThanRangeMax"));
33867
33791
  }
33868
33792
  isRangeMaxInvalid() {
33869
- return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(CommandResult.EmptyGaugeRangeMax) || this.state.sectionRuleDispatchResult?.isCancelledBecause(CommandResult.GaugeRangeMaxNaN) || this.state.sectionRuleDispatchResult?.isCancelledBecause(CommandResult.GaugeRangeMinBiggerThanRangeMax));
33793
+ return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("EmptyGaugeRangeMax") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMaxNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMinBiggerThanRangeMax"));
33870
33794
  }
33871
33795
  get isLowerInflectionPointInvalid() {
33872
- return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(CommandResult.GaugeLowerInflectionPointNaN) || this.state.sectionRuleDispatchResult?.isCancelledBecause(CommandResult.GaugeLowerBiggerThanUpper));
33796
+ return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeLowerInflectionPointNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeLowerBiggerThanUpper"));
33873
33797
  }
33874
33798
  get isUpperInflectionPointInvalid() {
33875
- return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(CommandResult.GaugeUpperInflectionPointNaN) || this.state.sectionRuleDispatchResult?.isCancelledBecause(CommandResult.GaugeLowerBiggerThanUpper));
33799
+ return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeUpperInflectionPointNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeLowerBiggerThanUpper"));
33876
33800
  }
33877
33801
  updateSectionColor(target, color) {
33878
33802
  const sectionRule = deepCopy(this.state.sectionRule);
@@ -33996,10 +33920,10 @@ var ScorecardChartConfigPanel = class extends _odoo_owl.Component {
33996
33920
  return [...this.state.keyValueDispatchResult?.reasons || [], ...this.state.baselineDispatchResult?.reasons || []].map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
33997
33921
  }
33998
33922
  get isKeyValueInvalid() {
33999
- return !!this.state.keyValueDispatchResult?.isCancelledBecause(CommandResult.InvalidScorecardKeyValue);
33923
+ return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardKeyValue");
34000
33924
  }
34001
33925
  get isBaselineInvalid() {
34002
- return !!this.state.keyValueDispatchResult?.isCancelledBecause(CommandResult.InvalidScorecardBaseline);
33926
+ return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardBaseline");
34003
33927
  }
34004
33928
  onKeyValueRangeChanged(ranges) {
34005
33929
  this.keyValue = ranges[0];
@@ -34888,6 +34812,7 @@ var AbstractComposerStore = class extends SpreadsheetStore {
34888
34812
  //#endregion
34889
34813
  //#region src/components/composer/standalone_composer/standalone_composer_store.ts
34890
34814
  var StandaloneComposerStore = class extends AbstractComposerStore {
34815
+ args;
34891
34816
  constructor(get, args) {
34892
34817
  super(get);
34893
34818
  this.args = args;
@@ -35025,7 +34950,7 @@ var StandaloneComposer = class extends _odoo_owl.Component {
35025
34950
  css`
35026
34951
  .o-icon-picker {
35027
34952
  position: absolute;
35028
- z-index: ${ComponentsImportance.IconPicker};
34953
+ z-index: ${25};
35029
34954
  box-shadow: 1px 2px 5px 2px rgba(51, 51, 51, 0.15);
35030
34955
  background-color: white;
35031
34956
  padding: 2px 1px;
@@ -35277,6 +35202,7 @@ var DOMDndHelper = class {
35277
35202
  }
35278
35203
  };
35279
35204
  var ContainerWrapper = class {
35205
+ el;
35280
35206
  constructor(el) {
35281
35207
  this.el = el;
35282
35208
  }
@@ -35656,11 +35582,12 @@ var ConditionalFormattingEditor = class extends _odoo_owl.Component {
35656
35582
  colorNumberString = colorNumberString;
35657
35583
  state;
35658
35584
  setup() {
35585
+ const cf = this.props.editedCf || {
35586
+ id: this.env.model.uuidGenerator.smallUuid(),
35587
+ ranges: this.env.model.getters.getSelectedZones().map((zone) => this.env.model.getters.zoneToXC(this.env.model.getters.getActiveSheetId(), zone))
35588
+ };
35659
35589
  this.state = (0, _odoo_owl.useState)({
35660
- currentCF: this.props.editedCf || {
35661
- id: this.env.model.uuidGenerator.smallUuid(),
35662
- ranges: this.env.model.getters.getSelectedZones().map((zone) => this.env.model.getters.zoneToXC(this.env.model.getters.getActiveSheetId(), zone))
35663
- },
35590
+ currentCF: cf,
35664
35591
  currentCFType: this.props.editedCf?.rule.type || "CellIsRule",
35665
35592
  errors: [],
35666
35593
  rules: this.getDefaultRules()
@@ -35682,7 +35609,7 @@ var ConditionalFormattingEditor = class extends _odoo_owl.Component {
35682
35609
  (0, _odoo_owl.useExternalListener)(window, "click", this.closeMenus);
35683
35610
  }
35684
35611
  get isRangeValid() {
35685
- return this.state.errors.includes(CommandResult.EmptyRange);
35612
+ return this.state.errors.includes("EmptyRange");
35686
35613
  }
35687
35614
  get errorMessages() {
35688
35615
  return this.state.errors.map((error) => CfTerms.Errors[error] || CfTerms.Errors.Unexpected);
@@ -35710,7 +35637,7 @@ var ConditionalFormattingEditor = class extends _odoo_owl.Component {
35710
35637
  saveConditionalFormat() {
35711
35638
  if (this.state.currentCF) {
35712
35639
  if (this.state.currentCF.ranges.some((xc) => !xc.match(rangeReference))) {
35713
- this.state.errors = [CommandResult.InvalidRange];
35640
+ this.state.errors = ["InvalidRange"];
35714
35641
  return;
35715
35642
  }
35716
35643
  const sheetId = this.env.model.getters.getActiveSheetId();
@@ -35805,10 +35732,10 @@ var ConditionalFormattingEditor = class extends _odoo_owl.Component {
35805
35732
  * Cell Is Rule
35806
35733
  ****************************************************************************/
35807
35734
  get isValue1Invalid() {
35808
- return this.state.errors.includes(CommandResult.FirstArgMissing) || this.state.errors.includes(CommandResult.ValueCellIsInvalidFormula);
35735
+ return this.state.errors.includes("FirstArgMissing") || this.state.errors.includes("ValueCellIsInvalidFormula");
35809
35736
  }
35810
35737
  get isValue2Invalid() {
35811
- return this.state.errors.includes(CommandResult.SecondArgMissing);
35738
+ return this.state.errors.includes("SecondArgMissing");
35812
35739
  }
35813
35740
  toggleStyle(tool) {
35814
35741
  const style = this.state.rules.cellIs.style;
@@ -35837,9 +35764,9 @@ var ConditionalFormattingEditor = class extends _odoo_owl.Component {
35837
35764
  ****************************************************************************/
35838
35765
  isValueInvalid(threshold) {
35839
35766
  switch (threshold) {
35840
- case "minimum": return this.state.errors.includes(CommandResult.MinInvalidFormula) || this.state.errors.includes(CommandResult.MinBiggerThanMid) || this.state.errors.includes(CommandResult.MinBiggerThanMax) || this.state.errors.includes(CommandResult.MinNaN);
35841
- case "midpoint": return this.state.errors.includes(CommandResult.MidInvalidFormula) || this.state.errors.includes(CommandResult.MidNaN) || this.state.errors.includes(CommandResult.MidBiggerThanMax);
35842
- case "maximum": return this.state.errors.includes(CommandResult.MaxInvalidFormula) || this.state.errors.includes(CommandResult.MaxNaN);
35767
+ case "minimum": return this.state.errors.includes("MinInvalidFormula") || this.state.errors.includes("MinBiggerThanMid") || this.state.errors.includes("MinBiggerThanMax") || this.state.errors.includes("MinNaN");
35768
+ case "midpoint": return this.state.errors.includes("MidInvalidFormula") || this.state.errors.includes("MidNaN") || this.state.errors.includes("MidBiggerThanMax");
35769
+ case "maximum": return this.state.errors.includes("MaxInvalidFormula") || this.state.errors.includes("MaxNaN");
35843
35770
  default: return false;
35844
35771
  }
35845
35772
  }
@@ -35876,8 +35803,8 @@ var ConditionalFormattingEditor = class extends _odoo_owl.Component {
35876
35803
  ****************************************************************************/
35877
35804
  isInflectionPointInvalid(inflectionPoint) {
35878
35805
  switch (inflectionPoint) {
35879
- case "lowerInflectionPoint": return this.state.errors.includes(CommandResult.ValueLowerInflectionNaN) || this.state.errors.includes(CommandResult.ValueLowerInvalidFormula) || this.state.errors.includes(CommandResult.LowerBiggerThanUpper);
35880
- case "upperInflectionPoint": return this.state.errors.includes(CommandResult.ValueUpperInflectionNaN) || this.state.errors.includes(CommandResult.ValueUpperInvalidFormula) || this.state.errors.includes(CommandResult.LowerBiggerThanUpper);
35806
+ case "lowerInflectionPoint": return this.state.errors.includes("ValueLowerInflectionNaN") || this.state.errors.includes("ValueLowerInvalidFormula") || this.state.errors.includes("LowerBiggerThanUpper");
35807
+ case "upperInflectionPoint": return this.state.errors.includes("ValueUpperInflectionNaN") || this.state.errors.includes("ValueUpperInvalidFormula") || this.state.errors.includes("LowerBiggerThanUpper");
35881
35808
  default: return true;
35882
35809
  }
35883
35810
  }
@@ -36124,13 +36051,14 @@ var CustomCurrencyPanel = class extends _odoo_owl.Component {
36124
36051
  if (currenciesRegistry.getAll().length === 0) (await this.env.loadCurrencies?.() || []).forEach((currency, index) => {
36125
36052
  currenciesRegistry.add(index.toString(), currency);
36126
36053
  });
36127
- this.availableCurrencies = [{
36054
+ const emptyCurrency = {
36128
36055
  name: _t(CustomCurrencyTerms.Custom),
36129
36056
  code: "",
36130
36057
  symbol: "",
36131
36058
  decimalPlaces: 2,
36132
36059
  position: "after"
36133
- }, ...currenciesRegistry.getAll()];
36060
+ };
36061
+ this.availableCurrencies = [emptyCurrency, ...currenciesRegistry.getAll()];
36134
36062
  }
36135
36063
  updateSelectCurrency(ev) {
36136
36064
  const target = ev.target;
@@ -37278,12 +37206,6 @@ var DataValidationPanel = class extends _odoo_owl.Component {
37278
37206
  //#endregion
37279
37207
  //#region src/components/side_panel/find_and_replace/find_and_replace_store.ts
37280
37208
  const FIND_AND_REPLACE_HIGHLIGHT_COLOR = "#8B008B";
37281
- var Direction = /* @__PURE__ */ function(Direction) {
37282
- Direction[Direction["previous"] = -1] = "previous";
37283
- Direction[Direction["current"] = 0] = "current";
37284
- Direction[Direction["next"] = 1] = "next";
37285
- return Direction;
37286
- }(Direction || {});
37287
37209
  var FindAndReplaceStore = class extends SpreadsheetStore {
37288
37210
  mutators = [
37289
37211
  "updateSearchOptions",
@@ -37344,10 +37266,10 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
37344
37266
  this.updateSearchOptions({ searchFormulas: showFormula });
37345
37267
  }
37346
37268
  selectPreviousMatch() {
37347
- this.selectNextCell(Direction.previous);
37269
+ this.selectNextCell(-1);
37348
37270
  }
37349
37271
  selectNextMatch() {
37350
- this.selectNextCell(Direction.next);
37272
+ this.selectNextCell(1);
37351
37273
  }
37352
37274
  handle(cmd) {
37353
37275
  switch (cmd.type) {
@@ -37414,7 +37336,7 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
37414
37336
  refreshSearch(jumpToMatchSheet = true) {
37415
37337
  if (!this.preserveSelectedMatchIndex) this.selectedMatchIndex = null;
37416
37338
  this.findMatches();
37417
- this.selectNextCell(Direction.current, jumpToMatchSheet);
37339
+ this.selectNextCell(0, jumpToMatchSheet);
37418
37340
  }
37419
37341
  getSheetsInSearchOrder() {
37420
37342
  switch (this.searchOptions.searchScope) {
@@ -37784,6 +37706,8 @@ var MoreFormatsPanel = class extends _odoo_owl.Component {
37784
37706
  //#endregion
37785
37707
  //#region src/components/side_panel/pivot/pivot_measure_display_panel/pivot_measure_display_panel_store.ts
37786
37708
  var PivotMeasureDisplayPanelStore = class extends SpreadsheetStore {
37709
+ pivotId;
37710
+ initialMeasure;
37787
37711
  mutators = [
37788
37712
  "cancelMeasureDisplayEdition",
37789
37713
  "updateMeasureDisplayType",
@@ -38688,7 +38612,7 @@ var PivotTitleSection = class extends _odoo_owl.Component {
38688
38612
  });
38689
38613
  let text;
38690
38614
  if (result.isSuccessful) text = _t("Pivot duplicated.");
38691
- else if (result.isCancelledBecause(CommandResult.PivotInError)) text = _t("Cannot duplicate a pivot in error.");
38615
+ else if (result.isCancelledBecause("PivotInError")) text = _t("Cannot duplicate a pivot in error.");
38692
38616
  else text = _t("Pivot duplication failed.");
38693
38617
  const type = result.isSuccessful ? "success" : "danger";
38694
38618
  this.env.notifyUser({
@@ -38752,13 +38676,30 @@ function createMeasure(fields, measure) {
38752
38676
  } : fields[fieldName];
38753
38677
  const aggregator = measure.aggregator;
38754
38678
  return {
38679
+ /**
38680
+ * Get the id of the measure, as it is stored in the pivot formula
38681
+ */
38755
38682
  id: measure.id,
38683
+ /**
38684
+ * Display name of the measure
38685
+ * e.g. "__count" -> "Count", "amount_total" -> "Total Amount"
38686
+ */
38756
38687
  get displayName() {
38757
38688
  return measure.userDefinedName ?? field?.string ?? measure.fieldName;
38758
38689
  },
38759
38690
  userDefinedName: measure.userDefinedName,
38691
+ /**
38692
+ * Get the name of the field of the measure
38693
+ */
38760
38694
  fieldName,
38695
+ /**
38696
+ * Get the aggregator of the measure
38697
+ */
38761
38698
  aggregator,
38699
+ /**
38700
+ * Get the type of the measure field
38701
+ * e.g. "stage_id" -> "many2one", "create_date:month" -> "date"
38702
+ */
38762
38703
  type: fieldName === "__count" ? "integer" : field?.type ?? "integer",
38763
38704
  isValid: !!(field || measure.computedBy),
38764
38705
  isHidden: measure.isHidden,
@@ -38772,10 +38713,30 @@ function createPivotDimension(fields, dimension) {
38772
38713
  const type = field?.type ?? "integer";
38773
38714
  const granularity = field && isDateOrDatetimeField(field) ? dimension.granularity : void 0;
38774
38715
  return {
38716
+ /**
38717
+ * Get the display name of the dimension
38718
+ * e.g. "stage_id" -> "Stage", "create_date:month" -> "Create Date"
38719
+ */
38775
38720
  displayName: field?.string ?? dimension.fieldName,
38721
+ /**
38722
+ * Get the name of the dimension, as it is stored in the pivot formula
38723
+ * e.g. "stage_id", "create_date:month"
38724
+ */
38776
38725
  nameWithGranularity: dimension.fieldName + (granularity ? `:${granularity}` : ""),
38726
+ /**
38727
+ * Get the name of the field of the dimension
38728
+ * e.g. "stage_id" -> "stage_id", "create_date:month" -> "create_date"
38729
+ */
38777
38730
  fieldName: dimension.fieldName,
38731
+ /**
38732
+ * Get the aggregate operator of the dimension
38733
+ * e.g. "stage_id" -> undefined, "create_date:month" -> "month"
38734
+ */
38778
38735
  granularity,
38736
+ /**
38737
+ * Get the type of the field of the dimension
38738
+ * e.g. "stage_id" -> "many2one", "create_date:month" -> "date"
38739
+ */
38779
38740
  type,
38780
38741
  order: dimension.order,
38781
38742
  isValid: !!field
@@ -39397,14 +39358,6 @@ function resetMapValueDimensionDate() {
39397
39358
 
39398
39359
  //#endregion
39399
39360
  //#region src/helpers/pivot/spreadsheet_pivot/spreadsheet_pivot.ts
39400
- var ReloadType = /* @__PURE__ */ function(ReloadType) {
39401
- ReloadType[ReloadType["NONE"] = 0] = "NONE";
39402
- ReloadType[ReloadType["TABLE"] = 1] = "TABLE";
39403
- ReloadType[ReloadType["DATA"] = 2] = "DATA";
39404
- ReloadType[ReloadType["DEFINITION"] = 3] = "DEFINITION";
39405
- ReloadType[ReloadType["ALL"] = 4] = "ALL";
39406
- return ReloadType;
39407
- }(ReloadType || {});
39408
39361
  /**
39409
39362
  * This class represents a pivot table that is created from a range of cells.
39410
39363
  * It will extract the fields from the first row of the range and the data from
@@ -39446,27 +39399,27 @@ var SpreadsheetPivot = class {
39446
39399
  }
39447
39400
  init(params = {}) {
39448
39401
  if (!this._definition || params.reload) {
39449
- this.reload(ReloadType.ALL);
39402
+ this.reload(4);
39450
39403
  this.needsReevaluation = false;
39451
39404
  }
39452
39405
  }
39453
39406
  reload(type) {
39454
- if (type === ReloadType.ALL) this.metaData = this.loadMetaData();
39455
- if (type >= ReloadType.DEFINITION) this._definition = this.loadRuntimeDefinition();
39456
- if (type >= ReloadType.DATA) this.dataEntries = this.loadData();
39457
- if (type >= ReloadType.TABLE) this.table = void 0;
39407
+ if (type === 4) this.metaData = this.loadMetaData();
39408
+ if (type >= 3) this._definition = this.loadRuntimeDefinition();
39409
+ if (type >= 2) this.dataEntries = this.loadData();
39410
+ if (type >= 1) this.table = void 0;
39458
39411
  }
39459
39412
  onDefinitionChange(nextDefinition) {
39460
39413
  const actualDefinition = this.coreDefinition;
39461
39414
  this.coreDefinition = nextDefinition;
39462
39415
  if (this._definition) {
39463
- const reloadType = Math.max(this.computeShouldReload(actualDefinition, nextDefinition), ReloadType.NONE);
39416
+ const reloadType = Math.max(this.computeShouldReload(actualDefinition, nextDefinition), 0);
39464
39417
  this.reload(reloadType);
39465
39418
  }
39466
39419
  }
39467
39420
  computeShouldReload(actualDefinition, nextDefinition) {
39468
- if (deepEquals(actualDefinition.dataSet, nextDefinition.dataSet)) return ReloadType.DEFINITION;
39469
- return ReloadType.ALL;
39421
+ if (deepEquals(actualDefinition.dataSet, nextDefinition.dataSet)) return 3;
39422
+ return 4;
39470
39423
  }
39471
39424
  get isInvalidRange() {
39472
39425
  return !!this.invalidRangeError;
@@ -39539,7 +39492,7 @@ var SpreadsheetPivot = class {
39539
39492
  if (dataEntries.length === 0) return { value: "" };
39540
39493
  const measure = this.getMeasure(measureId);
39541
39494
  const allValues = dataEntries.map((value) => value[measure.fieldName]).filter(isDefined);
39542
- const values = allValues.filter((cell) => cell.type !== CellValueType.empty);
39495
+ const values = allValues.filter((cell) => cell.type !== "empty");
39543
39496
  const aggregator = measure.aggregator;
39544
39497
  const operator = AGGREGATORS_FN[aggregator];
39545
39498
  if (!operator) throw new Error(`Aggregator ${aggregator} does not exist`);
@@ -39627,16 +39580,16 @@ var SpreadsheetPivot = class {
39627
39580
  return this.definition.getDimension(nameWithGranularity);
39628
39581
  }
39629
39582
  getTypeFromZone(sheetId, zone) {
39630
- const nonEmptyCells = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => !(cell.type === CellValueType.empty || cell.value === ""));
39583
+ const nonEmptyCells = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => !(cell.type === "empty" || cell.value === ""));
39631
39584
  if (nonEmptyCells.length === 0) return "integer";
39632
- if (nonEmptyCells.every((cell) => cell.type === CellValueType.number && cell.format && isDateTimeFormat(cell.format))) return "datetime";
39633
- if (nonEmptyCells.every((cell) => cell.type === CellValueType.boolean)) return "boolean";
39634
- if (nonEmptyCells.every((cell) => cell.type === CellValueType.number)) return "integer";
39585
+ if (nonEmptyCells.every((cell) => cell.type === "number" && cell.format && isDateTimeFormat(cell.format))) return "datetime";
39586
+ if (nonEmptyCells.every((cell) => cell.type === "boolean")) return "boolean";
39587
+ if (nonEmptyCells.every((cell) => cell.type === "number")) return "integer";
39635
39588
  return "char";
39636
39589
  }
39637
39590
  assertCellIsValidField(col, row, cell) {
39638
- if (cell.type === CellValueType.error) throw new EvaluationError(_t("The pivot cannot be created because cell %s contains an error", toXC(col, row)));
39639
- if (cell.type === CellValueType.empty || cell.value === "") throw new EvaluationError(_t("The pivot cannot be created because cell %s is empty", toXC(col, row)));
39591
+ if (cell.type === "error") throw new EvaluationError(_t("The pivot cannot be created because cell %s contains an error", toXC(col, row)));
39592
+ if (cell.type === "empty" || cell.value === "") throw new EvaluationError(_t("The pivot cannot be created because cell %s is empty", toXC(col, row)));
39640
39593
  if (cell.value === "__count") throw new EvaluationError(_t("The pivot cannot be created because cell %s contains a reserved value", toXC(col, row)));
39641
39594
  }
39642
39595
  /**
@@ -39704,14 +39657,14 @@ var SpreadsheetPivot = class {
39704
39657
  if (!field) throw new Error(`Field ${this.metaData.fieldKeys[index]} does not exist`);
39705
39658
  if (cell.value === "") entry[field.name] = {
39706
39659
  value: null,
39707
- type: CellValueType.empty,
39660
+ type: "empty",
39708
39661
  formattedValue: ""
39709
39662
  };
39710
39663
  else entry[field.name] = cell;
39711
39664
  }
39712
39665
  entry["__count"] = {
39713
39666
  value: 1,
39714
- type: CellValueType.number,
39667
+ type: "number",
39715
39668
  formattedValue: "1"
39716
39669
  };
39717
39670
  dataEntries.push(entry);
@@ -39724,7 +39677,7 @@ var SpreadsheetPivot = class {
39724
39677
  const { format, value: valueToFormat } = pivotTimeAdapter(dimension.granularity || "month").toValueAndFormat(value, locale);
39725
39678
  entry[dimension.nameWithGranularity] = {
39726
39679
  value,
39727
- type: entry[dimension.fieldName]?.type || CellValueType.empty,
39680
+ type: entry[dimension.fieldName]?.type || "empty",
39728
39681
  format: entry[dimension.fieldName]?.format,
39729
39682
  formattedValue: formatValue(valueToFormat, {
39730
39683
  locale,
@@ -39792,6 +39745,7 @@ function adaptPivotRange(range, applyChange) {
39792
39745
  //#endregion
39793
39746
  //#region src/components/side_panel/pivot/pivot_side_panel/pivot_side_panel_store.ts
39794
39747
  var PivotSidePanelStore = class extends SpreadsheetStore {
39748
+ pivotId;
39795
39749
  mutators = [
39796
39750
  "reset",
39797
39751
  "deferUpdates",
@@ -39926,7 +39880,8 @@ var PivotSidePanelStore = class extends SpreadsheetStore {
39926
39880
  }))
39927
39881
  };
39928
39882
  if (!this.draft && deepEquals(coreDefinition, cleanedDefinition)) return;
39929
- this.draft = this.addDefaultDateTimeGranularity(this.fields, cleanedDefinition);
39883
+ const cleanedWithGranularity = this.addDefaultDateTimeGranularity(this.fields, cleanedDefinition);
39884
+ this.draft = cleanedWithGranularity;
39930
39885
  if (!this.updatesAreDeferred) this.applyUpdate();
39931
39886
  }
39932
39887
  /**
@@ -40243,7 +40198,7 @@ function interactiveSplitToColumns(env, separator, addNewColumns) {
40243
40198
  separator,
40244
40199
  addNewColumns
40245
40200
  });
40246
- if (result.isCancelledBecause(CommandResult.SplitWillOverwriteContent)) env.askConfirmation(SplitToColumnsInteractiveContent.SplitIsDestructive, () => {
40201
+ if (result.isCancelledBecause("SplitWillOverwriteContent")) env.askConfirmation(SplitToColumnsInteractiveContent.SplitIsDestructive, () => {
40247
40202
  result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", {
40248
40203
  separator,
40249
40204
  addNewColumns,
@@ -40324,8 +40279,8 @@ var SplitIntoColumnsPanel = class extends _odoo_owl.Component {
40324
40279
  }).reasons;
40325
40280
  const errors = /* @__PURE__ */ new Set();
40326
40281
  for (const reason of cancelledReasons) switch (reason) {
40327
- case CommandResult.SplitWillOverwriteContent:
40328
- case CommandResult.EmptySplitSeparator: break;
40282
+ case "SplitWillOverwriteContent":
40283
+ case "EmptySplitSeparator": break;
40329
40284
  default: errors.add(SplitToColumnsTerms.Errors[reason] || SplitToColumnsTerms.Errors.Unexpected);
40330
40285
  }
40331
40286
  return Array.from(errors);
@@ -40336,7 +40291,7 @@ var SplitIntoColumnsPanel = class extends _odoo_owl.Component {
40336
40291
  separator: this.separatorValue,
40337
40292
  addNewColumns: this.state.addNewColumns,
40338
40293
  force: false
40339
- }).reasons.includes(CommandResult.SplitWillOverwriteContent)) warnings.push(SplitToColumnsTerms.Errors[CommandResult.SplitWillOverwriteContent]);
40294
+ }).reasons.includes("SplitWillOverwriteContent")) warnings.push(SplitToColumnsTerms.Errors["SplitWillOverwriteContent"]);
40340
40295
  return warnings;
40341
40296
  }
40342
40297
  get separatorValue() {
@@ -41328,7 +41283,7 @@ css`
41328
41283
  box-sizing: content-box;
41329
41284
 
41330
41285
  .o-fig-anchor {
41331
- z-index: ${ComponentsImportance.FigureAnchor};
41286
+ z-index: ${1e3};
41332
41287
  position: absolute;
41333
41288
  width: ${ANCHOR_SIZE}px;
41334
41289
  height: ${ANCHOR_SIZE}px;
@@ -41430,7 +41385,7 @@ var FigureComponent = class extends _odoo_owl.Component {
41430
41385
  top: `${y}px`,
41431
41386
  width: `${width}px`,
41432
41387
  height: `${height}px`,
41433
- "z-index": String(ComponentsImportance.Figure + (this.isSelected ? 1 : 0))
41388
+ "z-index": String(10 + (this.isSelected ? 1 : 0))
41434
41389
  });
41435
41390
  }
41436
41391
  getResizerPosition(resizer) {
@@ -41555,7 +41510,7 @@ function interactiveToggleGroup(env, sheetId, dimension, start, end) {
41555
41510
  end: group.end
41556
41511
  });
41557
41512
  if (!result.isSuccessful) {
41558
- if (result.isCancelledBecause(CommandResult.NotEnoughElements)) {
41513
+ if (result.isCancelledBecause("NotEnoughElements")) {
41559
41514
  const errorMessage = dimension === "ROW" ? ToggleGroupInteractiveContent.CannotHideAllRows : ToggleGroupInteractiveContent.CannotHideAllColumns;
41560
41515
  env.raiseError(errorMessage);
41561
41516
  }
@@ -41965,11 +41920,11 @@ var CellComposerStore = class extends AbstractComposerStore {
41965
41920
  if (this.model.getters.getArrayFormulaSpreadingOn(position)) return "";
41966
41921
  const { format, value, type, formattedValue } = this.getters.getEvaluatedCell(position);
41967
41922
  switch (type) {
41968
- case CellValueType.empty: return "";
41969
- case CellValueType.text:
41970
- case CellValueType.error: return value;
41971
- case CellValueType.boolean: return formattedValue;
41972
- case CellValueType.number:
41923
+ case "empty": return "";
41924
+ case "text":
41925
+ case "error": return value;
41926
+ case "boolean": return formattedValue;
41927
+ case "number":
41973
41928
  if (format && isDateTimeFormat(format)) {
41974
41929
  if (parseDateTime(formattedValue, locale) !== null) return formattedValue;
41975
41930
  return formatValue(value, {
@@ -42033,7 +41988,7 @@ const COMPOSER_BORDER_WIDTH = 3 * .4 * window.devicePixelRatio || 1;
42033
41988
  const GRID_CELL_REFERENCE_TOP_OFFSET = 28;
42034
41989
  css`
42035
41990
  div.o-grid-composer {
42036
- z-index: ${ComponentsImportance.GridComposer};
41991
+ z-index: ${20};
42037
41992
  box-sizing: border-box;
42038
41993
  position: absolute;
42039
41994
  border: ${COMPOSER_BORDER_WIDTH}px solid ${SELECTION_BORDER_COLOR};
@@ -42045,7 +42000,7 @@ css`
42045
42000
 
42046
42001
  div.o-cell-reference {
42047
42002
  position: absolute;
42048
- z-index: ${ComponentsImportance.GridComposer};
42003
+ z-index: ${20};
42049
42004
  background: ${SELECTION_BORDER_COLOR};
42050
42005
  color: white;
42051
42006
  font-size: 12px;
@@ -42660,7 +42615,7 @@ function getAxis(fig, axisType) {
42660
42615
  css`
42661
42616
  .o-figure-snap-line {
42662
42617
  position: relative;
42663
- z-index: ${ComponentsImportance.FigureSnapLine};
42618
+ z-index: ${1001};
42664
42619
  &.vertical {
42665
42620
  width: 0px;
42666
42621
  border-left: 1px dashed black;
@@ -43421,7 +43376,7 @@ var GridPopover = class extends _odoo_owl.Component {
43421
43376
  };
43422
43377
  static components = { Popover };
43423
43378
  cellPopovers;
43424
- zIndex = ComponentsImportance.GridPopover;
43379
+ zIndex = 19;
43425
43380
  setup() {
43426
43381
  this.cellPopovers = useStore(CellPopoverStore);
43427
43382
  }
@@ -43666,7 +43621,7 @@ css`
43666
43621
  color: ${ICONS_COLOR};
43667
43622
  }
43668
43623
  .o-unhide:hover {
43669
- z-index: ${ComponentsImportance.Grid + 1};
43624
+ z-index: ${0 + 1};
43670
43625
  background-color: lightgrey;
43671
43626
  }
43672
43627
  }
@@ -43738,7 +43693,7 @@ var ColResizer = class extends AbstractResizer {
43738
43693
  elements,
43739
43694
  position: this.state.position
43740
43695
  });
43741
- if (!result.isSuccessful && result.reasons.includes(CommandResult.WillRemoveExistingMerge)) this.env.raiseError(MergeErrorMessage);
43696
+ if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
43742
43697
  }
43743
43698
  _selectElement(index, addDistinctHeader) {
43744
43699
  this.env.model.selection.selectColumn(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
@@ -43822,7 +43777,7 @@ css`
43822
43777
  color: ${ICONS_COLOR};
43823
43778
  }
43824
43779
  .o-unhide:hover {
43825
- z-index: ${ComponentsImportance.Grid + 1};
43780
+ z-index: ${0 + 1};
43826
43781
  background-color: lightgrey;
43827
43782
  }
43828
43783
  }
@@ -43895,8 +43850,8 @@ var RowResizer = class extends AbstractResizer {
43895
43850
  position: this.state.position
43896
43851
  });
43897
43852
  if (!result.isSuccessful) {
43898
- if (result.reasons.includes(CommandResult.WillRemoveExistingMerge)) this.env.raiseError(MergeErrorMessage);
43899
- else if (result.reasons.includes(CommandResult.CannotMoveTableHeader)) this.env.raiseError(TableHeaderMoveErrorMessage);
43853
+ if (result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
43854
+ else if (result.reasons.includes("CannotMoveTableHeader")) this.env.raiseError(TableHeaderMoveErrorMessage);
43900
43855
  }
43901
43856
  }
43902
43857
  _selectElement(index, addDistinctHeader) {
@@ -44354,7 +44309,7 @@ var GridRenderer = class {
44354
44309
  const nextCellBorder = this.getters.getCellComputedBorder(position);
44355
44310
  const cellHasIcon = this.getters.doesCellHaveGridIcon(position);
44356
44311
  const cellHasCheckbox = this.getters.isCellValidCheckbox(position);
44357
- if (nextCell.type !== CellValueType.empty || this.getters.isInMerge(position) || nextCellBorder?.left || cellHasIcon || cellHasCheckbox) return col;
44312
+ if (nextCell.type !== "empty" || this.getters.isInMerge(position) || nextCellBorder?.left || cellHasIcon || cellHasCheckbox) return col;
44358
44313
  col++;
44359
44314
  }
44360
44315
  return col;
@@ -44372,7 +44327,7 @@ var GridRenderer = class {
44372
44327
  const previousCellBorder = this.getters.getCellComputedBorder(position);
44373
44328
  const cellHasIcon = this.getters.doesCellHaveGridIcon(position);
44374
44329
  const cellHasCheckbox = this.getters.isCellValidCheckbox(position);
44375
- if (previousCell.type !== CellValueType.empty || this.getters.isInMerge(position) || previousCellBorder?.right || cellHasIcon || cellHasCheckbox) return col;
44330
+ if (previousCell.type !== "empty" || this.getters.isInMerge(position) || previousCellBorder?.right || cellHasIcon || cellHasCheckbox) return col;
44376
44331
  col--;
44377
44332
  }
44378
44333
  return col;
@@ -44381,7 +44336,7 @@ var GridRenderer = class {
44381
44336
  if (this.getters.getCell(position)?.isFormula && this.getters.shouldShowFormulas()) return "left";
44382
44337
  const { align } = this.getters.getCellStyle(position);
44383
44338
  const evaluatedCell = this.getters.getEvaluatedCell(position);
44384
- if (isOverflowing && evaluatedCell.type === CellValueType.number) return align !== "center" ? "left" : align;
44339
+ if (isOverflowing && evaluatedCell.type === "number") return align !== "center" ? "left" : align;
44385
44340
  return align || evaluatedCell.defaultAlign;
44386
44341
  }
44387
44342
  createZoneBox(sheetId, zone, viewport) {
@@ -44406,7 +44361,7 @@ var GridRenderer = class {
44406
44361
  style: this.getters.getCellComputedStyle(position),
44407
44362
  dataBarFill: this.getters.getConditionalDataBar(position),
44408
44363
  verticalAlign,
44409
- isError: cell.type === CellValueType.error && !!cell.message || this.getters.isDataValidationInvalid(position)
44364
+ isError: cell.type === "error" && !!cell.message || this.getters.isDataValidationInvalid(position)
44410
44365
  };
44411
44366
  /** Icon */
44412
44367
  const iconSrc = this.getters.getCellIconSrc(position);
@@ -44426,7 +44381,7 @@ var GridRenderer = class {
44426
44381
  image: imageHtmlElement
44427
44382
  };
44428
44383
  }
44429
- if (cell.type === CellValueType.empty || this.getters.isCellValidCheckbox(position)) return box;
44384
+ if (cell.type === "empty" || this.getters.isCellValidCheckbox(position)) return box;
44430
44385
  /** Filter Header or data validation icon */
44431
44386
  box.hasIcon = this.getters.doesCellHaveGridIcon(position);
44432
44387
  const headerIconWidth = box.hasIcon ? 17 + 2 : 0;
@@ -44814,7 +44769,7 @@ var Corner = class extends _odoo_owl.Component {
44814
44769
  //#region src/components/highlight/highlight/highlight.ts
44815
44770
  css`
44816
44771
  .o-highlight {
44817
- z-index: ${ComponentsImportance.Highlight};
44772
+ z-index: ${5};
44818
44773
  }
44819
44774
  `;
44820
44775
  var Highlight = class extends _odoo_owl.Component {
@@ -44935,7 +44890,7 @@ css`
44935
44890
  .o-scrollbar {
44936
44891
  position: absolute;
44937
44892
  overflow: auto;
44938
- z-index: ${ComponentsImportance.ScrollBar};
44893
+ z-index: ${15};
44939
44894
  background-color: ${BACKGROUND_GRAY_COLOR};
44940
44895
 
44941
44896
  &.corner {
@@ -45331,12 +45286,12 @@ var Grid = class extends _odoo_owl.Component {
45331
45286
  }
45332
45287
  keyDownMapping = {
45333
45288
  Enter: () => {
45334
- this.env.model.getters.getActiveCell().type === CellValueType.empty ? this.onComposerCellFocused() : this.onComposerContentFocused();
45289
+ this.env.model.getters.getActiveCell().type === "empty" ? this.onComposerCellFocused() : this.onComposerContentFocused();
45335
45290
  },
45336
45291
  Tab: () => this.env.model.selection.moveAnchorCell("right", 1),
45337
45292
  "Shift+Tab": () => this.env.model.selection.moveAnchorCell("left", 1),
45338
45293
  F2: () => {
45339
- this.env.model.getters.getActiveCell().type === CellValueType.empty ? this.onComposerCellFocused() : this.onComposerContentFocused();
45294
+ this.env.model.getters.getActiveCell().type === "empty" ? this.onComposerCellFocused() : this.onComposerContentFocused();
45340
45295
  },
45341
45296
  Delete: () => {
45342
45297
  this.env.model.dispatch("DELETE_CONTENT", {
@@ -45567,7 +45522,7 @@ var Grid = class extends _odoo_owl.Component {
45567
45522
  sheetId,
45568
45523
  col,
45569
45524
  row
45570
- }).type === CellValueType.empty) this.onComposerCellFocused();
45525
+ }).type === "empty") this.onComposerCellFocused();
45571
45526
  else this.onComposerContentFocused();
45572
45527
  }
45573
45528
  processArrows(ev) {
@@ -45639,8 +45594,8 @@ var Grid = class extends _odoo_owl.Component {
45639
45594
  const clipboardData = ev.clipboardData;
45640
45595
  if (!clipboardData) return;
45641
45596
  const osClipboard = { content: {
45642
- [ClipboardMIMEType.PlainText]: clipboardData?.getData(ClipboardMIMEType.PlainText),
45643
- [ClipboardMIMEType.Html]: clipboardData?.getData(ClipboardMIMEType.Html)
45597
+ ["text/plain"]: clipboardData?.getData("text/plain"),
45598
+ ["text/html"]: clipboardData?.getData("text/html")
45644
45599
  } };
45645
45600
  const target = this.env.model.getters.getSelectedZones();
45646
45601
  const isCutOperation = this.env.model.getters.isCutOperation();
@@ -45648,7 +45603,7 @@ var Grid = class extends _odoo_owl.Component {
45648
45603
  const clipboardId = clipboardContent.data?.clipboardId;
45649
45604
  if (this.env.model.getters.getClipboardId() === clipboardId) interactivePaste(this.env, target);
45650
45605
  else interactivePasteFromOS(this.env, target, clipboardContent);
45651
- if (isCutOperation) await this.env.clipboard.write({ [ClipboardMIMEType.PlainText]: "" });
45606
+ if (isCutOperation) await this.env.clipboard.write({ ["text/plain"]: "" });
45652
45607
  }
45653
45608
  clearFormatting() {
45654
45609
  this.env.model.dispatch("CLEAR_FORMATTING", {
@@ -46115,7 +46070,7 @@ var BasePlugin = class {
46115
46070
  * There should not be any side effects in this method.
46116
46071
  */
46117
46072
  allowDispatch(command) {
46118
- return CommandResult.Success;
46073
+ return "Success";
46119
46074
  }
46120
46075
  /**
46121
46076
  * This method is useful when a plugin need to perform some action before a
@@ -46151,10 +46106,10 @@ var BasePlugin = class {
46151
46106
  for (const validation of validations) {
46152
46107
  let results = validation.call(this, toValidate);
46153
46108
  if (!Array.isArray(results)) results = [results];
46154
- const cancelledReasons = results.filter((result) => result !== CommandResult.Success);
46109
+ const cancelledReasons = results.filter((result) => result !== "Success");
46155
46110
  if (cancelledReasons.length) return cancelledReasons;
46156
46111
  }
46157
- return CommandResult.Success;
46112
+ return "Success";
46158
46113
  };
46159
46114
  }
46160
46115
  checkValidations(command, ...validations) {
@@ -46213,7 +46168,7 @@ var BordersPlugin = class extends CorePlugin {
46213
46168
  allowDispatch(cmd) {
46214
46169
  switch (cmd.type) {
46215
46170
  case "SET_BORDER": return this.checkBordersUnchanged(cmd);
46216
- default: return CommandResult.Success;
46171
+ default: return "Success";
46217
46172
  }
46218
46173
  }
46219
46174
  handle(cmd) {
@@ -46585,8 +46540,8 @@ var BordersPlugin = class extends CorePlugin {
46585
46540
  checkBordersUnchanged(cmd) {
46586
46541
  const currentBorder = this.getCellBorder(cmd);
46587
46542
  const areAllNewBordersUndefined = !cmd.border?.bottom && !cmd.border?.left && !cmd.border?.right && !cmd.border?.top;
46588
- if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return CommandResult.NoChanges;
46589
- return CommandResult.Success;
46543
+ if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return "NoChanges";
46544
+ return "Success";
46590
46545
  }
46591
46546
  import(data) {
46592
46547
  if (Object.keys(data.borders || {}).length) for (const sheet of data.sheets) for (const zoneXc in sheet.borders) {
@@ -46715,8 +46670,8 @@ var CellPlugin = class extends CorePlugin {
46715
46670
  switch (cmd.type) {
46716
46671
  case "UPDATE_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessUpdateCell);
46717
46672
  case "CLEAR_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessClearCell);
46718
- case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ? CommandResult.Success : CommandResult.InvalidCellId;
46719
- default: return CommandResult.Success;
46673
+ case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ? "Success" : "InvalidCellId";
46674
+ default: return "Success";
46720
46675
  }
46721
46676
  }
46722
46677
  handle(cmd) {
@@ -47139,25 +47094,30 @@ var CellPlugin = class extends CorePlugin {
47139
47094
  }
47140
47095
  checkCellOutOfSheet(cmd) {
47141
47096
  const { sheetId, col, row } = cmd;
47142
- if (!this.getters.tryGetSheet(sheetId)) return CommandResult.InvalidSheetId;
47143
- return isInside(col, row, this.getters.getSheetZone(sheetId)) ? CommandResult.Success : CommandResult.TargetOutOfSheet;
47097
+ if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
47098
+ return isInside(col, row, this.getters.getSheetZone(sheetId)) ? "Success" : "TargetOutOfSheet";
47144
47099
  }
47145
47100
  checkUselessClearCell(cmd) {
47146
47101
  const cell = this.getters.getCell(cmd);
47147
- if (!cell) return CommandResult.NoChanges;
47148
- if (!cell.content && !cell.style && !cell.format) return CommandResult.NoChanges;
47149
- return CommandResult.Success;
47102
+ if (!cell) return "NoChanges";
47103
+ if (!cell.content && !cell.style && !cell.format) return "NoChanges";
47104
+ return "Success";
47150
47105
  }
47151
47106
  checkUselessUpdateCell(cmd) {
47152
47107
  const cell = this.getters.getCell(cmd);
47153
47108
  const hasContent = "content" in cmd || "formula" in cmd;
47154
47109
  const hasStyle = "style" in cmd;
47155
47110
  const hasFormat = "format" in cmd;
47156
- if ((!hasContent || cell?.content === cmd.content) && (!hasStyle || deepEquals(cell?.style, cmd.style)) && (!hasFormat || cell?.format === cmd.format)) return CommandResult.NoChanges;
47157
- return CommandResult.Success;
47111
+ if ((!hasContent || cell?.content === cmd.content) && (!hasStyle || deepEquals(cell?.style, cmd.style)) && (!hasFormat || cell?.format === cmd.format)) return "NoChanges";
47112
+ return "Success";
47158
47113
  }
47159
47114
  };
47160
47115
  var FormulaCellWithDependencies = class {
47116
+ id;
47117
+ format;
47118
+ style;
47119
+ sheetId;
47120
+ getRangeString;
47161
47121
  isFormula = true;
47162
47122
  compiledFormula;
47163
47123
  constructor(id, compiledFormula, format, style, dependencies, sheetId, getRangeString) {
@@ -47192,6 +47152,10 @@ var FormulaCellWithDependencies = class {
47192
47152
  }
47193
47153
  };
47194
47154
  var RangeReferenceToken = class {
47155
+ ranges;
47156
+ rangeIndex;
47157
+ sheetId;
47158
+ getRangeString;
47195
47159
  type = "REFERENCE";
47196
47160
  constructor(ranges, rangeIndex, sheetId, getRangeString) {
47197
47161
  this.ranges = ranges;
@@ -47226,7 +47190,7 @@ var ChartPlugin = class extends CorePlugin {
47226
47190
  switch (cmd.type) {
47227
47191
  case "CREATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartDuplicate));
47228
47192
  case "UPDATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartExists));
47229
- default: return CommandResult.Success;
47193
+ default: return "Success";
47230
47194
  }
47231
47195
  }
47232
47196
  handle(cmd) {
@@ -47345,10 +47309,10 @@ var ChartPlugin = class extends CorePlugin {
47345
47309
  if (sheetId) this.history.update("charts", id, this.createChart(id, definition, sheetId));
47346
47310
  }
47347
47311
  checkChartDuplicate(cmd) {
47348
- return this.getters.getFigureSheetId(cmd.id) ? CommandResult.DuplicatedChartId : CommandResult.Success;
47312
+ return this.getters.getFigureSheetId(cmd.id) ? "DuplicatedChartId" : "Success";
47349
47313
  }
47350
47314
  checkChartExists(cmd) {
47351
- return this.isChartDefined(cmd.id) ? CommandResult.Success : CommandResult.ChartDoesNotExist;
47315
+ return this.isChartDefined(cmd.id) ? "Success" : "ChartDoesNotExist";
47352
47316
  }
47353
47317
  };
47354
47318
 
@@ -47407,7 +47371,7 @@ var ConditionalFormatPlugin = class extends CorePlugin {
47407
47371
  case "ADD_CONDITIONAL_FORMAT": return this.checkValidations(cmd, this.checkCFRule, this.checkEmptyRange);
47408
47372
  case "CHANGE_CONDITIONAL_FORMAT_PRIORITY": return this.checkValidPriorityChange(cmd.cfId, cmd.delta, cmd.sheetId);
47409
47373
  }
47410
- return CommandResult.Success;
47374
+ return "Success";
47411
47375
  }
47412
47376
  handle(cmd) {
47413
47377
  switch (cmd.type) {
@@ -47540,21 +47504,21 @@ var ConditionalFormatPlugin = class extends CorePlugin {
47540
47504
  this.history.update("cfRules", sheet, currentCF);
47541
47505
  }
47542
47506
  checkValidPriorityChange(cfId, delta, sheetId) {
47543
- if (!this.cfRules[sheetId]) return CommandResult.InvalidSheetId;
47507
+ if (!this.cfRules[sheetId]) return "InvalidSheetId";
47544
47508
  const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
47545
- if (ruleIndex === -1) return CommandResult.InvalidConditionalFormatId;
47509
+ if (ruleIndex === -1) return "InvalidConditionalFormatId";
47546
47510
  const cfIndex2 = ruleIndex - delta;
47547
- if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return CommandResult.InvalidConditionalFormatId;
47548
- return CommandResult.Success;
47511
+ if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return "InvalidConditionalFormatId";
47512
+ return "Success";
47549
47513
  }
47550
47514
  checkEmptyRange(cmd) {
47551
- return cmd.ranges.length ? CommandResult.Success : CommandResult.EmptyRange;
47515
+ return cmd.ranges.length ? "Success" : "EmptyRange";
47552
47516
  }
47553
47517
  checkCFRule(cmd) {
47554
47518
  const rule = cmd.cf.rule;
47555
47519
  switch (rule.type) {
47556
47520
  case "CellIsRule":
47557
- if (!CellIsOperators[rule.operator]) return CommandResult.InvalidConditionalFormatType;
47521
+ if (!CellIsOperators[rule.operator]) return "InvalidConditionalFormatType";
47558
47522
  return this.checkValidations(rule, this.checkOperatorArgsNumber(2, ["Between", "NotBetween"]), this.checkOperatorArgsNumber(1, [
47559
47523
  "BeginsWith",
47560
47524
  "ContainsText",
@@ -47569,9 +47533,9 @@ var ConditionalFormatPlugin = class extends CorePlugin {
47569
47533
  ]), this.checkOperatorArgsNumber(0, ["IsEmpty", "IsNotEmpty"]), this.checkCFValues);
47570
47534
  case "ColorScaleRule": return this.checkValidations(rule, this.chainValidations(this.checkThresholds(this.checkFormulaCompilation)), this.chainValidations(this.checkThresholds(this.checkNaN), this.batchValidations(this.checkMinBiggerThanMax, this.checkMinBiggerThanMid, this.checkMidBiggerThanMax)));
47571
47535
  case "IconSetRule": return this.checkValidations(rule, this.chainValidations(this.checkInflectionPoints(this.checkNaN), this.checkLowerBiggerThanUpper), this.chainValidations(this.checkInflectionPoints(this.checkFormulaCompilation)));
47572
- case "DataBarRule": return CommandResult.Success;
47536
+ case "DataBarRule": return "Success";
47573
47537
  }
47574
- return CommandResult.InvalidConditionalFormatType;
47538
+ return "InvalidConditionalFormatType";
47575
47539
  }
47576
47540
  checkOperatorArgsNumber(expectedNumber, operators) {
47577
47541
  if (expectedNumber > 2) throw new Error("Checking more than 2 arguments is currently not supported. Add the appropriate CommandResult if you want to.");
@@ -47579,11 +47543,11 @@ var ConditionalFormatPlugin = class extends CorePlugin {
47579
47543
  if (operators.includes(rule.operator)) {
47580
47544
  const errors = [];
47581
47545
  const isEmpty = (value) => value === void 0 || value === "";
47582
- if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push(CommandResult.FirstArgMissing);
47583
- if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push(CommandResult.SecondArgMissing);
47584
- return errors.length ? errors : CommandResult.Success;
47546
+ if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push("FirstArgMissing");
47547
+ if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push("SecondArgMissing");
47548
+ return errors.length ? errors : "Success";
47585
47549
  }
47586
- return CommandResult.Success;
47550
+ return "Success";
47587
47551
  };
47588
47552
  }
47589
47553
  checkNaN(threshold, thresholdName) {
@@ -47592,27 +47556,27 @@ var ConditionalFormatPlugin = class extends CorePlugin {
47592
47556
  "percentage",
47593
47557
  "percentile"
47594
47558
  ].includes(threshold.type) && (threshold.value === "" || isNaN(threshold.value))) switch (thresholdName) {
47595
- case "min": return CommandResult.MinNaN;
47596
- case "max": return CommandResult.MaxNaN;
47597
- case "mid": return CommandResult.MidNaN;
47598
- case "upperInflectionPoint": return CommandResult.ValueUpperInflectionNaN;
47599
- case "lowerInflectionPoint": return CommandResult.ValueLowerInflectionNaN;
47559
+ case "min": return "MinNaN";
47560
+ case "max": return "MaxNaN";
47561
+ case "mid": return "MidNaN";
47562
+ case "upperInflectionPoint": return "ValueUpperInflectionNaN";
47563
+ case "lowerInflectionPoint": return "ValueLowerInflectionNaN";
47600
47564
  }
47601
- return CommandResult.Success;
47565
+ return "Success";
47602
47566
  }
47603
47567
  checkFormulaCompilation(threshold, thresholdName) {
47604
- if (threshold.type !== "formula") return CommandResult.Success;
47568
+ if (threshold.type !== "formula") return "Success";
47605
47569
  if (compile(threshold.value || "").isBadExpression) switch (thresholdName) {
47606
- case "min": return CommandResult.MinInvalidFormula;
47607
- case "max": return CommandResult.MaxInvalidFormula;
47608
- case "mid": return CommandResult.MidInvalidFormula;
47609
- case "upperInflectionPoint": return CommandResult.ValueUpperInvalidFormula;
47610
- case "lowerInflectionPoint": return CommandResult.ValueLowerInvalidFormula;
47570
+ case "min": return "MinInvalidFormula";
47571
+ case "max": return "MaxInvalidFormula";
47572
+ case "mid": return "MidInvalidFormula";
47573
+ case "upperInflectionPoint": return "ValueUpperInvalidFormula";
47574
+ case "lowerInflectionPoint": return "ValueLowerInvalidFormula";
47611
47575
  }
47612
- return CommandResult.Success;
47576
+ return "Success";
47613
47577
  }
47614
47578
  checkThresholds(check) {
47615
- return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") : CommandResult.Success);
47579
+ return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") : "Success");
47616
47580
  }
47617
47581
  checkInflectionPoints(check) {
47618
47582
  return this.batchValidations((rule) => check(rule.lowerInflectionPoint, "lowerInflectionPoint"), (rule) => check(rule.upperInflectionPoint, "upperInflectionPoint"));
@@ -47624,8 +47588,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
47624
47588
  "number",
47625
47589
  "percentage",
47626
47590
  "percentile"
47627
- ].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return CommandResult.LowerBiggerThanUpper;
47628
- return CommandResult.Success;
47591
+ ].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return "LowerBiggerThanUpper";
47592
+ return "Success";
47629
47593
  }
47630
47594
  checkMinBiggerThanMax(rule) {
47631
47595
  const minValue = rule.minimum.value;
@@ -47634,8 +47598,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
47634
47598
  "number",
47635
47599
  "percentage",
47636
47600
  "percentile"
47637
- ].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return CommandResult.MinBiggerThanMax;
47638
- return CommandResult.Success;
47601
+ ].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return "MinBiggerThanMax";
47602
+ return "Success";
47639
47603
  }
47640
47604
  checkMidBiggerThanMax(rule) {
47641
47605
  const midValue = rule.midpoint?.value;
@@ -47644,8 +47608,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
47644
47608
  "number",
47645
47609
  "percentage",
47646
47610
  "percentile"
47647
- ].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return CommandResult.MidBiggerThanMax;
47648
- return CommandResult.Success;
47611
+ ].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return "MidBiggerThanMax";
47612
+ return "Success";
47649
47613
  }
47650
47614
  checkMinBiggerThanMid(rule) {
47651
47615
  const minValue = rule.minimum.value;
@@ -47654,15 +47618,15 @@ var ConditionalFormatPlugin = class extends CorePlugin {
47654
47618
  "number",
47655
47619
  "percentage",
47656
47620
  "percentile"
47657
- ].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return CommandResult.MinBiggerThanMid;
47658
- return CommandResult.Success;
47621
+ ].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return "MinBiggerThanMid";
47622
+ return "Success";
47659
47623
  }
47660
47624
  checkCFValues(rule) {
47661
47625
  for (const value of rule.values) {
47662
47626
  if (!value.startsWith("=")) continue;
47663
- if (compile(value || "").isBadExpression) return CommandResult.ValueCellIsInvalidFormula;
47627
+ if (compile(value || "").isBadExpression) return "ValueCellIsInvalidFormula";
47664
47628
  }
47665
- return CommandResult.Success;
47629
+ return "Success";
47666
47630
  }
47667
47631
  removeConditionalFormatting(id, sheet) {
47668
47632
  const cfIndex = this.cfRules[sheet].findIndex((s) => s.id === id);
@@ -47725,14 +47689,14 @@ var DataValidationPlugin = class extends CorePlugin {
47725
47689
  allowDispatch(cmd) {
47726
47690
  switch (cmd.type) {
47727
47691
  case "ADD_DATA_VALIDATION_RULE":
47728
- if (!this.getters.tryGetSheet(cmd.sheetId)) return CommandResult.InvalidSheetId;
47692
+ if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
47729
47693
  return this.checkValidations(cmd, this.chainValidations(this.checkEmptyRange, this.checkCriterionTypeIsValid, this.checkCriterionHasValidNumberOfValues, this.checkCriterionValuesAreValid));
47730
47694
  case "REMOVE_DATA_VALIDATION_RULE":
47731
- if (!this.getters.tryGetSheet(cmd.sheetId)) return CommandResult.InvalidSheetId;
47732
- if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return CommandResult.UnknownDataValidationRule;
47695
+ if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
47696
+ if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return "UnknownDataValidationRule";
47733
47697
  break;
47734
47698
  }
47735
- return CommandResult.Success;
47699
+ return "Success";
47736
47700
  }
47737
47701
  handle(cmd) {
47738
47702
  switch (cmd.type) {
@@ -47841,7 +47805,7 @@ var DataValidationPlugin = class extends CorePlugin {
47841
47805
  }
47842
47806
  }
47843
47807
  checkEmptyRange(cmd) {
47844
- return cmd.ranges.length ? CommandResult.Success : CommandResult.EmptyRange;
47808
+ return cmd.ranges.length ? "Success" : "EmptyRange";
47845
47809
  }
47846
47810
  import(data) {
47847
47811
  for (const sheet of data.sheets) {
@@ -47884,13 +47848,13 @@ var DataValidationPlugin = class extends CorePlugin {
47884
47848
  }
47885
47849
  }
47886
47850
  checkCriterionTypeIsValid(cmd) {
47887
- return dataValidationEvaluatorRegistry.contains(cmd.rule.criterion.type) ? CommandResult.Success : CommandResult.UnknownDataValidationCriterionType;
47851
+ return dataValidationEvaluatorRegistry.contains(cmd.rule.criterion.type) ? "Success" : "UnknownDataValidationCriterionType";
47888
47852
  }
47889
47853
  checkCriterionHasValidNumberOfValues(cmd) {
47890
47854
  const criterion = cmd.rule.criterion;
47891
47855
  const expectedNumberOfValues = dataValidationEvaluatorRegistry.get(criterion.type).numberOfValues(criterion);
47892
- if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return CommandResult.InvalidNumberOfCriterionValues;
47893
- return CommandResult.Success;
47856
+ if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return "InvalidNumberOfCriterionValues";
47857
+ return "Success";
47894
47858
  }
47895
47859
  checkCriterionValuesAreValid(cmd) {
47896
47860
  const criterion = cmd.rule.criterion;
@@ -47899,8 +47863,8 @@ var DataValidationPlugin = class extends CorePlugin {
47899
47863
  if (value.startsWith("=")) return evaluator.allowedValues === "onlyLiterals";
47900
47864
  else if (evaluator.allowedValues === "onlyFormulas") return true;
47901
47865
  else return !evaluator.isCriterionValueValid(value);
47902
- })) return CommandResult.InvalidDataValidationCriterionValue;
47903
- return CommandResult.Success;
47866
+ })) return "InvalidDataValidationCriterionValue";
47867
+ return "Success";
47904
47868
  }
47905
47869
  };
47906
47870
 
@@ -47919,7 +47883,7 @@ var FigurePlugin = class extends CorePlugin {
47919
47883
  case "CREATE_FIGURE": return this.checkFigureDuplicate(cmd.figure.id);
47920
47884
  case "UPDATE_FIGURE":
47921
47885
  case "DELETE_FIGURE": return this.checkFigureExists(cmd.sheetId, cmd.id);
47922
- default: return CommandResult.Success;
47886
+ default: return "Success";
47923
47887
  }
47924
47888
  }
47925
47889
  beforeHandle(cmd) {
@@ -48013,12 +47977,12 @@ var FigurePlugin = class extends CorePlugin {
48013
47977
  this.history.update("figures", sheetId, id, void 0);
48014
47978
  }
48015
47979
  checkFigureExists(sheetId, figureId) {
48016
- if (this.figures[sheetId]?.[figureId] === void 0) return CommandResult.FigureDoesNotExist;
48017
- return CommandResult.Success;
47980
+ if (this.figures[sheetId]?.[figureId] === void 0) return "FigureDoesNotExist";
47981
+ return "Success";
48018
47982
  }
48019
47983
  checkFigureDuplicate(figureId) {
48020
- if (Object.values(this.figures).find((sheet) => sheet?.[figureId])) return CommandResult.DuplicatedFigureId;
48021
- return CommandResult.Success;
47984
+ if (Object.values(this.figures).find((sheet) => sheet?.[figureId])) return "DuplicatedFigureId";
47985
+ return "Success";
48022
47986
  }
48023
47987
  getFigures(sheetId) {
48024
47988
  const figures = [];
@@ -48152,19 +48116,19 @@ var HeaderVisibilityPlugin = class extends CorePlugin {
48152
48116
  allowDispatch(cmd) {
48153
48117
  switch (cmd.type) {
48154
48118
  case "HIDE_COLUMNS_ROWS": {
48155
- if (!this.getters.tryGetSheet(cmd.sheetId)) return CommandResult.InvalidSheetId;
48119
+ if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
48156
48120
  const hiddenGroup = cmd.dimension === "COL" ? this.getHiddenColsGroups(cmd.sheetId) : this.getHiddenRowsGroups(cmd.sheetId);
48157
48121
  const elements = cmd.dimension === "COL" ? this.getters.getNumberCols(cmd.sheetId) : this.getters.getNumberRows(cmd.sheetId);
48158
- if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return CommandResult.TooManyHiddenElements;
48159
- else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return CommandResult.InvalidHeaderIndex;
48160
- else return CommandResult.Success;
48122
+ if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return "TooManyHiddenElements";
48123
+ else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return "InvalidHeaderIndex";
48124
+ else return "Success";
48161
48125
  }
48162
48126
  case "REMOVE_COLUMNS_ROWS":
48163
- if (!this.getters.tryGetSheet(cmd.sheetId)) return CommandResult.InvalidSheetId;
48164
- if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return CommandResult.NotEnoughElements;
48165
- return CommandResult.Success;
48127
+ if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
48128
+ if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
48129
+ return "Success";
48166
48130
  }
48167
- return CommandResult.Success;
48131
+ return "Success";
48168
48132
  }
48169
48133
  handle(cmd) {
48170
48134
  switch (cmd.type) {
@@ -48292,9 +48256,9 @@ var ImagePlugin = class extends CorePlugin {
48292
48256
  allowDispatch(cmd) {
48293
48257
  switch (cmd.type) {
48294
48258
  case "CREATE_IMAGE":
48295
- if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return CommandResult.InvalidFigureId;
48296
- return CommandResult.Success;
48297
- default: return CommandResult.Success;
48259
+ if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "InvalidFigureId";
48260
+ return "Success";
48261
+ default: return "Success";
48298
48262
  }
48299
48263
  }
48300
48264
  handle(cmd) {
@@ -48435,7 +48399,7 @@ var MergePlugin = class extends CorePlugin {
48435
48399
  return this.checkValidations(cmd, this.checkDestructiveMerge, this.checkOverlap, this.checkFrozenPanes);
48436
48400
  case "UPDATE_CELL": return this.checkMergedContentUpdate(cmd);
48437
48401
  case "REMOVE_MERGE": return this.checkMergeExists(cmd);
48438
- default: return CommandResult.Success;
48402
+ default: return "Success";
48439
48403
  }
48440
48404
  }
48441
48405
  handle(cmd) {
@@ -48615,18 +48579,18 @@ var MergePlugin = class extends CorePlugin {
48615
48579
  return range !== void 0 ? rangeToMerge(mergeId, range) : void 0;
48616
48580
  }
48617
48581
  checkDestructiveMerge({ sheetId, target }) {
48618
- if (!this.getters.tryGetSheet(sheetId)) return CommandResult.Success;
48619
- return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ? CommandResult.MergeIsDestructive : CommandResult.Success;
48582
+ if (!this.getters.tryGetSheet(sheetId)) return "Success";
48583
+ return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ? "MergeIsDestructive" : "Success";
48620
48584
  }
48621
48585
  checkOverlap({ target }) {
48622
- for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return CommandResult.MergeOverlap;
48623
- return CommandResult.Success;
48586
+ for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return "MergeOverlap";
48587
+ return "Success";
48624
48588
  }
48625
48589
  checkFrozenPanes({ sheetId, target }) {
48626
- if (!this.getters.tryGetSheet(sheetId)) return CommandResult.Success;
48590
+ if (!this.getters.tryGetSheet(sheetId)) return "Success";
48627
48591
  const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
48628
- for (const zone of target) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return CommandResult.FrozenPaneOverlap;
48629
- return CommandResult.Success;
48592
+ for (const zone of target) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return "FrozenPaneOverlap";
48593
+ return "Success";
48630
48594
  }
48631
48595
  /**
48632
48596
  * The content of a merged cell should always be empty.
@@ -48634,10 +48598,10 @@ var MergePlugin = class extends CorePlugin {
48634
48598
  */
48635
48599
  checkMergedContentUpdate(cmd) {
48636
48600
  const { col, row, content } = cmd;
48637
- if (content === void 0) return CommandResult.Success;
48601
+ if (content === void 0) return "Success";
48638
48602
  const { col: mainCol, row: mainRow } = this.getMainCellPosition(cmd);
48639
- if (mainCol === col && mainRow === row) return CommandResult.Success;
48640
- return CommandResult.CellIsMerged;
48603
+ if (mainCol === col && mainRow === row) return "Success";
48604
+ return "CellIsMerged";
48641
48605
  }
48642
48606
  checkMergeExists(cmd) {
48643
48607
  const { sheetId, target } = cmd;
@@ -48648,9 +48612,9 @@ var MergePlugin = class extends CorePlugin {
48648
48612
  col: left,
48649
48613
  row: top
48650
48614
  });
48651
- if (merge === void 0 || !isEqual(zone, merge)) return CommandResult.InvalidTarget;
48615
+ if (merge === void 0 || !isEqual(zone, merge)) return "InvalidTarget";
48652
48616
  }
48653
- return CommandResult.Success;
48617
+ return "Success";
48654
48618
  }
48655
48619
  /**
48656
48620
  * Merge the current selection. Note that:
@@ -48798,8 +48762,8 @@ var RangeAdapter = class {
48798
48762
  "removeRangesSheetPrefix"
48799
48763
  ];
48800
48764
  allowDispatch(cmd) {
48801
- if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ? CommandResult.Success : CommandResult.InvalidZones;
48802
- return CommandResult.Success;
48765
+ if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ? "Success" : "InvalidZones";
48766
+ return "Success";
48803
48767
  }
48804
48768
  beforeHandle(command) {}
48805
48769
  handle(cmd) {
@@ -49208,40 +49172,40 @@ var SheetPlugin = class extends CorePlugin {
49208
49172
  cellPosition = {};
49209
49173
  allowDispatch(cmd) {
49210
49174
  const genericChecks = this.chainValidations(this.checkSheetExists, this.checkZonesAreInSheet)(cmd);
49211
- if (genericChecks !== CommandResult.Success) return genericChecks;
49175
+ if (genericChecks !== "Success") return genericChecks;
49212
49176
  switch (cmd.type) {
49213
49177
  case "HIDE_SHEET":
49214
- if (this.getVisibleSheetIds().length === 1) return CommandResult.NotEnoughSheets;
49215
- return CommandResult.Success;
49178
+ if (this.getVisibleSheetIds().length === 1) return "NotEnoughSheets";
49179
+ return "Success";
49216
49180
  case "CREATE_SHEET": return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
49217
49181
  case "DUPLICATE_SHEET":
49218
- if (this.sheets[cmd.sheetIdTo]) return CommandResult.DuplicatedSheetId;
49219
- if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return CommandResult.DuplicatedSheetName;
49220
- return CommandResult.Success;
49182
+ if (this.sheets[cmd.sheetIdTo]) return "DuplicatedSheetId";
49183
+ if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return "DuplicatedSheetName";
49184
+ return "Success";
49221
49185
  case "MOVE_SHEET": try {
49222
49186
  const currentIndex = this.orderedSheetIds.findIndex((id) => id === cmd.sheetId);
49223
49187
  this.findIndexOfTargetSheet(currentIndex, cmd.delta);
49224
- return CommandResult.Success;
49188
+ return "Success";
49225
49189
  } catch (e) {
49226
- return CommandResult.WrongSheetMove;
49190
+ return "WrongSheetMove";
49227
49191
  }
49228
49192
  case "RENAME_SHEET": return this.isRenameAllowed(cmd);
49229
- case "COLOR_SHEET": return !cmd.color || isColorValid(cmd.color) ? CommandResult.Success : CommandResult.InvalidColor;
49230
- case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ? CommandResult.Success : CommandResult.NotEnoughSheets;
49193
+ case "COLOR_SHEET": return !cmd.color || isColorValid(cmd.color) ? "Success" : "InvalidColor";
49194
+ case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ? "Success" : "NotEnoughSheets";
49231
49195
  case "ADD_COLUMNS_ROWS":
49232
- if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return CommandResult.InvalidHeaderIndex;
49233
- else if (cmd.quantity <= 0) return CommandResult.InvalidQuantity;
49234
- return CommandResult.Success;
49196
+ if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return "InvalidHeaderIndex";
49197
+ else if (cmd.quantity <= 0) return "InvalidQuantity";
49198
+ return "Success";
49235
49199
  case "REMOVE_COLUMNS_ROWS": {
49236
49200
  const min = largeMin(cmd.elements);
49237
49201
  const max = largeMax(cmd.elements);
49238
- if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return CommandResult.InvalidHeaderIndex;
49239
- else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return CommandResult.NotEnoughElements;
49240
- else return CommandResult.Success;
49202
+ if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return "InvalidHeaderIndex";
49203
+ else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
49204
+ else return "Success";
49241
49205
  }
49242
49206
  case "FREEZE_ROWS": return this.checkValidations(cmd, this.checkRowFreezeQuantity, this.checkRowFreezeOverlapMerge);
49243
49207
  case "FREEZE_COLUMNS": return this.checkValidations(cmd, this.checkColFreezeQuantity, this.checkColFreezeOverlapMerge);
49244
- default: return CommandResult.Success;
49208
+ default: return "Success";
49245
49209
  }
49246
49210
  }
49247
49211
  handle(cmd) {
@@ -49504,12 +49468,12 @@ var SheetPlugin = class extends CorePlugin {
49504
49468
  * not outside the sheet.
49505
49469
  */
49506
49470
  checkZonesExistInSheet(sheetId, zones) {
49507
- if (!zones.every(isZoneValid)) return CommandResult.InvalidRange;
49471
+ if (!zones.every(isZoneValid)) return "InvalidRange";
49508
49472
  if (zones.length) {
49509
49473
  const sheetZone = this.getSheetZone(sheetId);
49510
- return zones.every((zone) => isZoneInside(zone, sheetZone)) ? CommandResult.Success : CommandResult.TargetOutOfSheet;
49474
+ return zones.every((zone) => isZoneInside(zone, sheetZone)) ? "Success" : "TargetOutOfSheet";
49511
49475
  }
49512
- return CommandResult.Success;
49476
+ return "Success";
49513
49477
  }
49514
49478
  updateCellPosition(cmd) {
49515
49479
  const { sheetId, cellId, col, row } = cmd;
@@ -49583,36 +49547,36 @@ var SheetPlugin = class extends CorePlugin {
49583
49547
  }
49584
49548
  checkSheetName(cmd) {
49585
49549
  const originalSheetName = this.getters.tryGetSheetName(cmd.sheetId);
49586
- if (originalSheetName !== void 0 && cmd.name === originalSheetName) return CommandResult.UnchangedSheetName;
49550
+ if (originalSheetName !== void 0 && cmd.name === originalSheetName) return "UnchangedSheetName";
49587
49551
  const { orderedSheetIds, sheets } = this;
49588
49552
  const name = cmd.name && cmd.name.trim().toLowerCase();
49589
- if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return CommandResult.DuplicatedSheetName;
49590
- if (FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX.test(name)) return CommandResult.ForbiddenCharactersInSheetName;
49591
- return CommandResult.Success;
49553
+ if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return "DuplicatedSheetName";
49554
+ if (FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX.test(name)) return "ForbiddenCharactersInSheetName";
49555
+ return "Success";
49592
49556
  }
49593
49557
  checkSheetPosition(cmd) {
49594
49558
  const { orderedSheetIds } = this;
49595
- if (cmd.position > orderedSheetIds.length || cmd.position < 0) return CommandResult.WrongSheetPosition;
49596
- return CommandResult.Success;
49559
+ if (cmd.position > orderedSheetIds.length || cmd.position < 0) return "WrongSheetPosition";
49560
+ return "Success";
49597
49561
  }
49598
49562
  checkRowFreezeQuantity(cmd) {
49599
- return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ? CommandResult.Success : CommandResult.InvalidFreezeQuantity;
49563
+ return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
49600
49564
  }
49601
49565
  checkColFreezeQuantity(cmd) {
49602
- return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ? CommandResult.Success : CommandResult.InvalidFreezeQuantity;
49566
+ return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
49603
49567
  }
49604
49568
  checkRowFreezeOverlapMerge(cmd) {
49605
49569
  const merges = this.getters.getMerges(cmd.sheetId);
49606
- for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return CommandResult.MergeOverlap;
49607
- return CommandResult.Success;
49570
+ for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return "MergeOverlap";
49571
+ return "Success";
49608
49572
  }
49609
49573
  checkColFreezeOverlapMerge(cmd) {
49610
49574
  const merges = this.getters.getMerges(cmd.sheetId);
49611
- for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return CommandResult.MergeOverlap;
49612
- return CommandResult.Success;
49575
+ for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return "MergeOverlap";
49576
+ return "Success";
49613
49577
  }
49614
49578
  isRenameAllowed(cmd) {
49615
- if (!(cmd.name && cmd.name.trim().toLowerCase())) return CommandResult.MissingSheetName;
49579
+ if (!(cmd.name && cmd.name.trim().toLowerCase())) return "MissingSheetName";
49616
49580
  return this.checkSheetName(cmd);
49617
49581
  }
49618
49582
  renameSheet(sheet, name) {
@@ -49834,17 +49798,17 @@ var SheetPlugin = class extends CorePlugin {
49834
49798
  * sheet.
49835
49799
  */
49836
49800
  checkSheetExists(cmd) {
49837
- if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return CommandResult.InvalidSheetId;
49838
- else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return CommandResult.DuplicatedSheetId;
49839
- return CommandResult.Success;
49801
+ if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return "InvalidSheetId";
49802
+ else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return "DuplicatedSheetId";
49803
+ return "Success";
49840
49804
  }
49841
49805
  /**
49842
49806
  * Check if zones in the command are well formed and
49843
49807
  * not outside the sheet.
49844
49808
  */
49845
49809
  checkZonesAreInSheet(cmd) {
49846
- if (!("sheetId" in cmd)) return CommandResult.Success;
49847
- if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return CommandResult.InvalidSheetId;
49810
+ if (!("sheetId" in cmd)) return "Success";
49811
+ if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
49848
49812
  return this.checkZonesExistInSheet(cmd.sheetId, this.getCommandZones(cmd));
49849
49813
  }
49850
49814
  };
@@ -49866,21 +49830,21 @@ var TablePlugin = class extends CorePlugin {
49866
49830
  allowDispatch(cmd) {
49867
49831
  switch (cmd.type) {
49868
49832
  case "CREATE_TABLE":
49869
- if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId) || rangeData._sheetId !== cmd.sheetId)) return CommandResult.InvalidSheetId;
49833
+ if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId) || rangeData._sheetId !== cmd.sheetId)) return "InvalidSheetId";
49870
49834
  const zones = cmd.ranges.map((rangeData) => this.getters.getRangeFromRangeData(rangeData).zone);
49871
- if (!areZonesContinuous(zones)) return CommandResult.NonContinuousTargets;
49872
- return this.checkValidations(cmd, (cmd) => this.getTablesOverlappingZones(cmd.sheetId, zones).length ? CommandResult.TableOverlap : CommandResult.Success, (cmd) => this.checkTableConfigUpdateIsValid(cmd.config));
49835
+ if (!areZonesContinuous(zones)) return "NonContinuousTargets";
49836
+ return this.checkValidations(cmd, (cmd) => this.getTablesOverlappingZones(cmd.sheetId, zones).length ? "TableOverlap" : "Success", (cmd) => this.checkTableConfigUpdateIsValid(cmd.config));
49873
49837
  case "UPDATE_TABLE":
49874
- if (!this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone)) return CommandResult.TableNotFound;
49838
+ if (!this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone)) return "TableNotFound";
49875
49839
  return this.checkValidations(cmd, this.checkUpdatedTableZoneIsValid, (cmd) => this.checkTableConfigUpdateIsValid(cmd.config));
49876
49840
  case "ADD_MERGE":
49877
49841
  for (const table of this.getCoreTables(cmd.sheetId)) {
49878
49842
  const tableZone = table.range.zone;
49879
- for (const merge of cmd.target) if (overlap(tableZone, merge)) return CommandResult.MergeInTable;
49843
+ for (const merge of cmd.target) if (overlap(tableZone, merge)) return "MergeInTable";
49880
49844
  }
49881
49845
  break;
49882
49846
  }
49883
- return CommandResult.Success;
49847
+ return "Success";
49884
49848
  }
49885
49849
  handle(cmd) {
49886
49850
  switch (cmd.type) {
@@ -50018,19 +49982,19 @@ var TablePlugin = class extends CorePlugin {
50018
49982
  }
50019
49983
  }
50020
49984
  checkUpdatedTableZoneIsValid(cmd) {
50021
- if (!cmd.newTableRange) return CommandResult.Success;
49985
+ if (!cmd.newTableRange) return "Success";
50022
49986
  const newTableZone = this.getters.getRangeFromRangeData(cmd.newTableRange).zone;
50023
49987
  const zoneIsInSheet = this.getters.checkZonesExistInSheet(cmd.sheetId, [newTableZone]);
50024
- if (zoneIsInSheet !== CommandResult.Success) return zoneIsInSheet;
49988
+ if (zoneIsInSheet !== "Success") return zoneIsInSheet;
50025
49989
  const updatedTable = this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone);
50026
- if (!updatedTable) return CommandResult.TableNotFound;
50027
- return this.getTablesOverlappingZones(cmd.sheetId, [newTableZone]).filter((table) => table.id !== updatedTable.id).length ? CommandResult.TableOverlap : CommandResult.Success;
49990
+ if (!updatedTable) return "TableNotFound";
49991
+ return this.getTablesOverlappingZones(cmd.sheetId, [newTableZone]).filter((table) => table.id !== updatedTable.id).length ? "TableOverlap" : "Success";
50028
49992
  }
50029
49993
  checkTableConfigUpdateIsValid(config) {
50030
- if (!config) return CommandResult.Success;
50031
- if (config.numberOfHeaders !== void 0 && config.numberOfHeaders < 0) return CommandResult.InvalidTableConfig;
50032
- if (config.hasFilters && config.numberOfHeaders === 0) return CommandResult.InvalidTableConfig;
50033
- return CommandResult.Success;
49994
+ if (!config) return "Success";
49995
+ if (config.numberOfHeaders !== void 0 && config.numberOfHeaders < 0) return "InvalidTableConfig";
49996
+ if (config.hasFilters && config.numberOfHeaders === 0) return "InvalidTableConfig";
49997
+ return "Success";
50034
49998
  }
50035
49999
  createStaticTable(id, type, tableRange, config, filters) {
50036
50000
  const zone = tableRange.zone;
@@ -50261,28 +50225,28 @@ var HeaderGroupingPlugin = class extends CorePlugin {
50261
50225
  switch (cmd.type) {
50262
50226
  case "GROUP_HEADERS": {
50263
50227
  const { start, end, sheetId } = cmd;
50264
- if (!this.getters.tryGetSheet(sheetId)) return CommandResult.InvalidSheetId;
50265
- if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return CommandResult.InvalidHeaderGroupStartEnd;
50266
- if (start > end) return CommandResult.InvalidHeaderGroupStartEnd;
50267
- if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return CommandResult.HeaderGroupAlreadyExists;
50228
+ if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
50229
+ if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
50230
+ if (start > end) return "InvalidHeaderGroupStartEnd";
50231
+ if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return "HeaderGroupAlreadyExists";
50268
50232
  break;
50269
50233
  }
50270
50234
  case "UNGROUP_HEADERS": {
50271
50235
  const { start, end, sheetId } = cmd;
50272
- if (!this.getters.tryGetSheet(sheetId)) return CommandResult.InvalidSheetId;
50273
- if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return CommandResult.InvalidHeaderGroupStartEnd;
50274
- if (start > end) return CommandResult.InvalidHeaderGroupStartEnd;
50236
+ if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
50237
+ if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
50238
+ if (start > end) return "InvalidHeaderGroupStartEnd";
50275
50239
  break;
50276
50240
  }
50277
50241
  case "UNFOLD_HEADER_GROUP":
50278
50242
  case "FOLD_HEADER_GROUP":
50279
- if (!this.getters.tryGetSheet(cmd.sheetId)) return CommandResult.InvalidSheetId;
50243
+ if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
50280
50244
  const group = this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, cmd.start, cmd.end);
50281
- if (!group) return CommandResult.UnknownHeaderGroup;
50282
- if (range(0, this.getters.getNumberHeaders(cmd.sheetId, cmd.dimension)).every((i) => i >= group.start && i <= group.end || this.getters.isHeaderHiddenByUser(cmd.sheetId, cmd.dimension, i))) return CommandResult.NotEnoughElements;
50245
+ if (!group) return "UnknownHeaderGroup";
50246
+ if (range(0, this.getters.getNumberHeaders(cmd.sheetId, cmd.dimension)).every((i) => i >= group.start && i <= group.end || this.getters.isHeaderHiddenByUser(cmd.sheetId, cmd.dimension, i))) return "NotEnoughElements";
50283
50247
  break;
50284
50248
  }
50285
- return CommandResult.Success;
50249
+ return "Success";
50286
50250
  }
50287
50251
  handle(cmd) {
50288
50252
  switch (cmd.type) {
@@ -50611,22 +50575,22 @@ var PivotCorePlugin = class extends CorePlugin {
50611
50575
  switch (cmd.type) {
50612
50576
  case "ADD_PIVOT": return this.checkDuplicatedMeasureIds(cmd.pivot);
50613
50577
  case "UPDATE_PIVOT":
50614
- if (!(cmd.pivotId in this.pivots)) return CommandResult.PivotIdNotFound;
50615
- if (deepEquals(cmd.pivot, this.pivots[cmd.pivotId]?.definition)) return CommandResult.NoChanges;
50616
- if (cmd.pivot.name === "") return CommandResult.EmptyName;
50578
+ if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
50579
+ if (deepEquals(cmd.pivot, this.pivots[cmd.pivotId]?.definition)) return "NoChanges";
50580
+ if (cmd.pivot.name === "") return "EmptyName";
50617
50581
  return this.checkDuplicatedMeasureIds(cmd.pivot);
50618
50582
  case "RENAME_PIVOT":
50619
- if (!(cmd.pivotId in this.pivots)) return CommandResult.PivotIdNotFound;
50620
- if (cmd.name === "") return CommandResult.EmptyName;
50583
+ if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
50584
+ if (cmd.name === "") return "EmptyName";
50621
50585
  break;
50622
50586
  case "REMOVE_PIVOT":
50623
50587
  case "DUPLICATE_PIVOT":
50624
50588
  case "INSERT_PIVOT":
50625
- if (!(cmd.pivotId in this.pivots)) return CommandResult.PivotIdNotFound;
50589
+ if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
50626
50590
  break;
50627
- case "DUPLICATE_PIVOT": if (!(cmd.pivotId in this.pivots)) return CommandResult.PivotIdNotFound;
50591
+ case "DUPLICATE_PIVOT": if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
50628
50592
  }
50629
- return CommandResult.Success;
50593
+ return "Success";
50630
50594
  }
50631
50595
  handle(cmd) {
50632
50596
  switch (cmd.type) {
@@ -50824,8 +50788,8 @@ var PivotCorePlugin = class extends CorePlugin {
50824
50788
  }
50825
50789
  checkDuplicatedMeasureIds(definition) {
50826
50790
  const uniqueIds = new Set(definition.measures.map((m) => m.id));
50827
- if (definition.measures.length !== uniqueIds.size) return CommandResult.InvalidDefinition;
50828
- return CommandResult.Success;
50791
+ if (definition.measures.length !== uniqueIds.size) return "InvalidDefinition";
50792
+ return "Success";
50829
50793
  }
50830
50794
  /**
50831
50795
  * Import the pivots
@@ -50854,9 +50818,9 @@ var SettingsPlugin = class extends CorePlugin {
50854
50818
  locale = DEFAULT_LOCALE;
50855
50819
  allowDispatch(cmd) {
50856
50820
  switch (cmd.type) {
50857
- case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ? CommandResult.Success : CommandResult.InvalidLocale;
50821
+ case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ? "Success" : "InvalidLocale";
50858
50822
  }
50859
- return CommandResult.Success;
50823
+ return "Success";
50860
50824
  }
50861
50825
  handle(cmd) {
50862
50826
  switch (cmd.type) {
@@ -50906,15 +50870,15 @@ var SpreadsheetPivotCorePlugin = class extends CorePlugin {
50906
50870
  const definition = cmd.pivot;
50907
50871
  return this.checkDataSetValidity(definition);
50908
50872
  }
50909
- return CommandResult.Success;
50873
+ return "Success";
50910
50874
  }
50911
50875
  checkDataSetValidity(definition) {
50912
50876
  if (definition.type === "SPREADSHEET" && definition.dataSet) {
50913
50877
  const { zone, sheetId } = definition.dataSet;
50914
- if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) return CommandResult.InvalidDataSet;
50878
+ if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) return "InvalidDataSet";
50915
50879
  return this.getters.checkZonesExistInSheet(sheetId, [zone]);
50916
50880
  }
50917
- return CommandResult.Success;
50881
+ return "Success";
50918
50882
  }
50919
50883
  };
50920
50884
 
@@ -50932,18 +50896,18 @@ var TableStylePlugin = class extends CorePlugin {
50932
50896
  switch (cmd.type) {
50933
50897
  case "CREATE_TABLE":
50934
50898
  case "UPDATE_TABLE":
50935
- if (cmd.config?.styleId && !this.styles[cmd.config.styleId]) return CommandResult.InvalidTableConfig;
50899
+ if (cmd.config?.styleId && !this.styles[cmd.config.styleId]) return "InvalidTableConfig";
50936
50900
  break;
50937
50901
  case "CREATE_TABLE_STYLE":
50938
- if (!TABLE_STYLES_TEMPLATES[cmd.templateName]) return CommandResult.InvalidTableStyle;
50902
+ if (!TABLE_STYLES_TEMPLATES[cmd.templateName]) return "InvalidTableStyle";
50939
50903
  try {
50940
50904
  toHex(cmd.primaryColor);
50941
50905
  } catch (e) {
50942
- return CommandResult.InvalidTableStyle;
50906
+ return "InvalidTableStyle";
50943
50907
  }
50944
50908
  break;
50945
50909
  }
50946
- return CommandResult.Success;
50910
+ return "Success";
50947
50911
  }
50948
50912
  handle(cmd) {
50949
50913
  switch (cmd.type) {
@@ -51045,6 +51009,8 @@ function buildCompilationParameters(context, getters, computeCell) {
51045
51009
  return new CompilationParametersBuilder(context, getters, computeCell).getParameters();
51046
51010
  }
51047
51011
  var CompilationParametersBuilder = class {
51012
+ getters;
51013
+ computeCell;
51048
51014
  evalContext;
51049
51015
  rangeCache = {};
51050
51016
  constructor(context, getters, computeCell) {
@@ -51682,6 +51648,7 @@ var ZoneRBush = class extends import_rbush.default {
51682
51648
  * It uses an R-Tree data structure to efficiently find dependent cells.
51683
51649
  */
51684
51650
  var FormulaDependencyGraph = class {
51651
+ createEmptyPositionSet;
51685
51652
  dependencies = new PositionMap();
51686
51653
  rTree;
51687
51654
  constructor(createEmptyPositionSet, data = []) {
@@ -51983,6 +51950,7 @@ const MAX_ITERATION = 30;
51983
51950
  const ERROR_CYCLE_CELL = Object.freeze(createEvaluatedCell(new CircularDependencyError()));
51984
51951
  const EMPTY_CELL = Object.freeze(createEvaluatedCell({ value: null }));
51985
51952
  var Evaluator = class {
51953
+ context;
51986
51954
  getters;
51987
51955
  compilationParams;
51988
51956
  evaluatedCells = new PositionMap();
@@ -52001,7 +51969,7 @@ var Evaluator = class {
52001
51969
  const spreadZone = this.spreadingRelations.getArrayResultZone(position);
52002
51970
  if (!spreadZone) return;
52003
51971
  const evaluatedCell = this.evaluatedCells.get(position);
52004
- if (evaluatedCell?.type === CellValueType.error && !(options.ignoreSpillError && evaluatedCell?.value === CellErrorType.SpilledBlocked)) return positionToZone(position);
51972
+ if (evaluatedCell?.type === "error" && !(options.ignoreSpillError && evaluatedCell?.value === CellErrorType.SpilledBlocked)) return positionToZone(position);
52005
51973
  return union(positionToZone(position), spreadZone);
52006
51974
  }
52007
51975
  getEvaluatedPositions() {
@@ -52011,7 +51979,7 @@ var Evaluator = class {
52011
51979
  return this.evaluatedCells.keysForSheet(sheetId);
52012
51980
  }
52013
51981
  getArrayFormulaSpreadingOn(position) {
52014
- if (this.getEvaluatedCell(position).type === CellValueType.empty) return;
51982
+ if (this.getEvaluatedCell(position).type === "empty") return;
52015
51983
  const arrayFormulas = this.spreadingRelations.searchFormulaPositionsSpreadingOn(position.sheetId, positionToZone(position));
52016
51984
  return Array.from(arrayFormulas).find((position) => !this.blockedArrayFormulas.has(position));
52017
51985
  }
@@ -52244,7 +52212,7 @@ var Evaluator = class {
52244
52212
  col: i + col,
52245
52213
  row: j + row
52246
52214
  };
52247
- if (this.getters.getCell(position)?.content || this.getters.getEvaluatedCell(position).type !== CellValueType.empty) {
52215
+ if (this.getters.getCell(position)?.content || this.getters.getEvaluatedCell(position).type !== "empty") {
52248
52216
  this.blockedArrayFormulas.add(formulaPosition);
52249
52217
  throw new SplillBlockedError(_t("Array result was not expanded because it would overwrite data in %s.", toXC(position.col, position.row)));
52250
52218
  }
@@ -52470,7 +52438,7 @@ var EvaluationPlugin = class extends UIPlugin {
52470
52438
  sheetId,
52471
52439
  col,
52472
52440
  row
52473
- })).every((cell) => cell.type === CellValueType.empty);
52441
+ })).every((cell) => cell.type === "empty");
52474
52442
  }
52475
52443
  /**
52476
52444
  * Maps the visible positions of a range according to a provided callback
@@ -52924,7 +52892,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
52924
52892
  return computedDataBars;
52925
52893
  }
52926
52894
  parsePoint(sheetId, range, threshold, functionName) {
52927
- const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, this.getters.getRangeFromSheetXC(sheetId, range).zone).filter((cell) => cell.type === CellValueType.number).map((cell) => cell.value);
52895
+ const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, this.getters.getRangeFromSheetXC(sheetId, range).zone).filter((cell) => cell.type === "number").map((cell) => cell.value);
52928
52896
  switch (threshold.type) {
52929
52897
  case "value": return functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
52930
52898
  case "number": return Number(threshold.value);
@@ -52955,7 +52923,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
52955
52923
  col,
52956
52924
  row
52957
52925
  });
52958
- if (cell.type !== CellValueType.number) continue;
52926
+ if (cell.type !== "number") continue;
52959
52927
  const icon = this.computeIcon(cell.value, upperInflectionPoint, rule.upperInflectionPoint.operator, lowerInflectionPoint, rule.lowerInflectionPoint.operator, iconSet);
52960
52928
  if (!computedIcons[col]) computedIcons[col] = [];
52961
52929
  computedIcons[col][row] = icon;
@@ -52968,7 +52936,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
52968
52936
  }
52969
52937
  applyDataBar(sheetId, range, rule, computedDataBars) {
52970
52938
  const rangeValues = this.getters.getRangeFromSheetXC(sheetId, rule.rangeValues || range);
52971
- const max = largeMax(this.getters.getEvaluatedCellsInZone(sheetId, rangeValues.zone).filter((cell) => cell.type === CellValueType.number).map((cell) => cell.value));
52939
+ const max = largeMax(this.getters.getEvaluatedCellsInZone(sheetId, rangeValues.zone).filter((cell) => cell.type === "number").map((cell) => cell.value));
52972
52940
  if (max <= 0) return;
52973
52941
  const color = rule.color;
52974
52942
  const zone = this.getters.getRangeFromSheetXC(sheetId, range).zone;
@@ -52981,7 +52949,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
52981
52949
  col: targetCol,
52982
52950
  row: targetRow
52983
52951
  });
52984
- if (!isInside(targetCol, targetRow, zoneOfValues) || cell.type !== CellValueType.number || cell.value <= 0) continue;
52952
+ if (!isInside(targetCol, targetRow, zoneOfValues) || cell.type !== "number" || cell.value <= 0) continue;
52985
52953
  if (!computedDataBars[col]) computedDataBars[col] = [];
52986
52954
  computedDataBars[col][row] = {
52987
52955
  color: colorNumberString(color),
@@ -53019,7 +52987,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
53019
52987
  col,
53020
52988
  row
53021
52989
  });
53022
- if (cell.type === CellValueType.number) {
52990
+ if (cell.type === "number") {
53023
52991
  const value = clip(cell.value, minValue, maxValue);
53024
52992
  let color;
53025
52993
  if (colorCellArgs.length === 2 && midValue) color = value <= midValue ? this.colorCell(value, colorCellArgs[0].minValue, colorCellArgs[0].minColor, colorCellArgs[0].colorDiffUnit) : this.colorCell(value, colorCellArgs[1].minValue, colorCellArgs[1].minColor, colorCellArgs[1].colorDiffUnit);
@@ -53053,7 +53021,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
53053
53021
  */
53054
53022
  rulePredicate = { CellIsRule: (target, rule) => {
53055
53023
  const cell = this.getters.getEvaluatedCell(target);
53056
- if (cell.type === CellValueType.error) return false;
53024
+ if (cell.type === "error") return false;
53057
53025
  let [value0, value1] = rule.values.map((val) => {
53058
53026
  if (val.startsWith("=")) return this.getters.evaluateFormula(target.sheetId, val) ?? "";
53059
53027
  return parseLiteral(val, DEFAULT_LOCALE);
@@ -53163,7 +53131,7 @@ var EvaluationDataValidationPlugin = class extends UIPlugin {
53163
53131
  if (!validationResults[col]) validationResults[col] = [];
53164
53132
  validationResults[col][row] = lazy(() => {
53165
53133
  const evaluatedCell = this.getters.getEvaluatedCell(cellPosition);
53166
- if (evaluatedCell.type === CellValueType.empty) return VALID_RESULT;
53134
+ if (evaluatedCell.type === "empty") return VALID_RESULT;
53167
53135
  return this.getValidationResultForCellValue(evaluatedCell.value, cellPosition);
53168
53136
  });
53169
53137
  }
@@ -53978,6 +53946,7 @@ var PivotUIPlugin = class extends UIPlugin {
53978
53946
  "getPivot",
53979
53947
  "getFirstPivotFunction",
53980
53948
  "getPivotIdFromPosition",
53949
+ "getPivotIdsFromPosition",
53981
53950
  "getPivotCellFromPosition",
53982
53951
  "generateNewCalculatedMeasureName",
53983
53952
  "isPivotUnused",
@@ -54002,9 +53971,11 @@ var PivotUIPlugin = class extends UIPlugin {
54002
53971
  this.refreshPivot(cmd.id);
54003
53972
  break;
54004
53973
  case "ADD_PIVOT":
53974
+ this.unusedPivots?.push(cmd.pivotId);
54005
53975
  this.setupPivot(cmd.pivotId);
54006
53976
  break;
54007
53977
  case "DUPLICATE_PIVOT":
53978
+ this.unusedPivots?.push(cmd.newPivotId);
54008
53979
  this.setupPivot(cmd.newPivotId);
54009
53980
  break;
54010
53981
  case "UPDATE_PIVOT":
@@ -54035,37 +54006,52 @@ var PivotUIPlugin = class extends UIPlugin {
54035
54006
  }
54036
54007
  }
54037
54008
  /**
54038
- * Get the id of the pivot at the given position. Returns undefined if there
54009
+ * Get the id of the first pivot in the formula at the given position. Returns undefined if there
54039
54010
  * is no pivot at this position
54040
54011
  */
54041
54012
  getPivotIdFromPosition(position) {
54013
+ return this.getPivotIdsFromPosition(position)[0];
54014
+ }
54015
+ /**
54016
+ * Get all of the ids of the pivot present in the formula at the given position.
54017
+ */
54018
+ getPivotIdsFromPosition(position) {
54042
54019
  const cell = this.getters.getCorrespondingFormulaCell(position);
54043
- if (cell && cell.isFormula) {
54044
- const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
54045
- if (pivotFunction) {
54046
- const pivotId = pivotFunction.args[0]?.toString();
54047
- return pivotId && this.getters.getPivotId(pivotId);
54048
- }
54049
- }
54020
+ if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
54021
+ return [];
54022
+ }
54023
+ getPivotIdsFromFormula(sheetId, formula) {
54024
+ return this.getPivotFunctions(sheetId, formula.tokens).map((pivotFunction) => {
54025
+ const pivotId = pivotFunction.args[0]?.toString();
54026
+ return pivotId && this.getters.getPivotId(pivotId);
54027
+ }).filter(isDefined);
54050
54028
  }
54051
54029
  isSpillPivotFormula(position) {
54052
54030
  const cell = this.getters.getCorrespondingFormulaCell(position);
54053
54031
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens)?.functionName === "PIVOT";
54054
54032
  return false;
54055
54033
  }
54056
- getFirstPivotFunction(sheetId, tokens) {
54057
- const pivotFunction = getFirstPivotFunction(tokens);
54058
- if (!pivotFunction) return;
54059
- const { functionName, args } = pivotFunction;
54060
- return {
54061
- functionName,
54062
- args: args.map((argAst) => {
54034
+ getPivotFunctions(sheetId, tokens) {
54035
+ const pivotFunctions = getPivotFunctions(tokens);
54036
+ if (!pivotFunctions.length) return [];
54037
+ const evaluatedPivotFunctions = [];
54038
+ for (const pivotFunction of pivotFunctions) {
54039
+ const { functionName, args } = pivotFunction;
54040
+ const evaluatedArgs = args.map((argAst) => {
54063
54041
  if (argAst.type === "EMPTY") return;
54064
54042
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
54065
54043
  const argsString = astToFormula(argAst);
54066
54044
  return this.getters.evaluateFormula(sheetId, argsString);
54067
- })
54068
- };
54045
+ });
54046
+ evaluatedPivotFunctions.push({
54047
+ functionName,
54048
+ args: evaluatedArgs
54049
+ });
54050
+ }
54051
+ return evaluatedPivotFunctions;
54052
+ }
54053
+ getFirstPivotFunction(sheetId, tokens) {
54054
+ return this.getPivotFunctions(sheetId, tokens)[0];
54069
54055
  }
54070
54056
  /**
54071
54057
  * Returns the domain args of a pivot formula from a position.
@@ -54165,8 +54151,8 @@ var PivotUIPlugin = class extends UIPlugin {
54165
54151
  const unusedPivots = new Set(this.getters.getPivotIds());
54166
54152
  for (const sheetId of this.getters.getSheetIds()) for (const cellId in this.getters.getCells(sheetId)) {
54167
54153
  const position = this.getters.getCellPosition(cellId);
54168
- const pivotId = this.getPivotIdFromPosition(position);
54169
- if (pivotId) {
54154
+ const pivotIds = this.getPivotIdsFromPosition(position);
54155
+ for (const pivotId of pivotIds) {
54170
54156
  unusedPivots.delete(pivotId);
54171
54157
  if (!unusedPivots.size) {
54172
54158
  this.unusedPivots = [];
@@ -54174,6 +54160,21 @@ var PivotUIPlugin = class extends UIPlugin {
54174
54160
  }
54175
54161
  }
54176
54162
  }
54163
+ for (const pivotId of this.getters.getPivotIds()) {
54164
+ const pivot = this.getters.getPivotCoreDefinition(pivotId);
54165
+ for (const measure of pivot.measures) if (measure.computedBy) {
54166
+ const { sheetId } = measure.computedBy;
54167
+ const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
54168
+ const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
54169
+ for (const relatedPivotId of relatedPivotIds) {
54170
+ unusedPivots.delete(relatedPivotId);
54171
+ if (!unusedPivots.size) {
54172
+ this.unusedPivots = [];
54173
+ return [];
54174
+ }
54175
+ }
54176
+ }
54177
+ }
54177
54178
  this.unusedPivots = [...unusedPivots];
54178
54179
  return this.unusedPivots;
54179
54180
  }
@@ -54250,10 +54251,10 @@ var AutofillPlugin = class extends UIPlugin {
54250
54251
  const sheetId = this.getters.getActiveSheetId();
54251
54252
  this.lastCellSelected.col = cmd.col === -1 ? this.lastCellSelected.col : clip(cmd.col, 0, this.getters.getNumberCols(sheetId));
54252
54253
  this.lastCellSelected.row = cmd.row === -1 ? this.lastCellSelected.row : clip(cmd.row, 0, this.getters.getNumberRows(sheetId));
54253
- if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return CommandResult.Success;
54254
- return CommandResult.InvalidAutofillSelection;
54254
+ if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return "Success";
54255
+ return "InvalidAutofillSelection";
54255
54256
  }
54256
- return CommandResult.Success;
54257
+ return "Success";
54257
54258
  }
54258
54259
  handle(cmd) {
54259
54260
  switch (cmd.type) {
@@ -54285,7 +54286,7 @@ var AutofillPlugin = class extends UIPlugin {
54285
54286
  const target = this.autofillZone;
54286
54287
  const autofillCellsData = [];
54287
54288
  switch (this.direction) {
54288
- case DIRECTION.DOWN:
54289
+ case "down":
54289
54290
  for (let col = source.left; col <= source.right; col++) {
54290
54291
  const xcs = [];
54291
54292
  for (let row = source.top; row <= source.bottom; row++) xcs.push(toXC(col, row));
@@ -54293,7 +54294,7 @@ var AutofillPlugin = class extends UIPlugin {
54293
54294
  for (let row = target.top; row <= target.bottom; row++) autofillCellsData.push(this.computeNewCell(generator, col, row));
54294
54295
  }
54295
54296
  break;
54296
- case DIRECTION.UP:
54297
+ case "up":
54297
54298
  for (let col = source.left; col <= source.right; col++) {
54298
54299
  const xcs = [];
54299
54300
  for (let row = source.bottom; row >= source.top; row--) xcs.push(toXC(col, row));
@@ -54301,7 +54302,7 @@ var AutofillPlugin = class extends UIPlugin {
54301
54302
  for (let row = target.bottom; row >= target.top; row--) autofillCellsData.push(this.computeNewCell(generator, col, row));
54302
54303
  }
54303
54304
  break;
54304
- case DIRECTION.LEFT:
54305
+ case "left":
54305
54306
  for (let row = source.top; row <= source.bottom; row++) {
54306
54307
  const xcs = [];
54307
54308
  for (let col = source.right; col >= source.left; col--) xcs.push(toXC(col, row));
@@ -54309,7 +54310,7 @@ var AutofillPlugin = class extends UIPlugin {
54309
54310
  for (let col = target.right; col >= target.left; col--) autofillCellsData.push(this.computeNewCell(generator, col, row));
54310
54311
  }
54311
54312
  break;
54312
- case DIRECTION.RIGHT:
54313
+ case "right":
54313
54314
  for (let row = source.top; row <= source.bottom; row++) {
54314
54315
  const xcs = [];
54315
54316
  for (let col = source.left; col <= source.right; col++) xcs.push(toXC(col, row));
@@ -54435,19 +54436,19 @@ var AutofillPlugin = class extends UIPlugin {
54435
54436
  }
54436
54437
  this.direction = this.getDirection(col, row);
54437
54438
  switch (this.direction) {
54438
- case DIRECTION.UP:
54439
+ case "up":
54439
54440
  this.saveZone(row, source.top - 1, source.left, source.right);
54440
54441
  this.steps = source.top - row;
54441
54442
  break;
54442
- case DIRECTION.DOWN:
54443
+ case "down":
54443
54444
  this.saveZone(source.bottom + 1, row, source.left, source.right);
54444
54445
  this.steps = row - source.bottom;
54445
54446
  break;
54446
- case DIRECTION.LEFT:
54447
+ case "left":
54447
54448
  this.saveZone(source.top, source.bottom, col, source.left - 1);
54448
54449
  this.steps = source.left - col;
54449
54450
  break;
54450
- case DIRECTION.RIGHT:
54451
+ case "right":
54451
54452
  this.saveZone(source.top, source.bottom, source.right + 1, col);
54452
54453
  this.steps = col - source.right;
54453
54454
  break;
@@ -54466,7 +54467,7 @@ var AutofillPlugin = class extends UIPlugin {
54466
54467
  for (let row = selection.bottom + 1; row <= autofillRow; row++) if (this.getters.getEvaluatedCell({
54467
54468
  ...activePosition,
54468
54469
  row
54469
- }).type !== CellValueType.empty) {
54470
+ }).type !== "empty") {
54470
54471
  autofillRow = row - 1;
54471
54472
  break;
54472
54473
  }
@@ -54486,7 +54487,7 @@ var AutofillPlugin = class extends UIPlugin {
54486
54487
  col: col - 1,
54487
54488
  row
54488
54489
  };
54489
- while (this.getters.getEvaluatedCell(leftPosition).type !== CellValueType.empty) {
54490
+ while (this.getters.getEvaluatedCell(leftPosition).type !== "empty") {
54490
54491
  row += 1;
54491
54492
  leftPosition = {
54492
54493
  sheetId,
@@ -54503,7 +54504,7 @@ var AutofillPlugin = class extends UIPlugin {
54503
54504
  col: col + 1,
54504
54505
  row
54505
54506
  };
54506
- while (this.getters.getEvaluatedCell(rightPosition).type !== CellValueType.empty) {
54507
+ while (this.getters.getEvaluatedCell(rightPosition).type !== "empty") {
54507
54508
  row += 1;
54508
54509
  rightPosition = {
54509
54510
  sheetId,
@@ -54593,19 +54594,19 @@ var AutofillPlugin = class extends UIPlugin {
54593
54594
  const position = {
54594
54595
  up: {
54595
54596
  number: source.top - row,
54596
- value: DIRECTION.UP
54597
+ value: "up"
54597
54598
  },
54598
54599
  down: {
54599
54600
  number: row - source.bottom,
54600
- value: DIRECTION.DOWN
54601
+ value: "down"
54601
54602
  },
54602
54603
  left: {
54603
54604
  number: source.left - col,
54604
- value: DIRECTION.LEFT
54605
+ value: "left"
54605
54606
  },
54606
54607
  right: {
54607
54608
  number: col - source.right,
54608
- value: DIRECTION.RIGHT
54609
+ value: "right"
54609
54610
  }
54610
54611
  };
54611
54612
  if (Object.values(position).map((x) => x.number > 0 ? 1 : 0).reduce((acc, value) => acc + value) === 1) return Object.values(position).find((x) => x.number > 0 ? 1 : 0).value;
@@ -54808,7 +54809,7 @@ var AutomaticSumPlugin = class extends UIPlugin {
54808
54809
  return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
54809
54810
  }
54810
54811
  isNumber(cell) {
54811
- return cell.type === CellValueType.number && !(cell.format && isDateTimeFormat(cell.format));
54812
+ return cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format));
54812
54813
  }
54813
54814
  isZoneValid(zone) {
54814
54815
  return zone.bottom >= zone.top && zone.right >= zone.left;
@@ -55302,6 +55303,8 @@ function transformPositionWithMerge(toTransform, executed) {
55302
55303
  //#endregion
55303
55304
  //#region src/collaborative/revisions.ts
55304
55305
  var Revision = class {
55306
+ rootCommand;
55307
+ timestamp;
55305
55308
  id;
55306
55309
  clientId;
55307
55310
  _commands = [];
@@ -55338,6 +55341,9 @@ var Revision = class {
55338
55341
  //#region src/collaborative/session.ts
55339
55342
  var ClientDisconnectedError = class extends Error {};
55340
55343
  var Session = class extends EventBus {
55344
+ revisions;
55345
+ transportService;
55346
+ serverRevisionId;
55341
55347
  /**
55342
55348
  * Positions of the others client.
55343
55349
  */
@@ -55803,7 +55809,7 @@ var DataCleanupPlugin = class extends UIPlugin {
55803
55809
  switch (cmd.type) {
55804
55810
  case "REMOVE_DUPLICATES": return this.checkValidations(cmd, this.chainValidations(this.checkSingleRangeSelected, this.checkNoMergeInZone, this.checkRangeContainsValues, this.checkColumnsIncludedInZone), this.chainValidations(this.checkNoColumnProvided, this.checkColumnsAreUnique));
55805
55811
  }
55806
- return CommandResult.Success;
55812
+ return "Success";
55807
55813
  }
55808
55814
  handle(cmd) {
55809
55815
  switch (cmd.type) {
@@ -55886,34 +55892,34 @@ var DataCleanupPlugin = class extends UIPlugin {
55886
55892
  });
55887
55893
  }
55888
55894
  checkSingleRangeSelected() {
55889
- if (this.getters.getSelectedZones().length !== 1) return CommandResult.MoreThanOneRangeSelected;
55890
- return CommandResult.Success;
55895
+ if (this.getters.getSelectedZones().length !== 1) return "MoreThanOneRangeSelected";
55896
+ return "Success";
55891
55897
  }
55892
55898
  checkNoMergeInZone() {
55893
55899
  const sheetId = this.getters.getActiveSheetId();
55894
55900
  const zone = this.getters.getSelectedZone();
55895
- if (this.getters.getMergesInZone(sheetId, zone).length > 0) return CommandResult.WillRemoveExistingMerge;
55896
- return CommandResult.Success;
55901
+ if (this.getters.getMergesInZone(sheetId, zone).length > 0) return "WillRemoveExistingMerge";
55902
+ return "Success";
55897
55903
  }
55898
55904
  checkRangeContainsValues(cmd) {
55899
55905
  const sheetId = this.getters.getActiveSheetId();
55900
55906
  const zone = this.getters.getSelectedZone();
55901
55907
  if (cmd.hasHeader) zone.top += 1;
55902
- if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return CommandResult.EmptyTarget;
55903
- return CommandResult.Success;
55908
+ if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return "EmptyTarget";
55909
+ return "Success";
55904
55910
  }
55905
55911
  checkNoColumnProvided(cmd) {
55906
- if (cmd.columns.length === 0) return CommandResult.NoColumnsProvided;
55907
- return CommandResult.Success;
55912
+ if (cmd.columns.length === 0) return "NoColumnsProvided";
55913
+ return "Success";
55908
55914
  }
55909
55915
  checkColumnsIncludedInZone(cmd) {
55910
55916
  const zone = this.getters.getSelectedZone();
55911
- if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return CommandResult.ColumnsNotIncludedInZone;
55912
- return CommandResult.Success;
55917
+ if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return "ColumnsNotIncludedInZone";
55918
+ return "Success";
55913
55919
  }
55914
55920
  checkColumnsAreUnique(cmd) {
55915
- if (cmd.columns.length !== new Set(cmd.columns).size) return CommandResult.DuplicatesColumnsSelected;
55916
- return CommandResult.Success;
55921
+ if (cmd.columns.length !== new Set(cmd.columns).size) return "DuplicatesColumnsSelected";
55922
+ return "Success";
55917
55923
  }
55918
55924
  trimWhitespace() {
55919
55925
  const zones = recomputeZones(this.getters.getSelectedZones());
@@ -56046,7 +56052,7 @@ var FormatPlugin = class extends UIPlugin {
56046
56052
  getCellNumberFormat(position) {
56047
56053
  for (const pos of [position]) {
56048
56054
  const cell = this.getters.getEvaluatedCell(pos);
56049
- if (cell.type === CellValueType.number && !(cell.format && isDateTimeFormat(cell.format))) return cell.format || createDefaultFormat(cell.value);
56055
+ if (cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format))) return cell.format || createDefaultFormat(cell.value);
56050
56056
  }
56051
56057
  }
56052
56058
  };
@@ -56114,11 +56120,11 @@ var InsertPivotPlugin = class extends UIPlugin {
56114
56120
  allowDispatch(cmd) {
56115
56121
  switch (cmd.type) {
56116
56122
  case "DUPLICATE_PIVOT_IN_NEW_SHEET":
56117
- if (!this.getters.isExistingPivot(cmd.pivotId)) return CommandResult.PivotIdNotFound;
56118
- if (!this.getters.getPivot(cmd.pivotId).isValid()) return CommandResult.PivotInError;
56123
+ if (!this.getters.isExistingPivot(cmd.pivotId)) return "PivotIdNotFound";
56124
+ if (!this.getters.getPivot(cmd.pivotId).isValid()) return "PivotInError";
56119
56125
  break;
56120
56126
  }
56121
- return CommandResult.Success;
56127
+ return "Success";
56122
56128
  }
56123
56129
  handle(cmd) {
56124
56130
  switch (cmd.type) {
@@ -56319,7 +56325,7 @@ var SortPlugin = class extends UIPlugin {
56319
56325
  if (!isInside(cmd.col, cmd.row, cmd.zone)) throw new Error(_t("The anchor must be part of the provided zone"));
56320
56326
  return this.checkValidations(cmd, this.checkMerge, this.checkMergeSizes);
56321
56327
  }
56322
- return CommandResult.Success;
56328
+ return "Success";
56323
56329
  }
56324
56330
  handle(cmd) {
56325
56331
  switch (cmd.type) {
@@ -56329,24 +56335,24 @@ var SortPlugin = class extends UIPlugin {
56329
56335
  }
56330
56336
  }
56331
56337
  checkMerge({ sheetId, zone }) {
56332
- if (!this.getters.doesIntersectMerge(sheetId, zone)) return CommandResult.Success;
56338
+ if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
56333
56339
  if (positions(zone).some(({ col, row }) => !this.getters.isInMerge({
56334
56340
  sheetId,
56335
56341
  col,
56336
56342
  row
56337
- }))) return CommandResult.InvalidSortZone;
56338
- return CommandResult.Success;
56343
+ }))) return "InvalidSortZone";
56344
+ return "Success";
56339
56345
  }
56340
56346
  checkMergeSizes({ sheetId, zone }) {
56341
- if (!this.getters.doesIntersectMerge(sheetId, zone)) return CommandResult.Success;
56347
+ if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
56342
56348
  const merges = this.getters.getMerges(sheetId).filter((merge) => overlap(merge, zone));
56343
56349
  const mergeDimension = zoneToDimension(merges[0]);
56344
56350
  const [widthFirst, heightFirst] = [mergeDimension.numberOfCols, mergeDimension.numberOfRows];
56345
56351
  if (!merges.every((merge) => {
56346
56352
  const [widthCurrent, heightCurrent] = [merge.right - merge.left + 1, merge.bottom - merge.top + 1];
56347
56353
  return widthCurrent === widthFirst && heightCurrent === heightFirst;
56348
- })) return CommandResult.InvalidSortZone;
56349
- return CommandResult.Success;
56354
+ })) return "InvalidSortZone";
56355
+ return "Success";
56350
56356
  }
56351
56357
  /**
56352
56358
  * This function evaluates if the top row of a provided zone can be considered as a `header`
@@ -56364,9 +56370,9 @@ var SortPlugin = class extends UIPlugin {
56364
56370
  col,
56365
56371
  row
56366
56372
  }).type));
56367
- if (cells[0][0] === CellValueType.empty) cells = cells.slice(1);
56368
- if (cells.some((item) => item[0] === CellValueType.empty)) return false;
56369
- else if (cells.some((item) => item[1] !== CellValueType.empty && item[0] !== item[1])) return true;
56373
+ if (cells[0][0] === "empty") cells = cells.slice(1);
56374
+ if (cells.some((item) => item[0] === "empty")) return false;
56375
+ else if (cells.some((item) => item[1] !== "empty" && item[0] !== item[1])) return true;
56370
56376
  else return false;
56371
56377
  }
56372
56378
  sortZone(sheetId, anchor, zone, sortDirection, options) {
@@ -56624,7 +56630,7 @@ var SheetUIPlugin = class extends UIPlugin {
56624
56630
  */
56625
56631
  isCellEmpty(position) {
56626
56632
  const mainPosition = this.getters.getMainCellPosition(position);
56627
- return this.getters.getEvaluatedCell(mainPosition).type === CellValueType.empty;
56633
+ return this.getters.getEvaluatedCell(mainPosition).type === "empty";
56628
56634
  }
56629
56635
  getColMaxWidth(sheetId, index) {
56630
56636
  const sizes = positions(this.getters.getColsZone(sheetId, index, index)).map((position) => this.getCellWidth({
@@ -56638,8 +56644,8 @@ var SheetUIPlugin = class extends UIPlugin {
56638
56644
  * sheet.
56639
56645
  */
56640
56646
  checkSheetExists(cmd) {
56641
- if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0) return CommandResult.InvalidSheetId;
56642
- return CommandResult.Success;
56647
+ if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0) return "InvalidSheetId";
56648
+ return "Success";
56643
56649
  }
56644
56650
  /**
56645
56651
  * Check if zones in the command are well formed and
@@ -56647,11 +56653,11 @@ var SheetUIPlugin = class extends UIPlugin {
56647
56653
  */
56648
56654
  checkZonesAreInSheet(cmd) {
56649
56655
  const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.tryGetActiveSheetId();
56650
- if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return CommandResult.InvalidSheetId;
56656
+ if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
56651
56657
  const zones = this.getters.getCommandZones(cmd);
56652
- if (!sheetId && zones.length > 0) return CommandResult.NoActiveSheet;
56658
+ if (!sheetId && zones.length > 0) return "NoActiveSheet";
56653
56659
  if (sheetId && zones.length > 0) return this.getters.checkZonesExistInSheet(sheetId, zones);
56654
- return CommandResult.Success;
56660
+ return "Success";
56655
56661
  }
56656
56662
  autoResizeRows(sheetId, rows) {
56657
56663
  const rowSizes = [];
@@ -56899,7 +56905,7 @@ var DataValidationInsertionPlugin = class extends UIPlugin {
56899
56905
  ...position,
56900
56906
  content: "FALSE"
56901
56907
  });
56902
- else if (cell?.content && evaluatedCell.type === CellValueType.empty) {
56908
+ else if (cell?.content && evaluatedCell.type === "empty") {
56903
56909
  let value;
56904
56910
  if (cell.content.startsWith("=")) {
56905
56911
  const result = this.getters.evaluateFormula(position.sheetId, cell.content);
@@ -56909,7 +56915,7 @@ var DataValidationInsertionPlugin = class extends UIPlugin {
56909
56915
  ...position,
56910
56916
  content: "FALSE"
56911
56917
  });
56912
- } else if (evaluatedCell.type !== CellValueType.boolean) this.dispatch("UPDATE_CELL", {
56918
+ } else if (evaluatedCell.type !== "boolean") this.dispatch("UPDATE_CELL", {
56913
56919
  ...position,
56914
56920
  content: "FALSE"
56915
56921
  });
@@ -57162,13 +57168,13 @@ var HistoryPlugin = class extends UIPlugin {
57162
57168
  allowDispatch(cmd) {
57163
57169
  switch (cmd.type) {
57164
57170
  case "REQUEST_UNDO":
57165
- if (!this.canUndo()) return CommandResult.EmptyUndoStack;
57171
+ if (!this.canUndo()) return "EmptyUndoStack";
57166
57172
  break;
57167
57173
  case "REQUEST_REDO":
57168
- if (!this.canRedo()) return CommandResult.EmptyRedoStack;
57174
+ if (!this.canRedo()) return "EmptyRedoStack";
57169
57175
  break;
57170
57176
  }
57171
- return CommandResult.Success;
57177
+ return "Success";
57172
57178
  }
57173
57179
  handle(cmd) {
57174
57180
  switch (cmd.type) {
@@ -57285,7 +57291,7 @@ var SplitToColumnsPlugin = class extends UIPlugin {
57285
57291
  switch (cmd.type) {
57286
57292
  case "SPLIT_TEXT_INTO_COLUMNS": return this.chainValidations(this.batchValidations(this.checkSingleColSelected, this.checkNonEmptySelector), this.batchValidations(this.checkNotOverwritingContent, this.checkSeparatorInSelection))(cmd);
57287
57293
  }
57288
- return CommandResult.Success;
57294
+ return "Success";
57289
57295
  }
57290
57296
  handle(cmd) {
57291
57297
  switch (cmd.type) {
@@ -57296,7 +57302,7 @@ var SplitToColumnsPlugin = class extends UIPlugin {
57296
57302
  }
57297
57303
  getAutomaticSeparator() {
57298
57304
  const cells = this.getters.getSelectedCells();
57299
- for (const cell of cells) if (cell.value && cell.type === CellValueType.text) {
57305
+ for (const cell of cells) if (cell.value && cell.type === "text") {
57300
57306
  const separator = this.getAutoSeparatorForString(cell.value);
57301
57307
  if (separator) return separator;
57302
57308
  }
@@ -57432,24 +57438,24 @@ var SplitToColumnsPlugin = class extends UIPlugin {
57432
57438
  });
57433
57439
  }
57434
57440
  checkSingleColSelected() {
57435
- if (!this.getters.isSingleColSelected()) return CommandResult.MoreThanOneColumnSelected;
57436
- return CommandResult.Success;
57441
+ if (!this.getters.isSingleColSelected()) return "MoreThanOneColumnSelected";
57442
+ return "Success";
57437
57443
  }
57438
57444
  checkNonEmptySelector(cmd) {
57439
- if (cmd.separator === "") return CommandResult.EmptySplitSeparator;
57440
- return CommandResult.Success;
57445
+ if (cmd.separator === "") return "EmptySplitSeparator";
57446
+ return "Success";
57441
57447
  }
57442
57448
  checkNotOverwritingContent(cmd) {
57443
- if (cmd.addNewColumns || cmd.force) return CommandResult.Success;
57449
+ if (cmd.addNewColumns || cmd.force) return "Success";
57444
57450
  const selection = this.getters.getSelectedZones()[0];
57445
57451
  const splitted = this.getSplittedCols(selection, cmd.separator);
57446
- if (this.willSplittedColsOverwriteContent(selection, splitted)) return CommandResult.SplitWillOverwriteContent;
57447
- return CommandResult.Success;
57452
+ if (this.willSplittedColsOverwriteContent(selection, splitted)) return "SplitWillOverwriteContent";
57453
+ return "Success";
57448
57454
  }
57449
57455
  checkSeparatorInSelection({ separator }) {
57450
57456
  const cells = this.getters.getSelectedCells();
57451
- for (const cell of cells) if (cell.formattedValue.includes(separator)) return CommandResult.Success;
57452
- return CommandResult.NoSplitSeparatorInSelection;
57457
+ for (const cell of cells) if (cell.formattedValue.includes(separator)) return "Success";
57458
+ return "NoSplitSeparatorInSelection";
57453
57459
  }
57454
57460
  };
57455
57461
 
@@ -57486,7 +57492,7 @@ var TableAutofillPlugin = class extends UIPlugin {
57486
57492
  col,
57487
57493
  row: r,
57488
57494
  sheetId
57489
- }).type !== CellValueType.empty) return;
57495
+ }).type !== "empty") return;
57490
57496
  }
57491
57497
  const oldSelection = {
57492
57498
  zone: this.getters.getSelectedZone(),
@@ -57515,13 +57521,13 @@ var TableResizeUI = class extends UIPlugin {
57515
57521
  switch (cmd.type) {
57516
57522
  case "RESIZE_TABLE":
57517
57523
  const table = this.getters.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone);
57518
- if (!table) return CommandResult.TableNotFound;
57524
+ if (!table) return "TableNotFound";
57519
57525
  const oldTableZone = table.range.zone;
57520
57526
  const newTableZone = this.getters.getRangeFromRangeData(cmd.newTableRange).zone;
57521
- if (newTableZone.top !== oldTableZone.top || newTableZone.left !== oldTableZone.left) return CommandResult.InvalidTableResize;
57527
+ if (newTableZone.top !== oldTableZone.top || newTableZone.left !== oldTableZone.left) return "InvalidTableResize";
57522
57528
  return this.canDispatch("UPDATE_TABLE", { ...cmd }).reasons;
57523
57529
  }
57524
- return CommandResult.Success;
57530
+ return "Success";
57525
57531
  }
57526
57532
  handle(cmd) {
57527
57533
  switch (cmd.type) {
@@ -57586,7 +57592,7 @@ var ClipboardPlugin = class extends UIPlugin {
57586
57592
  });
57587
57593
  }
57588
57594
  case "PASTE": {
57589
- if (!this.copiedData) return CommandResult.EmptyClipboard;
57595
+ if (!this.copiedData) return "EmptyClipboard";
57590
57596
  const pasteOption = cmd.pasteOption;
57591
57597
  return this.isPasteAllowed(cmd.target, this.copiedData, {
57592
57598
  pasteOption,
@@ -57595,12 +57601,12 @@ var ClipboardPlugin = class extends UIPlugin {
57595
57601
  }
57596
57602
  case "COPY_PASTE_CELLS_ABOVE": {
57597
57603
  const zones = this.getters.getSelectedZones();
57598
- if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return CommandResult.InvalidCopyPasteSelection;
57604
+ if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return "InvalidCopyPasteSelection";
57599
57605
  break;
57600
57606
  }
57601
57607
  case "COPY_PASTE_CELLS_ON_LEFT": {
57602
57608
  const zones = this.getters.getSelectedZones();
57603
- if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return CommandResult.InvalidCopyPasteSelection;
57609
+ if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return "InvalidCopyPasteSelection";
57604
57610
  break;
57605
57611
  }
57606
57612
  case "INSERT_CELL": {
@@ -57614,7 +57620,7 @@ var ClipboardPlugin = class extends UIPlugin {
57614
57620
  return this.isPasteAllowed(paste, copiedData, { isCutOperation: true });
57615
57621
  }
57616
57622
  }
57617
- return CommandResult.Success;
57623
+ return "Success";
57618
57624
  }
57619
57625
  handle(cmd) {
57620
57626
  switch (cmd.type) {
@@ -57772,16 +57778,16 @@ var ClipboardPlugin = class extends UIPlugin {
57772
57778
  const clipboardData = this.getClipboardData(zones);
57773
57779
  for (const { handler } of this.selectClipboardHandlers(clipboardData)) {
57774
57780
  const result = handler.isCutAllowed(clipboardData);
57775
- if (result !== CommandResult.Success) return result;
57781
+ if (result !== "Success") return result;
57776
57782
  }
57777
- return CommandResult.Success;
57783
+ return "Success";
57778
57784
  }
57779
57785
  isPasteAllowed(target, copiedData, options) {
57780
57786
  for (const { handler } of this.selectClipboardHandlers(copiedData)) {
57781
57787
  const result = handler.isPasteAllowed(this.getters.getActiveSheetId(), target, copiedData, { ...options });
57782
- if (result !== CommandResult.Success) return result;
57788
+ if (result !== "Success") return result;
57783
57789
  }
57784
- return CommandResult.Success;
57790
+ return "Success";
57785
57791
  }
57786
57792
  isColRowDirtyingClipboard(position, dimension) {
57787
57793
  if (!this.copiedData || !this.copiedData.zones) return false;
@@ -57858,8 +57864,8 @@ var ClipboardPlugin = class extends UIPlugin {
57858
57864
  }
57859
57865
  getClipboardContent() {
57860
57866
  return {
57861
- [ClipboardMIMEType.PlainText]: this.getPlainTextContent(),
57862
- [ClipboardMIMEType.Html]: this.getHTMLContent()
57867
+ ["text/plain"]: this.getPlainTextContent(),
57868
+ ["text/html"]: this.getHTMLContent()
57863
57869
  };
57864
57870
  }
57865
57871
  getSheetData() {
@@ -57992,10 +57998,10 @@ var FilterEvaluationPlugin = class extends UIPlugin {
57992
57998
  allowDispatch(cmd) {
57993
57999
  switch (cmd.type) {
57994
58000
  case "UPDATE_FILTER":
57995
- if (!this.getters.getFilterId(cmd)) return CommandResult.FilterNotFound;
58001
+ if (!this.getters.getFilterId(cmd)) return "FilterNotFound";
57996
58002
  break;
57997
58003
  }
57998
- return CommandResult.Success;
58004
+ return "Success";
57999
58005
  }
58000
58006
  handle(cmd) {
58001
58007
  switch (cmd.type) {
@@ -58209,14 +58215,14 @@ var GridSelectionPlugin = class extends UIPlugin {
58209
58215
  allowDispatch(cmd) {
58210
58216
  switch (cmd.type) {
58211
58217
  case "ACTIVATE_SHEET": try {
58212
- if (!this.getters.getSheet(cmd.sheetIdTo).isVisible) return CommandResult.SheetIsHidden;
58218
+ if (!this.getters.getSheet(cmd.sheetIdTo).isVisible) return "SheetIsHidden";
58213
58219
  break;
58214
58220
  } catch (error) {
58215
- return CommandResult.InvalidSheetId;
58221
+ return "InvalidSheetId";
58216
58222
  }
58217
58223
  case "MOVE_COLUMNS_ROWS": return this.isMoveElementAllowed(cmd);
58218
58224
  }
58219
- return CommandResult.Success;
58225
+ return "Success";
58220
58226
  }
58221
58227
  handleEvent(event) {
58222
58228
  const anchor = event.anchor;
@@ -58505,7 +58511,8 @@ var GridSelectionPlugin = class extends UIPlugin {
58505
58511
  }, [zone]);
58506
58512
  }
58507
58513
  setActiveSheet(id) {
58508
- this.activeSheet = this.getters.getSheet(id);
58514
+ const sheet = this.getters.getSheet(id);
58515
+ this.activeSheet = sheet;
58509
58516
  }
58510
58517
  activateNextSheet(direction) {
58511
58518
  const sheetIds = this.getters.getSheetIds();
@@ -58643,12 +58650,12 @@ var GridSelectionPlugin = class extends UIPlugin {
58643
58650
  const end = cmd.elements[cmd.elements.length - 1];
58644
58651
  const id = cmd.sheetId;
58645
58652
  const doesElementsHaveCommonMerges = isCol ? this.getters.doesColumnsHaveCommonMerges : this.getters.doesRowsHaveCommonMerges;
58646
- if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return CommandResult.WillRemoveExistingMerge;
58653
+ if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return "WillRemoveExistingMerge";
58647
58654
  const headers = [cmd.base, ...cmd.elements];
58648
58655
  const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
58649
- if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return CommandResult.InvalidHeaderIndex;
58650
- if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) return CommandResult.CannotMoveTableHeader;
58651
- return CommandResult.Success;
58656
+ if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return "InvalidHeaderIndex";
58657
+ if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) return "CannotMoveTableHeader";
58658
+ return "Success";
58652
58659
  }
58653
58660
  isTableRowMoveAllowed(sheetId, selectedRows) {
58654
58661
  const tables = this.getters.getCoreTables(sheetId);
@@ -58741,6 +58748,9 @@ var GridSelectionPlugin = class extends UIPlugin {
58741
58748
  //#endregion
58742
58749
  //#region src/helpers/internal_viewport.ts
58743
58750
  var InternalViewport = class {
58751
+ getters;
58752
+ sheetId;
58753
+ boundaries;
58744
58754
  top;
58745
58755
  bottom;
58746
58756
  left;
@@ -59078,7 +59088,7 @@ var SheetViewPlugin = class extends UIPlugin {
59078
59088
  switch (cmd.type) {
59079
59089
  case "SET_VIEWPORT_OFFSET": return this.chainValidations(this.checkScrollingDirection, this.checkIfViewportsWillChange)(cmd);
59080
59090
  case "RESIZE_SHEETVIEW": return this.chainValidations(this.checkValuesAreDifferent, this.checkPositiveDimension)(cmd);
59081
- default: return CommandResult.Success;
59091
+ default: return "Success";
59082
59092
  }
59083
59093
  }
59084
59094
  handleEvent(event) {
@@ -59486,23 +59496,23 @@ var SheetViewPlugin = class extends UIPlugin {
59486
59496
  return Object.values(this.viewports[sheetId]).filter(isDefined);
59487
59497
  }
59488
59498
  checkPositiveDimension(cmd) {
59489
- if (cmd.width < 0 || cmd.height < 0) return CommandResult.InvalidViewportSize;
59490
- return CommandResult.Success;
59499
+ if (cmd.width < 0 || cmd.height < 0) return "InvalidViewportSize";
59500
+ return "Success";
59491
59501
  }
59492
59502
  checkValuesAreDifferent(cmd) {
59493
59503
  const { height, width } = this.getSheetViewDimension();
59494
- if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return CommandResult.ValuesNotChanged;
59495
- return CommandResult.Success;
59504
+ if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return "ValuesNotChanged";
59505
+ return "Success";
59496
59506
  }
59497
59507
  checkScrollingDirection({ offsetX, offsetY }) {
59498
59508
  const pane = this.getMainInternalViewport(this.getters.getActiveSheetId());
59499
- if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return CommandResult.InvalidScrollingDirection;
59500
- return CommandResult.Success;
59509
+ if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return "InvalidScrollingDirection";
59510
+ return "Success";
59501
59511
  }
59502
59512
  checkIfViewportsWillChange({ offsetX, offsetY }) {
59503
59513
  const sheetId = this.getters.getActiveSheetId();
59504
59514
  const { maxOffsetX, maxOffsetY } = this.getMaximumSheetOffset();
59505
- return this.getSubViewports(sheetId).some((viewport) => viewport.willNewOffsetScrollViewport(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY))) ? CommandResult.Success : CommandResult.ViewportScrollLimitsReached;
59515
+ return this.getSubViewports(sheetId).some((viewport) => viewport.willNewOffsetScrollViewport(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY))) ? "Success" : "ViewportScrollLimitsReached";
59506
59516
  }
59507
59517
  getMainViewport(sheetId) {
59508
59518
  const viewport = this.getMainInternalViewport(sheetId);
@@ -60087,9 +60097,9 @@ function interactiveRenameSheet(env, sheetId, name, errorCallback) {
60087
60097
  sheetId,
60088
60098
  name
60089
60099
  });
60090
- if (result.reasons.includes(CommandResult.MissingSheetName)) env.raiseError(_t("The sheet name cannot be empty."), errorCallback);
60091
- else if (result.reasons.includes(CommandResult.DuplicatedSheetName)) env.raiseError(_t("A sheet with the name %s already exists. Please select another name.", name), errorCallback);
60092
- else if (result.reasons.includes(CommandResult.ForbiddenCharactersInSheetName)) env.raiseError(_t("Some used characters are not allowed in a sheet name (Forbidden characters are %s).", FORBIDDEN_SHEETNAME_CHARS.join(" ")), errorCallback);
60100
+ if (result.reasons.includes("MissingSheetName")) env.raiseError(_t("The sheet name cannot be empty."), errorCallback);
60101
+ else if (result.reasons.includes("DuplicatedSheetName")) env.raiseError(_t("A sheet with the name %s already exists. Please select another name.", name), errorCallback);
60102
+ else if (result.reasons.includes("ForbiddenCharactersInSheetName")) env.raiseError(_t("Some used characters are not allowed in a sheet name (Forbidden characters are %s).", FORBIDDEN_SHEETNAME_CHARS.join(" ")), errorCallback);
60093
60103
  }
60094
60104
 
60095
60105
  //#endregion
@@ -60301,41 +60311,41 @@ var BottomBarSheet = class extends _odoo_owl.Component {
60301
60311
  const selectionStatisticFunctions = [
60302
60312
  {
60303
60313
  name: _t("Sum"),
60304
- types: [CellValueType.number],
60314
+ types: ["number"],
60305
60315
  compute: (values, locale) => sum([[values]], locale)
60306
60316
  },
60307
60317
  {
60308
60318
  name: _t("Avg"),
60309
- types: [CellValueType.number],
60319
+ types: ["number"],
60310
60320
  compute: (values, locale) => average([[values]], locale)
60311
60321
  },
60312
60322
  {
60313
60323
  name: _t("Min"),
60314
- types: [CellValueType.number],
60324
+ types: ["number"],
60315
60325
  compute: (values, locale) => min([[values]], locale).value
60316
60326
  },
60317
60327
  {
60318
60328
  name: _t("Max"),
60319
- types: [CellValueType.number],
60329
+ types: ["number"],
60320
60330
  compute: (values, locale) => max([[values]], locale).value
60321
60331
  },
60322
60332
  {
60323
60333
  name: _t("Count"),
60324
60334
  types: [
60325
- CellValueType.number,
60326
- CellValueType.text,
60327
- CellValueType.boolean,
60328
- CellValueType.error
60335
+ "number",
60336
+ "text",
60337
+ "boolean",
60338
+ "error"
60329
60339
  ],
60330
60340
  compute: (values) => countAny([[values]])
60331
60341
  },
60332
60342
  {
60333
60343
  name: _t("Count Numbers"),
60334
60344
  types: [
60335
- CellValueType.number,
60336
- CellValueType.text,
60337
- CellValueType.boolean,
60338
- CellValueType.error
60345
+ "number",
60346
+ "text",
60347
+ "boolean",
60348
+ "error"
60339
60349
  ],
60340
60350
  compute: (values, locale) => countNumbers([[values]], locale)
60341
60351
  }
@@ -60385,7 +60395,7 @@ var AggregateStatisticsStore = class extends SpreadsheetStore {
60385
60395
  col,
60386
60396
  row
60387
60397
  });
60388
- if (evaluatedCell.type !== CellValueType.empty) cells.push(evaluatedCell);
60398
+ if (evaluatedCell.type !== "empty") cells.push(evaluatedCell);
60389
60399
  }
60390
60400
  const locale = getters.getLocale();
60391
60401
  const statisticFnResults = {};
@@ -60870,7 +60880,7 @@ var SpreadsheetDashboard = class extends _odoo_owl.Component {
60870
60880
  css`
60871
60881
  .o-header-group {
60872
60882
  .o-header-group-header {
60873
- z-index: ${ComponentsImportance.HeaderGroupingButton};
60883
+ z-index: ${6};
60874
60884
  .o-group-fold-button {
60875
60885
  cursor: pointer;
60876
60886
  width: 13px;
@@ -61656,7 +61666,7 @@ var TopBarComposer = class extends _odoo_owl.Component {
61656
61666
  });
61657
61667
  return cssPropertiesToCss({
61658
61668
  "border-color": SELECTION_BORDER_COLOR,
61659
- "z-index": String(ComponentsImportance.TopBarComposer)
61669
+ "z-index": String(30)
61660
61670
  });
61661
61671
  }
61662
61672
  onFocus(selection) {
@@ -61892,7 +61902,7 @@ css`
61892
61902
  overflow-y: auto;
61893
61903
  overflow-x: hidden;
61894
61904
  padding: 2px;
61895
- z-index: ${ComponentsImportance.Dropdown};
61905
+ z-index: ${21};
61896
61906
  box-shadow: 1px 2px 5px 2px rgba(51, 51, 51, 0.15);
61897
61907
  background-color: white;
61898
61908
 
@@ -62031,6 +62041,7 @@ function instantiateClipboard() {
62031
62041
  return new WebClipboardWrapper(navigator.clipboard);
62032
62042
  }
62033
62043
  var WebClipboardWrapper = class {
62044
+ clipboard;
62034
62045
  constructor(clipboard) {
62035
62046
  this.clipboard = clipboard;
62036
62047
  }
@@ -62045,12 +62056,12 @@ var WebClipboardWrapper = class {
62045
62056
  */
62046
62057
  try {
62047
62058
  await this.clipboard?.write([new ClipboardItem({
62048
- [ClipboardMIMEType.PlainText]: this.getBlob(clipboardContent, ClipboardMIMEType.PlainText),
62049
- [ClipboardMIMEType.Html]: this.getBlob(clipboardContent, ClipboardMIMEType.Html)
62059
+ ["text/plain"]: this.getBlob(clipboardContent, "text/plain"),
62060
+ ["text/html"]: this.getBlob(clipboardContent, "text/html")
62050
62061
  })]);
62051
62062
  } catch (e) {}
62052
62063
  }
62053
- else await this.writeText(clipboardContent[ClipboardMIMEType.PlainText] ?? "");
62064
+ else await this.writeText(clipboardContent["text/plain"] ?? "");
62054
62065
  }
62055
62066
  async writeText(text) {
62056
62067
  try {
@@ -62075,13 +62086,13 @@ var WebClipboardWrapper = class {
62075
62086
  }
62076
62087
  else return {
62077
62088
  status: "ok",
62078
- content: { [ClipboardMIMEType.PlainText]: await this.clipboard?.readText() }
62089
+ content: { ["text/plain"]: await this.clipboard?.readText() }
62079
62090
  };
62080
62091
  }
62081
62092
  getClipboardItems(content) {
62082
62093
  const clipboardItemData = {
62083
- [ClipboardMIMEType.PlainText]: this.getBlob(content, ClipboardMIMEType.PlainText),
62084
- [ClipboardMIMEType.Html]: this.getBlob(content, ClipboardMIMEType.Html)
62094
+ ["text/plain"]: this.getBlob(content, "text/plain"),
62095
+ ["text/html"]: this.getBlob(content, "text/html")
62085
62096
  };
62086
62097
  return [new ClipboardItem(clipboardItemData)];
62087
62098
  }
@@ -62539,6 +62550,8 @@ function inverseCommand(cmd) {
62539
62550
  * @param operations initial operations
62540
62551
  */
62541
62552
  var Branch = class Branch {
62553
+ buildTransformation;
62554
+ operations;
62542
62555
  constructor(buildTransformation, operations = []) {
62543
62556
  this.buildTransformation = buildTransformation;
62544
62557
  this.operations = operations;
@@ -62655,6 +62668,8 @@ var Branch = class Branch {
62655
62668
  * to revert it).
62656
62669
  */
62657
62670
  var Operation = class {
62671
+ id;
62672
+ data;
62658
62673
  constructor(id, data) {
62659
62674
  this.id = id;
62660
62675
  this.data = data;
@@ -62664,6 +62679,8 @@ var Operation = class {
62664
62679
  }
62665
62680
  };
62666
62681
  var LazyOperation = class LazyOperation {
62682
+ id;
62683
+ lazyData;
62667
62684
  constructor(id, lazyData) {
62668
62685
  this.id = id;
62669
62686
  this.lazyData = lazyData;
@@ -62689,6 +62706,7 @@ var LazyOperation = class LazyOperation {
62689
62706
  * ```
62690
62707
  */
62691
62708
  var OperationSequence = class OperationSequence {
62709
+ operations;
62692
62710
  constructor(operations) {
62693
62711
  this.operations = operations;
62694
62712
  }
@@ -62764,6 +62782,7 @@ var OperationSequence = class OperationSequence {
62764
62782
  *
62765
62783
  */
62766
62784
  var Tree = class {
62785
+ buildTransformation;
62767
62786
  branches;
62768
62787
  branchingOperationIds = /* @__PURE__ */ new Map();
62769
62788
  constructor(buildTransformation, initialBranch) {
@@ -63346,6 +63365,7 @@ var EventStream = class {
63346
63365
  * with the new selected anchor
63347
63366
  */
63348
63367
  var SelectionStreamProcessorImpl = class {
63368
+ getters;
63349
63369
  stream;
63350
63370
  /**
63351
63371
  * "Active" anchor used as a reference to compute new anchors
@@ -63444,7 +63464,7 @@ var SelectionStreamProcessorImpl = class {
63444
63464
  * Set the selection to one of the cells adjacent to the current anchor cell.
63445
63465
  */
63446
63466
  moveAnchorCell(direction, step = 1) {
63447
- if (step !== "end" && step <= 0) return new DispatchResult(CommandResult.InvalidSelectionStep);
63467
+ if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
63448
63468
  const { col, row } = this.getNextAvailablePosition(direction, step);
63449
63469
  return this.selectCell(col, row);
63450
63470
  }
@@ -63506,7 +63526,7 @@ var SelectionStreamProcessorImpl = class {
63506
63526
  * of the anchor zone which moves.
63507
63527
  */
63508
63528
  resizeAnchorZone(direction, step = 1) {
63509
- if (step !== "end" && step <= 0) return new DispatchResult(CommandResult.InvalidSelectionStep);
63529
+ if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
63510
63530
  const sheetId = this.getters.getActiveSheetId();
63511
63531
  const anchor = this.anchor;
63512
63532
  const { col: anchorCol, row: anchorRow } = anchor.cell;
@@ -63753,7 +63773,7 @@ var SelectionStreamProcessorImpl = class {
63753
63773
  previousAnchor: deepCopy(this.anchor)
63754
63774
  };
63755
63775
  const commandResult = this.checkEventAnchorZone(event);
63756
- if (commandResult !== CommandResult.Success) return new DispatchResult(commandResult);
63776
+ if (commandResult !== "Success") return new DispatchResult(commandResult);
63757
63777
  this.anchor = event.anchor;
63758
63778
  this.stream.send(event);
63759
63779
  return DispatchResult.Success;
@@ -63763,15 +63783,15 @@ var SelectionStreamProcessorImpl = class {
63763
63783
  }
63764
63784
  checkAnchorZone(anchor) {
63765
63785
  const { cell, zone } = anchor;
63766
- if (!isInside(cell.col, cell.row, zone)) return CommandResult.InvalidAnchorZone;
63786
+ if (!isInside(cell.col, cell.row, zone)) return "InvalidAnchorZone";
63767
63787
  const { left, right, top, bottom } = zone;
63768
63788
  const sheetId = this.getters.getActiveSheetId();
63769
63789
  const refCol = this.getters.findVisibleHeader(sheetId, "COL", left, right);
63770
- if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return CommandResult.SelectionOutOfBound;
63771
- return CommandResult.Success;
63790
+ if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return "SelectionOutOfBound";
63791
+ return "Success";
63772
63792
  }
63773
63793
  checkAnchorZoneOrThrow(anchor) {
63774
- if (this.checkAnchorZone(anchor) === CommandResult.InvalidAnchorZone) throw new Error(_t("The provided anchor is invalid. The cell must be part of the zone."));
63794
+ if (this.checkAnchorZone(anchor) === "InvalidAnchorZone") throw new Error(_t("The provided anchor is invalid. The cell must be part of the zone."));
63775
63795
  }
63776
63796
  /**
63777
63797
  * ---- PRIVATE ----
@@ -63928,7 +63948,7 @@ var SelectionStreamProcessorImpl = class {
63928
63948
  isCellSkippableInCluster(position) {
63929
63949
  const mainPosition = this.getters.getMainCellPosition(position);
63930
63950
  const cell = this.getters.getEvaluatedCell(mainPosition);
63931
- return cell.type === CellValueType.empty || cell.type === CellValueType.text && cell.value === "";
63951
+ return cell.type === "empty" || cell.type === "text" && cell.value === "";
63932
63952
  }
63933
63953
  };
63934
63954
 
@@ -65851,13 +65871,6 @@ function purgeSingleRowTables(data) {
65851
65871
 
65852
65872
  //#endregion
65853
65873
  //#region src/model.ts
65854
- var Status = /* @__PURE__ */ function(Status) {
65855
- Status[Status["Ready"] = 0] = "Ready";
65856
- Status[Status["Running"] = 1] = "Running";
65857
- Status[Status["RunningCore"] = 2] = "RunningCore";
65858
- Status[Status["Finalizing"] = 3] = "Finalizing";
65859
- return Status;
65860
- }(Status || {});
65861
65874
  var Model = class extends EventBus {
65862
65875
  corePlugins = [];
65863
65876
  featurePlugins = [];
@@ -65881,7 +65894,7 @@ var Model = class extends EventBus {
65881
65894
  /**
65882
65895
  * Internal status of the model. Important for command handling coordination
65883
65896
  */
65884
- status = Status.Ready;
65897
+ status = 0;
65885
65898
  /**
65886
65899
  * The config object contains some configuration flag and callbacks
65887
65900
  */
@@ -66018,7 +66031,7 @@ var Model = class extends EventBus {
66018
66031
  onRemoteRevisionReceived({ commands }) {
66019
66032
  for (const command of commands) {
66020
66033
  const previousStatus = this.status;
66021
- this.status = Status.RunningCore;
66034
+ this.status = 2;
66022
66035
  this.dispatchToHandlers(this.statefulUIPlugins, command);
66023
66036
  this.status = previousStatus;
66024
66037
  }
@@ -66116,7 +66129,7 @@ var Model = class extends EventBus {
66116
66129
  */
66117
66130
  checkDispatchAllowed(command) {
66118
66131
  const results = isCoreCommand(command) ? this.checkDispatchAllowedCoreCommand(command) : this.checkDispatchAllowedLocalCommand(command);
66119
- if (results.some((r) => r !== CommandResult.Success)) return new DispatchResult(results.flat());
66132
+ if (results.some((r) => r !== "Success")) return new DispatchResult(results.flat());
66120
66133
  return DispatchResult.Success;
66121
66134
  }
66122
66135
  checkDispatchAllowedCoreCommand(command) {
@@ -66128,9 +66141,9 @@ var Model = class extends EventBus {
66128
66141
  return this.uiHandlers.map((handler) => handler.allowDispatch(command));
66129
66142
  }
66130
66143
  finalize() {
66131
- this.status = Status.Finalizing;
66144
+ this.status = 3;
66132
66145
  for (const h of this.handlers) h.finalize();
66133
- this.status = Status.Ready;
66146
+ this.status = 0;
66134
66147
  this.trigger("command-finalized");
66135
66148
  }
66136
66149
  /**
@@ -66157,16 +66170,16 @@ var Model = class extends EventBus {
66157
66170
  dispatch = (type, payload) => {
66158
66171
  const command = createCommand(type, payload);
66159
66172
  const status = this.status;
66160
- if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult(CommandResult.Readonly);
66161
- if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult(CommandResult.WaitingSessionConfirmation);
66173
+ if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult("Readonly");
66174
+ if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult("WaitingSessionConfirmation");
66162
66175
  switch (status) {
66163
- case Status.Ready:
66176
+ case 0:
66164
66177
  const result = this.checkDispatchAllowed(command);
66165
66178
  if (!result.isSuccessful) {
66166
66179
  this.trigger("update");
66167
66180
  return result;
66168
66181
  }
66169
- this.status = Status.Running;
66182
+ this.status = 1;
66170
66183
  const { changes, commands } = this.state.recordChanges(() => {
66171
66184
  const start = performance.now();
66172
66185
  if (isCoreCommand(command)) this.state.addCommand(command);
@@ -66176,10 +66189,10 @@ var Model = class extends EventBus {
66176
66189
  if (time > 5) console.debug(type, time, "ms");
66177
66190
  });
66178
66191
  this.session.save(command, commands, changes);
66179
- this.status = Status.Ready;
66192
+ this.status = 0;
66180
66193
  this.trigger("update");
66181
66194
  break;
66182
- case Status.Running:
66195
+ case 1:
66183
66196
  if (isCoreCommand(command)) {
66184
66197
  const dispatchResult = this.checkDispatchAllowed(command);
66185
66198
  if (!dispatchResult.isSuccessful) return dispatchResult;
@@ -66187,8 +66200,8 @@ var Model = class extends EventBus {
66187
66200
  }
66188
66201
  this.dispatchToHandlers(this.handlers, command);
66189
66202
  break;
66190
- case Status.Finalizing: throw new Error("Cannot dispatch commands in the finalize state");
66191
- case Status.RunningCore:
66203
+ case 3: throw new Error("Cannot dispatch commands in the finalize state");
66204
+ case 2:
66192
66205
  if (isCoreCommand(command)) throw new Error(`A UI plugin cannot dispatch ${type} while handling a core command`);
66193
66206
  this.dispatchToHandlers(this.handlers, command);
66194
66207
  }
@@ -66201,7 +66214,7 @@ var Model = class extends EventBus {
66201
66214
  dispatchFromCorePlugin = (type, payload) => {
66202
66215
  const command = createCommand(type, payload);
66203
66216
  const previousStatus = this.status;
66204
- this.status = Status.RunningCore;
66217
+ this.status = 2;
66205
66218
  const handlers = this.isReplayingCommand ? this.coreHandlers : this.handlers;
66206
66219
  this.dispatchToHandlers(handlers, command);
66207
66220
  this.status = previousStatus;
@@ -66545,6 +66558,6 @@ exports.stores = stores;
66545
66558
  exports.tokenColors = tokenColors;
66546
66559
  exports.tokenize = tokenize;
66547
66560
 
66548
- __info__.version = "18.0.68";
66549
- __info__.date = "2026-05-12T12:16:54.199Z";
66550
- __info__.hash = "a0763ab";
66561
+ __info__.version = "18.0.70";
66562
+ __info__.date = "2026-06-06T06:20:39.985Z";
66563
+ __info__.hash = "3ff29f6";