@odoo/o-spreadsheet 19.3.2 → 19.3.4

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 19.3.2
6
- * @date 2026-05-11T13:52:24.823Z
7
- * @hash 14395f7
5
+ * @version 19.3.4
6
+ * @date 2026-05-15T07:07:34.417Z
7
+ * @hash 1dc7b42
8
8
  */
9
9
 
10
10
  (function(exports, _odoo_owl) {
@@ -17,7 +17,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
17
17
  var __getOwnPropNames = Object.getOwnPropertyNames;
18
18
  var __getProtoOf = Object.getPrototypeOf;
19
19
  var __hasOwnProp = Object.prototype.hasOwnProperty;
20
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
20
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
21
21
  var __exportAll = (all, no_symbols) => {
22
22
  let target = {};
23
23
  for (var name in all) {
@@ -463,13 +463,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
463
463
  function isMatrix(x) {
464
464
  return Array.isArray(x) && Array.isArray(x[0]);
465
465
  }
466
- let DIRECTION = /* @__PURE__ */ function(DIRECTION) {
467
- DIRECTION["UP"] = "up";
468
- DIRECTION["DOWN"] = "down";
469
- DIRECTION["LEFT"] = "left";
470
- DIRECTION["RIGHT"] = "right";
471
- return DIRECTION;
472
- }({});
473
466
 
474
467
  //#endregion
475
468
  //#region src/helpers/misc.ts
@@ -926,7 +919,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
926
919
  }
927
920
  shift() {
928
921
  const current = this.current;
929
- this.current = this.text[++this.currentIndex];
922
+ const next = this.text[++this.currentIndex];
923
+ this.current = next;
930
924
  return current;
931
925
  }
932
926
  advanceBy(length) {
@@ -2114,6 +2108,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2114
2108
  }
2115
2109
  };
2116
2110
  var StoreFactory = class {
2111
+ get;
2117
2112
  pendingBuilds = /* @__PURE__ */ new Set();
2118
2113
  constructor(get) {
2119
2114
  this.get = get;
@@ -2158,6 +2153,7 @@ stores.inject(MyMetaStore, storeInstance);
2158
2153
  return MetaStore;
2159
2154
  }
2160
2155
  var DisposableStore = class {
2156
+ get;
2161
2157
  disposeCallbacks = [];
2162
2158
  constructor(get) {
2163
2159
  this.get = get;
@@ -2261,6 +2257,7 @@ stores.inject(MyMetaStore, storeInstance);
2261
2257
  //#endregion
2262
2258
  //#region src/stores/renderer_store.ts
2263
2259
  var RendererStore = class {
2260
+ layers;
2264
2261
  mutators = [
2265
2262
  "register",
2266
2263
  "unRegister",
@@ -2915,6 +2912,7 @@ stores.inject(MyMetaStore, storeInstance);
2915
2912
  else return ALTERNATING_COLORS_XL;
2916
2913
  }
2917
2914
  var ColorGenerator = class {
2915
+ preferredColors;
2918
2916
  currentColorIndex = 0;
2919
2917
  palette;
2920
2918
  constructor(paletteSize, preferredColors = []) {
@@ -3311,6 +3309,7 @@ stores.inject(MyMetaStore, storeInstance);
3311
3309
  return sprintf(_translate(s), ...values);
3312
3310
  };
3313
3311
  var LazyTranslatedString = class extends String {
3312
+ values;
3314
3313
  constructor(str, values) {
3315
3314
  super(str);
3316
3315
  this.values = values;
@@ -3340,6 +3339,8 @@ stores.inject(MyMetaStore, storeInstance);
3340
3339
  };
3341
3340
  const errorTypes = new Set(Object.values(CellErrorType));
3342
3341
  var EvaluationError = class {
3342
+ message;
3343
+ value;
3343
3344
  constructor(message = _t("Error"), value = CellErrorType.GenericError) {
3344
3345
  this.message = message;
3345
3346
  this.value = value;
@@ -3372,6 +3373,7 @@ stores.inject(MyMetaStore, storeInstance);
3372
3373
  }
3373
3374
  };
3374
3375
  var SplillBlockedError = class extends EvaluationError {
3376
+ errorOriginPosition;
3375
3377
  constructor(message = _t("Spill range is not empty"), errorOriginPosition) {
3376
3378
  super(message, CellErrorType.SpilledBlocked);
3377
3379
  this.errorOriginPosition = errorOriginPosition;
@@ -5054,46 +5056,6 @@ stores.inject(MyMetaStore, storeInstance);
5054
5056
 
5055
5057
  //#endregion
5056
5058
  //#region src/formulas/range_tokenizer.ts
5057
- var State = /* @__PURE__ */ function(State) {
5058
- /**
5059
- * Initial state.
5060
- * Expecting any reference for the left part of a range
5061
- * e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
5062
- */
5063
- State[State["LeftRef"] = 0] = "LeftRef";
5064
- /**
5065
- * Expecting any reference for the right part of a range
5066
- * e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
5067
- */
5068
- State[State["RightRef"] = 1] = "RightRef";
5069
- /**
5070
- * Expecting the separator without any constraint on the right part
5071
- */
5072
- State[State["Separator"] = 2] = "Separator";
5073
- /**
5074
- * Expecting the separator for a full column range
5075
- */
5076
- State[State["FullColumnSeparator"] = 3] = "FullColumnSeparator";
5077
- /**
5078
- * Expecting the separator for a full row range
5079
- */
5080
- State[State["FullRowSeparator"] = 4] = "FullRowSeparator";
5081
- /**
5082
- * Expecting the right part of a full column range
5083
- * e.g. "1", "A1"
5084
- */
5085
- State[State["RightColumnRef"] = 5] = "RightColumnRef";
5086
- /**
5087
- * Expecting the right part of a full row range
5088
- * e.g. "A", "A1"
5089
- */
5090
- State[State["RightRowRef"] = 6] = "RightRowRef";
5091
- /**
5092
- * Final state. A range has been matched
5093
- */
5094
- State[State["Found"] = 7] = "Found";
5095
- return State;
5096
- }(State || {});
5097
5059
  const goTo = (state, guard = () => true) => [{
5098
5060
  goTo: state,
5099
5061
  guard
@@ -5103,41 +5065,41 @@ stores.inject(MyMetaStore, storeInstance);
5103
5065
  guard
5104
5066
  });
5105
5067
  const machine = {
5106
- [State.LeftRef]: {
5107
- REFERENCE: goTo(State.Separator),
5108
- NUMBER: goTo(State.FullRowSeparator),
5109
- SYMBOL: [goToMulti(State.FullColumnSeparator, (token) => isColReference(token.value)), goToMulti(State.FullRowSeparator, (token) => isRowReference(token.value))]
5110
- },
5111
- [State.FullColumnSeparator]: {
5112
- SPACE: goTo(State.FullColumnSeparator),
5113
- OPERATOR: goTo(State.RightColumnRef, (token) => token.value === ":")
5114
- },
5115
- [State.FullRowSeparator]: {
5116
- SPACE: goTo(State.FullRowSeparator),
5117
- OPERATOR: goTo(State.RightRowRef, (token) => token.value === ":")
5118
- },
5119
- [State.Separator]: {
5120
- SPACE: goTo(State.Separator),
5121
- OPERATOR: goTo(State.RightRef, (token) => token.value === ":")
5122
- },
5123
- [State.RightRef]: {
5124
- SPACE: goTo(State.RightRef),
5125
- NUMBER: goTo(State.Found),
5126
- REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value)),
5127
- SYMBOL: goTo(State.Found, (token) => isColHeader(token.value) || isRowHeader(token.value))
5128
- },
5129
- [State.RightColumnRef]: {
5130
- SPACE: goTo(State.RightColumnRef),
5131
- SYMBOL: goTo(State.Found, (token) => isColHeader(token.value)),
5132
- REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value))
5133
- },
5134
- [State.RightRowRef]: {
5135
- SPACE: goTo(State.RightRowRef),
5136
- NUMBER: goTo(State.Found),
5137
- REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value)),
5138
- SYMBOL: goTo(State.Found, (token) => isRowHeader(token.value))
5139
- },
5140
- [State.Found]: {}
5068
+ [0]: {
5069
+ REFERENCE: goTo(2),
5070
+ NUMBER: goTo(4),
5071
+ SYMBOL: [goToMulti(3, (token) => isColReference(token.value)), goToMulti(4, (token) => isRowReference(token.value))]
5072
+ },
5073
+ [3]: {
5074
+ SPACE: goTo(3),
5075
+ OPERATOR: goTo(5, (token) => token.value === ":")
5076
+ },
5077
+ [4]: {
5078
+ SPACE: goTo(4),
5079
+ OPERATOR: goTo(6, (token) => token.value === ":")
5080
+ },
5081
+ [2]: {
5082
+ SPACE: goTo(2),
5083
+ OPERATOR: goTo(1, (token) => token.value === ":")
5084
+ },
5085
+ [1]: {
5086
+ SPACE: goTo(1),
5087
+ NUMBER: goTo(7),
5088
+ REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
5089
+ SYMBOL: goTo(7, (token) => isColHeader(token.value) || isRowHeader(token.value))
5090
+ },
5091
+ [5]: {
5092
+ SPACE: goTo(5),
5093
+ SYMBOL: goTo(7, (token) => isColHeader(token.value)),
5094
+ REFERENCE: goTo(7, (token) => isSingleCellReference(token.value))
5095
+ },
5096
+ [6]: {
5097
+ SPACE: goTo(6),
5098
+ NUMBER: goTo(7),
5099
+ REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
5100
+ SYMBOL: goTo(7, (token) => isRowHeader(token.value))
5101
+ },
5102
+ [7]: {}
5141
5103
  };
5142
5104
  /**
5143
5105
  * Check if the list of tokens starts with a sequence of tokens representing
@@ -5147,7 +5109,7 @@ stores.inject(MyMetaStore, storeInstance);
5147
5109
  */
5148
5110
  function matchReference(tokens) {
5149
5111
  let head = 0;
5150
- let transitions = machine[State.LeftRef];
5112
+ let transitions = machine[0];
5151
5113
  let matchedTokens = "";
5152
5114
  while (transitions !== void 0) {
5153
5115
  const token = tokens[head++];
@@ -5156,7 +5118,7 @@ stores.inject(MyMetaStore, storeInstance);
5156
5118
  const nextState = transition ? transition.goTo : void 0;
5157
5119
  switch (nextState) {
5158
5120
  case void 0: return null;
5159
- case State.Found:
5121
+ case 7:
5160
5122
  matchedTokens += token.value;
5161
5123
  tokens.splice(0, head);
5162
5124
  return {
@@ -6103,6 +6065,7 @@ stores.inject(MyMetaStore, storeInstance);
6103
6065
  //#endregion
6104
6066
  //#region src/formulas/code_builder.ts
6105
6067
  var FunctionCodeBuilder = class {
6068
+ scope;
6106
6069
  code = "";
6107
6070
  constructor(scope = new Scope()) {
6108
6071
  this.scope = scope;
@@ -6118,6 +6081,8 @@ stores.inject(MyMetaStore, storeInstance);
6118
6081
  }
6119
6082
  };
6120
6083
  var FunctionCodeImpl = class {
6084
+ scope;
6085
+ returnExpression;
6121
6086
  code;
6122
6087
  constructor(scope, code, returnExpression) {
6123
6088
  this.scope = scope;
@@ -6200,6 +6165,13 @@ stores.inject(MyMetaStore, storeInstance);
6200
6165
  * without recompiling it (for example when the formula is copied to another cell, or when we want to replace literal values but keep the same structure).
6201
6166
  * */
6202
6167
  var CompiledFormula = class CompiledFormula {
6168
+ sheetId;
6169
+ tokens;
6170
+ literalValues;
6171
+ symbols;
6172
+ isBadExpression;
6173
+ normalizedFormula;
6174
+ execute;
6203
6175
  rangeDependencies;
6204
6176
  hasDependencies;
6205
6177
  constructor(sheetId, tokens, literalValues, symbols, dependencies, isBadExpression, normalizedFormula, execute) {
@@ -7805,7 +7777,7 @@ stores.inject(MyMetaStore, storeInstance);
7805
7777
  constructor(results = []) {
7806
7778
  if (!Array.isArray(results)) results = [results];
7807
7779
  results = [...new Set(results)];
7808
- this.reasons = results.filter((result) => result !== CommandResult.Success);
7780
+ this.reasons = results.filter((result) => result !== "Success");
7809
7781
  }
7810
7782
  /**
7811
7783
  * Static helper which returns a successful DispatchResult
@@ -8003,7 +7975,7 @@ stores.inject(MyMetaStore, storeInstance);
8003
7975
  if (env.model.dispatch("ACTIVATE_SHEET", {
8004
7976
  sheetIdFrom: env.model.getters.getActiveSheetId(),
8005
7977
  sheetIdTo: sheetId
8006
- }).isCancelledBecause(CommandResult.SheetIsHidden)) env.notifyUser({
7978
+ }).isCancelledBecause("SheetIsHidden")) env.notifyUser({
8007
7979
  type: "warning",
8008
7980
  sticky: false,
8009
7981
  text: _t("Cannot open the link because the linked sheet is hidden.")
@@ -8137,22 +8109,22 @@ stores.inject(MyMetaStore, storeInstance);
8137
8109
  return textCell(value, format, formattedValue, position);
8138
8110
  }
8139
8111
  function isNumberResult(result) {
8140
- return !!result && getEvaluatedCellType(result) === CellValueType.number;
8112
+ return !!result && getEvaluatedCellType(result) === "number";
8141
8113
  }
8142
8114
  function isTextResult(result) {
8143
- return !!result && getEvaluatedCellType(result) === CellValueType.text;
8115
+ return !!result && getEvaluatedCellType(result) === "text";
8144
8116
  }
8145
8117
  function isErrorResult(result) {
8146
- return !!result && getEvaluatedCellType(result) === CellValueType.error;
8118
+ return !!result && getEvaluatedCellType(result) === "error";
8147
8119
  }
8148
8120
  function getEvaluatedCellType({ value, format }) {
8149
- if (value === null) return CellValueType.empty;
8150
- else if (isEvaluationError(value)) return CellValueType.error;
8151
- else if (isTextFormat(format)) return CellValueType.text;
8121
+ if (value === null) return "empty";
8122
+ else if (isEvaluationError(value)) return "error";
8123
+ else if (isTextFormat(format)) return "text";
8152
8124
  switch (typeof value) {
8153
- case "number": return CellValueType.number;
8154
- case "boolean": return CellValueType.boolean;
8155
- case "string": return CellValueType.text;
8125
+ case "number": return "number";
8126
+ case "boolean": return "boolean";
8127
+ case "string": return "text";
8156
8128
  }
8157
8129
  }
8158
8130
  function textCell(value, format, formattedValue, position) {
@@ -8161,7 +8133,7 @@ stores.inject(MyMetaStore, storeInstance);
8161
8133
  format,
8162
8134
  formattedValue,
8163
8135
  position,
8164
- type: CellValueType.text,
8136
+ type: "text",
8165
8137
  isAutoSummable: true,
8166
8138
  defaultAlign: "left"
8167
8139
  };
@@ -8172,7 +8144,7 @@ stores.inject(MyMetaStore, storeInstance);
8172
8144
  format,
8173
8145
  formattedValue,
8174
8146
  position,
8175
- type: CellValueType.number,
8147
+ type: "number",
8176
8148
  isAutoSummable: true,
8177
8149
  defaultAlign: "right"
8178
8150
  };
@@ -8182,7 +8154,7 @@ stores.inject(MyMetaStore, storeInstance);
8182
8154
  value: null,
8183
8155
  format,
8184
8156
  formattedValue: "",
8185
- type: CellValueType.empty,
8157
+ type: "empty",
8186
8158
  isAutoSummable: true,
8187
8159
  defaultAlign: "left"
8188
8160
  };
@@ -8193,7 +8165,7 @@ stores.inject(MyMetaStore, storeInstance);
8193
8165
  format,
8194
8166
  formattedValue,
8195
8167
  position,
8196
- type: CellValueType.number,
8168
+ type: "number",
8197
8169
  isAutoSummable: false,
8198
8170
  defaultAlign: "right"
8199
8171
  };
@@ -8204,7 +8176,7 @@ stores.inject(MyMetaStore, storeInstance);
8204
8176
  format,
8205
8177
  formattedValue,
8206
8178
  position,
8207
- type: CellValueType.boolean,
8179
+ type: "boolean",
8208
8180
  isAutoSummable: false,
8209
8181
  defaultAlign: "center"
8210
8182
  };
@@ -8215,7 +8187,7 @@ stores.inject(MyMetaStore, storeInstance);
8215
8187
  formattedValue: value,
8216
8188
  message,
8217
8189
  position,
8218
- type: CellValueType.error,
8190
+ type: "error",
8219
8191
  isAutoSummable: false,
8220
8192
  defaultAlign: "center",
8221
8193
  errorOriginPosition
@@ -9458,15 +9430,15 @@ stores.inject(MyMetaStore, storeInstance);
9458
9430
  return relativeLuminance(backgroundColor) < .3 ? "#C8C8C8" : "#666666";
9459
9431
  }
9460
9432
  function checkDataset(dataSource) {
9461
- if (dataSource.dataSets.find((range) => !rangeReference.test(range.dataRange)) !== void 0) return CommandResult.InvalidDataSet;
9462
- if (dataSource.dataSets.map((ds) => toUnboundedZone(ds.dataRange)).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return CommandResult.InvalidDataSet;
9463
- return CommandResult.Success;
9433
+ if (dataSource.dataSets.find((range) => !rangeReference.test(range.dataRange)) !== void 0) return "InvalidDataSet";
9434
+ if (dataSource.dataSets.map((ds) => toUnboundedZone(ds.dataRange)).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return "InvalidDataSet";
9435
+ return "Success";
9464
9436
  }
9465
9437
  function checkLabelRange(dataSource) {
9466
9438
  if (dataSource.labelRange) {
9467
- if (!rangeReference.test(dataSource.labelRange || "")) return CommandResult.InvalidLabelRange;
9439
+ if (!rangeReference.test(dataSource.labelRange || "")) return "InvalidLabelRange";
9468
9440
  }
9469
- return CommandResult.Success;
9441
+ return "Success";
9470
9442
  }
9471
9443
  function shouldRemoveFirstLabel(numberOfLabels, numberOfDataPoints, dataSetsHaveTitle) {
9472
9444
  return dataSetsHaveTitle && !!numberOfDataPoints && numberOfLabels >= numberOfDataPoints;
@@ -11131,7 +11103,7 @@ stores.inject(MyMetaStore, storeInstance);
11131
11103
  //#region src/helpers/figures/charts/scorecard_chart.ts
11132
11104
  function getBaselineText(baseline, keyValue, baselineMode, humanizeNumbers, locale) {
11133
11105
  if (!baseline) return "";
11134
- else if (baselineMode === "text" || keyValue?.type !== CellValueType.number || baseline.type !== CellValueType.number) {
11106
+ else if (baselineMode === "text" || keyValue?.type !== "number" || baseline.type !== "number") {
11135
11107
  if (humanizeNumbers) return humanizeNumber(baseline, locale);
11136
11108
  return baseline.formattedValue;
11137
11109
  }
@@ -11160,23 +11132,23 @@ stores.inject(MyMetaStore, storeInstance);
11160
11132
  return keyValueCell.formattedValue ?? String(keyValueCell.value ?? "");
11161
11133
  }
11162
11134
  function getBaselineColor(baseline, baselineMode, keyValue, colorUp, colorDown) {
11163
- if (baselineMode === "text" || baselineMode === "progress" || baseline?.type !== CellValueType.number || keyValue?.type !== CellValueType.number) return;
11135
+ if (baselineMode === "text" || baselineMode === "progress" || baseline?.type !== "number" || keyValue?.type !== "number") return;
11164
11136
  const diff = keyValue.value - baseline.value;
11165
11137
  if (diff > 0) return colorUp;
11166
11138
  else if (diff < 0) return colorDown;
11167
11139
  }
11168
11140
  function getBaselineArrowDirection(baseline, keyValue, baselineMode) {
11169
- if (baselineMode === "text" || baseline?.type !== CellValueType.number || keyValue?.type !== CellValueType.number) return "neutral";
11141
+ if (baselineMode === "text" || baseline?.type !== "number" || keyValue?.type !== "number") return "neutral";
11170
11142
  const diff = keyValue.value - baseline.value;
11171
11143
  if (diff > 0) return "up";
11172
11144
  else if (diff < 0) return "down";
11173
11145
  return "neutral";
11174
11146
  }
11175
11147
  function checkKeyValue(definition) {
11176
- return definition.keyValue && !rangeReference.test(definition.keyValue) ? CommandResult.InvalidScorecardKeyValue : CommandResult.Success;
11148
+ return definition.keyValue && !rangeReference.test(definition.keyValue) ? "InvalidScorecardKeyValue" : "Success";
11177
11149
  }
11178
11150
  function checkBaseline(definition) {
11179
- return definition.baseline && !rangeReference.test(definition.baseline) ? CommandResult.InvalidScorecardBaseline : CommandResult.Success;
11151
+ return definition.baseline && !rangeReference.test(definition.baseline) ? "InvalidScorecardBaseline" : "Success";
11180
11152
  }
11181
11153
  const Path2DConstructor = globalThis.Path2D;
11182
11154
  const arrowDownPath = Path2DConstructor && new Path2DConstructor("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");
@@ -11435,6 +11407,7 @@ stores.inject(MyMetaStore, storeInstance);
11435
11407
  }, runtime).computeDesign();
11436
11408
  }
11437
11409
  var ScorecardChartConfigBuilder = class {
11410
+ runtime;
11438
11411
  context;
11439
11412
  width;
11440
11413
  height;
@@ -12762,15 +12735,6 @@ stores.inject(MyMetaStore, storeInstance);
12762
12735
  };
12763
12736
  }
12764
12737
 
12765
- //#endregion
12766
- //#region src/types/clipboard.ts
12767
- let ClipboardMIMEType = /* @__PURE__ */ function(ClipboardMIMEType) {
12768
- ClipboardMIMEType["PlainText"] = "text/plain";
12769
- ClipboardMIMEType["Html"] = "text/html";
12770
- ClipboardMIMEType["Image"] = "image";
12771
- return ClipboardMIMEType;
12772
- }({});
12773
-
12774
12738
  //#endregion
12775
12739
  //#region src/types/conditional_formatting.ts
12776
12740
  const cfOperators = [
@@ -15078,7 +15042,7 @@ stores.inject(MyMetaStore, storeInstance);
15078
15042
  copyInSheetId: (definition) => definition,
15079
15043
  duplicateInDuplicatedSheet: (definition) => definition,
15080
15044
  transformDefinition: (definition) => definition,
15081
- validateDefinition: () => CommandResult.Success,
15045
+ validateDefinition: () => "Success",
15082
15046
  updateRanges: (definition) => definition,
15083
15047
  getContextCreation: (definition) => definition,
15084
15048
  getDefinitionFromContextCreation(context, dataSourceBuilder) {
@@ -15143,42 +15107,42 @@ stores.inject(MyMetaStore, storeInstance);
15143
15107
  //#endregion
15144
15108
  //#region src/helpers/figures/charts/gauge_chart.ts
15145
15109
  function isDataRangeValid(definition) {
15146
- return definition.dataRange && !rangeReference.test(definition.dataRange) ? CommandResult.InvalidGaugeDataRange : CommandResult.Success;
15110
+ return definition.dataRange && !rangeReference.test(definition.dataRange) ? "InvalidGaugeDataRange" : "Success";
15147
15111
  }
15148
15112
  function checkRangeLimits(check, batchValidations) {
15149
15113
  return batchValidations((definition) => {
15150
15114
  if (definition.sectionRule) return check(definition.sectionRule.rangeMin, "rangeMin");
15151
- return CommandResult.Success;
15115
+ return "Success";
15152
15116
  }, (definition) => {
15153
15117
  if (definition.sectionRule) return check(definition.sectionRule.rangeMax, "rangeMax");
15154
- return CommandResult.Success;
15118
+ return "Success";
15155
15119
  });
15156
15120
  }
15157
15121
  function checkInflectionPointsValue(check, batchValidations) {
15158
15122
  return batchValidations((definition) => {
15159
15123
  if (definition.sectionRule) return check(definition.sectionRule.lowerInflectionPoint.value, "lowerInflectionPointValue");
15160
- return CommandResult.Success;
15124
+ return "Success";
15161
15125
  }, (definition) => {
15162
15126
  if (definition.sectionRule) return check(definition.sectionRule.upperInflectionPoint.value, "upperInflectionPointValue");
15163
- return CommandResult.Success;
15127
+ return "Success";
15164
15128
  });
15165
15129
  }
15166
15130
  function checkEmpty(value, valueName) {
15167
15131
  if (value === "") switch (valueName) {
15168
- case "rangeMin": return CommandResult.EmptyGaugeRangeMin;
15169
- case "rangeMax": return CommandResult.EmptyGaugeRangeMax;
15132
+ case "rangeMin": return "EmptyGaugeRangeMin";
15133
+ case "rangeMax": return "EmptyGaugeRangeMax";
15170
15134
  }
15171
- return CommandResult.Success;
15135
+ return "Success";
15172
15136
  }
15173
15137
  function checkValueIsNumberOrFormula(value, valueName) {
15174
- if (value.startsWith("=")) return CommandResult.Success;
15138
+ if (value.startsWith("=")) return "Success";
15175
15139
  if (isNaN(value)) switch (valueName) {
15176
- case "rangeMin": return CommandResult.GaugeRangeMinNaN;
15177
- case "rangeMax": return CommandResult.GaugeRangeMaxNaN;
15178
- case "lowerInflectionPointValue": return CommandResult.GaugeLowerInflectionPointNaN;
15179
- case "upperInflectionPointValue": return CommandResult.GaugeUpperInflectionPointNaN;
15140
+ case "rangeMin": return "GaugeRangeMinNaN";
15141
+ case "rangeMax": return "GaugeRangeMaxNaN";
15142
+ case "lowerInflectionPointValue": return "GaugeLowerInflectionPointNaN";
15143
+ case "upperInflectionPointValue": return "GaugeUpperInflectionPointNaN";
15180
15144
  }
15181
- return CommandResult.Success;
15145
+ return "Success";
15182
15146
  }
15183
15147
  const GaugeChart = {
15184
15148
  sequence: 50,
@@ -15300,7 +15264,7 @@ stores.inject(MyMetaStore, storeInstance);
15300
15264
  col: dataRange.zone.left,
15301
15265
  row: dataRange.zone.top
15302
15266
  });
15303
- if (cell.type === CellValueType.number) {
15267
+ if (cell.type === "number") {
15304
15268
  gaugeValue = cell.value;
15305
15269
  formattedValue = cell.formattedValue;
15306
15270
  format = cell.format;
@@ -15434,7 +15398,7 @@ stores.inject(MyMetaStore, storeInstance);
15434
15398
  copyInSheetId: (definition) => definition,
15435
15399
  duplicateInDuplicatedSheet: (definition) => definition,
15436
15400
  transformDefinition: (definition) => definition,
15437
- validateDefinition: () => CommandResult.Success,
15401
+ validateDefinition: () => "Success",
15438
15402
  updateRanges: (definition) => definition,
15439
15403
  getContextCreation: (definition) => definition,
15440
15404
  getDefinitionFromContextCreation(context, dataSourceBuilder) {
@@ -15518,7 +15482,7 @@ stores.inject(MyMetaStore, storeInstance);
15518
15482
  copyInSheetId: (definition) => definition,
15519
15483
  duplicateInDuplicatedSheet: (definition) => definition,
15520
15484
  transformDefinition: (definition) => definition,
15521
- validateDefinition: () => CommandResult.Success,
15485
+ validateDefinition: () => "Success",
15522
15486
  updateRanges: (definition) => definition,
15523
15487
  getContextCreation: (definition) => definition,
15524
15488
  getDefinitionFromContextCreation(context, dataSourceBuilder) {
@@ -15597,7 +15561,7 @@ stores.inject(MyMetaStore, storeInstance);
15597
15561
  copyInSheetId: (definition) => definition,
15598
15562
  duplicateInDuplicatedSheet: (definition) => definition,
15599
15563
  transformDefinition: (definition) => definition,
15600
- validateDefinition: () => CommandResult.Success,
15564
+ validateDefinition: () => "Success",
15601
15565
  updateRanges: (definition) => definition,
15602
15566
  getContextCreation: (definition) => definition,
15603
15567
  getDefinitionFromContextCreation(context, dataSourceBuilder) {
@@ -16909,6 +16873,10 @@ stores.inject(MyMetaStore, storeInstance);
16909
16873
  * Animation interpolating values using the ease-out quartic curve function (chartJS default easing)
16910
16874
  */
16911
16875
  var Animation = class {
16876
+ startValue;
16877
+ endValue;
16878
+ duration;
16879
+ callback;
16912
16880
  startTime = void 0;
16913
16881
  animationFrameId = null;
16914
16882
  constructor(startValue, endValue, duration, callback) {
@@ -17137,6 +17105,10 @@ stores.inject(MyMetaStore, storeInstance);
17137
17105
  onKeyDown: {
17138
17106
  type: Function,
17139
17107
  optional: true
17108
+ },
17109
+ disableKeyboardNavigation: {
17110
+ type: Boolean,
17111
+ optional: true
17140
17112
  }
17141
17113
  };
17142
17114
  static components = {};
@@ -17144,7 +17116,7 @@ stores.inject(MyMetaStore, storeInstance);
17144
17116
  menuRef = (0, _odoo_owl.useRef)("menu");
17145
17117
  setup() {
17146
17118
  (0, _odoo_owl.useEffect)(() => {
17147
- if (this.props.hoveredMenuId && this.props.isHoveredMenuFocused && this.menuRef.el) {
17119
+ if (this.props.hoveredMenuId && this.props.isHoveredMenuFocused && this.menuRef.el && !this.props.disableKeyboardNavigation) {
17148
17120
  const selector = `[data-name='${this.props.hoveredMenuId}']`;
17149
17121
  this.menuRef.el.querySelector(selector)?.focus();
17150
17122
  }
@@ -17379,6 +17351,11 @@ stores.inject(MyMetaStore, storeInstance);
17379
17351
  }
17380
17352
  };
17381
17353
  var PopoverPositionContext = class {
17354
+ anchorRect;
17355
+ containerRect;
17356
+ propsMaxSize;
17357
+ spreadsheetOffset;
17358
+ lastPosition;
17382
17359
  constructor(anchorRect, containerRect, propsMaxSize, spreadsheetOffset, lastPosition) {
17383
17360
  this.anchorRect = anchorRect;
17384
17361
  this.containerRect = containerRect;
@@ -17573,7 +17550,8 @@ stores.inject(MyMetaStore, storeInstance);
17573
17550
  onScroll: this.onScroll.bind(this),
17574
17551
  onKeyDown: this.onKeydown.bind(this),
17575
17552
  hoveredMenuId,
17576
- isHoveredMenuFocused: !this.subMenu.isOpen
17553
+ isHoveredMenuFocused: !this.subMenu.isOpen,
17554
+ disableKeyboardNavigation: this.props.disableKeyboardNavigation
17577
17555
  };
17578
17556
  }
17579
17557
  get subMenuAnchorRect() {
@@ -18432,26 +18410,26 @@ stores.inject(MyMetaStore, storeInstance);
18432
18410
  //#region src/components/translations_terms.ts
18433
18411
  const CfTerms = {
18434
18412
  Errors: {
18435
- [CommandResult.InvalidRange]: _t("The range is invalid"),
18436
- [CommandResult.FirstArgMissing]: _t("The argument is missing. Please provide a value"),
18437
- [CommandResult.SecondArgMissing]: _t("The second argument is missing. Please provide a value"),
18438
- [CommandResult.MinNaN]: _t("The minpoint must be a number"),
18439
- [CommandResult.MidNaN]: _t("The midpoint must be a number"),
18440
- [CommandResult.MaxNaN]: _t("The maxpoint must be a number"),
18441
- [CommandResult.ValueUpperInflectionNaN]: _t("The first value must be a number"),
18442
- [CommandResult.ValueLowerInflectionNaN]: _t("The second value must be a number"),
18443
- [CommandResult.MinBiggerThanMax]: _t("Minimum must be smaller then Maximum"),
18444
- [CommandResult.MinBiggerThanMid]: _t("Minimum must be smaller then Midpoint"),
18445
- [CommandResult.MidBiggerThanMax]: _t("Midpoint must be smaller then Maximum"),
18446
- [CommandResult.LowerBiggerThanUpper]: _t("Lower inflection point must be smaller than upper inflection point"),
18447
- [CommandResult.MinInvalidFormula]: _t("Invalid Minpoint formula"),
18448
- [CommandResult.MaxInvalidFormula]: _t("Invalid Maxpoint formula"),
18449
- [CommandResult.MidInvalidFormula]: _t("Invalid Midpoint formula"),
18450
- [CommandResult.ValueUpperInvalidFormula]: _t("Invalid upper inflection point formula"),
18451
- [CommandResult.ValueLowerInvalidFormula]: _t("Invalid lower inflection point formula"),
18452
- [CommandResult.EmptyRange]: _t("A range needs to be defined"),
18453
- [CommandResult.EmptyTarget]: _t("Target must contain at least one zone"),
18454
- [CommandResult.ValueCellIsInvalidFormula]: _t("At least one of the provided values is an invalid formula"),
18413
+ ["InvalidRange"]: _t("The range is invalid"),
18414
+ ["FirstArgMissing"]: _t("The argument is missing. Please provide a value"),
18415
+ ["SecondArgMissing"]: _t("The second argument is missing. Please provide a value"),
18416
+ ["MinNaN"]: _t("The minpoint must be a number"),
18417
+ ["MidNaN"]: _t("The midpoint must be a number"),
18418
+ ["MaxNaN"]: _t("The maxpoint must be a number"),
18419
+ ["ValueUpperInflectionNaN"]: _t("The first value must be a number"),
18420
+ ["ValueLowerInflectionNaN"]: _t("The second value must be a number"),
18421
+ ["MinBiggerThanMax"]: _t("Minimum must be smaller then Maximum"),
18422
+ ["MinBiggerThanMid"]: _t("Minimum must be smaller then Midpoint"),
18423
+ ["MidBiggerThanMax"]: _t("Midpoint must be smaller then Maximum"),
18424
+ ["LowerBiggerThanUpper"]: _t("Lower inflection point must be smaller than upper inflection point"),
18425
+ ["MinInvalidFormula"]: _t("Invalid Minpoint formula"),
18426
+ ["MaxInvalidFormula"]: _t("Invalid Maxpoint formula"),
18427
+ ["MidInvalidFormula"]: _t("Invalid Midpoint formula"),
18428
+ ["ValueUpperInvalidFormula"]: _t("Invalid upper inflection point formula"),
18429
+ ["ValueLowerInvalidFormula"]: _t("Invalid lower inflection point formula"),
18430
+ ["EmptyRange"]: _t("A range needs to be defined"),
18431
+ ["EmptyTarget"]: _t("Target must contain at least one zone"),
18432
+ ["ValueCellIsInvalidFormula"]: _t("At least one of the provided values is an invalid formula"),
18455
18433
  Unexpected: _t("The rule is invalid for an unknown reason")
18456
18434
  },
18457
18435
  ColorScale: _t("Color scale"),
@@ -18470,17 +18448,17 @@ stores.inject(MyMetaStore, storeInstance);
18470
18448
  AggregatedChart: _t("Aggregate"),
18471
18449
  Errors: {
18472
18450
  Unexpected: _t("The chart definition is invalid for an unknown reason"),
18473
- [CommandResult.InvalidDataSet]: _t("The dataset is invalid"),
18474
- [CommandResult.InvalidLabelRange]: _t("Labels are invalid"),
18475
- [CommandResult.InvalidScorecardKeyValue]: _t("The key value is invalid"),
18476
- [CommandResult.InvalidScorecardBaseline]: _t("The baseline value is invalid"),
18477
- [CommandResult.InvalidGaugeDataRange]: _t("The data range is invalid"),
18478
- [CommandResult.EmptyGaugeRangeMin]: _t("A minimum range limit value is needed"),
18479
- [CommandResult.GaugeRangeMinNaN]: _t("The minimum range limit value must be a number"),
18480
- [CommandResult.EmptyGaugeRangeMax]: _t("A maximum range limit value is needed"),
18481
- [CommandResult.GaugeRangeMaxNaN]: _t("The maximum range limit value must be a number"),
18482
- [CommandResult.GaugeLowerInflectionPointNaN]: _t("The lower inflection point value must be a number"),
18483
- [CommandResult.GaugeUpperInflectionPointNaN]: _t("The upper inflection point value must be a number")
18451
+ ["InvalidDataSet"]: _t("The dataset is invalid"),
18452
+ ["InvalidLabelRange"]: _t("Labels are invalid"),
18453
+ ["InvalidScorecardKeyValue"]: _t("The key value is invalid"),
18454
+ ["InvalidScorecardBaseline"]: _t("The baseline value is invalid"),
18455
+ ["InvalidGaugeDataRange"]: _t("The data range is invalid"),
18456
+ ["EmptyGaugeRangeMin"]: _t("A minimum range limit value is needed"),
18457
+ ["GaugeRangeMinNaN"]: _t("The minimum range limit value must be a number"),
18458
+ ["EmptyGaugeRangeMax"]: _t("A maximum range limit value is needed"),
18459
+ ["GaugeRangeMaxNaN"]: _t("The maximum range limit value must be a number"),
18460
+ ["GaugeLowerInflectionPointNaN"]: _t("The lower inflection point value must be a number"),
18461
+ ["GaugeUpperInflectionPointNaN"]: _t("The upper inflection point value must be a number")
18484
18462
  },
18485
18463
  ColorScales: {
18486
18464
  blues: _t("Blues"),
@@ -18500,16 +18478,16 @@ stores.inject(MyMetaStore, storeInstance);
18500
18478
  const TableHeaderMoveErrorMessage = _t("The header row of a table can't be moved.");
18501
18479
  const SplitToColumnsTerms = { Errors: {
18502
18480
  Unexpected: _t("Cannot split the selection for an unknown reason"),
18503
- [CommandResult.NoSplitSeparatorInSelection]: _t("There is no match for the selected separator in the selection"),
18504
- [CommandResult.MoreThanOneColumnSelected]: _t("Only a selection from a single column can be split"),
18505
- [CommandResult.SplitWillOverwriteContent]: _t("Splitting will overwrite existing content")
18481
+ ["NoSplitSeparatorInSelection"]: _t("There is no match for the selected separator in the selection"),
18482
+ ["MoreThanOneColumnSelected"]: _t("Only a selection from a single column can be split"),
18483
+ ["SplitWillOverwriteContent"]: _t("Splitting will overwrite existing content")
18506
18484
  } };
18507
18485
  const RemoveDuplicateTerms = { Errors: {
18508
18486
  Unexpected: _t("Cannot remove duplicates for an unknown reason"),
18509
- [CommandResult.MoreThanOneRangeSelected]: _t("Please select only one range of cells"),
18510
- [CommandResult.EmptySelectedRange]: _t("Please select a range of cells containing values."),
18511
- [CommandResult.NoColumnsProvided]: _t("Please select at latest one column to analyze."),
18512
- [CommandResult.WillRemoveExistingMerge]: _t("This operation is not possible due to a merge. Please remove the merges first than try again.")
18487
+ ["MoreThanOneRangeSelected"]: _t("Please select only one range of cells"),
18488
+ ["EmptySelectedRange"]: _t("Please select a range of cells containing values."),
18489
+ ["NoColumnsProvided"]: _t("Please select at latest one column to analyze."),
18490
+ ["WillRemoveExistingMerge"]: _t("This operation is not possible due to a merge. Please remove the merges first than try again.")
18513
18491
  } };
18514
18492
  const DVTerms = {
18515
18493
  DateIs: {
@@ -18537,19 +18515,19 @@ stores.inject(MyMetaStore, storeInstance);
18537
18515
  positiveNumber: _t("The value must be a positive number")
18538
18516
  },
18539
18517
  Errors: {
18540
- [CommandResult.InvalidRange]: _t("The range is invalid."),
18541
- [CommandResult.InvalidDataValidationCriterionValue]: _t("One or more of the provided criteria values are invalid. Please review and correct them."),
18542
- [CommandResult.InvalidNumberOfCriterionValues]: _t("One or more of the provided criteria values are missing."),
18518
+ ["InvalidRange"]: _t("The range is invalid."),
18519
+ ["InvalidDataValidationCriterionValue"]: _t("One or more of the provided criteria values are invalid. Please review and correct them."),
18520
+ ["InvalidNumberOfCriterionValues"]: _t("One or more of the provided criteria values are missing."),
18543
18521
  Unexpected: _t("The rule is invalid for an unknown reason.")
18544
18522
  }
18545
18523
  };
18546
18524
  const TableTerms = {
18547
18525
  Errors: {
18548
18526
  Unexpected: _t("The table zone is invalid for an unknown reason"),
18549
- [CommandResult.TableOverlap]: _t("You cannot create overlapping tables."),
18550
- [CommandResult.NonContinuousTargets]: _t("A table can only be created on a continuous selection."),
18551
- [CommandResult.InvalidRange]: _t("The range is invalid"),
18552
- [CommandResult.TargetOutOfSheet]: _t("The range is out of the sheet")
18527
+ ["TableOverlap"]: _t("You cannot create overlapping tables."),
18528
+ ["NonContinuousTargets"]: _t("A table can only be created on a continuous selection."),
18529
+ ["InvalidRange"]: _t("The range is invalid"),
18530
+ ["TargetOutOfSheet"]: _t("The range is out of the sheet")
18553
18531
  },
18554
18532
  Checkboxes: {
18555
18533
  hasFilters: _t("Filter button"),
@@ -18873,6 +18851,7 @@ stores.inject(MyMetaStore, storeInstance);
18873
18851
  * Represent a raw XML string
18874
18852
  */
18875
18853
  var XMLString = class {
18854
+ xmlString;
18876
18855
  /**
18877
18856
  * @param xmlString should be a well formed, properly escaped XML string
18878
18857
  */
@@ -19223,30 +19202,6 @@ stores.inject(MyMetaStore, storeInstance);
19223
19202
 
19224
19203
  //#endregion
19225
19204
  //#region src/xlsx/helpers/xlsx_parser_error_manager.ts
19226
- /**
19227
- * Map of the different types of conversions warnings and their name in error messages
19228
- */
19229
- let WarningTypes = /* @__PURE__ */ function(WarningTypes) {
19230
- WarningTypes["DiagonalBorderNotSupported"] = "Diagonal Borders";
19231
- WarningTypes["BorderStyleNotSupported"] = "Border style";
19232
- WarningTypes["FillStyleNotSupported"] = "Fill Style";
19233
- WarningTypes["FontNotSupported"] = "Font";
19234
- WarningTypes["HorizontalAlignmentNotSupported"] = "Horizontal Alignment";
19235
- WarningTypes["VerticalAlignmentNotSupported"] = "Vertical Alignments";
19236
- WarningTypes["MultipleRulesCfNotSupported"] = "Multiple rules conditional formats";
19237
- WarningTypes["CfTypeNotSupported"] = "Conditional format type";
19238
- WarningTypes["CfFormatBorderNotSupported"] = "Borders in conditional formats";
19239
- WarningTypes["CfFormatAlignmentNotSupported"] = "Alignment in conditional formats";
19240
- WarningTypes["CfFormatNumFmtNotSupported"] = "Num formats in conditional formats";
19241
- WarningTypes["CfIconSetEmptyIconNotSupported"] = "IconSets with empty icons";
19242
- WarningTypes["BadlyFormattedHyperlink"] = "Badly formatted hyperlink";
19243
- WarningTypes["NumFmtIdNotSupported"] = "Number format";
19244
- WarningTypes["TimeDataValidationNotSupported"] = "Time data validation rules";
19245
- WarningTypes["TextLengthDataValidationNotSupported"] = "Text length data validation rules";
19246
- WarningTypes["WholeNumberDataValidationNotSupported"] = "Whole number data validation rules";
19247
- WarningTypes["NotEqualDateDataValidationNotSupported"] = "Not equal date data validation rules";
19248
- return WarningTypes;
19249
- }({});
19250
19205
  var XLSXImportWarningManager = class {
19251
19206
  _parsingWarnings = /* @__PURE__ */ new Set();
19252
19207
  _conversionWarnings = /* @__PURE__ */ new Set();
@@ -20006,7 +19961,7 @@ stores.inject(MyMetaStore, storeInstance);
20006
19961
  if (isXlsxDateFormat(convertedFormat)) convertedFormat = convertDateFormat$1(convertedFormat);
20007
19962
  if (isFormatSupported(convertedFormat)) return convertedFormat;
20008
19963
  } catch (e) {}
20009
- warningManager.generateNotSupportedWarning(WarningTypes.NumFmtIdNotSupported, format || `nmFmtId ${numFmtId}`);
19964
+ warningManager.generateNotSupportedWarning("Number format", format || `nmFmtId ${numFmtId}`);
20010
19965
  }
20011
19966
  function isFormatSupported(format) {
20012
19967
  try {
@@ -20091,20 +20046,20 @@ stores.inject(MyMetaStore, storeInstance);
20091
20046
  return arrayToObject(formats, 1);
20092
20047
  }
20093
20048
  function addStyleWarnings(font, fill, warningManager) {
20094
- if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning(WarningTypes.FontNotSupported, font.name, SUPPORTED_FONTS);
20095
- if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning(WarningTypes.FillStyleNotSupported, fill.patternType, SUPPORTED_FILL_PATTERNS);
20049
+ if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning("Font", font.name, SUPPORTED_FONTS);
20050
+ if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning("Fill Style", fill.patternType, SUPPORTED_FILL_PATTERNS);
20096
20051
  }
20097
20052
  function addBorderDescrWarnings(borderDescr, warningManager) {
20098
- if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning(WarningTypes.BorderStyleNotSupported, borderDescr.style, SUPPORTED_BORDER_STYLES);
20053
+ if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning("Border style", borderDescr.style, SUPPORTED_BORDER_STYLES);
20099
20054
  }
20100
20055
  function addBorderWarnings(border, warningManager) {
20101
- if (border.diagonal) warningManager.generateNotSupportedWarning(WarningTypes.DiagonalBorderNotSupported);
20056
+ if (border.diagonal) warningManager.generateNotSupportedWarning("Diagonal Borders");
20102
20057
  }
20103
20058
  function addHorizontalAlignmentWarnings(alignment, warningManager) {
20104
- if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(WarningTypes.HorizontalAlignmentNotSupported, alignment, SUPPORTED_HORIZONTAL_ALIGNMENTS);
20059
+ if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Horizontal Alignment", alignment, SUPPORTED_HORIZONTAL_ALIGNMENTS);
20105
20060
  }
20106
20061
  function addVerticalAlignmentWarnings(alignment, warningManager) {
20107
- if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(WarningTypes.VerticalAlignmentNotSupported, alignment, SUPPORTED_VERTICAL_ALIGNMENTS);
20062
+ if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Vertical Alignments", alignment, SUPPORTED_VERTICAL_ALIGNMENTS);
20108
20063
  }
20109
20064
 
20110
20065
  //#endregion
@@ -20273,7 +20228,7 @@ stores.inject(MyMetaStore, storeInstance);
20273
20228
  lower: icons.upper
20274
20229
  };
20275
20230
  for (const key of Object.keys(icons)) if (!icons[key]) {
20276
- warningManager.generateNotSupportedWarning(WarningTypes.CfIconSetEmptyIconNotSupported);
20231
+ warningManager.generateNotSupportedWarning("IconSets with empty icons");
20277
20232
  switch (key) {
20278
20233
  case "upper":
20279
20234
  icons[key] = ICON_SETS.dots.good;
@@ -20309,13 +20264,13 @@ stores.inject(MyMetaStore, storeInstance);
20309
20264
  return index === 0 ? ICON_SETS[iconSet].bad : index === 1 ? ICON_SETS[iconSet].neutral : ICON_SETS[iconSet].good;
20310
20265
  }
20311
20266
  function addCfConversionWarnings(cf, dxfs, warningManager) {
20312
- if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning(WarningTypes.MultipleRulesCfNotSupported);
20313
- if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning(WarningTypes.CfTypeNotSupported, cf.cfRules[0].type);
20267
+ if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning("Multiple rules conditional formats");
20268
+ if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning("Conditional format type", cf.cfRules[0].type);
20314
20269
  if (cf.cfRules[0].dxfId) {
20315
20270
  const dxf = dxfs[cf.cfRules[0].dxfId];
20316
- if (dxf.border) warningManager.generateNotSupportedWarning(WarningTypes.CfFormatBorderNotSupported);
20317
- if (dxf.alignment) warningManager.generateNotSupportedWarning(WarningTypes.CfFormatAlignmentNotSupported);
20318
- if (dxf.numFmt) warningManager.generateNotSupportedWarning(WarningTypes.CfFormatNumFmtNotSupported);
20271
+ if (dxf.border) warningManager.generateNotSupportedWarning("Borders in conditional formats");
20272
+ if (dxf.alignment) warningManager.generateNotSupportedWarning("Alignment in conditional formats");
20273
+ if (dxf.numFmt) warningManager.generateNotSupportedWarning("Num formats in conditional formats");
20319
20274
  }
20320
20275
  }
20321
20276
 
@@ -20481,13 +20436,13 @@ stores.inject(MyMetaStore, storeInstance);
20481
20436
  if (!dv) continue;
20482
20437
  switch (dv.type) {
20483
20438
  case "time":
20484
- warningManager.generateNotSupportedWarning(WarningTypes.TimeDataValidationNotSupported);
20439
+ warningManager.generateNotSupportedWarning("Time data validation rules");
20485
20440
  break;
20486
20441
  case "textLength":
20487
- warningManager.generateNotSupportedWarning(WarningTypes.TextLengthDataValidationNotSupported);
20442
+ warningManager.generateNotSupportedWarning("Text length data validation rules");
20488
20443
  break;
20489
20444
  case "whole":
20490
- warningManager.generateNotSupportedWarning(WarningTypes.WholeNumberDataValidationNotSupported);
20445
+ warningManager.generateNotSupportedWarning("Whole number data validation rules");
20491
20446
  break;
20492
20447
  case "decimal":
20493
20448
  const decimalRule = convertDecimalRule(dvId++, dv);
@@ -20499,7 +20454,7 @@ stores.inject(MyMetaStore, storeInstance);
20499
20454
  break;
20500
20455
  case "date":
20501
20456
  if (dv.operator === "notEqual") {
20502
- warningManager.generateNotSupportedWarning(WarningTypes.NotEqualDateDataValidationNotSupported);
20457
+ warningManager.generateNotSupportedWarning("Not equal date data validation rules");
20503
20458
  break;
20504
20459
  }
20505
20460
  const dateRule = convertDateRule(dvId++, dv);
@@ -20796,7 +20751,7 @@ stores.inject(MyMetaStore, storeInstance);
20796
20751
  }
20797
20752
  function convertHyperlink(link, cellValue, warningManager) {
20798
20753
  const label = link.display || cellValue;
20799
- if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning(WarningTypes.BadlyFormattedHyperlink);
20754
+ if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning("Badly formatted hyperlink");
20800
20755
  return markdownLink(label, link.relTarget ? link.relTarget : buildSheetLink(splitReference(link.location).sheetName));
20801
20756
  }
20802
20757
  function getSheetDims(sheet) {
@@ -24000,7 +23955,7 @@ stores.inject(MyMetaStore, storeInstance);
24000
23955
  //#endregion
24001
23956
  //#region src/helpers/ui/paste_interactive.ts
24002
23957
  const handleCopyPasteResult = (env, command) => {
24003
- if (env.model.dispatch(command.type).isCancelledBecause(CommandResult.WillRemoveExistingMerge)) env.raiseError(MergeErrorMessage);
23958
+ if (env.model.dispatch(command.type).isCancelledBecause("WillRemoveExistingMerge")) env.raiseError(MergeErrorMessage);
24004
23959
  };
24005
23960
  const PasteInteractiveContent = {
24006
23961
  wrongPasteSelection: _t("This operation is not allowed with multiple selections."),
@@ -24010,10 +23965,10 @@ stores.inject(MyMetaStore, storeInstance);
24010
23965
  };
24011
23966
  function handlePasteResult(env, result) {
24012
23967
  if (!result.isSuccessful) {
24013
- if (result.reasons.includes(CommandResult.WrongPasteSelection)) env.raiseError(PasteInteractiveContent.wrongPasteSelection);
24014
- else if (result.reasons.includes(CommandResult.WillRemoveExistingMerge)) env.raiseError(PasteInteractiveContent.willRemoveExistingMerge);
24015
- else if (result.reasons.includes(CommandResult.WrongFigurePasteOption)) env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
24016
- else if (result.reasons.includes(CommandResult.FrozenPaneOverlap)) env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
23968
+ if (result.reasons.includes("WrongPasteSelection")) env.raiseError(PasteInteractiveContent.wrongPasteSelection);
23969
+ else if (result.reasons.includes("WillRemoveExistingMerge")) env.raiseError(PasteInteractiveContent.willRemoveExistingMerge);
23970
+ else if (result.reasons.includes("WrongFigurePasteOption")) env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
23971
+ else if (result.reasons.includes("FrozenPaneOverlap")) env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
24017
23972
  }
24018
23973
  }
24019
23974
  function interactivePaste(env, target, pasteOption) {
@@ -24201,7 +24156,7 @@ stores.inject(MyMetaStore, storeInstance);
24201
24156
  };
24202
24157
  const ErrorToolTipPopoverBuilder = { onHover: (position, getters) => {
24203
24158
  const cell = getters.getEvaluatedCell(position);
24204
- if (cell.type === CellValueType.error && !!cell.message || getters.getInvalidDataValidationMessage(position)) return {
24159
+ if (cell.type === "error" && !!cell.message || getters.getInvalidDataValidationMessage(position)) return {
24205
24160
  isOpen: true,
24206
24161
  props: { cellPosition: position },
24207
24162
  Component: ErrorToolTip,
@@ -24250,7 +24205,7 @@ stores.inject(MyMetaStore, storeInstance);
24250
24205
  sortDirection,
24251
24206
  sortOptions
24252
24207
  });
24253
- if (result.isCancelledBecause(CommandResult.InvalidSortZone)) {
24208
+ if (result.isCancelledBecause("InvalidSortZone")) {
24254
24209
  const { col, row } = anchor;
24255
24210
  env.model.selection.selectZone({
24256
24211
  cell: {
@@ -24261,7 +24216,7 @@ stores.inject(MyMetaStore, storeInstance);
24261
24216
  });
24262
24217
  env.raiseError(_t("Cannot sort. To sort, select only cells or only merges that have the same size."));
24263
24218
  }
24264
- if (result.isCancelledBecause(CommandResult.SortZoneWithArrayFormulas)) {
24219
+ if (result.isCancelledBecause("SortZoneWithArrayFormulas")) {
24265
24220
  const { col, row } = anchor;
24266
24221
  env.model.selection.selectZone({
24267
24222
  cell: {
@@ -26912,6 +26867,7 @@ stores.inject(MyMetaStore, storeInstance);
26912
26867
  //#endregion
26913
26868
  //#region src/components/composer/standalone_composer/standalone_composer_store.ts
26914
26869
  var StandaloneComposerStore = class extends AbstractComposerStore {
26870
+ args;
26915
26871
  constructor(get, args) {
26916
26872
  super(get);
26917
26873
  this.args = args;
@@ -27815,6 +27771,7 @@ stores.inject(MyMetaStore, storeInstance);
27815
27771
  }
27816
27772
  };
27817
27773
  var ContainerWrapper = class {
27774
+ el;
27818
27775
  constructor(el) {
27819
27776
  this.el = el;
27820
27777
  }
@@ -27886,6 +27843,10 @@ stores.inject(MyMetaStore, storeInstance);
27886
27843
  * This plugin handles this internal state.
27887
27844
  */
27888
27845
  var SelectionInputStore = class extends SpreadsheetStore {
27846
+ initialRanges;
27847
+ inputHasSingleRange;
27848
+ colors;
27849
+ disabledRanges;
27889
27850
  mutators = [
27890
27851
  "resetWithRanges",
27891
27852
  "focusById",
@@ -29008,8 +28969,8 @@ stores.inject(MyMetaStore, storeInstance);
29008
28969
  row,
29009
28970
  col: position.col
29010
28971
  });
29011
- if (cell.type === CellValueType.text || cell.type === CellValueType.boolean) cellTypesCount.text++;
29012
- else if (cell.type === CellValueType.number) if (cell.format && isDateTimeFormat(cell.format)) cellTypesCount.date++;
28972
+ if (cell.type === "text" || cell.type === "boolean") cellTypesCount.text++;
28973
+ else if (cell.type === "number") if (cell.format && isDateTimeFormat(cell.format)) cellTypesCount.date++;
29013
28974
  else cellTypesCount.number++;
29014
28975
  }
29015
28976
  const max = Math.max(cellTypesCount.text, cellTypesCount.number, cellTypesCount.date);
@@ -29370,8 +29331,8 @@ stores.inject(MyMetaStore, storeInstance);
29370
29331
  }
29371
29332
  function parseOSClipboardContent(content) {
29372
29333
  let spreadsheetContent = void 0;
29373
- if (content[ClipboardMIMEType.Html]) spreadsheetContent = getOSheetDataFromHTML(new DOMParser().parseFromString(content[ClipboardMIMEType.Html], "text/html"));
29374
- const textContent = content[ClipboardMIMEType.PlainText] || "";
29334
+ if (content["text/html"]) spreadsheetContent = getOSheetDataFromHTML(new DOMParser().parseFromString(content["text/html"], "text/html"));
29335
+ const textContent = content["text/plain"] || "";
29375
29336
  let imageBlob = void 0;
29376
29337
  if (!textContent.trim()) {
29377
29338
  for (const type of AllowedImageMimeTypes) if (content[type]) {
@@ -29498,10 +29459,10 @@ stores.inject(MyMetaStore, storeInstance);
29498
29459
  let detectedType = "empty";
29499
29460
  for (const cell of cells) {
29500
29461
  let type = null;
29501
- if (cell.type === CellValueType.number) if (cell.format && isDateTimeFormat(cell.format)) type = "date";
29462
+ if (cell.type === "number") if (cell.format && isDateTimeFormat(cell.format)) type = "date";
29502
29463
  else if (cell.format?.includes("%")) type = "percentage";
29503
29464
  else type = "number";
29504
- else if (cell.type === CellValueType.text) type = "text";
29465
+ else if (cell.type === "text") type = "text";
29505
29466
  if (type) {
29506
29467
  const newCount = ++counts[type];
29507
29468
  if (newCount > max) {
@@ -29536,7 +29497,7 @@ stores.inject(MyMetaStore, storeInstance);
29536
29497
  col: column.zone.left,
29537
29498
  row: column.zone.top
29538
29499
  });
29539
- return ![CellValueType.number, CellValueType.empty].includes(titleCell.type);
29500
+ return !["number", "empty"].includes(titleCell.type);
29540
29501
  }
29541
29502
  /**
29542
29503
  * Builds a chart definition for a single column selection. The logic to detect the chart type is as follows:
@@ -29859,8 +29820,8 @@ stores.inject(MyMetaStore, storeInstance);
29859
29820
  config: tableConfig,
29860
29821
  tableType: isDynamic ? "dynamic" : "static"
29861
29822
  });
29862
- if (result.isCancelledBecause(CommandResult.TableOverlap)) env.raiseError(TableTerms.Errors.TableOverlap);
29863
- else if (result.isCancelledBecause(CommandResult.NonContinuousTargets)) env.raiseError(TableTerms.Errors.NonContinuousTargets);
29823
+ if (result.isCancelledBecause("TableOverlap")) env.raiseError(TableTerms.Errors.TableOverlap);
29824
+ else if (result.isCancelledBecause("NonContinuousTargets")) env.raiseError(TableTerms.Errors.NonContinuousTargets);
29864
29825
  return result;
29865
29826
  }
29866
29827
 
@@ -29888,9 +29849,9 @@ stores.inject(MyMetaStore, storeInstance);
29888
29849
  case "ok":
29889
29850
  const clipboardId = env.model.getters.getClipboardId();
29890
29851
  const target = env.model.getters.getSelectedZones();
29891
- if (clipboardId === getOSheetClipboardIdFromHTML(osClipboard.content[ClipboardMIMEType.Html])) interactivePaste(env, target, pasteOption);
29852
+ if (clipboardId === getOSheetClipboardIdFromHTML(osClipboard.content["text/html"])) interactivePaste(env, target, pasteOption);
29892
29853
  else await interactivePasteFromOS(env, target, parseOSClipboardContent(osClipboard.content), pasteOption);
29893
- if (env.model.getters.isCutOperation() && pasteOption !== "asValue") await env.clipboard.write({ [ClipboardMIMEType.PlainText]: "" });
29854
+ if (env.model.getters.isCutOperation() && pasteOption !== "asValue") await env.clipboard.write({ ["text/plain"]: "" });
29894
29855
  break;
29895
29856
  case "notImplemented":
29896
29857
  env.raiseError(_t("Pasting from the context menu is not supported in this browser. Use keyboard shortcuts ctrl+c / ctrl+v instead."));
@@ -32435,13 +32396,13 @@ stores.inject(MyMetaStore, storeInstance);
32435
32396
  if (this.props.dataSource.type === "range") this.datasetOrientation = this.computeDatasetOrientation();
32436
32397
  }
32437
32398
  get errorMessages() {
32438
- return [...this.state.datasetDispatchResult?.reasons || [], ...this.state.labelsDispatchResult?.reasons || []].filter((reason) => reason !== CommandResult.NoChanges).map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
32399
+ return [...this.state.datasetDispatchResult?.reasons || [], ...this.state.labelsDispatchResult?.reasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
32439
32400
  }
32440
32401
  get isDatasetInvalid() {
32441
- return !!this.state.datasetDispatchResult?.isCancelledBecause(CommandResult.InvalidDataSet);
32402
+ return !!this.state.datasetDispatchResult?.isCancelledBecause("InvalidDataSet");
32442
32403
  }
32443
32404
  get isLabelInvalid() {
32444
- return !!this.state.labelsDispatchResult?.isCancelledBecause(CommandResult.InvalidLabelRange);
32405
+ return !!this.state.labelsDispatchResult?.isCancelledBecause("InvalidLabelRange");
32445
32406
  }
32446
32407
  get dataSetsHaveTitleLabel() {
32447
32408
  return this.datasetOrientation === "rows" ? _t("Use col %(column_name)s as headers", { column_name: numberToLetters(this.calculateHeaderPosition() || 0) }) : _t("Use row %(row_position)s as headers", { row_position: this.calculateHeaderPosition() || "" });
@@ -32773,6 +32734,11 @@ stores.inject(MyMetaStore, storeInstance);
32773
32734
  //#endregion
32774
32735
  //#region src/helpers/figures/chart.ts
32775
32736
  var SpreadsheetChart = class SpreadsheetChart {
32737
+ getters;
32738
+ sheetId;
32739
+ definition;
32740
+ chartTypeBuilder;
32741
+ dataSourceBuilder;
32776
32742
  dataSource;
32777
32743
  constructor(getters, sheetId, definition, chartTypeBuilder, dataSourceBuilder) {
32778
32744
  this.getters = getters;
@@ -32810,9 +32776,6 @@ stores.inject(MyMetaStore, storeInstance);
32810
32776
  dataSource: newDataSource
32811
32777
  };
32812
32778
  }
32813
- getSupportedChartTypes() {
32814
- return new Set(this.dataSourceBuilder.supportedChartTypes);
32815
- }
32816
32779
  getRangeDefinition() {
32817
32780
  return {
32818
32781
  ...this.definition,
@@ -33011,6 +32974,10 @@ stores.inject(MyMetaStore, storeInstance);
33011
32974
  dataSetsHaveTitle: dataSource.dataSetsHaveTitle
33012
32975
  };
33013
32976
  },
32977
+ /**
32978
+ * Duplicate the dataSets. All ranges on sheetIdFrom are adapted to target
32979
+ * sheetIdTo.
32980
+ */
33014
32981
  duplicateInDuplicatedSheet(dataSource, sheetIdFrom, sheetIdTo, getters) {
33015
32982
  return {
33016
32983
  ...dataSource,
@@ -33164,7 +33131,7 @@ stores.inject(MyMetaStore, storeInstance);
33164
33131
  fromExternalDefinition: () => ({ type: "none" }),
33165
33132
  fromContextCreation: () => ({ type: "none" }),
33166
33133
  fromHierarchicalContextCreation: () => ({ type: "none" }),
33167
- validate: () => CommandResult.Success,
33134
+ validate: () => "Success",
33168
33135
  transform: () => ({ type: "none" }),
33169
33136
  extractData: () => ({
33170
33137
  dataSetsValues: [],
@@ -33499,10 +33466,10 @@ stores.inject(MyMetaStore, storeInstance);
33499
33466
  state = (0, _odoo_owl.useState)({ dataRangeDispatchResult: void 0 });
33500
33467
  dataRange = this.props.definition.dataRange;
33501
33468
  get configurationErrorMessages() {
33502
- return [...this.state.dataRangeDispatchResult?.reasons || []].filter((reason) => reason !== CommandResult.NoChanges).map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
33469
+ return [...this.state.dataRangeDispatchResult?.reasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
33503
33470
  }
33504
33471
  get isDataRangeInvalid() {
33505
- return !!this.state.dataRangeDispatchResult?.isCancelledBecause(CommandResult.InvalidGaugeDataRange);
33472
+ return !!this.state.dataRangeDispatchResult?.isCancelledBecause("InvalidGaugeDataRange");
33506
33473
  }
33507
33474
  onDataRangeChanged(ranges) {
33508
33475
  this.dataRange = ranges[0];
@@ -33539,19 +33506,19 @@ stores.inject(MyMetaStore, storeInstance);
33539
33506
  });
33540
33507
  }
33541
33508
  get designErrorMessages() {
33542
- return [...this.state.sectionRuleCancelledReasons || []].filter((reason) => reason !== CommandResult.NoChanges).map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
33509
+ return [...this.state.sectionRuleCancelledReasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
33543
33510
  }
33544
33511
  get isRangeMinInvalid() {
33545
- return !!(this.state.sectionRuleCancelledReasons?.has(CommandResult.EmptyGaugeRangeMin) || this.state.sectionRuleCancelledReasons?.has(CommandResult.GaugeRangeMinNaN));
33512
+ return !!(this.state.sectionRuleCancelledReasons?.has("EmptyGaugeRangeMin") || this.state.sectionRuleCancelledReasons?.has("GaugeRangeMinNaN"));
33546
33513
  }
33547
33514
  get isRangeMaxInvalid() {
33548
- return !!(this.state.sectionRuleCancelledReasons?.has(CommandResult.EmptyGaugeRangeMax) || this.state.sectionRuleCancelledReasons?.has(CommandResult.GaugeRangeMaxNaN));
33515
+ return !!(this.state.sectionRuleCancelledReasons?.has("EmptyGaugeRangeMax") || this.state.sectionRuleCancelledReasons?.has("GaugeRangeMaxNaN"));
33549
33516
  }
33550
33517
  get isLowerInflectionPointInvalid() {
33551
- return !!this.state.sectionRuleCancelledReasons?.has(CommandResult.GaugeLowerInflectionPointNaN);
33518
+ return !!this.state.sectionRuleCancelledReasons?.has("GaugeLowerInflectionPointNaN");
33552
33519
  }
33553
33520
  get isUpperInflectionPointInvalid() {
33554
- return !!this.state.sectionRuleCancelledReasons?.has(CommandResult.GaugeUpperInflectionPointNaN);
33521
+ return !!this.state.sectionRuleCancelledReasons?.has("GaugeUpperInflectionPointNaN");
33555
33522
  }
33556
33523
  updateSectionColor(target, color) {
33557
33524
  const sectionRule = deepCopy(this.state.sectionRule);
@@ -33615,10 +33582,10 @@ stores.inject(MyMetaStore, storeInstance);
33615
33582
  }
33616
33583
  checkSectionRuleFormulasAreValid(sectionRule) {
33617
33584
  const reasons = /* @__PURE__ */ new Set();
33618
- if (!this.valueIsValidNumber(sectionRule.rangeMin)) reasons.add(CommandResult.GaugeRangeMinNaN);
33619
- if (!this.valueIsValidNumber(sectionRule.rangeMax)) reasons.add(CommandResult.GaugeRangeMaxNaN);
33620
- if (!this.valueIsValidNumber(sectionRule.lowerInflectionPoint.value)) reasons.add(CommandResult.GaugeLowerInflectionPointNaN);
33621
- if (!this.valueIsValidNumber(sectionRule.upperInflectionPoint.value)) reasons.add(CommandResult.GaugeUpperInflectionPointNaN);
33585
+ if (!this.valueIsValidNumber(sectionRule.rangeMin)) reasons.add("GaugeRangeMinNaN");
33586
+ if (!this.valueIsValidNumber(sectionRule.rangeMax)) reasons.add("GaugeRangeMaxNaN");
33587
+ if (!this.valueIsValidNumber(sectionRule.lowerInflectionPoint.value)) reasons.add("GaugeLowerInflectionPointNaN");
33588
+ if (!this.valueIsValidNumber(sectionRule.upperInflectionPoint.value)) reasons.add("GaugeUpperInflectionPointNaN");
33622
33589
  return reasons;
33623
33590
  }
33624
33591
  valueIsValidNumber(value) {
@@ -33958,13 +33925,13 @@ stores.inject(MyMetaStore, storeInstance);
33958
33925
  keyValue = this.props.definition.keyValue;
33959
33926
  baseline = this.props.definition.baseline;
33960
33927
  get errorMessages() {
33961
- return [...this.state.keyValueDispatchResult?.reasons || [], ...this.state.baselineDispatchResult?.reasons || []].filter((reason) => reason !== CommandResult.NoChanges).map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
33928
+ return [...this.state.keyValueDispatchResult?.reasons || [], ...this.state.baselineDispatchResult?.reasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
33962
33929
  }
33963
33930
  get isKeyValueInvalid() {
33964
- return !!this.state.keyValueDispatchResult?.isCancelledBecause(CommandResult.InvalidScorecardKeyValue);
33931
+ return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardKeyValue");
33965
33932
  }
33966
33933
  get isBaselineInvalid() {
33967
- return !!this.state.keyValueDispatchResult?.isCancelledBecause(CommandResult.InvalidScorecardBaseline);
33934
+ return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardBaseline");
33968
33935
  }
33969
33936
  onKeyValueRangeChanged(ranges) {
33970
33937
  this.keyValue = ranges[0];
@@ -34398,13 +34365,23 @@ stores.inject(MyMetaStore, storeInstance);
34398
34365
  });
34399
34366
  setup() {
34400
34367
  (0, _odoo_owl.useExternalListener)(window, "pointerdown", this.onExternalClick, { capture: true });
34401
- const supportedTypes = this.env.model.getters.getChart(this.props.chartId)?.getSupportedChartTypes() ?? /* @__PURE__ */ new Set();
34368
+ const definition = this.env.model.getters.getChartDefinition(this.props.chartId);
34369
+ const supportedTypes = this.getSupportedChartTypes(definition);
34402
34370
  for (const subtypeProperties of chartSubtypeRegistry.getAll()) {
34403
34371
  if (!supportedTypes.has(subtypeProperties.chartType)) continue;
34404
34372
  if (this.chartTypeByCategories[subtypeProperties.category]) this.chartTypeByCategories[subtypeProperties.category].push(subtypeProperties);
34405
34373
  else this.chartTypeByCategories[subtypeProperties.category] = [subtypeProperties];
34406
34374
  }
34407
34375
  }
34376
+ getSupportedChartTypes(definition) {
34377
+ let supportedTypes;
34378
+ if (definition.dataSource) {
34379
+ const dataSourceBuilder = chartDataSourceRegistry.get(definition.dataSource.type);
34380
+ supportedTypes = new Set(dataSourceBuilder.supportedChartTypes);
34381
+ } else if (!definition.dataSource && (definition.type === "scorecard" || definition.type === "gauge")) supportedTypes = new Set(CHART_TYPES);
34382
+ else throw new Error("Missing chart data source for a chart type that requires it");
34383
+ return supportedTypes;
34384
+ }
34408
34385
  onExternalClick(ev) {
34409
34386
  if (isChildEvent(this.popoverRef.el?.parentElement, ev) || isChildEvent(this.selectRef.el, ev)) return;
34410
34387
  this.closePopover();
@@ -34698,10 +34675,10 @@ stores.inject(MyMetaStore, storeInstance);
34698
34675
  {
34699
34676
  name: _t("Unique values"),
34700
34677
  types: [
34701
- CellValueType.number,
34702
- CellValueType.text,
34703
- CellValueType.boolean,
34704
- CellValueType.error
34678
+ "number",
34679
+ "text",
34680
+ "boolean",
34681
+ "error"
34705
34682
  ],
34706
34683
  compute: (values, locale) => {
34707
34684
  const uniqueValues = /* @__PURE__ */ new Set();
@@ -34712,27 +34689,27 @@ stores.inject(MyMetaStore, storeInstance);
34712
34689
  },
34713
34690
  {
34714
34691
  name: _t("Sum"),
34715
- types: [CellValueType.number],
34692
+ types: ["number"],
34716
34693
  compute: (values, locale) => sum([[values]], locale)
34717
34694
  },
34718
34695
  {
34719
34696
  name: _t("Average"),
34720
- types: [CellValueType.number],
34697
+ types: ["number"],
34721
34698
  compute: (values, locale) => average([[values]], locale)
34722
34699
  },
34723
34700
  {
34724
34701
  name: _t("Median"),
34725
- types: [CellValueType.number],
34702
+ types: ["number"],
34726
34703
  compute: (values, locale) => median([[values]], locale) ?? ""
34727
34704
  },
34728
34705
  {
34729
34706
  name: _t("Minimum value"),
34730
- types: [CellValueType.number],
34707
+ types: ["number"],
34731
34708
  compute: (values, locale) => min([[values]], locale).value
34732
34709
  },
34733
34710
  {
34734
34711
  name: _t("Maximum value"),
34735
- types: [CellValueType.number],
34712
+ types: ["number"],
34736
34713
  compute: (values, locale) => max([[values]], locale).value
34737
34714
  }
34738
34715
  ];
@@ -34879,12 +34856,13 @@ stores.inject(MyMetaStore, storeInstance);
34879
34856
  }
34880
34857
  const { sheetId, col } = getters.getActivePosition();
34881
34858
  this.selectedColumn = col;
34882
- this.dataFormat = getters.getEvaluatedCellsInZone(sheetId, {
34859
+ const formatsInDataset = getters.getEvaluatedCellsInZone(sheetId, {
34883
34860
  top: 0,
34884
34861
  left: col,
34885
34862
  bottom: getters.getNumberRows(sheetId) - 1,
34886
34863
  right: col
34887
- }).map((cell) => cell.format).find(isDefined) ?? "0.00";
34864
+ }).map((cell) => cell.format);
34865
+ this.dataFormat = formatsInDataset.find(isDefined) ?? "0.00";
34888
34866
  const numberOfRows = getters.getNumberRows(sheetId);
34889
34867
  const cells = [];
34890
34868
  const numericValues = [];
@@ -34902,20 +34880,21 @@ stores.inject(MyMetaStore, storeInstance);
34902
34880
  row
34903
34881
  });
34904
34882
  cells.push(evaluatedCell);
34905
- if (evaluatedCell.type !== CellValueType.empty && evaluatedCell.type !== CellValueType.error) {
34883
+ if (evaluatedCell.type !== "empty" && evaluatedCell.type !== "error") {
34906
34884
  values.push({
34907
34885
  row,
34908
34886
  col,
34909
34887
  value: evaluatedCell.value
34910
34888
  });
34911
- if (evaluatedCell.type === CellValueType.number) numericValues.push({
34889
+ if (evaluatedCell.type === "number") numericValues.push({
34912
34890
  row,
34913
34891
  col,
34914
34892
  value: evaluatedCell.value
34915
34893
  });
34916
34894
  }
34917
34895
  }
34918
- this.statisticFnResults = computeStatisticFnResults(columnStatisticFunctions, cells, getters.getLocale());
34896
+ const locale = getters.getLocale();
34897
+ this.statisticFnResults = computeStatisticFnResults(columnStatisticFunctions, cells, locale);
34919
34898
  this.numericValues = numericValues;
34920
34899
  this.values = values;
34921
34900
  this.countChartData = this.computeCountChartData();
@@ -35249,7 +35228,7 @@ stores.inject(MyMetaStore, storeInstance);
35249
35228
  updateConditionalFormat(newCf) {
35250
35229
  const ranges = newCf.ranges || this.state.ranges;
35251
35230
  if (this.state.ranges.some((xc) => !xc.match(rangeReference))) {
35252
- if (!newCf.suppressErrors) this.state.errors = [CommandResult.InvalidRange];
35231
+ if (!newCf.suppressErrors) this.state.errors = ["InvalidRange"];
35253
35232
  return;
35254
35233
  }
35255
35234
  const sheetId = this.model.getters.getActiveSheetId();
@@ -35264,11 +35243,11 @@ stores.inject(MyMetaStore, storeInstance);
35264
35243
  sheetId
35265
35244
  });
35266
35245
  if (result.isSuccessful) this.state.hasEditedCf = true;
35267
- const reasons = result.reasons.filter((r) => r !== CommandResult.NoChanges);
35246
+ const reasons = result.reasons.filter((r) => r !== "NoChanges");
35268
35247
  if (!newCf.suppressErrors) this.state.errors = reasons;
35269
35248
  }
35270
35249
  get isRangeValid() {
35271
- return this.state.errors.includes(CommandResult.EmptyRange);
35250
+ return this.state.errors.includes("EmptyRange");
35272
35251
  }
35273
35252
  get errorMessages() {
35274
35253
  return this.state.errors.map((error) => CfTerms.Errors[error] || CfTerms.Errors.Unexpected);
@@ -35522,9 +35501,9 @@ stores.inject(MyMetaStore, storeInstance);
35522
35501
  isValueInvalid() {
35523
35502
  const errors = this.props.store.state.errors;
35524
35503
  switch (this.props.thresholdType) {
35525
- case "minimum": return errors.includes(CommandResult.MinInvalidFormula) || errors.includes(CommandResult.MinBiggerThanMid) || errors.includes(CommandResult.MinBiggerThanMax) || errors.includes(CommandResult.MinNaN);
35526
- case "midpoint": return errors.includes(CommandResult.MidInvalidFormula) || errors.includes(CommandResult.MidNaN) || errors.includes(CommandResult.MidBiggerThanMax);
35527
- case "maximum": return errors.includes(CommandResult.MaxInvalidFormula) || errors.includes(CommandResult.MaxNaN);
35504
+ case "minimum": return errors.includes("MinInvalidFormula") || errors.includes("MinBiggerThanMid") || errors.includes("MinBiggerThanMax") || errors.includes("MinNaN");
35505
+ case "midpoint": return errors.includes("MidInvalidFormula") || errors.includes("MidNaN") || errors.includes("MidBiggerThanMax");
35506
+ case "maximum": return errors.includes("MaxInvalidFormula") || errors.includes("MaxNaN");
35528
35507
  default: return false;
35529
35508
  }
35530
35509
  }
@@ -35632,8 +35611,8 @@ stores.inject(MyMetaStore, storeInstance);
35632
35611
  isInflectionPointInvalid(inflectionPoint) {
35633
35612
  const errors = this.props.store.state.errors;
35634
35613
  switch (inflectionPoint) {
35635
- case "lowerInflectionPoint": return errors.includes(CommandResult.ValueLowerInflectionNaN) || errors.includes(CommandResult.ValueLowerInvalidFormula) || errors.includes(CommandResult.LowerBiggerThanUpper);
35636
- case "upperInflectionPoint": return errors.includes(CommandResult.ValueUpperInflectionNaN) || errors.includes(CommandResult.ValueUpperInvalidFormula) || errors.includes(CommandResult.LowerBiggerThanUpper);
35614
+ case "lowerInflectionPoint": return errors.includes("ValueLowerInflectionNaN") || errors.includes("ValueLowerInvalidFormula") || errors.includes("LowerBiggerThanUpper");
35615
+ case "upperInflectionPoint": return errors.includes("ValueUpperInflectionNaN") || errors.includes("ValueUpperInvalidFormula") || errors.includes("LowerBiggerThanUpper");
35637
35616
  default: return true;
35638
35617
  }
35639
35618
  }
@@ -36050,12 +36029,6 @@ stores.inject(MyMetaStore, storeInstance);
36050
36029
  //#endregion
36051
36030
  //#region src/components/side_panel/find_and_replace/find_and_replace_store.ts
36052
36031
  const FIND_AND_REPLACE_HIGHLIGHT_COLOR = "#8B008B";
36053
- var Direction = /* @__PURE__ */ function(Direction) {
36054
- Direction[Direction["previous"] = -1] = "previous";
36055
- Direction[Direction["current"] = 0] = "current";
36056
- Direction[Direction["next"] = 1] = "next";
36057
- return Direction;
36058
- }(Direction || {});
36059
36032
  var FindAndReplaceStore = class extends SpreadsheetStore {
36060
36033
  mutators = [
36061
36034
  "updateSearchOptions",
@@ -36117,13 +36090,13 @@ stores.inject(MyMetaStore, storeInstance);
36117
36090
  this.updateSearchOptions({ searchFormulas: showFormula });
36118
36091
  }
36119
36092
  selectPreviousMatch() {
36120
- this.selectNextCell(Direction.previous, {
36093
+ this.selectNextCell(-1, {
36121
36094
  jumpToMatchSheet: true,
36122
36095
  updateSelection: true
36123
36096
  });
36124
36097
  }
36125
36098
  selectNextMatch() {
36126
- this.selectNextCell(Direction.next, {
36099
+ this.selectNextCell(1, {
36127
36100
  jumpToMatchSheet: true,
36128
36101
  updateSelection: true
36129
36102
  });
@@ -36206,7 +36179,7 @@ stores.inject(MyMetaStore, storeInstance);
36206
36179
  refreshSearch(options) {
36207
36180
  if (!this.preserveSelectedMatchIndex) this.selectedMatchIndex = null;
36208
36181
  this.findMatches();
36209
- this.selectNextCell(Direction.current, options);
36182
+ this.selectNextCell(0, options);
36210
36183
  }
36211
36184
  getSheetsInSearchOrder() {
36212
36185
  switch (this.searchOptions.searchScope) {
@@ -37290,10 +37263,10 @@ stores.inject(MyMetaStore, storeInstance);
37290
37263
  }
37291
37264
  function handleResult(env, result) {
37292
37265
  if (!result.isSuccessful) {
37293
- if (result.isCancelledBecause(CommandResult.NamedRangeNameAlreadyExists)) env.raiseError(_t("A named range with this name already exists."));
37294
- else if (result.isCancelledBecause(CommandResult.NamedRangeInvalidName)) env.raiseError(_t("The named range name is invalid. Valid names can contain letters, digits, underscores, and periods. The name cannot be only a number, TRUE, or FALSE."));
37295
- else if (result.isCancelledBecause(CommandResult.NamedRangeNameLooksLikeCellReference)) env.raiseError(_t("A named range name cannot resemble a cell reference."));
37296
- else if (result.isCancelledBecause(CommandResult.NamedRangeNotFound)) env.raiseError(_t("The named range to update was not found."));
37266
+ if (result.isCancelledBecause("NamedRangeNameAlreadyExists")) env.raiseError(_t("A named range with this name already exists."));
37267
+ else if (result.isCancelledBecause("NamedRangeInvalidName")) env.raiseError(_t("The named range name is invalid. Valid names can contain letters, digits, underscores, and periods. The name cannot be only a number, TRUE, or FALSE."));
37268
+ else if (result.isCancelledBecause("NamedRangeNameLooksLikeCellReference")) env.raiseError(_t("A named range name cannot resemble a cell reference."));
37269
+ else if (result.isCancelledBecause("NamedRangeNotFound")) env.raiseError(_t("The named range to update was not found."));
37297
37270
  }
37298
37271
  }
37299
37272
 
@@ -37380,6 +37353,8 @@ stores.inject(MyMetaStore, storeInstance);
37380
37353
  //#endregion
37381
37354
  //#region src/components/side_panel/pivot/pivot_measure_display_panel/pivot_measure_display_panel_store.ts
37382
37355
  var PivotMeasureDisplayPanelStore = class extends SpreadsheetStore {
37356
+ pivotId;
37357
+ initialMeasure;
37383
37358
  mutators = [
37384
37359
  "cancelMeasureDisplayEdition",
37385
37360
  "updateMeasureDisplayType",
@@ -38322,7 +38297,7 @@ stores.inject(MyMetaStore, storeInstance);
38322
38297
  });
38323
38298
  let text;
38324
38299
  if (result.isSuccessful) text = _t("Pivot duplicated.");
38325
- else if (result.isCancelledBecause(CommandResult.PivotInError)) text = _t("Cannot duplicate a pivot in error.");
38300
+ else if (result.isCancelledBecause("PivotInError")) text = _t("Cannot duplicate a pivot in error.");
38326
38301
  else text = _t("Pivot duplication failed.");
38327
38302
  const type = result.isSuccessful ? "success" : "danger";
38328
38303
  this.env.notifyUser({
@@ -38399,13 +38374,30 @@ stores.inject(MyMetaStore, storeInstance);
38399
38374
  break;
38400
38375
  }
38401
38376
  return {
38377
+ /**
38378
+ * Get the id of the measure, as it is stored in the pivot formula
38379
+ */
38402
38380
  id: measure.id,
38381
+ /**
38382
+ * Display name of the measure
38383
+ * e.g. "__count" -> "Count", "amount_total" -> "Total Amount"
38384
+ */
38403
38385
  get displayName() {
38404
38386
  return measure.userDefinedName ?? field?.string ?? measure.fieldName;
38405
38387
  },
38406
38388
  userDefinedName: measure.userDefinedName,
38389
+ /**
38390
+ * Get the name of the field of the measure
38391
+ */
38407
38392
  fieldName,
38393
+ /**
38394
+ * Get the aggregator of the measure
38395
+ */
38408
38396
  aggregator,
38397
+ /**
38398
+ * Get the type of the measure field
38399
+ * e.g. "stage_id" -> "many2one", "create_date:month" -> "date"
38400
+ */
38409
38401
  type: fieldName === "__count" ? "integer" : field?.type ?? "integer",
38410
38402
  isValid,
38411
38403
  isHidden: measure.isHidden,
@@ -38419,10 +38411,30 @@ stores.inject(MyMetaStore, storeInstance);
38419
38411
  const type = field?.type ?? "integer";
38420
38412
  const granularity = field && isDateOrDatetimeField(field) ? dimension.granularity : void 0;
38421
38413
  return {
38414
+ /**
38415
+ * Get the display name of the dimension
38416
+ * e.g. "stage_id" -> "Stage", "create_date:month" -> "Create Date"
38417
+ */
38422
38418
  displayName: field?.string ?? dimension.fieldName,
38419
+ /**
38420
+ * Get the name of the dimension, as it is stored in the pivot formula
38421
+ * e.g. "stage_id", "create_date:month"
38422
+ */
38423
38423
  nameWithGranularity: dimension.fieldName + (granularity ? `:${granularity}` : ""),
38424
+ /**
38425
+ * Get the name of the field of the dimension
38426
+ * e.g. "stage_id" -> "stage_id", "create_date:month" -> "create_date"
38427
+ */
38424
38428
  fieldName: dimension.fieldName,
38429
+ /**
38430
+ * Get the aggregate operator of the dimension
38431
+ * e.g. "stage_id" -> undefined, "create_date:month" -> "month"
38432
+ */
38425
38433
  granularity,
38434
+ /**
38435
+ * Get the type of the field of the dimension
38436
+ * e.g. "stage_id" -> "many2one", "create_date:month" -> "date"
38437
+ */
38426
38438
  type: field?.isCustomField ? "custom" : type,
38427
38439
  order: dimension.order,
38428
38440
  isValid: !!field,
@@ -39182,15 +39194,7 @@ stores.inject(MyMetaStore, storeInstance);
39182
39194
 
39183
39195
  //#endregion
39184
39196
  //#region src/helpers/pivot/spreadsheet_pivot/spreadsheet_pivot.ts
39185
- var ReloadType = /* @__PURE__ */ function(ReloadType) {
39186
- ReloadType[ReloadType["NONE"] = 0] = "NONE";
39187
- ReloadType[ReloadType["TABLE"] = 1] = "TABLE";
39188
- ReloadType[ReloadType["DATA"] = 2] = "DATA";
39189
- ReloadType[ReloadType["DEFINITION"] = 3] = "DEFINITION";
39190
- ReloadType[ReloadType["ALL"] = 4] = "ALL";
39191
- return ReloadType;
39192
- }(ReloadType || {});
39193
- /**
39197
+ /**
39194
39198
  * This class represents a pivot table that is created from a range of cells.
39195
39199
  * It will extract the fields from the first row of the range and the data from
39196
39200
  * the rest of the rows.
@@ -39232,15 +39236,15 @@ stores.inject(MyMetaStore, storeInstance);
39232
39236
  }
39233
39237
  init(params = {}) {
39234
39238
  if (!this._definition || params.reload) {
39235
- this.reload(ReloadType.ALL);
39239
+ this.reload(4);
39236
39240
  this.needsReevaluation = false;
39237
39241
  }
39238
39242
  }
39239
39243
  reload(type) {
39240
- if (type === ReloadType.ALL) this.metaData = this.loadMetaData();
39241
- if (type >= ReloadType.DEFINITION) this._definition = this.loadRuntimeDefinition();
39242
- if (type >= ReloadType.DATA) this.dataEntries = this.loadData();
39243
- if (type >= ReloadType.TABLE) {
39244
+ if (type === 4) this.metaData = this.loadMetaData();
39245
+ if (type >= 3) this._definition = this.loadRuntimeDefinition();
39246
+ if (type >= 2) this.dataEntries = this.loadData();
39247
+ if (type >= 1) {
39244
39248
  this.collapsedTable = void 0;
39245
39249
  this.expandedTable = void 0;
39246
39250
  }
@@ -39249,13 +39253,13 @@ stores.inject(MyMetaStore, storeInstance);
39249
39253
  const actualDefinition = this.coreDefinition;
39250
39254
  this.coreDefinition = nextDefinition;
39251
39255
  if (this._definition) {
39252
- const reloadType = Math.max(this.computeShouldReload(actualDefinition, nextDefinition), ReloadType.NONE);
39256
+ const reloadType = Math.max(this.computeShouldReload(actualDefinition, nextDefinition), 0);
39253
39257
  this.reload(reloadType);
39254
39258
  }
39255
39259
  }
39256
39260
  computeShouldReload(actualDefinition, nextDefinition) {
39257
- if (deepEquals(actualDefinition.dataSet, nextDefinition.dataSet)) return ReloadType.DEFINITION;
39258
- return ReloadType.ALL;
39261
+ if (deepEquals(actualDefinition.dataSet, nextDefinition.dataSet)) return 3;
39262
+ return 4;
39259
39263
  }
39260
39264
  get isInvalidRange() {
39261
39265
  return !!this.invalidRangeError;
@@ -39328,7 +39332,7 @@ stores.inject(MyMetaStore, storeInstance);
39328
39332
  if (dataEntries.length === 0) return { value: "" };
39329
39333
  const measure = this.getMeasure(measureId);
39330
39334
  const allValues = dataEntries.map((value) => value[measure.fieldName]).filter(isDefined);
39331
- const values = allValues.filter((cell) => cell.type !== CellValueType.empty);
39335
+ const values = allValues.filter((cell) => cell.type !== "empty");
39332
39336
  const aggregator = measure.aggregator;
39333
39337
  const operator = AGGREGATORS_FN[aggregator];
39334
39338
  if (!operator) throw new Error(`Aggregator ${aggregator} does not exist`);
@@ -39430,16 +39434,16 @@ stores.inject(MyMetaStore, storeInstance);
39430
39434
  return this.definition.getDimension(nameWithGranularity);
39431
39435
  }
39432
39436
  getTypeFromZone(sheetId, zone) {
39433
- const nonEmptyCells = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => !(cell.type === CellValueType.empty || cell.value === ""));
39437
+ const nonEmptyCells = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => !(cell.type === "empty" || cell.value === ""));
39434
39438
  if (nonEmptyCells.length === 0) return "integer";
39435
- if (nonEmptyCells.every((cell) => cell.type === CellValueType.number && cell.format && isDateTimeFormat(cell.format))) return "datetime";
39436
- if (nonEmptyCells.every((cell) => cell.type === CellValueType.boolean)) return "boolean";
39437
- if (nonEmptyCells.every((cell) => cell.type === CellValueType.number)) return "integer";
39439
+ if (nonEmptyCells.every((cell) => cell.type === "number" && cell.format && isDateTimeFormat(cell.format))) return "datetime";
39440
+ if (nonEmptyCells.every((cell) => cell.type === "boolean")) return "boolean";
39441
+ if (nonEmptyCells.every((cell) => cell.type === "number")) return "integer";
39438
39442
  return "char";
39439
39443
  }
39440
39444
  assertCellIsValidField(col, row, cell) {
39441
- if (cell.type === CellValueType.error) throw new EvaluationError(_t("The pivot cannot be created because cell %s contains an error", toXC(col, row)));
39442
- if (cell.type === CellValueType.empty || cell.value === "") throw new EvaluationError(_t("The pivot cannot be created because cell %s is empty", toXC(col, row)));
39445
+ if (cell.type === "error") throw new EvaluationError(_t("The pivot cannot be created because cell %s contains an error", toXC(col, row)));
39446
+ if (cell.type === "empty" || cell.value === "") throw new EvaluationError(_t("The pivot cannot be created because cell %s is empty", toXC(col, row)));
39443
39447
  if (cell.value === "__count") throw new EvaluationError(_t("The pivot cannot be created because cell %s contains a reserved value", toXC(col, row)));
39444
39448
  }
39445
39449
  /**
@@ -39498,7 +39502,7 @@ stores.inject(MyMetaStore, storeInstance);
39498
39502
  if (!field) throw new Error(`Field ${this.metaData.fieldKeys[index]} does not exist`);
39499
39503
  if (cell.value === "") entry[field.name] = {
39500
39504
  value: null,
39501
- type: CellValueType.empty,
39505
+ type: "empty",
39502
39506
  formattedValue: ""
39503
39507
  };
39504
39508
  else entry[field.name] = cell;
@@ -39511,7 +39515,7 @@ stores.inject(MyMetaStore, storeInstance);
39511
39515
  if (!baseValue || !parentField) {
39512
39516
  entry[customFieldName] = {
39513
39517
  value: null,
39514
- type: CellValueType.empty,
39518
+ type: "empty",
39515
39519
  formattedValue: ""
39516
39520
  };
39517
39521
  continue;
@@ -39524,7 +39528,7 @@ stores.inject(MyMetaStore, storeInstance);
39524
39528
  }
39525
39529
  entry["__count"] = {
39526
39530
  value: 1,
39527
- type: CellValueType.number,
39531
+ type: "number",
39528
39532
  formattedValue: "1"
39529
39533
  };
39530
39534
  dataEntries.push(entry);
@@ -39537,7 +39541,7 @@ stores.inject(MyMetaStore, storeInstance);
39537
39541
  const { format, value: valueToFormat } = pivotTimeAdapter(dimension.granularity || "month").toValueAndFormat(value, locale);
39538
39542
  entry[dimension.nameWithGranularity] = {
39539
39543
  value,
39540
- type: entry[dimension.fieldName]?.type || CellValueType.empty,
39544
+ type: entry[dimension.fieldName]?.type || "empty",
39541
39545
  format: entry[dimension.fieldName]?.format,
39542
39546
  formattedValue: formatValue(valueToFormat, {
39543
39547
  locale,
@@ -39692,6 +39696,8 @@ stores.inject(MyMetaStore, storeInstance);
39692
39696
  //#endregion
39693
39697
  //#region src/components/side_panel/pivot/pivot_side_panel/pivot_side_panel_store.ts
39694
39698
  var PivotSidePanelStore = class extends SpreadsheetStore {
39699
+ pivotId;
39700
+ updateMode;
39695
39701
  mutators = [
39696
39702
  "reset",
39697
39703
  "deferUpdates",
@@ -39853,7 +39859,8 @@ stores.inject(MyMetaStore, storeInstance);
39853
39859
  };
39854
39860
  }
39855
39861
  if (!this.draft && deepEquals(coreDefinition, cleanedDefinition)) return;
39856
- this.draft = this.addDefaultDateTimeGranularity(this.fields, cleanedDefinition);
39862
+ const cleanedWithGranularity = this.addDefaultDateTimeGranularity(this.fields, cleanedDefinition);
39863
+ this.draft = cleanedWithGranularity;
39857
39864
  if (!this.updatesAreDeferred) this.applyUpdate();
39858
39865
  }
39859
39866
  /**
@@ -41609,7 +41616,7 @@ stores.inject(MyMetaStore, storeInstance);
41609
41616
  separator,
41610
41617
  addNewColumns
41611
41618
  });
41612
- if (result.isCancelledBecause(CommandResult.SplitWillOverwriteContent)) env.askConfirmation(SplitToColumnsInteractiveContent.SplitIsDestructive, () => {
41619
+ if (result.isCancelledBecause("SplitWillOverwriteContent")) env.askConfirmation(SplitToColumnsInteractiveContent.SplitIsDestructive, () => {
41613
41620
  result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", {
41614
41621
  separator,
41615
41622
  addNewColumns,
@@ -41691,8 +41698,8 @@ stores.inject(MyMetaStore, storeInstance);
41691
41698
  }).reasons;
41692
41699
  const errors = /* @__PURE__ */ new Set();
41693
41700
  for (const reason of cancelledReasons) switch (reason) {
41694
- case CommandResult.SplitWillOverwriteContent:
41695
- case CommandResult.EmptySplitSeparator: break;
41701
+ case "SplitWillOverwriteContent":
41702
+ case "EmptySplitSeparator": break;
41696
41703
  default: errors.add(SplitToColumnsTerms.Errors[reason] || SplitToColumnsTerms.Errors.Unexpected);
41697
41704
  }
41698
41705
  return Array.from(errors);
@@ -41703,7 +41710,7 @@ stores.inject(MyMetaStore, storeInstance);
41703
41710
  separator: this.separatorValue,
41704
41711
  addNewColumns: this.state.addNewColumns,
41705
41712
  force: false
41706
- }).reasons.includes(CommandResult.SplitWillOverwriteContent)) warnings.push(SplitToColumnsTerms.Errors[CommandResult.SplitWillOverwriteContent]);
41713
+ }).reasons.includes("SplitWillOverwriteContent")) warnings.push(SplitToColumnsTerms.Errors["SplitWillOverwriteContent"]);
41707
41714
  return warnings;
41708
41715
  }
41709
41716
  get separatorValue() {
@@ -42334,7 +42341,7 @@ stores.inject(MyMetaStore, storeInstance);
42334
42341
  if (env.model.dispatch(cmd, {
42335
42342
  sheetId,
42336
42343
  quantity: base
42337
- }).isCancelledBecause(CommandResult.MergeOverlap)) env.raiseError(MergeErrorMessage);
42344
+ }).isCancelledBecause("MergeOverlap")) env.raiseError(MergeErrorMessage);
42338
42345
  }
42339
42346
 
42340
42347
  //#endregion
@@ -42514,11 +42521,11 @@ stores.inject(MyMetaStore, storeInstance);
42514
42521
  }
42515
42522
  getLiteralFingerprint(position) {
42516
42523
  switch (this.getters.getEvaluatedCell(position).type) {
42517
- case CellValueType.number:
42518
- case CellValueType.boolean: return DATA_FINGERPRINT;
42519
- case CellValueType.text:
42520
- case CellValueType.empty:
42521
- case CellValueType.error: return;
42524
+ case "number":
42525
+ case "boolean": return DATA_FINGERPRINT;
42526
+ case "text":
42527
+ case "empty":
42528
+ case "error": return;
42522
42529
  }
42523
42530
  }
42524
42531
  };
@@ -42802,7 +42809,7 @@ stores.inject(MyMetaStore, storeInstance);
42802
42809
  function interactiveCut(env) {
42803
42810
  const result = env.model.dispatch("CUT");
42804
42811
  if (!result.isSuccessful) {
42805
- if (result.isCancelledBecause(CommandResult.WrongCutSelection)) env.raiseError(_t("This operation is not allowed with multiple selections."));
42812
+ if (result.isCancelledBecause("WrongCutSelection")) env.raiseError(_t("This operation is not allowed with multiple selections."));
42806
42813
  }
42807
42814
  }
42808
42815
 
@@ -42873,8 +42880,8 @@ stores.inject(MyMetaStore, storeInstance);
42873
42880
  sheetId,
42874
42881
  target
42875
42882
  });
42876
- if (result.isCancelledBecause(CommandResult.MergeInTable)) env.raiseError(AddMergeInteractiveContent.MergeInFilter);
42877
- else if (result.isCancelledBecause(CommandResult.MergeIsDestructive)) env.askConfirmation(AddMergeInteractiveContent.MergeIsDestructive, () => {
42883
+ if (result.isCancelledBecause("MergeInTable")) env.raiseError(AddMergeInteractiveContent.MergeInFilter);
42884
+ else if (result.isCancelledBecause("MergeIsDestructive")) env.askConfirmation(AddMergeInteractiveContent.MergeIsDestructive, () => {
42878
42885
  env.model.dispatch("ADD_MERGE", {
42879
42886
  sheetId,
42880
42887
  target,
@@ -43111,7 +43118,7 @@ stores.inject(MyMetaStore, storeInstance);
43111
43118
  if (!pivotId) return false;
43112
43119
  const pivot = env.model.getters.getPivot(pivotId);
43113
43120
  const cell = env.model.getters.getEvaluatedCell(position);
43114
- return pivot.isValid() && env.model.getters.isSpillPivotFormula(position) && cell.type !== CellValueType.error;
43121
+ return pivot.isValid() && env.model.getters.isSpillPivotFormula(position) && cell.type !== "error";
43115
43122
  },
43116
43123
  icon: "o-spreadsheet-Icon.PIVOT"
43117
43124
  };
@@ -43752,7 +43759,7 @@ stores.inject(MyMetaStore, storeInstance);
43752
43759
  end: group.end
43753
43760
  });
43754
43761
  if (!result.isSuccessful) {
43755
- if (result.isCancelledBecause(CommandResult.NotEnoughElements)) {
43762
+ if (result.isCancelledBecause("NotEnoughElements")) {
43756
43763
  const errorMessage = dimension === "ROW" ? ToggleGroupInteractiveContent.CannotHideAllRows : ToggleGroupInteractiveContent.CannotHideAllColumns;
43757
43764
  env.raiseError(errorMessage);
43758
43765
  }
@@ -44707,11 +44714,11 @@ stores.inject(MyMetaStore, storeInstance);
44707
44714
  if (cell?.content.startsWith("'")) return { text: cell.content };
44708
44715
  const { format, value, type, formattedValue } = this.getters.getEvaluatedCell(position);
44709
44716
  switch (type) {
44710
- case CellValueType.empty: return { text: "" };
44711
- case CellValueType.text:
44712
- case CellValueType.error: return { text: value };
44713
- case CellValueType.boolean: return { text: formattedValue };
44714
- case CellValueType.number:
44717
+ case "empty": return { text: "" };
44718
+ case "text":
44719
+ case "error": return { text: value };
44720
+ case "boolean": return { text: formattedValue };
44721
+ case "number":
44715
44722
  if (format && isDateTimeFormat(format)) {
44716
44723
  if (parseDateTime(formattedValue, locale) !== null) return { text: formattedValue };
44717
44724
  return { text: formatValue(value, {
@@ -44768,7 +44775,7 @@ stores.inject(MyMetaStore, storeInstance);
44768
44775
  startEdition(text, selection) {
44769
44776
  if (this.getters.isCurrentSheetLocked()) {
44770
44777
  this.model.trigger("command-rejected", {
44771
- result: new DispatchResult(CommandResult.SheetLocked),
44778
+ result: new DispatchResult("SheetLocked"),
44772
44779
  command: { sheetId: this.getters.getActiveSheetId() }
44773
44780
  });
44774
44781
  return "NoStateChange";
@@ -46393,7 +46400,7 @@ stores.inject(MyMetaStore, storeInstance);
46393
46400
  elements,
46394
46401
  position: this.state.position
46395
46402
  });
46396
- if (!result.isSuccessful && result.reasons.includes(CommandResult.WillRemoveExistingMerge)) this.env.raiseError(MergeErrorMessage);
46403
+ if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
46397
46404
  }
46398
46405
  _selectElement(index, addDistinctHeader) {
46399
46406
  this.env.model.selection.selectColumn(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
@@ -46530,8 +46537,8 @@ stores.inject(MyMetaStore, storeInstance);
46530
46537
  position: this.state.position
46531
46538
  });
46532
46539
  if (!result.isSuccessful) {
46533
- if (result.reasons.includes(CommandResult.WillRemoveExistingMerge)) this.env.raiseError(MergeErrorMessage);
46534
- else if (result.reasons.includes(CommandResult.CannotMoveTableHeader)) this.env.raiseError(TableHeaderMoveErrorMessage);
46540
+ if (result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
46541
+ else if (result.reasons.includes("CannotMoveTableHeader")) this.env.raiseError(TableHeaderMoveErrorMessage);
46535
46542
  }
46536
46543
  }
46537
46544
  _selectElement(index, addDistinctHeader) {
@@ -46608,6 +46615,7 @@ stores.inject(MyMetaStore, storeInstance);
46608
46615
  //#region src/stores/grid_renderer_store.ts
46609
46616
  const CELL_ANIMATION_DURATION = 200;
46610
46617
  var GridRenderer = class extends DisposableStore {
46618
+ renderer;
46611
46619
  fingerprints;
46612
46620
  hoveredTables;
46613
46621
  hoveredIcon;
@@ -47092,7 +47100,7 @@ stores.inject(MyMetaStore, storeInstance);
47092
47100
  const nextCell = this.getters.getEvaluatedCell(position);
47093
47101
  const nextCellBorder = this.getters.getCellComputedBorder(position);
47094
47102
  const doesCellHaveGridIcon = this.getters.doesCellHaveGridIcon(position);
47095
- if (nextCell.type !== CellValueType.empty || this.getters.isInMerge(position) || nextCellBorder?.left || doesCellHaveGridIcon) return col;
47103
+ if (nextCell.type !== "empty" || this.getters.isInMerge(position) || nextCellBorder?.left || doesCellHaveGridIcon) return col;
47096
47104
  col++;
47097
47105
  }
47098
47106
  return col;
@@ -47108,7 +47116,7 @@ stores.inject(MyMetaStore, storeInstance);
47108
47116
  const previousCell = this.getters.getEvaluatedCell(position);
47109
47117
  const previousCellBorder = this.getters.getCellComputedBorder(position);
47110
47118
  const doesCellHaveGridIcon = this.getters.doesCellHaveGridIcon(position);
47111
- if (previousCell.type !== CellValueType.empty || this.getters.isInMerge(position) || previousCellBorder?.right || doesCellHaveGridIcon) return col;
47119
+ if (previousCell.type !== "empty" || this.getters.isInMerge(position) || previousCellBorder?.right || doesCellHaveGridIcon) return col;
47112
47120
  col--;
47113
47121
  }
47114
47122
  return col;
@@ -47118,7 +47126,7 @@ stores.inject(MyMetaStore, storeInstance);
47118
47126
  const { align } = this.getters.getCellStyle(position);
47119
47127
  const evaluatedCell = this.getters.getEvaluatedCell(position);
47120
47128
  if (!align && formatHasRepeatedChar(evaluatedCell.value, evaluatedCell.format)) return "left";
47121
- if (isOverflowing && evaluatedCell.type === CellValueType.number) return align !== "center" ? "left" : align;
47129
+ if (isOverflowing && evaluatedCell.type === "number") return align !== "center" ? "left" : align;
47122
47130
  return align || evaluatedCell.defaultAlign;
47123
47131
  }
47124
47132
  createZoneBox(viewports, sheetId, zone, viewport) {
@@ -47163,12 +47171,12 @@ stores.inject(MyMetaStore, storeInstance);
47163
47171
  style,
47164
47172
  dataBarFill,
47165
47173
  overlayColor: this.hoveredTables.overlayColors.get(position),
47166
- isError: cell.type === CellValueType.error && !!cell.message || this.getters.isDataValidationInvalid(position),
47174
+ isError: cell.type === "error" && !!cell.message || this.getters.isDataValidationInvalid(position),
47167
47175
  icons: cellIcons,
47168
47176
  disabledAnimation: this.zonesWithPreventedAnimationsInNextFrame[sheetId]?.some((z) => isZoneInside(zone, z) || overlap(zone, z))
47169
47177
  };
47170
47178
  const fontSizePX = computeTextFontSizeInPixels(box.style);
47171
- if (cell.type === CellValueType.empty || box.icons.center) return box;
47179
+ if (cell.type === "empty" || box.icons.center) return box;
47172
47180
  /** Content */
47173
47181
  const wrapping = style.wrapping || "overflow";
47174
47182
  const wrapText = wrapping === "wrap" && !showFormula;
@@ -48344,7 +48352,7 @@ stores.inject(MyMetaStore, storeInstance);
48344
48352
  "Alt+Shift+ArrowDown": () => this.processHeaderGroupingKey("down")
48345
48353
  };
48346
48354
  focusComposerFromActiveCell() {
48347
- this.env.model.getters.getActiveCell().type === CellValueType.empty ? this.onComposerCellFocused() : this.onComposerContentFocused();
48355
+ this.env.model.getters.getActiveCell().type === "empty" ? this.onComposerCellFocused() : this.onComposerContentFocused();
48348
48356
  }
48349
48357
  editOrMoveInSelection(direction) {
48350
48358
  if (this.isSingleCellOrMergeSelection()) {
@@ -48469,7 +48477,7 @@ stores.inject(MyMetaStore, storeInstance);
48469
48477
  sheetId,
48470
48478
  col,
48471
48479
  row
48472
- }).type === CellValueType.empty) this.onComposerCellFocused();
48480
+ }).type === "empty") this.onComposerCellFocused();
48473
48481
  else this.onComposerContentFocused();
48474
48482
  }
48475
48483
  processArrows(ev) {
@@ -48550,18 +48558,18 @@ stores.inject(MyMetaStore, storeInstance);
48550
48558
  if (!clipboardData) return;
48551
48559
  const image = [...clipboardData.files]?.find((file) => AllowedImageMimeTypes.includes(file.type));
48552
48560
  const osClipboard = { content: {
48553
- [ClipboardMIMEType.PlainText]: clipboardData?.getData(ClipboardMIMEType.PlainText),
48554
- [ClipboardMIMEType.Html]: clipboardData?.getData(ClipboardMIMEType.Html)
48561
+ ["text/plain"]: clipboardData?.getData("text/plain"),
48562
+ ["text/html"]: clipboardData?.getData("text/html")
48555
48563
  } };
48556
48564
  if (image) osClipboard.content[image.type] = image;
48557
48565
  const target = this.env.model.getters.getSelectedZones();
48558
48566
  const isCutOperation = this.env.model.getters.isCutOperation();
48559
- if (this.env.model.getters.getClipboardId() === getOSheetClipboardIdFromHTML(osClipboard.content[ClipboardMIMEType.Html])) interactivePaste(this.env, target);
48567
+ if (this.env.model.getters.getClipboardId() === getOSheetClipboardIdFromHTML(osClipboard.content["text/html"])) interactivePaste(this.env, target);
48560
48568
  else {
48561
48569
  const osClipboardContent = parseOSClipboardContent(osClipboard.content);
48562
48570
  await interactivePasteFromOS(this.env, target, osClipboardContent);
48563
48571
  }
48564
- if (isCutOperation) await this.env.clipboard.write({ [ClipboardMIMEType.PlainText]: "" });
48572
+ if (isCutOperation) await this.env.clipboard.write({ ["text/plain"]: "" });
48565
48573
  }
48566
48574
  clearFormatting() {
48567
48575
  this.env.model.dispatch("CLEAR_FORMATTING", {
@@ -49048,7 +49056,7 @@ stores.inject(MyMetaStore, storeInstance);
49048
49056
  * There should not be any side effects in this method.
49049
49057
  */
49050
49058
  allowDispatch(command) {
49051
- return CommandResult.Success;
49059
+ return "Success";
49052
49060
  }
49053
49061
  /**
49054
49062
  * This method is useful when a plugin needs to perform some action before a
@@ -49084,10 +49092,10 @@ stores.inject(MyMetaStore, storeInstance);
49084
49092
  for (const validation of validations) {
49085
49093
  let results = validation.call(this, toValidate);
49086
49094
  if (!Array.isArray(results)) results = [results];
49087
- const cancelledReasons = results.filter((result) => result !== CommandResult.Success);
49095
+ const cancelledReasons = results.filter((result) => result !== "Success");
49088
49096
  if (cancelledReasons.length) return cancelledReasons;
49089
49097
  }
49090
- return CommandResult.Success;
49098
+ return "Success";
49091
49099
  };
49092
49100
  }
49093
49101
  checkValidations(command, ...validations) {
@@ -49144,7 +49152,7 @@ stores.inject(MyMetaStore, storeInstance);
49144
49152
  allowDispatch(cmd) {
49145
49153
  switch (cmd.type) {
49146
49154
  case "SET_BORDER": return this.checkBordersUnchanged(cmd);
49147
- default: return CommandResult.Success;
49155
+ default: return "Success";
49148
49156
  }
49149
49157
  }
49150
49158
  handle(cmd) {
@@ -49558,8 +49566,8 @@ stores.inject(MyMetaStore, storeInstance);
49558
49566
  checkBordersUnchanged(cmd) {
49559
49567
  const currentBorder = this.getCellBorder(cmd);
49560
49568
  const areAllNewBordersUndefined = !cmd.border?.bottom && !cmd.border?.left && !cmd.border?.right && !cmd.border?.top;
49561
- if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return CommandResult.NoChanges;
49562
- return CommandResult.Success;
49569
+ if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return "NoChanges";
49570
+ return "Success";
49563
49571
  }
49564
49572
  import(data) {
49565
49573
  if (Object.keys(data.borders || {}).length) for (const sheet of data.sheets) for (const [position, borderId] of iterateItemIdsPositions(sheet.id, sheet.borders)) {
@@ -49607,13 +49615,13 @@ stores.inject(MyMetaStore, storeInstance);
49607
49615
  allowDispatch(cmd) {
49608
49616
  switch (cmd.type) {
49609
49617
  case "CREATE_CAROUSEL":
49610
- if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return CommandResult.DuplicatedFigureId;
49611
- return CommandResult.Success;
49618
+ if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "DuplicatedFigureId";
49619
+ return "Success";
49612
49620
  case "UPDATE_CAROUSEL":
49613
- if (!this.carousels[cmd.sheetId]?.[cmd.figureId]) return CommandResult.InvalidFigureId;
49614
- return CommandResult.Success;
49621
+ if (!this.carousels[cmd.sheetId]?.[cmd.figureId]) return "InvalidFigureId";
49622
+ return "Success";
49615
49623
  }
49616
- return CommandResult.Success;
49624
+ return "Success";
49617
49625
  }
49618
49626
  handle(cmd) {
49619
49627
  switch (cmd.type) {
@@ -50233,9 +50241,9 @@ stores.inject(MyMetaStore, storeInstance);
50233
50241
  switch (cmd.type) {
50234
50242
  case "UPDATE_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessUpdateCell);
50235
50243
  case "CLEAR_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessClearCell);
50236
- case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ? CommandResult.Success : CommandResult.InvalidCellId;
50244
+ case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ? "Success" : "InvalidCellId";
50237
50245
  case "SET_FORMATTING": return this.checkUselessSetFormatting(cmd);
50238
- default: return CommandResult.Success;
50246
+ default: return "Success";
50239
50247
  }
50240
50248
  }
50241
50249
  handle(cmd) {
@@ -50591,28 +50599,28 @@ stores.inject(MyMetaStore, storeInstance);
50591
50599
  }
50592
50600
  checkCellOutOfSheet(cmd) {
50593
50601
  const { sheetId, col, row } = cmd;
50594
- if (!this.getters.tryGetSheet(sheetId)) return CommandResult.InvalidSheetId;
50595
- return isInside(col, row, this.getters.getSheetZone(sheetId)) ? CommandResult.Success : CommandResult.TargetOutOfSheet;
50602
+ if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
50603
+ return isInside(col, row, this.getters.getSheetZone(sheetId)) ? "Success" : "TargetOutOfSheet";
50596
50604
  }
50597
50605
  checkUselessClearCell(cmd) {
50598
50606
  const cell = this.getters.getCell(cmd);
50599
- if (!cell) return CommandResult.NoChanges;
50600
- if (!cell.isFormula && !cell.content && !cell.style && !cell.format) return CommandResult.NoChanges;
50601
- return CommandResult.Success;
50607
+ if (!cell) return "NoChanges";
50608
+ if (!cell.isFormula && !cell.content && !cell.style && !cell.format) return "NoChanges";
50609
+ return "Success";
50602
50610
  }
50603
50611
  checkUselessUpdateCell(cmd) {
50604
50612
  const cell = this.getters.getCell(cmd);
50605
50613
  const hasContent = "content" in cmd || "formula" in cmd;
50606
50614
  const hasStyle = "style" in cmd;
50607
50615
  const hasFormat = "format" in cmd;
50608
- if ((!hasContent || cell?.isFormula && cell.compiledFormula.toFormulaString(this.getters) === cmd.content || !cell?.isFormula && cell?.content === cmd.content) && (!hasStyle || deepEquals(cell?.style, cmd.style)) && (!hasFormat || cell?.format === cmd.format)) return CommandResult.NoChanges;
50609
- return CommandResult.Success;
50616
+ if ((!hasContent || cell?.isFormula && cell.compiledFormula.toFormulaString(this.getters) === cmd.content || !cell?.isFormula && cell?.content === cmd.content) && (!hasStyle || deepEquals(cell?.style, cmd.style)) && (!hasFormat || cell?.format === cmd.format)) return "NoChanges";
50617
+ return "Success";
50610
50618
  }
50611
50619
  checkUselessSetFormatting(cmd) {
50612
50620
  const { sheetId, target } = cmd;
50613
50621
  const hasStyle = "style" in cmd;
50614
50622
  const hasFormat = "format" in cmd;
50615
- if (!hasStyle && !hasFormat) return CommandResult.NoChanges;
50623
+ if (!hasStyle && !hasFormat) return "NoChanges";
50616
50624
  for (const zone of recomputeZones(target)) for (let col = zone.left; col <= zone.right; col++) for (let row = zone.top; row <= zone.bottom; row++) {
50617
50625
  const position = {
50618
50626
  sheetId,
@@ -50620,9 +50628,9 @@ stores.inject(MyMetaStore, storeInstance);
50620
50628
  row
50621
50629
  };
50622
50630
  const cell = this.getters.getCell(position);
50623
- if (hasStyle && !deepEquals(cell?.style, cmd.style) || hasFormat && cell?.format !== cmd.format) return CommandResult.Success;
50631
+ if (hasStyle && !deepEquals(cell?.style, cmd.style) || hasFormat && cell?.format !== cmd.format) return "Success";
50624
50632
  }
50625
- return CommandResult.NoChanges;
50633
+ return "NoChanges";
50626
50634
  }
50627
50635
  };
50628
50636
 
@@ -50653,8 +50661,8 @@ stores.inject(MyMetaStore, storeInstance);
50653
50661
  switch (cmd.type) {
50654
50662
  case "CREATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.checkFigureArguments, this.checkChartDefinition, this.checkChartDuplicate));
50655
50663
  case "UPDATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.checkChartDefinition, this.checkChartExists, this.checkChartChanged));
50656
- case "DELETE_CHART": return CommandResult.SubCommandOnly;
50657
- default: return CommandResult.Success;
50664
+ case "DELETE_CHART": return "SubCommandOnly";
50665
+ default: return "Success";
50658
50666
  }
50659
50667
  }
50660
50668
  handle(cmd) {
@@ -50813,22 +50821,22 @@ stores.inject(MyMetaStore, storeInstance);
50813
50821
  }
50814
50822
  }
50815
50823
  checkChartDuplicate(cmd) {
50816
- return this.isChartDefined(cmd.chartId) ? CommandResult.DuplicatedChartId : CommandResult.Success;
50824
+ return this.isChartDefined(cmd.chartId) ? "DuplicatedChartId" : "Success";
50817
50825
  }
50818
50826
  checkChartDefinition(cmd) {
50819
50827
  return SpreadsheetChart.validate(this, cmd.definition);
50820
50828
  }
50821
50829
  checkChartExists(cmd) {
50822
- return this.isChartDefined(cmd.chartId) ? CommandResult.Success : CommandResult.ChartDoesNotExist;
50830
+ return this.isChartDefined(cmd.chartId) ? "Success" : "ChartDoesNotExist";
50823
50831
  }
50824
50832
  checkChartChanged(cmd) {
50825
- if (cmd.figureId !== this.charts[cmd.chartId]?.figureId) return CommandResult.Success;
50826
- return deepEquals(this.getChartDefinition(cmd.chartId), cmd.definition) ? CommandResult.NoChanges : CommandResult.Success;
50833
+ if (cmd.figureId !== this.charts[cmd.chartId]?.figureId) return "Success";
50834
+ return deepEquals(this.getChartDefinition(cmd.chartId), cmd.definition) ? "NoChanges" : "Success";
50827
50835
  }
50828
50836
  /** If the command is meant to create a new figure, the position & offset argument need to be defined in the command */
50829
50837
  checkFigureArguments(cmd) {
50830
- if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return CommandResult.Success;
50831
- return cmd.offset !== void 0 && cmd.col !== void 0 && cmd.row !== void 0 ? CommandResult.Success : CommandResult.MissingFigureArguments;
50838
+ if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "Success";
50839
+ return cmd.offset !== void 0 && cmd.col !== void 0 && cmd.row !== void 0 ? "Success" : "MissingFigureArguments";
50832
50840
  }
50833
50841
  };
50834
50842
 
@@ -50895,11 +50903,11 @@ stores.inject(MyMetaStore, storeInstance);
50895
50903
  allowDispatch(cmd) {
50896
50904
  switch (cmd.type) {
50897
50905
  case "ADD_CONDITIONAL_FORMAT":
50898
- if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return CommandResult.InvalidSheetId;
50906
+ if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
50899
50907
  return this.checkValidations(cmd, this.checkCFRule, this.checkEmptyRange, this.checkCFHasChanged);
50900
50908
  case "CHANGE_CONDITIONAL_FORMAT_PRIORITY": return this.checkValidPriorityChange(cmd.cfId, cmd.delta, cmd.sheetId);
50901
50909
  }
50902
- return CommandResult.Success;
50910
+ return "Success";
50903
50911
  }
50904
50912
  handle(cmd) {
50905
50913
  switch (cmd.type) {
@@ -51032,27 +51040,27 @@ stores.inject(MyMetaStore, storeInstance);
51032
51040
  this.history.update("cfRules", sheet, currentCF);
51033
51041
  }
51034
51042
  checkValidPriorityChange(cfId, delta, sheetId) {
51035
- if (!this.cfRules[sheetId]) return CommandResult.InvalidSheetId;
51043
+ if (!this.cfRules[sheetId]) return "InvalidSheetId";
51036
51044
  const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
51037
- if (ruleIndex === -1) return CommandResult.InvalidConditionalFormatId;
51045
+ if (ruleIndex === -1) return "InvalidConditionalFormatId";
51038
51046
  const cfIndex2 = ruleIndex - delta;
51039
- if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return CommandResult.InvalidConditionalFormatId;
51040
- return CommandResult.Success;
51047
+ if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return "InvalidConditionalFormatId";
51048
+ return "Success";
51041
51049
  }
51042
51050
  checkEmptyRange(cmd) {
51043
- return cmd.ranges.length ? CommandResult.Success : CommandResult.EmptyRange;
51051
+ return cmd.ranges.length ? "Success" : "EmptyRange";
51044
51052
  }
51045
51053
  checkCFRule(cmd) {
51046
51054
  const rule = cmd.cf.rule;
51047
51055
  switch (rule.type) {
51048
51056
  case "CellIsRule":
51049
- if (!availableConditionalFormatOperators.has(rule.operator)) return CommandResult.InvalidConditionalFormatType;
51057
+ if (!availableConditionalFormatOperators.has(rule.operator)) return "InvalidConditionalFormatType";
51050
51058
  return this.checkValidations(rule, this.checkOperatorArgsNumber, this.checkCFValues);
51051
51059
  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)));
51052
51060
  case "IconSetRule": return this.checkValidations(rule, this.chainValidations(this.checkInflectionPoints(this.checkNaN), this.checkLowerBiggerThanUpper), this.chainValidations(this.checkInflectionPoints(this.checkFormulaCompilation)));
51053
- case "DataBarRule": return CommandResult.Success;
51061
+ case "DataBarRule": return "Success";
51054
51062
  }
51055
- return CommandResult.InvalidConditionalFormatType;
51063
+ return "InvalidConditionalFormatType";
51056
51064
  }
51057
51065
  checkCFHasChanged(cmd) {
51058
51066
  const newCF = this.mapToConditionalFormatInternal(cmd.sheetId, {
@@ -51060,8 +51068,8 @@ stores.inject(MyMetaStore, storeInstance);
51060
51068
  ranges: cmd.ranges.map((rangeData) => this.getters.getRangeString(this.getters.getRangeFromRangeData(rangeData), cmd.sheetId))
51061
51069
  });
51062
51070
  const currentCF = this.cfRules[cmd.sheetId]?.find((cf) => cf.id === cmd.cf.id);
51063
- if (currentCF && deepEquals(newCF, currentCF)) return CommandResult.NoChanges;
51064
- return CommandResult.Success;
51071
+ if (currentCF && deepEquals(newCF, currentCF)) return "NoChanges";
51072
+ return "Success";
51065
51073
  }
51066
51074
  checkOperatorArgsNumber(rule) {
51067
51075
  const expectedNumber = criterionEvaluatorRegistry.get(rule.operator).numberOfValues({
@@ -51071,9 +51079,9 @@ stores.inject(MyMetaStore, storeInstance);
51071
51079
  if (expectedNumber === void 0 || expectedNumber > 2) throw new Error("Checking more than 2 arguments is currently not supported. Add the appropriate CommandResult if you want to.");
51072
51080
  const errors = [];
51073
51081
  const isEmpty = (value) => value === void 0 || value === "";
51074
- if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push(CommandResult.FirstArgMissing);
51075
- if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push(CommandResult.SecondArgMissing);
51076
- return errors.length ? errors : CommandResult.Success;
51082
+ if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push("FirstArgMissing");
51083
+ if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push("SecondArgMissing");
51084
+ return errors.length ? errors : "Success";
51077
51085
  }
51078
51086
  checkNaN(threshold, thresholdName) {
51079
51087
  if ([
@@ -51081,27 +51089,27 @@ stores.inject(MyMetaStore, storeInstance);
51081
51089
  "percentage",
51082
51090
  "percentile"
51083
51091
  ].includes(threshold.type) && (threshold.value === "" || isNaN(threshold.value))) switch (thresholdName) {
51084
- case "min": return CommandResult.MinNaN;
51085
- case "max": return CommandResult.MaxNaN;
51086
- case "mid": return CommandResult.MidNaN;
51087
- case "upperInflectionPoint": return CommandResult.ValueUpperInflectionNaN;
51088
- case "lowerInflectionPoint": return CommandResult.ValueLowerInflectionNaN;
51092
+ case "min": return "MinNaN";
51093
+ case "max": return "MaxNaN";
51094
+ case "mid": return "MidNaN";
51095
+ case "upperInflectionPoint": return "ValueUpperInflectionNaN";
51096
+ case "lowerInflectionPoint": return "ValueLowerInflectionNaN";
51089
51097
  }
51090
- return CommandResult.Success;
51098
+ return "Success";
51091
51099
  }
51092
51100
  checkFormulaCompilation(threshold, thresholdName) {
51093
- if (threshold.type !== "formula") return CommandResult.Success;
51101
+ if (threshold.type !== "formula") return "Success";
51094
51102
  if (CompiledFormula.IsBadExpression(threshold.value || "")) switch (thresholdName) {
51095
- case "min": return CommandResult.MinInvalidFormula;
51096
- case "max": return CommandResult.MaxInvalidFormula;
51097
- case "mid": return CommandResult.MidInvalidFormula;
51098
- case "upperInflectionPoint": return CommandResult.ValueUpperInvalidFormula;
51099
- case "lowerInflectionPoint": return CommandResult.ValueLowerInvalidFormula;
51103
+ case "min": return "MinInvalidFormula";
51104
+ case "max": return "MaxInvalidFormula";
51105
+ case "mid": return "MidInvalidFormula";
51106
+ case "upperInflectionPoint": return "ValueUpperInvalidFormula";
51107
+ case "lowerInflectionPoint": return "ValueLowerInvalidFormula";
51100
51108
  }
51101
- return CommandResult.Success;
51109
+ return "Success";
51102
51110
  }
51103
51111
  checkThresholds(check) {
51104
- return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") : CommandResult.Success);
51112
+ return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") : "Success");
51105
51113
  }
51106
51114
  checkInflectionPoints(check) {
51107
51115
  return this.batchValidations((rule) => check(rule.lowerInflectionPoint, "lowerInflectionPoint"), (rule) => check(rule.upperInflectionPoint, "upperInflectionPoint"));
@@ -51113,8 +51121,8 @@ stores.inject(MyMetaStore, storeInstance);
51113
51121
  "number",
51114
51122
  "percentage",
51115
51123
  "percentile"
51116
- ].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return CommandResult.LowerBiggerThanUpper;
51117
- return CommandResult.Success;
51124
+ ].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return "LowerBiggerThanUpper";
51125
+ return "Success";
51118
51126
  }
51119
51127
  checkMinBiggerThanMax(rule) {
51120
51128
  const minValue = rule.minimum.value;
@@ -51123,8 +51131,8 @@ stores.inject(MyMetaStore, storeInstance);
51123
51131
  "number",
51124
51132
  "percentage",
51125
51133
  "percentile"
51126
- ].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return CommandResult.MinBiggerThanMax;
51127
- return CommandResult.Success;
51134
+ ].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return "MinBiggerThanMax";
51135
+ return "Success";
51128
51136
  }
51129
51137
  checkMidBiggerThanMax(rule) {
51130
51138
  const midValue = rule.midpoint?.value;
@@ -51133,8 +51141,8 @@ stores.inject(MyMetaStore, storeInstance);
51133
51141
  "number",
51134
51142
  "percentage",
51135
51143
  "percentile"
51136
- ].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return CommandResult.MidBiggerThanMax;
51137
- return CommandResult.Success;
51144
+ ].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return "MidBiggerThanMax";
51145
+ return "Success";
51138
51146
  }
51139
51147
  checkMinBiggerThanMid(rule) {
51140
51148
  const minValue = rule.minimum.value;
@@ -51143,15 +51151,15 @@ stores.inject(MyMetaStore, storeInstance);
51143
51151
  "number",
51144
51152
  "percentage",
51145
51153
  "percentile"
51146
- ].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return CommandResult.MinBiggerThanMid;
51147
- return CommandResult.Success;
51154
+ ].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return "MinBiggerThanMid";
51155
+ return "Success";
51148
51156
  }
51149
51157
  checkCFValues(rule) {
51150
51158
  for (const value of rule.values) {
51151
51159
  if (!value.startsWith("=")) continue;
51152
- if (CompiledFormula.IsBadExpression(value)) return CommandResult.ValueCellIsInvalidFormula;
51160
+ if (CompiledFormula.IsBadExpression(value)) return "ValueCellIsInvalidFormula";
51153
51161
  }
51154
- return CommandResult.Success;
51162
+ return "Success";
51155
51163
  }
51156
51164
  removeConditionalFormatting(id, sheet) {
51157
51165
  const cfIndex = this.cfRules[sheet].findIndex((s) => s.id === id);
@@ -51226,15 +51234,15 @@ stores.inject(MyMetaStore, storeInstance);
51226
51234
  allowDispatch(cmd) {
51227
51235
  switch (cmd.type) {
51228
51236
  case "ADD_DATA_VALIDATION_RULE":
51229
- if (!this.getters.tryGetSheet(cmd.sheetId)) return CommandResult.InvalidSheetId;
51230
- if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return CommandResult.InvalidSheetId;
51237
+ if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
51238
+ if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
51231
51239
  return this.checkValidations(cmd, this.chainValidations(this.checkEmptyRange, this.checkValidRange, this.checkCriterionTypeIsValid, this.checkCriterionHasValidNumberOfValues, this.checkCriterionValuesAreValid));
51232
51240
  case "REMOVE_DATA_VALIDATION_RULE":
51233
- if (!this.getters.tryGetSheet(cmd.sheetId)) return CommandResult.InvalidSheetId;
51234
- if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return CommandResult.UnknownDataValidationRule;
51241
+ if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
51242
+ if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return "UnknownDataValidationRule";
51235
51243
  break;
51236
51244
  }
51237
- return CommandResult.Success;
51245
+ return "Success";
51238
51246
  }
51239
51247
  handle(cmd) {
51240
51248
  switch (cmd.type) {
@@ -51344,7 +51352,7 @@ stores.inject(MyMetaStore, storeInstance);
51344
51352
  }
51345
51353
  }
51346
51354
  checkEmptyRange(cmd) {
51347
- return cmd.ranges.length ? CommandResult.Success : CommandResult.EmptyRange;
51355
+ return cmd.ranges.length ? "Success" : "EmptyRange";
51348
51356
  }
51349
51357
  import(data) {
51350
51358
  for (const sheet of data.sheets) {
@@ -51387,13 +51395,13 @@ stores.inject(MyMetaStore, storeInstance);
51387
51395
  }
51388
51396
  }
51389
51397
  checkCriterionTypeIsValid(cmd) {
51390
- return criterionEvaluatorRegistry.contains(cmd.rule.criterion.type) ? CommandResult.Success : CommandResult.UnknownDataValidationCriterionType;
51398
+ return criterionEvaluatorRegistry.contains(cmd.rule.criterion.type) ? "Success" : "UnknownDataValidationCriterionType";
51391
51399
  }
51392
51400
  checkCriterionHasValidNumberOfValues(cmd) {
51393
51401
  const criterion = cmd.rule.criterion;
51394
51402
  const expectedNumberOfValues = criterionEvaluatorRegistry.get(criterion.type).numberOfValues(criterion);
51395
- if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return CommandResult.InvalidNumberOfCriterionValues;
51396
- return CommandResult.Success;
51403
+ if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return "InvalidNumberOfCriterionValues";
51404
+ return "Success";
51397
51405
  }
51398
51406
  checkCriterionValuesAreValid(cmd) {
51399
51407
  const criterion = cmd.rule.criterion;
@@ -51403,12 +51411,12 @@ stores.inject(MyMetaStore, storeInstance);
51403
51411
  if (value.startsWith("=")) return evaluator.allowedValues === "onlyLiterals" || CompiledFormula.IsBadExpression(value);
51404
51412
  return !evaluator.isCriterionValueValid(value);
51405
51413
  };
51406
- if (criterion.values.some(isInvalid)) return CommandResult.InvalidDataValidationCriterionValue;
51407
- return CommandResult.Success;
51414
+ if (criterion.values.some(isInvalid)) return "InvalidDataValidationCriterionValue";
51415
+ return "Success";
51408
51416
  }
51409
51417
  checkValidRange(cmd) {
51410
- if (cmd.ranges.map((range) => this.getters.getRangeFromRangeData(range)).map((range) => this.getters.getRangeString(range, cmd.sheetId)).some((xc) => !this.getters.isRangeValid(xc))) return CommandResult.InvalidRange;
51411
- return CommandResult.Success;
51418
+ if (cmd.ranges.map((range) => this.getters.getRangeFromRangeData(range)).map((range) => this.getters.getRangeString(range, cmd.sheetId)).some((xc) => !this.getters.isRangeValid(xc))) return "InvalidRange";
51419
+ return "Success";
51412
51420
  }
51413
51421
  };
51414
51422
 
@@ -51464,7 +51472,7 @@ stores.inject(MyMetaStore, storeInstance);
51464
51472
  case "CREATE_FIGURE": return this.checkValidations(cmd, this.checkFigureDuplicate, this.checkFigureAnchorOffset);
51465
51473
  case "UPDATE_FIGURE": return this.checkValidations(cmd, this.checkFigureExists, this.checkFigureAnchorOffset);
51466
51474
  case "DELETE_FIGURE": return this.checkFigureExists(cmd);
51467
- default: return CommandResult.Success;
51475
+ default: return "Success";
51468
51476
  }
51469
51477
  }
51470
51478
  beforeHandle(cmd) {
@@ -51633,16 +51641,16 @@ stores.inject(MyMetaStore, storeInstance);
51633
51641
  this.history.update("figures", sheetId, id, void 0);
51634
51642
  }
51635
51643
  checkFigureExists(cmd) {
51636
- if (this.figures[cmd.sheetId]?.[cmd.figureId] === void 0) return CommandResult.FigureDoesNotExist;
51637
- return CommandResult.Success;
51644
+ if (this.figures[cmd.sheetId]?.[cmd.figureId] === void 0) return "FigureDoesNotExist";
51645
+ return "Success";
51638
51646
  }
51639
51647
  checkFigureDuplicate(cmd) {
51640
- if (Object.values(this.figures).find((sheet) => sheet?.[cmd.figureId])) return CommandResult.DuplicatedFigureId;
51641
- return CommandResult.Success;
51648
+ if (Object.values(this.figures).find((sheet) => sheet?.[cmd.figureId])) return "DuplicatedFigureId";
51649
+ return "Success";
51642
51650
  }
51643
51651
  checkFigureAnchorOffset(cmd) {
51644
- if (cmd.col < 0 || cmd.row < 0 || cmd.offset && (cmd.offset.x < 0 || cmd.offset.y < 0)) return CommandResult.WrongSheetPosition;
51645
- return CommandResult.Success;
51652
+ if (cmd.col < 0 || cmd.row < 0 || cmd.offset && (cmd.offset.x < 0 || cmd.offset.y < 0)) return "WrongSheetPosition";
51653
+ return "Success";
51646
51654
  }
51647
51655
  getFigures(sheetId) {
51648
51656
  const figures = [];
@@ -51693,28 +51701,28 @@ stores.inject(MyMetaStore, storeInstance);
51693
51701
  switch (cmd.type) {
51694
51702
  case "GROUP_HEADERS": {
51695
51703
  const { start, end, sheetId } = cmd;
51696
- if (!this.getters.tryGetSheet(sheetId)) return CommandResult.InvalidSheetId;
51697
- if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return CommandResult.InvalidHeaderGroupStartEnd;
51698
- if (start > end) return CommandResult.InvalidHeaderGroupStartEnd;
51699
- if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return CommandResult.HeaderGroupAlreadyExists;
51704
+ if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
51705
+ if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
51706
+ if (start > end) return "InvalidHeaderGroupStartEnd";
51707
+ if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return "HeaderGroupAlreadyExists";
51700
51708
  break;
51701
51709
  }
51702
51710
  case "UNGROUP_HEADERS": {
51703
51711
  const { start, end, sheetId } = cmd;
51704
- if (!this.getters.tryGetSheet(sheetId)) return CommandResult.InvalidSheetId;
51705
- if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return CommandResult.InvalidHeaderGroupStartEnd;
51706
- if (start > end) return CommandResult.InvalidHeaderGroupStartEnd;
51712
+ if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
51713
+ if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
51714
+ if (start > end) return "InvalidHeaderGroupStartEnd";
51707
51715
  break;
51708
51716
  }
51709
51717
  case "UNFOLD_HEADER_GROUP":
51710
51718
  case "FOLD_HEADER_GROUP":
51711
- if (!this.getters.tryGetSheet(cmd.sheetId)) return CommandResult.InvalidSheetId;
51719
+ if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
51712
51720
  const group = this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, cmd.start, cmd.end);
51713
- if (!group) return CommandResult.UnknownHeaderGroup;
51714
- 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;
51721
+ if (!group) return "UnknownHeaderGroup";
51722
+ 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";
51715
51723
  break;
51716
51724
  }
51717
- return CommandResult.Success;
51725
+ return "Success";
51718
51726
  }
51719
51727
  handle(cmd) {
51720
51728
  switch (cmd.type) {
@@ -52122,19 +52130,19 @@ stores.inject(MyMetaStore, storeInstance);
52122
52130
  allowDispatch(cmd) {
52123
52131
  switch (cmd.type) {
52124
52132
  case "HIDE_COLUMNS_ROWS": {
52125
- if (!this.getters.tryGetSheet(cmd.sheetId)) return CommandResult.InvalidSheetId;
52133
+ if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
52126
52134
  const hiddenGroup = cmd.dimension === "COL" ? this.getHiddenColsGroups(cmd.sheetId) : this.getHiddenRowsGroups(cmd.sheetId);
52127
52135
  const elements = cmd.dimension === "COL" ? this.getters.getNumberCols(cmd.sheetId) : this.getters.getNumberRows(cmd.sheetId);
52128
- if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return CommandResult.TooManyHiddenElements;
52129
- else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return CommandResult.InvalidHeaderIndex;
52130
- else return CommandResult.Success;
52136
+ if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return "TooManyHiddenElements";
52137
+ else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return "InvalidHeaderIndex";
52138
+ else return "Success";
52131
52139
  }
52132
52140
  case "REMOVE_COLUMNS_ROWS":
52133
- if (!this.getters.tryGetSheet(cmd.sheetId)) return CommandResult.InvalidSheetId;
52134
- if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return CommandResult.NotEnoughElements;
52135
- return CommandResult.Success;
52141
+ if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
52142
+ if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
52143
+ return "Success";
52136
52144
  }
52137
- return CommandResult.Success;
52145
+ return "Success";
52138
52146
  }
52139
52147
  handle(cmd) {
52140
52148
  switch (cmd.type) {
@@ -52262,9 +52270,9 @@ stores.inject(MyMetaStore, storeInstance);
52262
52270
  allowDispatch(cmd) {
52263
52271
  switch (cmd.type) {
52264
52272
  case "CREATE_IMAGE":
52265
- if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return CommandResult.InvalidFigureId;
52266
- return CommandResult.Success;
52267
- default: return CommandResult.Success;
52273
+ if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "InvalidFigureId";
52274
+ return "Success";
52275
+ default: return "Success";
52268
52276
  }
52269
52277
  }
52270
52278
  handle(cmd) {
@@ -52388,7 +52396,7 @@ stores.inject(MyMetaStore, storeInstance);
52388
52396
  return this.checkValidations(cmd, this.checkDestructiveMerge, this.checkOverlap, this.checkFrozenPanes);
52389
52397
  case "UPDATE_CELL": return this.checkMergedContentUpdate(cmd);
52390
52398
  case "REMOVE_MERGE": return this.checkMergeExists(cmd);
52391
- default: return CommandResult.Success;
52399
+ default: return "Success";
52392
52400
  }
52393
52401
  }
52394
52402
  handle(cmd) {
@@ -52549,18 +52557,18 @@ stores.inject(MyMetaStore, storeInstance);
52549
52557
  return range !== void 0 ? rangeToMerge(mergeId, range) : void 0;
52550
52558
  }
52551
52559
  checkDestructiveMerge({ sheetId, target }) {
52552
- if (!this.getters.tryGetSheet(sheetId)) return CommandResult.Success;
52553
- return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ? CommandResult.MergeIsDestructive : CommandResult.Success;
52560
+ if (!this.getters.tryGetSheet(sheetId)) return "Success";
52561
+ return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ? "MergeIsDestructive" : "Success";
52554
52562
  }
52555
52563
  checkOverlap({ target }) {
52556
- for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return CommandResult.MergeOverlap;
52557
- return CommandResult.Success;
52564
+ for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return "MergeOverlap";
52565
+ return "Success";
52558
52566
  }
52559
52567
  checkFrozenPanes({ sheetId, target }) {
52560
- if (!this.getters.tryGetSheet(sheetId)) return CommandResult.Success;
52568
+ if (!this.getters.tryGetSheet(sheetId)) return "Success";
52561
52569
  const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
52562
- if (doesAnyZoneCrossFrozenPane(target, xSplit, ySplit)) return CommandResult.FrozenPaneOverlap;
52563
- return CommandResult.Success;
52570
+ if (doesAnyZoneCrossFrozenPane(target, xSplit, ySplit)) return "FrozenPaneOverlap";
52571
+ return "Success";
52564
52572
  }
52565
52573
  /**
52566
52574
  * The content of a merged cell should always be empty.
@@ -52568,10 +52576,10 @@ stores.inject(MyMetaStore, storeInstance);
52568
52576
  */
52569
52577
  checkMergedContentUpdate(cmd) {
52570
52578
  const { col, row, content } = cmd;
52571
- if (content === void 0) return CommandResult.Success;
52579
+ if (content === void 0) return "Success";
52572
52580
  const { col: mainCol, row: mainRow } = this.getMainCellPosition(cmd);
52573
- if (mainCol === col && mainRow === row) return CommandResult.Success;
52574
- return CommandResult.CellIsMerged;
52581
+ if (mainCol === col && mainRow === row) return "Success";
52582
+ return "CellIsMerged";
52575
52583
  }
52576
52584
  checkMergeExists(cmd) {
52577
52585
  const { sheetId, target } = cmd;
@@ -52582,9 +52590,9 @@ stores.inject(MyMetaStore, storeInstance);
52582
52590
  col: left,
52583
52591
  row: top
52584
52592
  });
52585
- if (merge === void 0 || !isEqual(zone, merge)) return CommandResult.InvalidTarget;
52593
+ if (merge === void 0 || !isEqual(zone, merge)) return "InvalidTarget";
52586
52594
  }
52587
- return CommandResult.Success;
52595
+ return "Success";
52588
52596
  }
52589
52597
  /**
52590
52598
  * Merge the current selection. Note that:
@@ -52749,10 +52757,10 @@ stores.inject(MyMetaStore, storeInstance);
52749
52757
  allowDispatch(cmd) {
52750
52758
  switch (cmd.type) {
52751
52759
  case "CREATE_NAMED_RANGE": return this.checkValidNewNamedRangeName(cmd.name);
52752
- case "UPDATE_NAMED_RANGE": return this.checkValidations(cmd, () => this.checkNamedRangeExists(cmd.oldRangeName), () => cmd.newRangeName !== cmd.oldRangeName ? this.checkValidNewNamedRangeName(cmd.newRangeName) : CommandResult.Success);
52760
+ case "UPDATE_NAMED_RANGE": return this.checkValidations(cmd, () => this.checkNamedRangeExists(cmd.oldRangeName), () => cmd.newRangeName !== cmd.oldRangeName ? this.checkValidNewNamedRangeName(cmd.newRangeName) : "Success");
52753
52761
  case "DELETE_NAMED_RANGE": return this.checkNamedRangeExists(cmd.name);
52754
52762
  }
52755
- return CommandResult.Success;
52763
+ return "Success";
52756
52764
  }
52757
52765
  handle(cmd) {
52758
52766
  switch (cmd.type) {
@@ -52816,14 +52824,14 @@ stores.inject(MyMetaStore, storeInstance);
52816
52824
  }
52817
52825
  }
52818
52826
  checkValidNewNamedRangeName(name) {
52819
- if (this.getNamedRange(name)) return CommandResult.NamedRangeNameAlreadyExists;
52820
- if (!validNamedRangeNameRegex.test(name) || isNumber(name, DEFAULT_LOCALE) || ["TRUE", "FALSE"].includes(name.toUpperCase())) return CommandResult.NamedRangeInvalidName;
52821
- if (rangeReference.test(name)) return CommandResult.NamedRangeNameLooksLikeCellReference;
52822
- return CommandResult.Success;
52827
+ if (this.getNamedRange(name)) return "NamedRangeNameAlreadyExists";
52828
+ if (!validNamedRangeNameRegex.test(name) || isNumber(name, DEFAULT_LOCALE) || ["TRUE", "FALSE"].includes(name.toUpperCase())) return "NamedRangeInvalidName";
52829
+ if (rangeReference.test(name)) return "NamedRangeNameLooksLikeCellReference";
52830
+ return "Success";
52823
52831
  }
52824
52832
  checkNamedRangeExists(name) {
52825
- if (!this.getNamedRange(name)) return CommandResult.NamedRangeNotFound;
52826
- return CommandResult.Success;
52833
+ if (!this.getNamedRange(name)) return "NamedRangeNotFound";
52834
+ return "Success";
52827
52835
  }
52828
52836
  };
52829
52837
 
@@ -52848,25 +52856,25 @@ stores.inject(MyMetaStore, storeInstance);
52848
52856
  allowDispatch(cmd) {
52849
52857
  switch (cmd.type) {
52850
52858
  case "ADD_PIVOT":
52851
- if (cmd.pivotId in this.pivots) return CommandResult.PivotIdTaken;
52859
+ if (cmd.pivotId in this.pivots) return "PivotIdTaken";
52852
52860
  return this.checkValidations(cmd.pivot, this.checkDuplicatedMeasureIds, this.checkSortedColumnInMeasures, this.checkCustomFieldsAreValid);
52853
52861
  case "UPDATE_PIVOT":
52854
- if (!(cmd.pivotId in this.pivots)) return CommandResult.PivotIdNotFound;
52855
- if (deepEquals(cmd.pivot, this.pivots[cmd.pivotId]?.definition)) return CommandResult.NoChanges;
52856
- if (cmd.pivot.name === "") return CommandResult.EmptyName;
52862
+ if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
52863
+ if (deepEquals(cmd.pivot, this.pivots[cmd.pivotId]?.definition)) return "NoChanges";
52864
+ if (cmd.pivot.name === "") return "EmptyName";
52857
52865
  return this.checkValidations(cmd.pivot, this.checkDuplicatedMeasureIds, this.checkSortedColumnInMeasures, this.checkCustomFieldsAreValid);
52858
52866
  case "RENAME_PIVOT":
52859
- if (!(cmd.pivotId in this.pivots)) return CommandResult.PivotIdNotFound;
52860
- if (cmd.name === "") return CommandResult.EmptyName;
52867
+ if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
52868
+ if (cmd.name === "") return "EmptyName";
52861
52869
  break;
52862
52870
  case "REMOVE_PIVOT":
52863
52871
  case "DUPLICATE_PIVOT":
52864
52872
  case "INSERT_PIVOT":
52865
- if (!(cmd.pivotId in this.pivots)) return CommandResult.PivotIdNotFound;
52873
+ if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
52866
52874
  break;
52867
- case "DUPLICATE_PIVOT": if (!(cmd.pivotId in this.pivots)) return CommandResult.PivotIdNotFound;
52875
+ case "DUPLICATE_PIVOT": if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
52868
52876
  }
52869
- return CommandResult.Success;
52877
+ return "Success";
52870
52878
  }
52871
52879
  handle(cmd) {
52872
52880
  switch (cmd.type) {
@@ -53063,13 +53071,13 @@ stores.inject(MyMetaStore, storeInstance);
53063
53071
  }
53064
53072
  checkSortedColumnInMeasures(definition) {
53065
53073
  const measures = definition.measures.map((measure) => measure.id);
53066
- if (definition.sortedColumn && !measures.includes(definition.sortedColumn.measure)) return CommandResult.InvalidDefinition;
53067
- return CommandResult.Success;
53074
+ if (definition.sortedColumn && !measures.includes(definition.sortedColumn.measure)) return "InvalidDefinition";
53075
+ return "Success";
53068
53076
  }
53069
53077
  checkDuplicatedMeasureIds(definition) {
53070
53078
  const uniqueIds = new Set(definition.measures.map((m) => m.id));
53071
- if (definition.measures.length !== uniqueIds.size) return CommandResult.InvalidDefinition;
53072
- return CommandResult.Success;
53079
+ if (definition.measures.length !== uniqueIds.size) return "InvalidDefinition";
53080
+ return "Success";
53073
53081
  }
53074
53082
  checkCustomFieldsAreValid(definition) {
53075
53083
  for (const customFieldName in definition.customFields) {
@@ -53078,15 +53086,15 @@ stores.inject(MyMetaStore, storeInstance);
53078
53086
  const groupNames = /* @__PURE__ */ new Set();
53079
53087
  let hasOtherGroup = false;
53080
53088
  for (const group of customField.groups) {
53081
- if (!group.name || groupNames.has(group.name)) return CommandResult.InvalidPivotCustomField;
53082
- if (group.values.some((value) => groupedValues.has(value))) return CommandResult.InvalidPivotCustomField;
53083
- if (group.isOtherGroup && hasOtherGroup) return CommandResult.InvalidPivotCustomField;
53089
+ if (!group.name || groupNames.has(group.name)) return "InvalidPivotCustomField";
53090
+ if (group.values.some((value) => groupedValues.has(value))) return "InvalidPivotCustomField";
53091
+ if (group.isOtherGroup && hasOtherGroup) return "InvalidPivotCustomField";
53084
53092
  group.values.forEach((value) => groupedValues.add(value));
53085
53093
  groupNames.add(group.name);
53086
53094
  hasOtherGroup ||= !!group.isOtherGroup;
53087
53095
  }
53088
53096
  }
53089
- return CommandResult.Success;
53097
+ return "Success";
53090
53098
  }
53091
53099
  /**
53092
53100
  * Import the pivots
@@ -53115,9 +53123,9 @@ stores.inject(MyMetaStore, storeInstance);
53115
53123
  locale = DEFAULT_LOCALE;
53116
53124
  allowDispatch(cmd) {
53117
53125
  switch (cmd.type) {
53118
- case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ? CommandResult.Success : CommandResult.InvalidLocale;
53126
+ case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ? "Success" : "InvalidLocale";
53119
53127
  }
53120
- return CommandResult.Success;
53128
+ return "Success";
53121
53129
  }
53122
53130
  handle(cmd) {
53123
53131
  switch (cmd.type) {
@@ -53198,7 +53206,7 @@ stores.inject(MyMetaStore, storeInstance);
53198
53206
  cellPosition = {};
53199
53207
  allowDispatch(cmd) {
53200
53208
  const genericChecks = this.chainValidations(this.checkSheetExists, this.checkZonesAreInSheet)(cmd);
53201
- if (genericChecks !== CommandResult.Success) return genericChecks;
53209
+ if (genericChecks !== "Success") return genericChecks;
53202
53210
  let sheetNameMissing = false;
53203
53211
  switch (cmd.type) {
53204
53212
  case "CREATE_SHEET":
@@ -53214,37 +53222,37 @@ stores.inject(MyMetaStore, storeInstance);
53214
53222
  if (sheetNameMissing) console.warn("Deprecation Warning: Sheet name is missing in the command %s payload.", cmd.type);
53215
53223
  switch (cmd.type) {
53216
53224
  case "HIDE_SHEET":
53217
- if (this.getVisibleSheetIds().length === 1) return CommandResult.NotEnoughSheets;
53218
- return CommandResult.Success;
53225
+ if (this.getVisibleSheetIds().length === 1) return "NotEnoughSheets";
53226
+ return "Success";
53219
53227
  case "CREATE_SHEET": return this.checkValidations(cmd, this.createSheetHasName, this.checkSheetName, this.checkSheetPosition);
53220
53228
  case "DUPLICATE_SHEET":
53221
- if (this.sheets[cmd.sheetIdTo]) return CommandResult.DuplicatedSheetId;
53222
- if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return CommandResult.DuplicatedSheetName;
53223
- return CommandResult.Success;
53229
+ if (this.sheets[cmd.sheetIdTo]) return "DuplicatedSheetId";
53230
+ if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return "DuplicatedSheetName";
53231
+ return "Success";
53224
53232
  case "MOVE_SHEET": try {
53225
53233
  const currentIndex = this.orderedSheetIds.findIndex((id) => id === cmd.sheetId);
53226
53234
  this.findIndexOfTargetSheet(currentIndex, cmd.delta);
53227
- return CommandResult.Success;
53235
+ return "Success";
53228
53236
  } catch (e) {
53229
- return CommandResult.WrongSheetMove;
53237
+ return "WrongSheetMove";
53230
53238
  }
53231
53239
  case "RENAME_SHEET": return this.isRenameAllowed(cmd);
53232
- case "COLOR_SHEET": return !cmd.color || isColorValid(cmd.color) ? CommandResult.Success : CommandResult.InvalidColor;
53233
- case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ? CommandResult.Success : CommandResult.NotEnoughSheets;
53240
+ case "COLOR_SHEET": return !cmd.color || isColorValid(cmd.color) ? "Success" : "InvalidColor";
53241
+ case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ? "Success" : "NotEnoughSheets";
53234
53242
  case "ADD_COLUMNS_ROWS":
53235
- if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return CommandResult.InvalidHeaderIndex;
53236
- else if (cmd.quantity <= 0) return CommandResult.InvalidQuantity;
53237
- return CommandResult.Success;
53243
+ if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return "InvalidHeaderIndex";
53244
+ else if (cmd.quantity <= 0) return "InvalidQuantity";
53245
+ return "Success";
53238
53246
  case "REMOVE_COLUMNS_ROWS": {
53239
53247
  const min = largeMin(cmd.elements);
53240
53248
  const max = largeMax(cmd.elements);
53241
- if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return CommandResult.InvalidHeaderIndex;
53242
- else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return CommandResult.NotEnoughElements;
53243
- else return CommandResult.Success;
53249
+ if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return "InvalidHeaderIndex";
53250
+ else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
53251
+ else return "Success";
53244
53252
  }
53245
53253
  case "FREEZE_ROWS": return this.checkValidations(cmd, this.checkRowFreezeQuantity, this.checkRowFreezeOverlapMerge);
53246
53254
  case "FREEZE_COLUMNS": return this.checkValidations(cmd, this.checkColFreezeQuantity, this.checkColFreezeOverlapMerge);
53247
- default: return CommandResult.Success;
53255
+ default: return "Success";
53248
53256
  }
53249
53257
  }
53250
53258
  handle(cmd) {
@@ -53519,12 +53527,12 @@ stores.inject(MyMetaStore, storeInstance);
53519
53527
  * not outside the sheet.
53520
53528
  */
53521
53529
  checkZonesExistInSheet(sheetId, zones) {
53522
- if (!zones.every(isZoneValid)) return CommandResult.InvalidRange;
53530
+ if (!zones.every(isZoneValid)) return "InvalidRange";
53523
53531
  if (zones.length) {
53524
53532
  const sheetZone = this.getSheetZone(sheetId);
53525
- return zones.every((zone) => isZoneInside(zone, sheetZone)) ? CommandResult.Success : CommandResult.TargetOutOfSheet;
53533
+ return zones.every((zone) => isZoneInside(zone, sheetZone)) ? "Success" : "TargetOutOfSheet";
53526
53534
  }
53527
- return CommandResult.Success;
53535
+ return "Success";
53528
53536
  }
53529
53537
  updateCellPosition(cmd) {
53530
53538
  const { sheetId, cellId, col, row } = cmd;
@@ -53598,42 +53606,42 @@ stores.inject(MyMetaStore, storeInstance);
53598
53606
  throw new Error("There is not enough visible sheets");
53599
53607
  }
53600
53608
  createSheetHasName(cmd) {
53601
- if (cmd.name !== void 0 && !cmd.name.trim()) return CommandResult.MissingSheetName;
53602
- return CommandResult.Success;
53609
+ if (cmd.name !== void 0 && !cmd.name.trim()) return "MissingSheetName";
53610
+ return "Success";
53603
53611
  }
53604
53612
  checkSheetName(cmd) {
53605
53613
  const originalSheetName = this.getters.tryGetSheetName(cmd.sheetId);
53606
53614
  const sheetName = cmd.type === "RENAME_SHEET" ? cmd.newName : cmd.name;
53607
- if (originalSheetName !== void 0 && sheetName === originalSheetName) return CommandResult.UnchangedSheetName;
53615
+ if (originalSheetName !== void 0 && sheetName === originalSheetName) return "UnchangedSheetName";
53608
53616
  const { orderedSheetIds, sheets } = this;
53609
53617
  const name = sheetName && sheetName.trim().toLowerCase();
53610
- if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return CommandResult.DuplicatedSheetName;
53611
- if (FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX.test(name)) return CommandResult.ForbiddenCharactersInSheetName;
53612
- return CommandResult.Success;
53618
+ if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return "DuplicatedSheetName";
53619
+ if (FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX.test(name)) return "ForbiddenCharactersInSheetName";
53620
+ return "Success";
53613
53621
  }
53614
53622
  checkSheetPosition(cmd) {
53615
53623
  const { orderedSheetIds } = this;
53616
- if (cmd.position > orderedSheetIds.length || cmd.position < 0) return CommandResult.WrongSheetPosition;
53617
- return CommandResult.Success;
53624
+ if (cmd.position > orderedSheetIds.length || cmd.position < 0) return "WrongSheetPosition";
53625
+ return "Success";
53618
53626
  }
53619
53627
  checkRowFreezeQuantity(cmd) {
53620
- return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ? CommandResult.Success : CommandResult.InvalidFreezeQuantity;
53628
+ return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
53621
53629
  }
53622
53630
  checkColFreezeQuantity(cmd) {
53623
- return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ? CommandResult.Success : CommandResult.InvalidFreezeQuantity;
53631
+ return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
53624
53632
  }
53625
53633
  checkRowFreezeOverlapMerge(cmd) {
53626
53634
  const merges = this.getters.getMerges(cmd.sheetId);
53627
- for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return CommandResult.MergeOverlap;
53628
- return CommandResult.Success;
53635
+ for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return "MergeOverlap";
53636
+ return "Success";
53629
53637
  }
53630
53638
  checkColFreezeOverlapMerge(cmd) {
53631
53639
  const merges = this.getters.getMerges(cmd.sheetId);
53632
- for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return CommandResult.MergeOverlap;
53633
- return CommandResult.Success;
53640
+ for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return "MergeOverlap";
53641
+ return "Success";
53634
53642
  }
53635
53643
  isRenameAllowed(cmd) {
53636
- if (!(cmd.newName && cmd.newName.trim().toLowerCase())) return CommandResult.MissingSheetName;
53644
+ if (!(cmd.newName && cmd.newName.trim().toLowerCase())) return "MissingSheetName";
53637
53645
  return this.checkSheetName(cmd);
53638
53646
  }
53639
53647
  renameSheet(sheet, name) {
@@ -53856,19 +53864,19 @@ stores.inject(MyMetaStore, storeInstance);
53856
53864
  * sheet.
53857
53865
  */
53858
53866
  checkSheetExists(cmd) {
53859
- if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return CommandResult.InvalidSheetId;
53860
- else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return CommandResult.DuplicatedSheetId;
53861
- return CommandResult.Success;
53867
+ if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return "InvalidSheetId";
53868
+ else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return "DuplicatedSheetId";
53869
+ return "Success";
53862
53870
  }
53863
53871
  /**
53864
53872
  * Check if zones in the command are well formed and
53865
53873
  * not outside the sheet.
53866
53874
  */
53867
53875
  checkZonesAreInSheet(cmd) {
53868
- if (isRangeDependant(cmd) && cmd.ranges.length === 0) return CommandResult.EmptyRange;
53869
- if (!("sheetId" in cmd)) return CommandResult.Success;
53870
- if ("ranges" in cmd && cmd.ranges.some((rangeData) => rangeData._sheetId !== "" && !this.getters.tryGetSheet(rangeData._sheetId))) return CommandResult.InvalidSheetId;
53871
- if (isTargetDependent(cmd) && cmd.target.length === 0) return CommandResult.EmptyTarget;
53876
+ if (isRangeDependant(cmd) && cmd.ranges.length === 0) return "EmptyRange";
53877
+ if (!("sheetId" in cmd)) return "Success";
53878
+ if ("ranges" in cmd && cmd.ranges.some((rangeData) => rangeData._sheetId !== "" && !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
53879
+ if (isTargetDependent(cmd) && cmd.target.length === 0) return "EmptyTarget";
53872
53880
  return this.checkZonesExistInSheet(cmd.sheetId, this.getCommandZones(cmd));
53873
53881
  }
53874
53882
  };
@@ -53883,15 +53891,15 @@ stores.inject(MyMetaStore, storeInstance);
53883
53891
  const definition = cmd.pivot;
53884
53892
  return this.checkDataSetValidity(definition);
53885
53893
  }
53886
- return CommandResult.Success;
53894
+ return "Success";
53887
53895
  }
53888
53896
  checkDataSetValidity(definition) {
53889
53897
  if (definition.type === "SPREADSHEET" && definition.dataSet) {
53890
53898
  const { zone, sheetId } = definition.dataSet;
53891
- if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) return CommandResult.InvalidDataSet;
53899
+ if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) return "InvalidDataSet";
53892
53900
  return this.getters.checkZonesExistInSheet(sheetId, [zone]);
53893
53901
  }
53894
- return CommandResult.Success;
53902
+ return "Success";
53895
53903
  }
53896
53904
  };
53897
53905
 
@@ -53909,18 +53917,18 @@ stores.inject(MyMetaStore, storeInstance);
53909
53917
  switch (cmd.type) {
53910
53918
  case "CREATE_TABLE":
53911
53919
  case "UPDATE_TABLE":
53912
- if (cmd.config?.styleId && !this.styles[cmd.config.styleId]) return CommandResult.InvalidTableConfig;
53920
+ if (cmd.config?.styleId && !this.styles[cmd.config.styleId]) return "InvalidTableConfig";
53913
53921
  break;
53914
53922
  case "CREATE_TABLE_STYLE":
53915
- if (!TABLE_STYLES_TEMPLATES[cmd.templateName]) return CommandResult.InvalidTableStyle;
53923
+ if (!TABLE_STYLES_TEMPLATES[cmd.templateName]) return "InvalidTableStyle";
53916
53924
  try {
53917
53925
  toHex(cmd.primaryColor);
53918
53926
  } catch (e) {
53919
- return CommandResult.InvalidTableStyle;
53927
+ return "InvalidTableStyle";
53920
53928
  }
53921
53929
  break;
53922
53930
  }
53923
- return CommandResult.Success;
53931
+ return "Success";
53924
53932
  }
53925
53933
  handle(cmd) {
53926
53934
  switch (cmd.type) {
@@ -53991,21 +53999,21 @@ stores.inject(MyMetaStore, storeInstance);
53991
53999
  allowDispatch(cmd) {
53992
54000
  switch (cmd.type) {
53993
54001
  case "CREATE_TABLE":
53994
- if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId) || rangeData._sheetId !== cmd.sheetId)) return CommandResult.InvalidSheetId;
54002
+ if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId) || rangeData._sheetId !== cmd.sheetId)) return "InvalidSheetId";
53995
54003
  const zones = cmd.ranges.map((rangeData) => this.getters.getRangeFromRangeData(rangeData).zone);
53996
- if (!areZonesContinuous(zones)) return CommandResult.NonContinuousTargets;
53997
- return this.checkValidations(cmd, (cmd) => this.getTablesOverlappingZones(cmd.sheetId, zones).length ? CommandResult.TableOverlap : CommandResult.Success, (cmd) => this.checkTableConfigUpdateIsValid(cmd.config));
54004
+ if (!areZonesContinuous(zones)) return "NonContinuousTargets";
54005
+ return this.checkValidations(cmd, (cmd) => this.getTablesOverlappingZones(cmd.sheetId, zones).length ? "TableOverlap" : "Success", (cmd) => this.checkTableConfigUpdateIsValid(cmd.config));
53998
54006
  case "UPDATE_TABLE":
53999
- if (!this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone)) return CommandResult.TableNotFound;
54007
+ if (!this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone)) return "TableNotFound";
54000
54008
  return this.checkValidations(cmd, this.checkUpdatedTableZoneIsValid, (cmd) => this.checkTableConfigUpdateIsValid(cmd.config));
54001
54009
  case "ADD_MERGE":
54002
54010
  for (const table of this.getCoreTables(cmd.sheetId)) {
54003
54011
  const tableZone = table.range.zone;
54004
- for (const merge of cmd.target) if (overlap(tableZone, merge)) return CommandResult.MergeInTable;
54012
+ for (const merge of cmd.target) if (overlap(tableZone, merge)) return "MergeInTable";
54005
54013
  }
54006
54014
  break;
54007
54015
  }
54008
- return CommandResult.Success;
54016
+ return "Success";
54009
54017
  }
54010
54018
  handle(cmd) {
54011
54019
  switch (cmd.type) {
@@ -54139,19 +54147,19 @@ stores.inject(MyMetaStore, storeInstance);
54139
54147
  }
54140
54148
  }
54141
54149
  checkUpdatedTableZoneIsValid(cmd) {
54142
- if (!cmd.newTableRange) return CommandResult.Success;
54150
+ if (!cmd.newTableRange) return "Success";
54143
54151
  const newTableZone = this.getters.getRangeFromRangeData(cmd.newTableRange).zone;
54144
54152
  const zoneIsInSheet = this.getters.checkZonesExistInSheet(cmd.sheetId, [newTableZone]);
54145
- if (zoneIsInSheet !== CommandResult.Success) return zoneIsInSheet;
54153
+ if (zoneIsInSheet !== "Success") return zoneIsInSheet;
54146
54154
  const updatedTable = this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone);
54147
- if (!updatedTable) return CommandResult.TableNotFound;
54148
- return this.getTablesOverlappingZones(cmd.sheetId, [newTableZone]).filter((table) => table.id !== updatedTable.id).length ? CommandResult.TableOverlap : CommandResult.Success;
54155
+ if (!updatedTable) return "TableNotFound";
54156
+ return this.getTablesOverlappingZones(cmd.sheetId, [newTableZone]).filter((table) => table.id !== updatedTable.id).length ? "TableOverlap" : "Success";
54149
54157
  }
54150
54158
  checkTableConfigUpdateIsValid(config) {
54151
- if (!config) return CommandResult.Success;
54152
- if (config.numberOfHeaders !== void 0 && config.numberOfHeaders < 0) return CommandResult.InvalidTableConfig;
54153
- if (config.hasFilters && config.numberOfHeaders === 0) return CommandResult.InvalidTableConfig;
54154
- return CommandResult.Success;
54159
+ if (!config) return "Success";
54160
+ if (config.numberOfHeaders !== void 0 && config.numberOfHeaders < 0) return "InvalidTableConfig";
54161
+ if (config.hasFilters && config.numberOfHeaders === 0) return "InvalidTableConfig";
54162
+ return "Success";
54155
54163
  }
54156
54164
  createStaticTable(id, type, tableRange, config, filters) {
54157
54165
  const zone = tableRange.zone;
@@ -54391,6 +54399,8 @@ stores.inject(MyMetaStore, storeInstance);
54391
54399
  return new CompilationParametersBuilder(context, getters, computeCell).getParameters();
54392
54400
  }
54393
54401
  var CompilationParametersBuilder = class {
54402
+ getters;
54403
+ computeCell;
54394
54404
  evalContext;
54395
54405
  rangeCache = {};
54396
54406
  constructor(context, getters, computeCell) {
@@ -54482,6 +54492,9 @@ stores.inject(MyMetaStore, storeInstance);
54482
54492
  //#endregion
54483
54493
  //#region src/plugins/ui_core_views/cell_evaluation/interval_tree.ts
54484
54494
  var IntervalNode = class {
54495
+ interval;
54496
+ left;
54497
+ right;
54485
54498
  /**
54486
54499
  * Augmented value: the highest 'bottom' boundary in this subtree.
54487
54500
  * Allows O(log n) pruning during overlap searches.
@@ -55382,6 +55395,7 @@ stores.inject(MyMetaStore, storeInstance);
55382
55395
  const MAX_ITERATION = 30;
55383
55396
  const EMPTY_CELL = Object.freeze(createEvaluatedCell({ value: null }));
55384
55397
  var Evaluator = class {
55398
+ context;
55385
55399
  getters;
55386
55400
  compilationParams;
55387
55401
  evaluatedCells = new PositionMap();
@@ -55400,7 +55414,7 @@ stores.inject(MyMetaStore, storeInstance);
55400
55414
  const spreadZone = this.spreadingRelations.getArrayResultZone(position);
55401
55415
  if (!spreadZone) return;
55402
55416
  const evaluatedCell = this.evaluatedCells.get(position);
55403
- if (evaluatedCell?.type === CellValueType.error && !(options.ignoreSpillError && evaluatedCell?.value === CellErrorType.SpilledBlocked)) return positionToZone(position);
55417
+ if (evaluatedCell?.type === "error" && !(options.ignoreSpillError && evaluatedCell?.value === CellErrorType.SpilledBlocked)) return positionToZone(position);
55404
55418
  return union(positionToZone(position), spreadZone);
55405
55419
  }
55406
55420
  getEvaluatedPositions() {
@@ -55410,7 +55424,7 @@ stores.inject(MyMetaStore, storeInstance);
55410
55424
  return this.evaluatedCells.keysForSheet(sheetId);
55411
55425
  }
55412
55426
  getArrayFormulaSpreadingOn(position) {
55413
- if (this.getEvaluatedCell(position).type === CellValueType.empty) return;
55427
+ if (this.getEvaluatedCell(position).type === "empty") return;
55414
55428
  return this.spreadingRelations.searchFormulaPositionsSpreadingOn(position.sheetId, positionToZone(position)).find((position) => !this.blockedArrayFormulas.has(position));
55415
55429
  }
55416
55430
  isArrayFormulaSpillBlocked(position) {
@@ -55607,7 +55621,7 @@ stores.inject(MyMetaStore, storeInstance);
55607
55621
  const formulaReturn = updateEvalContextAndExecute(cellData.compiledFormula, this.compilationParams, formulaPosition.sheetId, this.buildSafeGetSymbolValue(), formulaPosition);
55608
55622
  if (!isMatrix(formulaReturn)) {
55609
55623
  const evaluatedCell = createEvaluatedCell(validateNumberValue(formulaReturn), this.getters.getLocale(), formulaPosition, cellData);
55610
- if (evaluatedCell.type === CellValueType.error) evaluatedCell.errorOriginPosition = formulaReturn.errorOriginPosition ?? formulaPosition;
55624
+ if (evaluatedCell.type === "error") evaluatedCell.errorOriginPosition = formulaReturn.errorOriginPosition ?? formulaPosition;
55611
55625
  return evaluatedCell;
55612
55626
  }
55613
55627
  this.assertSheetHasEnoughSpaceToSpreadFormulaResult(formulaPosition, formulaReturn);
@@ -55668,7 +55682,7 @@ stores.inject(MyMetaStore, storeInstance);
55668
55682
  row: j + row
55669
55683
  };
55670
55684
  const rawCell = this.getters.getCell(position);
55671
- if (rawCell?.isFormula || rawCell?.content || this.getters.getEvaluatedCell(position).type !== CellValueType.empty) {
55685
+ if (rawCell?.isFormula || rawCell?.content || this.getters.getEvaluatedCell(position).type !== "empty") {
55672
55686
  this.blockedArrayFormulas.add(formulaPosition);
55673
55687
  throw new SplillBlockedError(_t("Array result was not expanded because it would overwrite data."), position);
55674
55688
  }
@@ -55685,7 +55699,7 @@ stores.inject(MyMetaStore, storeInstance);
55685
55699
  };
55686
55700
  const cell = this.getters.getCell(position);
55687
55701
  const evaluatedCell = createEvaluatedCell(validateNumberValue(matrixResult[i][j]), this.getters.getLocale(), position, cell);
55688
- if (evaluatedCell.type === CellValueType.error) evaluatedCell.errorOriginPosition = matrixResult[i][j].errorOriginPosition ?? position;
55702
+ if (evaluatedCell.type === "error") evaluatedCell.errorOriginPosition = matrixResult[i][j].errorOriginPosition ?? position;
55689
55703
  this.evaluatedCells.set(position, evaluatedCell);
55690
55704
  };
55691
55705
  return spreadValues;
@@ -55889,7 +55903,7 @@ stores.inject(MyMetaStore, storeInstance);
55889
55903
  sheetId,
55890
55904
  col,
55891
55905
  row
55892
- })).every((cell) => cell.type === CellValueType.empty);
55906
+ })).every((cell) => cell.type === "empty");
55893
55907
  }
55894
55908
  /**
55895
55909
  * Maps the visible positions of a range according to a provided callback
@@ -56842,7 +56856,7 @@ stores.inject(MyMetaStore, storeInstance);
56842
56856
  }
56843
56857
  parsePoint(sheetId, range, threshold, functionName) {
56844
56858
  const zone = this.getters.getRangeFromSheetXC(sheetId, range).zone;
56845
- const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => cell.type === CellValueType.number).map((cell) => cell.value);
56859
+ const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => cell.type === "number").map((cell) => cell.value);
56846
56860
  switch (threshold.type) {
56847
56861
  case "value": return functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
56848
56862
  case "number": return Number(threshold.value);
@@ -56873,7 +56887,7 @@ stores.inject(MyMetaStore, storeInstance);
56873
56887
  col,
56874
56888
  row
56875
56889
  });
56876
- if (cell.type !== CellValueType.number) continue;
56890
+ if (cell.type !== "number") continue;
56877
56891
  const icon = this.computeIcon(cell.value, upperInflectionPoint, rule.upperInflectionPoint.operator, lowerInflectionPoint, rule.lowerInflectionPoint.operator, iconSet);
56878
56892
  if (!computedIcons[col]) computedIcons[col] = [];
56879
56893
  computedIcons[col][row] = icon;
@@ -56886,7 +56900,7 @@ stores.inject(MyMetaStore, storeInstance);
56886
56900
  }
56887
56901
  applyDataBar(sheetId, range, rule, computedDataBars) {
56888
56902
  const rangeValues = this.getters.getRangeFromSheetXC(sheetId, rule.rangeValues || range);
56889
- const max = largeMax(this.getters.getEvaluatedCellsInZone(sheetId, rangeValues.zone).filter((cell) => cell.type === CellValueType.number).map((cell) => cell.value));
56903
+ const max = largeMax(this.getters.getEvaluatedCellsInZone(sheetId, rangeValues.zone).filter((cell) => cell.type === "number").map((cell) => cell.value));
56890
56904
  if (max <= 0) return;
56891
56905
  const color = rule.color;
56892
56906
  const zone = this.getters.getRangeFromSheetXC(sheetId, range).zone;
@@ -56899,7 +56913,7 @@ stores.inject(MyMetaStore, storeInstance);
56899
56913
  col: targetCol,
56900
56914
  row: targetRow
56901
56915
  });
56902
- if (!isInside(targetCol, targetRow, zoneOfValues) || cell.type !== CellValueType.number || cell.value <= 0) continue;
56916
+ if (!isInside(targetCol, targetRow, zoneOfValues) || cell.type !== "number" || cell.value <= 0) continue;
56903
56917
  if (!computedDataBars[col]) computedDataBars[col] = [];
56904
56918
  computedDataBars[col][row] = {
56905
56919
  color: colorNumberToHex(color),
@@ -56933,7 +56947,7 @@ stores.inject(MyMetaStore, storeInstance);
56933
56947
  col,
56934
56948
  row
56935
56949
  });
56936
- if (cell.type === CellValueType.number) {
56950
+ if (cell.type === "number") {
56937
56951
  const value = clip(cell.value, minValue, maxValue);
56938
56952
  if (!computedStyle[col]) computedStyle[col] = [];
56939
56953
  computedStyle[col][row] = computedStyle[col]?.[row] || {};
@@ -56943,7 +56957,7 @@ stores.inject(MyMetaStore, storeInstance);
56943
56957
  }
56944
56958
  getRuleResultForTarget(target, rule, preComputedCriterion) {
56945
56959
  const cell = this.getters.getEvaluatedCell(target);
56946
- if (cell.type === CellValueType.error) return false;
56960
+ if (cell.type === "error") return false;
56947
56961
  const { sheetId } = target;
56948
56962
  const evaluator = criterionEvaluatorRegistry.get(rule.operator);
56949
56963
  const evaluatedCriterionValues = rule.values.map((value) => {
@@ -57089,7 +57103,7 @@ stores.inject(MyMetaStore, storeInstance);
57089
57103
  if (!validationResults[col]) validationResults[col] = [];
57090
57104
  validationResults[col][row] = lazy(() => {
57091
57105
  const evaluatedCell = this.getters.getEvaluatedCell(cellPosition);
57092
- if (evaluatedCell.type === CellValueType.empty) return VALID_RESULT;
57106
+ if (evaluatedCell.type === "empty") return VALID_RESULT;
57093
57107
  return this.getValidationResultForCellValue(evaluatedCell.value, cellPosition);
57094
57108
  });
57095
57109
  }
@@ -58031,7 +58045,7 @@ stores.inject(MyMetaStore, storeInstance);
58031
58045
  const result = [];
58032
58046
  for (const cellId of this.getters.getCellsWithTrackedFormula("PIVOT")) {
58033
58047
  const position = this.getters.getCellPosition(cellId);
58034
- if (this.getters.getEvaluatedCell(position).type === CellValueType.error) continue;
58048
+ if (this.getters.getEvaluatedCell(position).type === "error") continue;
58035
58049
  const pivotInfo = this.getPivotStyleAtPosition(position);
58036
58050
  if (pivotInfo) result.push({
58037
58051
  position,
@@ -58063,6 +58077,8 @@ stores.inject(MyMetaStore, storeInstance);
58063
58077
  //#endregion
58064
58078
  //#region src/clipboard_handlers/abstract_clipboard_handler.ts
58065
58079
  var ClipboardHandler = class {
58080
+ getters;
58081
+ dispatch;
58066
58082
  constructor(getters, dispatch) {
58067
58083
  this.getters = getters;
58068
58084
  this.dispatch = dispatch;
@@ -58070,10 +58086,10 @@ stores.inject(MyMetaStore, storeInstance);
58070
58086
  copy(data, isCutOperation, mode = "copyPaste") {}
58071
58087
  paste(target, clippedContent, options) {}
58072
58088
  isPasteAllowed(sheetId, target, content, option) {
58073
- return CommandResult.Success;
58089
+ return "Success";
58074
58090
  }
58075
58091
  isCutAllowed(data) {
58076
- return CommandResult.Success;
58092
+ return "Success";
58077
58093
  }
58078
58094
  getPasteTarget(sheetId, target, content, options) {
58079
58095
  return {
@@ -58099,8 +58115,8 @@ stores.inject(MyMetaStore, storeInstance);
58099
58115
  //#region src/clipboard_handlers/cell_clipboard.ts
58100
58116
  var CellClipboardHandler = class extends AbstractCellClipboardHandler {
58101
58117
  isCutAllowed(data) {
58102
- if (data.zones.length !== 1) return CommandResult.WrongCutSelection;
58103
- return CommandResult.Success;
58118
+ if (data.zones.length !== 1) return "WrongCutSelection";
58119
+ return "Success";
58104
58120
  }
58105
58121
  copy(data, isCutOperation, mode = "copyPaste") {
58106
58122
  const sheetId = data.sheetId;
@@ -58165,17 +58181,17 @@ stores.inject(MyMetaStore, storeInstance);
58165
58181
  };
58166
58182
  }
58167
58183
  isPasteAllowed(sheetId, target, content, clipboardOptions) {
58168
- if (!content.cells) return CommandResult.Success;
58169
- if (clipboardOptions?.isCutOperation && clipboardOptions?.pasteOption !== void 0) return CommandResult.WrongPasteOption;
58184
+ if (!content.cells) return "Success";
58185
+ if (clipboardOptions?.isCutOperation && clipboardOptions?.pasteOption !== void 0) return "WrongPasteOption";
58170
58186
  if (target.length > 1) {
58171
- if (content.cells.length > 1 || content.cells[0].length > 1) return CommandResult.WrongPasteSelection;
58187
+ if (content.cells.length > 1 || content.cells[0].length > 1) return "WrongPasteSelection";
58172
58188
  }
58173
58189
  const clipboardHeight = content.cells.length;
58174
58190
  const clipboardWidth = content.cells[0].length;
58175
58191
  for (const zone of getPasteZones(target, content.cells)) if (this.getters.doesIntersectMerge(sheetId, zone)) {
58176
- if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return CommandResult.WillRemoveExistingMerge;
58192
+ if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return "WillRemoveExistingMerge";
58177
58193
  }
58178
- return CommandResult.Success;
58194
+ return "Success";
58179
58195
  }
58180
58196
  /**
58181
58197
  * Paste the clipboard content in the given target
@@ -58324,7 +58340,7 @@ stores.inject(MyMetaStore, storeInstance);
58324
58340
  switch (cmd.type) {
58325
58341
  case "REMOVE_DUPLICATES": return this.checkValidations(cmd, this.chainValidations(this.checkSingleRangeSelected, this.checkNoMergeInZone, this.checkRangeContainsValues, this.checkColumnsIncludedInZone), this.chainValidations(this.checkNoColumnProvided, this.checkColumnsAreUnique));
58326
58342
  }
58327
- return CommandResult.Success;
58343
+ return "Success";
58328
58344
  }
58329
58345
  handle(cmd) {
58330
58346
  switch (cmd.type) {
@@ -58407,34 +58423,34 @@ stores.inject(MyMetaStore, storeInstance);
58407
58423
  });
58408
58424
  }
58409
58425
  checkSingleRangeSelected() {
58410
- if (this.getters.getSelectedZones().length !== 1) return CommandResult.MoreThanOneRangeSelected;
58411
- return CommandResult.Success;
58426
+ if (this.getters.getSelectedZones().length !== 1) return "MoreThanOneRangeSelected";
58427
+ return "Success";
58412
58428
  }
58413
58429
  checkNoMergeInZone() {
58414
58430
  const sheetId = this.getters.getActiveSheetId();
58415
58431
  const zone = this.getters.getSelectedZone();
58416
- if (this.getters.getMergesInZone(sheetId, zone).length > 0) return CommandResult.WillRemoveExistingMerge;
58417
- return CommandResult.Success;
58432
+ if (this.getters.getMergesInZone(sheetId, zone).length > 0) return "WillRemoveExistingMerge";
58433
+ return "Success";
58418
58434
  }
58419
58435
  checkRangeContainsValues(cmd) {
58420
58436
  const sheetId = this.getters.getActiveSheetId();
58421
58437
  const zone = this.getters.getSelectedZone();
58422
58438
  if (cmd.hasHeader) zone.top += 1;
58423
- if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return CommandResult.EmptySelectedRange;
58424
- return CommandResult.Success;
58439
+ if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return "EmptySelectedRange";
58440
+ return "Success";
58425
58441
  }
58426
58442
  checkNoColumnProvided(cmd) {
58427
- if (cmd.columns.length === 0) return CommandResult.NoColumnsProvided;
58428
- return CommandResult.Success;
58443
+ if (cmd.columns.length === 0) return "NoColumnsProvided";
58444
+ return "Success";
58429
58445
  }
58430
58446
  checkColumnsIncludedInZone(cmd) {
58431
58447
  const zone = this.getters.getSelectedZone();
58432
- if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return CommandResult.ColumnsNotIncludedInZone;
58433
- return CommandResult.Success;
58448
+ if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return "ColumnsNotIncludedInZone";
58449
+ return "Success";
58434
58450
  }
58435
58451
  checkColumnsAreUnique(cmd) {
58436
- if (cmd.columns.length !== new Set(cmd.columns).size) return CommandResult.DuplicatesColumnsSelected;
58437
- return CommandResult.Success;
58452
+ if (cmd.columns.length !== new Set(cmd.columns).size) return "DuplicatesColumnsSelected";
58453
+ return "Success";
58438
58454
  }
58439
58455
  trimWhitespace() {
58440
58456
  const zones = recomputeZones(this.getters.getSelectedZones());
@@ -58552,19 +58568,19 @@ stores.inject(MyMetaStore, storeInstance);
58552
58568
  let x = 0;
58553
58569
  let y = 0;
58554
58570
  switch (direction) {
58555
- case DIRECTION.UP:
58571
+ case "up":
58556
58572
  x = 0;
58557
58573
  y = -rule.current;
58558
58574
  break;
58559
- case DIRECTION.DOWN:
58575
+ case "down":
58560
58576
  x = 0;
58561
58577
  y = rule.current;
58562
58578
  break;
58563
- case DIRECTION.LEFT:
58579
+ case "left":
58564
58580
  x = -rule.current;
58565
58581
  y = 0;
58566
58582
  break;
58567
- case DIRECTION.RIGHT:
58583
+ case "right":
58568
58584
  x = rule.current;
58569
58585
  y = 0;
58570
58586
  break;
@@ -58691,11 +58707,11 @@ stores.inject(MyMetaStore, storeInstance);
58691
58707
  },
58692
58708
  sequence: 10
58693
58709
  }).add("increment_alphanumeric_value", {
58694
- condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === CellValueType.text && alphaNumericValueRegExp.test(cell.content),
58710
+ condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "text" && alphaNumericValueRegExp.test(cell.content),
58695
58711
  generateRule: (cell, cells, direction) => {
58696
58712
  const numberPostfix = parseInt(cell.content.match(numberPostfixRegExp)[0]);
58697
58713
  const prefix = cell.content.match(stringPrefixRegExp)[0];
58698
- 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) => (cell.value ?? "").toString().match(numberPostfixRegExp)[0]);
58714
+ const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "text" && alphaNumericValueRegExp.test(evaluatedCell.value)).filter((cell) => prefix === (cell.value ?? "").toString().match(stringPrefixRegExp)[0]).map((cell) => (cell.value ?? "").toString().match(numberPostfixRegExp)[0]);
58699
58715
  const mostLeadingZeros = group.reduce((candidate, current) => {
58700
58716
  const currentLength = current.match(leadingZerosRegex)[0].length;
58701
58717
  return currentLength > candidate[1] ? [current, currentLength] : candidate;
@@ -58713,7 +58729,7 @@ stores.inject(MyMetaStore, storeInstance);
58713
58729
  },
58714
58730
  sequence: 15
58715
58731
  }).add("copy_text", {
58716
- condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === CellValueType.text,
58732
+ condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "text",
58717
58733
  generateRule: () => {
58718
58734
  return { type: "COPY_MODIFIER" };
58719
58735
  },
@@ -58730,10 +58746,10 @@ stores.inject(MyMetaStore, storeInstance);
58730
58746
  sequence: 30
58731
58747
  }).add("increment_dates", {
58732
58748
  condition: (cell, cells) => {
58733
- return !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === CellValueType.number && !!cell.format && isDateTimeFormat(cell.format);
58749
+ return !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "number" && !!cell.format && isDateTimeFormat(cell.format);
58734
58750
  },
58735
58751
  generateRule: (cell, cells) => {
58736
- const increment = calculateDateIncrementBasedOnGroup(getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === CellValueType.number && !!evaluatedCell.format && isDateTimeFormat(evaluatedCell.format)).map((cell) => Number(cell.value)));
58752
+ const increment = calculateDateIncrementBasedOnGroup(getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number" && !!evaluatedCell.format && isDateTimeFormat(evaluatedCell.format)).map((cell) => Number(cell.value)));
58737
58753
  if (increment === void 0) return { type: "COPY_MODIFIER" };
58738
58754
  /** requires to detect the current date (requires to be an integer value with the right format)
58739
58755
  * detect if year or if month or if day then extrapolate increment required (+1 month, +1 year + 1 day)
@@ -58742,26 +58758,26 @@ stores.inject(MyMetaStore, storeInstance);
58742
58758
  if (typeof increment === "object") return {
58743
58759
  type: "DATE_INCREMENT_MODIFIER",
58744
58760
  increment,
58745
- current: evaluation.type === CellValueType.number ? evaluation.value : 0
58761
+ current: evaluation.type === "number" ? evaluation.value : 0
58746
58762
  };
58747
58763
  return {
58748
58764
  type: "INCREMENT_MODIFIER",
58749
58765
  increment,
58750
- current: evaluation.type === CellValueType.number ? evaluation.value : 0
58766
+ current: evaluation.type === "number" ? evaluation.value : 0
58751
58767
  };
58752
58768
  },
58753
58769
  sequence: 25
58754
58770
  }).add("increment_number", {
58755
- condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === CellValueType.number,
58771
+ condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "number",
58756
58772
  generateRule: (cell, cells, direction) => {
58757
- const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === CellValueType.number && !isDateTimeFormat(evaluatedCell.format || "")).map((cell) => Number(cell.value));
58773
+ const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number" && !isDateTimeFormat(evaluatedCell.format || "")).map((cell) => Number(cell.value));
58758
58774
  let increment = calculateIncrementBasedOnGroup(group);
58759
58775
  if (["up", "left"].includes(direction) && group.length === 1) increment = -increment;
58760
58776
  const evaluation = evaluateLiteral(cell, { locale: DEFAULT_LOCALE });
58761
58777
  return {
58762
58778
  type: "INCREMENT_MODIFIER",
58763
58779
  increment,
58764
- current: evaluation.type === CellValueType.number ? evaluation.value : 0
58780
+ current: evaluation.type === "number" ? evaluation.value : 0
58765
58781
  };
58766
58782
  },
58767
58783
  sequence: 40
@@ -58871,10 +58887,10 @@ stores.inject(MyMetaStore, storeInstance);
58871
58887
  const sheetId = this.getters.getActiveSheetId();
58872
58888
  this.lastCellSelected.col = cmd.col === -1 ? this.lastCellSelected.col : clip(cmd.col, 0, this.getters.getNumberCols(sheetId));
58873
58889
  this.lastCellSelected.row = cmd.row === -1 ? this.lastCellSelected.row : clip(cmd.row, 0, this.getters.getNumberRows(sheetId));
58874
- if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return CommandResult.Success;
58875
- return CommandResult.InvalidAutofillSelection;
58890
+ if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return "Success";
58891
+ return "InvalidAutofillSelection";
58876
58892
  }
58877
- return CommandResult.Success;
58893
+ return "Success";
58878
58894
  }
58879
58895
  handle(cmd) {
58880
58896
  switch (cmd.type) {
@@ -58906,7 +58922,7 @@ stores.inject(MyMetaStore, storeInstance);
58906
58922
  const target = this.autofillZone;
58907
58923
  const autofillCellsData = [];
58908
58924
  switch (this.direction) {
58909
- case DIRECTION.DOWN:
58925
+ case "down":
58910
58926
  for (let col = source.left; col <= source.right; col++) {
58911
58927
  const xcs = [];
58912
58928
  for (let row = source.top; row <= source.bottom; row++) xcs.push(toXC(col, row));
@@ -58914,7 +58930,7 @@ stores.inject(MyMetaStore, storeInstance);
58914
58930
  for (let row = target.top; row <= target.bottom; row++) autofillCellsData.push(this.computeNewCell(generator, col, row));
58915
58931
  }
58916
58932
  break;
58917
- case DIRECTION.UP:
58933
+ case "up":
58918
58934
  for (let col = source.left; col <= source.right; col++) {
58919
58935
  const xcs = [];
58920
58936
  for (let row = source.bottom; row >= source.top; row--) xcs.push(toXC(col, row));
@@ -58922,7 +58938,7 @@ stores.inject(MyMetaStore, storeInstance);
58922
58938
  for (let row = target.bottom; row >= target.top; row--) autofillCellsData.push(this.computeNewCell(generator, col, row));
58923
58939
  }
58924
58940
  break;
58925
- case DIRECTION.LEFT:
58941
+ case "left":
58926
58942
  for (let row = source.top; row <= source.bottom; row++) {
58927
58943
  const xcs = [];
58928
58944
  for (let col = source.right; col >= source.left; col--) xcs.push(toXC(col, row));
@@ -58930,7 +58946,7 @@ stores.inject(MyMetaStore, storeInstance);
58930
58946
  for (let col = target.right; col >= target.left; col--) autofillCellsData.push(this.computeNewCell(generator, col, row));
58931
58947
  }
58932
58948
  break;
58933
- case DIRECTION.RIGHT:
58949
+ case "right":
58934
58950
  for (let row = source.top; row <= source.bottom; row++) {
58935
58951
  const xcs = [];
58936
58952
  for (let col = source.left; col <= source.right; col++) xcs.push(toXC(col, row));
@@ -59056,19 +59072,19 @@ stores.inject(MyMetaStore, storeInstance);
59056
59072
  }
59057
59073
  this.direction = this.getDirection(col, row);
59058
59074
  switch (this.direction) {
59059
- case DIRECTION.UP:
59075
+ case "up":
59060
59076
  this.saveZone(row, source.top - 1, source.left, source.right);
59061
59077
  this.steps = source.top - row;
59062
59078
  break;
59063
- case DIRECTION.DOWN:
59079
+ case "down":
59064
59080
  this.saveZone(source.bottom + 1, row, source.left, source.right);
59065
59081
  this.steps = row - source.bottom;
59066
59082
  break;
59067
- case DIRECTION.LEFT:
59083
+ case "left":
59068
59084
  this.saveZone(source.top, source.bottom, col, source.left - 1);
59069
59085
  this.steps = source.left - col;
59070
59086
  break;
59071
- case DIRECTION.RIGHT:
59087
+ case "right":
59072
59088
  this.saveZone(source.top, source.bottom, source.right + 1, col);
59073
59089
  this.steps = col - source.right;
59074
59090
  break;
@@ -59087,7 +59103,7 @@ stores.inject(MyMetaStore, storeInstance);
59087
59103
  for (let row = selection.bottom + 1; row <= autofillRow; row++) if (this.getters.getEvaluatedCell({
59088
59104
  ...activePosition,
59089
59105
  row
59090
- }).type !== CellValueType.empty) {
59106
+ }).type !== "empty") {
59091
59107
  autofillRow = row - 1;
59092
59108
  break;
59093
59109
  }
@@ -59107,7 +59123,7 @@ stores.inject(MyMetaStore, storeInstance);
59107
59123
  col: col - 1,
59108
59124
  row
59109
59125
  };
59110
- while (this.getters.getEvaluatedCell(leftPosition).type !== CellValueType.empty) {
59126
+ while (this.getters.getEvaluatedCell(leftPosition).type !== "empty") {
59111
59127
  row += 1;
59112
59128
  leftPosition = {
59113
59129
  sheetId,
@@ -59124,7 +59140,7 @@ stores.inject(MyMetaStore, storeInstance);
59124
59140
  col: col + 1,
59125
59141
  row
59126
59142
  };
59127
- while (this.getters.getEvaluatedCell(rightPosition).type !== CellValueType.empty) {
59143
+ while (this.getters.getEvaluatedCell(rightPosition).type !== "empty") {
59128
59144
  row += 1;
59129
59145
  rightPosition = {
59130
59146
  sheetId,
@@ -59214,19 +59230,19 @@ stores.inject(MyMetaStore, storeInstance);
59214
59230
  const position = {
59215
59231
  up: {
59216
59232
  number: source.top - row,
59217
- value: DIRECTION.UP
59233
+ value: "up"
59218
59234
  },
59219
59235
  down: {
59220
59236
  number: row - source.bottom,
59221
- value: DIRECTION.DOWN
59237
+ value: "down"
59222
59238
  },
59223
59239
  left: {
59224
59240
  number: source.left - col,
59225
- value: DIRECTION.LEFT
59241
+ value: "left"
59226
59242
  },
59227
59243
  right: {
59228
59244
  number: col - source.right,
59229
- value: DIRECTION.RIGHT
59245
+ value: "right"
59230
59246
  }
59231
59247
  };
59232
59248
  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;
@@ -59429,7 +59445,7 @@ stores.inject(MyMetaStore, storeInstance);
59429
59445
  return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
59430
59446
  }
59431
59447
  isNumber(cell) {
59432
- return cell.type === CellValueType.number && !(cell.format && isDateTimeFormat(cell.format));
59448
+ return cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format));
59433
59449
  }
59434
59450
  isZoneValid(zone) {
59435
59451
  return zone.bottom >= zone.top && zone.right >= zone.left;
@@ -60492,6 +60508,8 @@ stores.inject(MyMetaStore, storeInstance);
60492
60508
  //#endregion
60493
60509
  //#region src/collaborative/revisions.ts
60494
60510
  var Revision = class {
60511
+ rootCommand;
60512
+ timestamp;
60495
60513
  id;
60496
60514
  clientId;
60497
60515
  _commands = [];
@@ -60528,6 +60546,10 @@ stores.inject(MyMetaStore, storeInstance);
60528
60546
  //#region src/collaborative/session.ts
60529
60547
  var ClientDisconnectedError = class extends Error {};
60530
60548
  var Session = class extends EventBus {
60549
+ revisions;
60550
+ transportService;
60551
+ serverRevisionId;
60552
+ commandSquisher;
60531
60553
  /**
60532
60554
  * Positions of the others client.
60533
60555
  */
@@ -60994,7 +61016,7 @@ stores.inject(MyMetaStore, storeInstance);
60994
61016
  ...position,
60995
61017
  content: "FALSE"
60996
61018
  });
60997
- else if ((cell?.isFormula || cell?.content) && evaluatedCell.type === CellValueType.empty) {
61019
+ else if ((cell?.isFormula || cell?.content) && evaluatedCell.type === "empty") {
60998
61020
  let value;
60999
61021
  if (cell.isFormula) {
61000
61022
  const result = this.getters.evaluateCompiledFormula(position.sheetId, cell.compiledFormula);
@@ -61004,7 +61026,7 @@ stores.inject(MyMetaStore, storeInstance);
61004
61026
  ...position,
61005
61027
  content: "FALSE"
61006
61028
  });
61007
- } else if (evaluatedCell.type !== CellValueType.boolean) this.dispatch("UPDATE_CELL", {
61029
+ } else if (evaluatedCell.type !== "boolean") this.dispatch("UPDATE_CELL", {
61008
61030
  ...position,
61009
61031
  content: "FALSE"
61010
61032
  });
@@ -61131,7 +61153,7 @@ stores.inject(MyMetaStore, storeInstance);
61131
61153
  getCellNumberFormat(position) {
61132
61154
  for (const pos of [position]) {
61133
61155
  const cell = this.getters.getEvaluatedCell(pos);
61134
- if (cell.type === CellValueType.number && !(cell.format && isDateTimeFormat(cell.format))) return cell.format || createDefaultFormat(cell.value);
61156
+ if (cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format))) return cell.format || createDefaultFormat(cell.value);
61135
61157
  }
61136
61158
  }
61137
61159
  };
@@ -61299,11 +61321,11 @@ stores.inject(MyMetaStore, storeInstance);
61299
61321
  allowDispatch(cmd) {
61300
61322
  switch (cmd.type) {
61301
61323
  case "DUPLICATE_PIVOT_IN_NEW_SHEET":
61302
- if (!this.getters.isExistingPivot(cmd.pivotId)) return CommandResult.PivotIdNotFound;
61303
- if (!this.getters.getPivot(cmd.pivotId).isValid()) return CommandResult.PivotInError;
61324
+ if (!this.getters.isExistingPivot(cmd.pivotId)) return "PivotIdNotFound";
61325
+ if (!this.getters.getPivot(cmd.pivotId).isValid()) return "PivotInError";
61304
61326
  break;
61305
61327
  }
61306
- return CommandResult.Success;
61328
+ return "Success";
61307
61329
  }
61308
61330
  handle(cmd) {
61309
61331
  switch (cmd.type) {
@@ -61566,13 +61588,13 @@ stores.inject(MyMetaStore, storeInstance);
61566
61588
  allowDispatch(cmd) {
61567
61589
  switch (cmd.type) {
61568
61590
  case "REQUEST_UNDO":
61569
- if (!this.canUndo()) return CommandResult.EmptyUndoStack;
61591
+ if (!this.canUndo()) return "EmptyUndoStack";
61570
61592
  break;
61571
61593
  case "REQUEST_REDO":
61572
- if (!this.canRedo()) return CommandResult.EmptyRedoStack;
61594
+ if (!this.canRedo()) return "EmptyRedoStack";
61573
61595
  break;
61574
61596
  }
61575
- return CommandResult.Success;
61597
+ return "Success";
61576
61598
  }
61577
61599
  handle(cmd) {
61578
61600
  switch (cmd.type) {
@@ -61636,9 +61658,9 @@ stores.inject(MyMetaStore, storeInstance);
61636
61658
  * to other users and can do any operation and can do core modifications that will only affect them
61637
61659
  * It is acceptable to bypass the locked sheet restriction in this case
61638
61660
  */
61639
- if (lockedSheetAllowedCommands.has(cmd.type) || this.getters.isDashboard()) return CommandResult.Success;
61640
- if ("sheetId" in cmd && this.getters.isSheetLocked(cmd.sheetId) || !isCoreCommand(cmd) && this.isCurrentSheetLocked()) return CommandResult.SheetLocked;
61641
- return CommandResult.Success;
61661
+ if (lockedSheetAllowedCommands.has(cmd.type) || this.getters.isDashboard()) return "Success";
61662
+ if ("sheetId" in cmd && this.getters.isSheetLocked(cmd.sheetId) || !isCoreCommand(cmd) && this.isCurrentSheetLocked()) return "SheetLocked";
61663
+ return "Success";
61642
61664
  }
61643
61665
  isCurrentSheetLocked() {
61644
61666
  return this.getters.isSheetLocked(this.getters.getActiveSheetId());
@@ -61703,18 +61725,18 @@ stores.inject(MyMetaStore, storeInstance);
61703
61725
  //#endregion
61704
61726
  //#region src/helpers/sort.ts
61705
61727
  const SORT_TYPES = [
61706
- CellValueType.number,
61707
- CellValueType.error,
61708
- CellValueType.text,
61709
- CellValueType.boolean
61728
+ "number",
61729
+ "error",
61730
+ "text",
61731
+ "boolean"
61710
61732
  ];
61711
61733
  function cellsSortingCriterion(sortingOrder) {
61712
61734
  const inverse = sortingOrder === "asc" ? 1 : -1;
61713
61735
  return (left, right) => {
61714
- if (left.type === CellValueType.empty) return right.type === CellValueType.empty ? 0 : 1;
61715
- else if (right.type === CellValueType.empty) return -1;
61736
+ if (left.type === "empty") return right.type === "empty" ? 0 : 1;
61737
+ else if (right.type === "empty") return -1;
61716
61738
  let typeOrder = SORT_TYPES.indexOf(left.type) - SORT_TYPES.indexOf(right.type);
61717
- if (typeOrder === 0) if (left.type === CellValueType.text || left.type === CellValueType.error) typeOrder = left.value.localeCompare(right.value);
61739
+ if (typeOrder === 0) if (left.type === "text" || left.type === "error") typeOrder = left.value.localeCompare(right.value);
61718
61740
  else typeOrder = left.value - right.value;
61719
61741
  return inverse * typeOrder;
61720
61742
  };
@@ -61725,9 +61747,9 @@ stores.inject(MyMetaStore, storeInstance);
61725
61747
  type: cell.type,
61726
61748
  value: cell.value
61727
61749
  }));
61728
- return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type === CellValueType.empty ? {
61750
+ return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type === "empty" ? {
61729
61751
  ...cell,
61730
- type: CellValueType.number,
61752
+ type: "number",
61731
61753
  value: 0
61732
61754
  } : cell) : cellsWithIndex).sort(cellsSortingCriterion(sortDirection));
61733
61755
  }
@@ -61738,10 +61760,10 @@ stores.inject(MyMetaStore, storeInstance);
61738
61760
  allowDispatch(cmd) {
61739
61761
  switch (cmd.type) {
61740
61762
  case "SORT_CELLS":
61741
- if (!isInside(cmd.col, cmd.row, cmd.zone)) return CommandResult.InvalidSortAnchor;
61763
+ if (!isInside(cmd.col, cmd.row, cmd.zone)) return "InvalidSortAnchor";
61742
61764
  return this.checkValidations(cmd, this.checkMerge, this.checkMergeSizes, this.checkArrayFormulaInSortZone);
61743
61765
  }
61744
- return CommandResult.Success;
61766
+ return "Success";
61745
61767
  }
61746
61768
  handle(cmd) {
61747
61769
  switch (cmd.type) {
@@ -61751,24 +61773,24 @@ stores.inject(MyMetaStore, storeInstance);
61751
61773
  }
61752
61774
  }
61753
61775
  checkMerge({ sheetId, zone }) {
61754
- if (!this.getters.doesIntersectMerge(sheetId, zone)) return CommandResult.Success;
61776
+ if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
61755
61777
  if (positions(zone).some(({ col, row }) => !this.getters.isInMerge({
61756
61778
  sheetId,
61757
61779
  col,
61758
61780
  row
61759
- }))) return CommandResult.InvalidSortZone;
61760
- return CommandResult.Success;
61781
+ }))) return "InvalidSortZone";
61782
+ return "Success";
61761
61783
  }
61762
61784
  checkMergeSizes({ sheetId, zone }) {
61763
- if (!this.getters.doesIntersectMerge(sheetId, zone)) return CommandResult.Success;
61785
+ if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
61764
61786
  const merges = this.getters.getMerges(sheetId).filter((merge) => overlap(merge, zone));
61765
61787
  const mergeDimension = zoneToDimension(merges[0]);
61766
61788
  const [widthFirst, heightFirst] = [mergeDimension.numberOfCols, mergeDimension.numberOfRows];
61767
61789
  if (!merges.every((merge) => {
61768
61790
  const [widthCurrent, heightCurrent] = [merge.right - merge.left + 1, merge.bottom - merge.top + 1];
61769
61791
  return widthCurrent === widthFirst && heightCurrent === heightFirst;
61770
- })) return CommandResult.InvalidSortZone;
61771
- return CommandResult.Success;
61792
+ })) return "InvalidSortZone";
61793
+ return "Success";
61772
61794
  }
61773
61795
  checkArrayFormulaInSortZone({ sheetId, zone }) {
61774
61796
  return positions(zone).some(({ col, row }) => {
@@ -61782,7 +61804,7 @@ stores.inject(MyMetaStore, storeInstance);
61782
61804
  col,
61783
61805
  row
61784
61806
  });
61785
- }) ? CommandResult.SortZoneWithArrayFormulas : CommandResult.Success;
61807
+ }) ? "SortZoneWithArrayFormulas" : "Success";
61786
61808
  }
61787
61809
  /**
61788
61810
  * This function evaluates if the top row of a provided zone can be considered as a `header`
@@ -61800,9 +61822,9 @@ stores.inject(MyMetaStore, storeInstance);
61800
61822
  col,
61801
61823
  row
61802
61824
  }).type));
61803
- if (cells[0][0] === CellValueType.empty) cells = cells.slice(1);
61804
- if (cells.some((item) => item[0] === CellValueType.empty)) return false;
61805
- else if (cells.some((item) => item[1] !== CellValueType.empty && item[0] !== item[1])) return true;
61825
+ if (cells[0][0] === "empty") cells = cells.slice(1);
61826
+ if (cells.some((item) => item[0] === "empty")) return false;
61827
+ else if (cells.some((item) => item[1] !== "empty" && item[0] !== item[1])) return true;
61806
61828
  else return false;
61807
61829
  }
61808
61830
  sortZone(sheetId, anchor, zone, sortDirection, options) {
@@ -61891,7 +61913,7 @@ stores.inject(MyMetaStore, storeInstance);
61891
61913
  switch (cmd.type) {
61892
61914
  case "SPLIT_TEXT_INTO_COLUMNS": return this.chainValidations(this.batchValidations(this.checkSingleColSelected, this.checkNonEmptySelector), this.batchValidations(this.checkNotOverwritingContent, this.checkSeparatorInSelection))(cmd);
61893
61915
  }
61894
- return CommandResult.Success;
61916
+ return "Success";
61895
61917
  }
61896
61918
  handle(cmd) {
61897
61919
  switch (cmd.type) {
@@ -61902,7 +61924,7 @@ stores.inject(MyMetaStore, storeInstance);
61902
61924
  }
61903
61925
  getAutomaticSeparator() {
61904
61926
  const cells = this.getters.getSelectedCells();
61905
- for (const cell of cells) if (cell.value && cell.type === CellValueType.text) {
61927
+ for (const cell of cells) if (cell.value && cell.type === "text") {
61906
61928
  const separator = this.getAutoSeparatorForString(cell.value);
61907
61929
  if (separator) return separator;
61908
61930
  }
@@ -62040,24 +62062,24 @@ stores.inject(MyMetaStore, storeInstance);
62040
62062
  });
62041
62063
  }
62042
62064
  checkSingleColSelected() {
62043
- if (!this.getters.isSingleColSelected()) return CommandResult.MoreThanOneColumnSelected;
62044
- return CommandResult.Success;
62065
+ if (!this.getters.isSingleColSelected()) return "MoreThanOneColumnSelected";
62066
+ return "Success";
62045
62067
  }
62046
62068
  checkNonEmptySelector(cmd) {
62047
- if (cmd.separator === "") return CommandResult.EmptySplitSeparator;
62048
- return CommandResult.Success;
62069
+ if (cmd.separator === "") return "EmptySplitSeparator";
62070
+ return "Success";
62049
62071
  }
62050
62072
  checkNotOverwritingContent(cmd) {
62051
- if (cmd.addNewColumns || cmd.force) return CommandResult.Success;
62073
+ if (cmd.addNewColumns || cmd.force) return "Success";
62052
62074
  const selection = this.getters.getSelectedZones()[0];
62053
62075
  const splitted = this.getSplittedCols(selection, cmd.separator);
62054
- if (this.willSplittedColsOverwriteContent(selection, splitted)) return CommandResult.SplitWillOverwriteContent;
62055
- return CommandResult.Success;
62076
+ if (this.willSplittedColsOverwriteContent(selection, splitted)) return "SplitWillOverwriteContent";
62077
+ return "Success";
62056
62078
  }
62057
62079
  checkSeparatorInSelection({ separator }) {
62058
62080
  const cells = this.getters.getSelectedCells();
62059
- for (const cell of cells) if (cell.formattedValue.includes(separator)) return CommandResult.Success;
62060
- return CommandResult.NoSplitSeparatorInSelection;
62081
+ for (const cell of cells) if (cell.formattedValue.includes(separator)) return "Success";
62082
+ return "NoSplitSeparatorInSelection";
62061
62083
  }
62062
62084
  };
62063
62085
 
@@ -62102,7 +62124,7 @@ stores.inject(MyMetaStore, storeInstance);
62102
62124
  col,
62103
62125
  row: r,
62104
62126
  sheetId
62105
- }).type !== CellValueType.empty) return;
62127
+ }).type !== "empty") return;
62106
62128
  }
62107
62129
  const oldSelection = {
62108
62130
  zone: this.getters.getSelectedZone(),
@@ -62131,13 +62153,13 @@ stores.inject(MyMetaStore, storeInstance);
62131
62153
  switch (cmd.type) {
62132
62154
  case "RESIZE_TABLE":
62133
62155
  const table = this.getters.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone);
62134
- if (!table) return CommandResult.TableNotFound;
62156
+ if (!table) return "TableNotFound";
62135
62157
  const oldTableZone = table.range.zone;
62136
62158
  const newTableZone = this.getters.getRangeFromRangeData(cmd.newTableRange).zone;
62137
- if (newTableZone.top !== oldTableZone.top || newTableZone.left !== oldTableZone.left) return CommandResult.InvalidTableResize;
62159
+ if (newTableZone.top !== oldTableZone.top || newTableZone.left !== oldTableZone.left) return "InvalidTableResize";
62138
62160
  return this.canDispatch("UPDATE_TABLE", { ...cmd }).reasons;
62139
62161
  }
62140
- return CommandResult.Success;
62162
+ return "Success";
62141
62163
  }
62142
62164
  handle(cmd) {
62143
62165
  switch (cmd.type) {
@@ -62365,7 +62387,7 @@ stores.inject(MyMetaStore, storeInstance);
62365
62387
  */
62366
62388
  isCellEmpty(position) {
62367
62389
  const mainPosition = this.getters.getMainCellPosition(position);
62368
- return this.getters.getEvaluatedCell(mainPosition).type === CellValueType.empty;
62390
+ return this.getters.getEvaluatedCell(mainPosition).type === "empty";
62369
62391
  }
62370
62392
  getColMaxWidth(sheetId, index) {
62371
62393
  const sizes = positions(this.getters.getColsZone(sheetId, index, index)).map((position) => this.getCellWidth({
@@ -62379,8 +62401,8 @@ stores.inject(MyMetaStore, storeInstance);
62379
62401
  * sheet.
62380
62402
  */
62381
62403
  checkSheetExists(cmd) {
62382
- if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0 && cmd.type !== "CREATE_SHEET") return CommandResult.InvalidSheetId;
62383
- return CommandResult.Success;
62404
+ if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0 && cmd.type !== "CREATE_SHEET") return "InvalidSheetId";
62405
+ return "Success";
62384
62406
  }
62385
62407
  /**
62386
62408
  * Check if zones in the command are well formed and
@@ -62388,11 +62410,11 @@ stores.inject(MyMetaStore, storeInstance);
62388
62410
  */
62389
62411
  checkZonesAreInSheet(cmd) {
62390
62412
  const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.tryGetActiveSheetId();
62391
- if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return CommandResult.InvalidSheetId;
62413
+ if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
62392
62414
  const zones = this.getters.getCommandZones(cmd);
62393
- if (!sheetId && zones.length > 0) return CommandResult.NoActiveSheet;
62415
+ if (!sheetId && zones.length > 0) return "NoActiveSheet";
62394
62416
  if (sheetId && zones.length > 0) return this.getters.checkZonesExistInSheet(sheetId, zones);
62395
- return CommandResult.Success;
62417
+ return "Success";
62396
62418
  }
62397
62419
  autoResizeRows(sheetId, rows) {
62398
62420
  const rowSizes = [];
@@ -62439,20 +62461,20 @@ stores.inject(MyMetaStore, storeInstance);
62439
62461
  allowDispatch(cmd) {
62440
62462
  switch (cmd.type) {
62441
62463
  case "ADD_FIGURE_CHART_TO_CAROUSEL":
62442
- if (!this.getters.doesCarouselExist(cmd.carouselFigureId) || this.getters.getFigure(cmd.sheetId, cmd.chartFigureId)?.tag !== "chart") return CommandResult.InvalidFigureId;
62443
- return CommandResult.Success;
62464
+ if (!this.getters.doesCarouselExist(cmd.carouselFigureId) || this.getters.getFigure(cmd.sheetId, cmd.chartFigureId)?.tag !== "chart") return "InvalidFigureId";
62465
+ return "Success";
62444
62466
  case "DUPLICATE_CAROUSEL_CHART":
62445
- if (!this.getters.doesCarouselExist(cmd.carouselId) || !this.getters.getCarousel(cmd.carouselId).items.some((item) => item.type === "chart" && item.chartId === cmd.chartId) || this.getters.getChart(cmd.duplicatedChartId)) return CommandResult.InvalidFigureId;
62446
- return CommandResult.Success;
62467
+ if (!this.getters.doesCarouselExist(cmd.carouselId) || !this.getters.getCarousel(cmd.carouselId).items.some((item) => item.type === "chart" && item.chartId === cmd.chartId) || this.getters.getChart(cmd.duplicatedChartId)) return "InvalidFigureId";
62468
+ return "Success";
62447
62469
  case "ADD_NEW_CHART_TO_CAROUSEL":
62448
- if (!this.getters.doesCarouselExist(cmd.figureId)) return CommandResult.InvalidFigureId;
62449
- return CommandResult.Success;
62470
+ if (!this.getters.doesCarouselExist(cmd.figureId)) return "InvalidFigureId";
62471
+ return "Success";
62450
62472
  case "UPDATE_CAROUSEL_ACTIVE_ITEM":
62451
- if (!this.getters.doesCarouselExist(cmd.figureId)) return CommandResult.InvalidFigureId;
62452
- else if (!this.getters.getCarousel(cmd.figureId).items.some((item) => deepEquals(item, cmd.item))) return CommandResult.InvalidCarouselItem;
62453
- return CommandResult.Success;
62473
+ if (!this.getters.doesCarouselExist(cmd.figureId)) return "InvalidFigureId";
62474
+ else if (!this.getters.getCarousel(cmd.figureId).items.some((item) => deepEquals(item, cmd.item))) return "InvalidCarouselItem";
62475
+ return "Success";
62454
62476
  }
62455
- return CommandResult.Success;
62477
+ return "Success";
62456
62478
  }
62457
62479
  handle(cmd) {
62458
62480
  switch (cmd.type) {
@@ -62689,7 +62711,7 @@ stores.inject(MyMetaStore, storeInstance);
62689
62711
  });
62690
62712
  }
62691
62713
  case "PASTE": {
62692
- if (!this.copiedData) return CommandResult.EmptyClipboard;
62714
+ if (!this.copiedData) return "EmptyClipboard";
62693
62715
  const pasteOption = cmd.pasteOption;
62694
62716
  return this.isPasteAllowed(cmd.target, this.copiedData, {
62695
62717
  pasteOption,
@@ -62698,21 +62720,21 @@ stores.inject(MyMetaStore, storeInstance);
62698
62720
  }
62699
62721
  case "COPY_PASTE_CELLS_ABOVE": {
62700
62722
  const zones = this.getters.getSelectedZones();
62701
- if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return CommandResult.InvalidCopyPasteSelection;
62723
+ if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return "InvalidCopyPasteSelection";
62702
62724
  const zone = this.getters.getSelectedZone();
62703
62725
  const copiedData = this.getCopiedDataAbove(zone);
62704
62726
  return this.isPasteAllowed(zones, copiedData, { isCutOperation: false });
62705
62727
  }
62706
62728
  case "COPY_PASTE_CELLS_ON_LEFT": {
62707
62729
  const zones = this.getters.getSelectedZones();
62708
- if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return CommandResult.InvalidCopyPasteSelection;
62730
+ if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return "InvalidCopyPasteSelection";
62709
62731
  const zone = this.getters.getSelectedZone();
62710
62732
  const copiedData = this.getCopiedDataOnLeft(zone);
62711
62733
  return this.isPasteAllowed(zones, copiedData, { isCutOperation: false });
62712
62734
  }
62713
62735
  case "COPY_PASTE_CELLS_ON_ZONE": {
62714
62736
  const zones = this.getters.getSelectedZones();
62715
- if (zones.length > 1) return CommandResult.InvalidCopyPasteSelection;
62737
+ if (zones.length > 1) return "InvalidCopyPasteSelection";
62716
62738
  const zone = this.getters.getSelectedZone();
62717
62739
  const copiedData = this.getCopiedDataOnLeft(zone);
62718
62740
  return this.isPasteAllowed(zones, copiedData, { isCutOperation: false });
@@ -62728,7 +62750,7 @@ stores.inject(MyMetaStore, storeInstance);
62728
62750
  return this.isPasteAllowed(paste, copiedData, { isCutOperation: true });
62729
62751
  }
62730
62752
  }
62731
- return CommandResult.Success;
62753
+ return "Success";
62732
62754
  }
62733
62755
  handle(cmd) {
62734
62756
  switch (cmd.type) {
@@ -62931,16 +62953,16 @@ stores.inject(MyMetaStore, storeInstance);
62931
62953
  const clipboardData = this.getClipboardData(zones);
62932
62954
  for (const { handler } of this.selectClipboardHandlers(clipboardData)) {
62933
62955
  const result = handler.isCutAllowed(clipboardData);
62934
- if (result !== CommandResult.Success) return result;
62956
+ if (result !== "Success") return result;
62935
62957
  }
62936
- return CommandResult.Success;
62958
+ return "Success";
62937
62959
  }
62938
62960
  isPasteAllowed(target, copiedData, options) {
62939
62961
  for (const { handler } of this.selectClipboardHandlers(copiedData)) {
62940
62962
  const result = handler.isPasteAllowed(this.getters.getActiveSheetId(), target, copiedData, { ...options });
62941
- if (result !== CommandResult.Success) return result;
62963
+ if (result !== "Success") return result;
62942
62964
  }
62943
- return CommandResult.Success;
62965
+ return "Success";
62944
62966
  }
62945
62967
  isColRowDirtyingClipboard(position, dimension) {
62946
62968
  if (!this.copiedData || !this.copiedData.zones) return false;
@@ -63021,12 +63043,12 @@ stores.inject(MyMetaStore, storeInstance);
63021
63043
  const file = await this.getImageContent();
63022
63044
  const mime = file?.type;
63023
63045
  const content = {
63024
- [ClipboardMIMEType.PlainText]: "",
63025
- [ClipboardMIMEType.Html]: ""
63046
+ ["text/plain"]: "",
63047
+ ["text/html"]: ""
63026
63048
  };
63027
63049
  try {
63028
- content[ClipboardMIMEType.PlainText] = this.getPlainTextContent();
63029
- content[ClipboardMIMEType.Html] = await this.getHTMLContent();
63050
+ content["text/plain"] = this.getPlainTextContent();
63051
+ content["text/html"] = await this.getHTMLContent();
63030
63052
  } catch (error) {
63031
63053
  this.ui.notifyUI({
63032
63054
  type: "danger",
@@ -63218,10 +63240,10 @@ stores.inject(MyMetaStore, storeInstance);
63218
63240
  allowDispatch(cmd) {
63219
63241
  switch (cmd.type) {
63220
63242
  case "UPDATE_FILTER":
63221
- if (!this.getters.getFilterId(cmd)) return CommandResult.FilterNotFound;
63243
+ if (!this.getters.getFilterId(cmd)) return "FilterNotFound";
63222
63244
  break;
63223
63245
  }
63224
- return CommandResult.Success;
63246
+ return "Success";
63225
63247
  }
63226
63248
  handle(cmd) {
63227
63249
  switch (cmd.type) {
@@ -63585,14 +63607,14 @@ stores.inject(MyMetaStore, storeInstance);
63585
63607
  allowDispatch(cmd) {
63586
63608
  switch (cmd.type) {
63587
63609
  case "ACTIVATE_SHEET": try {
63588
- if (!this.getters.getSheet(cmd.sheetIdTo).isVisible) return CommandResult.SheetIsHidden;
63610
+ if (!this.getters.getSheet(cmd.sheetIdTo).isVisible) return "SheetIsHidden";
63589
63611
  break;
63590
63612
  } catch (error) {
63591
- return CommandResult.InvalidSheetId;
63613
+ return "InvalidSheetId";
63592
63614
  }
63593
63615
  case "MOVE_COLUMNS_ROWS": return this.isMoveElementAllowed(cmd);
63594
63616
  }
63595
- return CommandResult.Success;
63617
+ return "Success";
63596
63618
  }
63597
63619
  handleEvent(event) {
63598
63620
  let anchor = event.anchor;
@@ -64113,12 +64135,12 @@ stores.inject(MyMetaStore, storeInstance);
64113
64135
  const end = cmd.elements[cmd.elements.length - 1];
64114
64136
  const id = cmd.sheetId;
64115
64137
  const doesElementsHaveCommonMerges = isCol ? this.getters.doesColumnsHaveCommonMerges : this.getters.doesRowsHaveCommonMerges;
64116
- if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return CommandResult.WillRemoveExistingMerge;
64138
+ if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return "WillRemoveExistingMerge";
64117
64139
  const headers = [cmd.base, ...cmd.elements];
64118
64140
  const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
64119
- if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return CommandResult.InvalidHeaderIndex;
64120
- if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) return CommandResult.CannotMoveTableHeader;
64121
- return CommandResult.Success;
64141
+ if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return "InvalidHeaderIndex";
64142
+ if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) return "CannotMoveTableHeader";
64143
+ return "Success";
64122
64144
  }
64123
64145
  isTableRowMoveAllowed(sheetId, selectedRows) {
64124
64146
  const tables = this.getters.getCoreTables(sheetId);
@@ -64220,6 +64242,9 @@ stores.inject(MyMetaStore, storeInstance);
64220
64242
  //#endregion
64221
64243
  //#region src/helpers/internal_viewport.ts
64222
64244
  var InternalViewport = class {
64245
+ getters;
64246
+ sheetId;
64247
+ boundaries;
64223
64248
  top;
64224
64249
  bottom;
64225
64250
  left;
@@ -64491,6 +64516,10 @@ stores.inject(MyMetaStore, storeInstance);
64491
64516
  * ↓ ↓
64492
64517
  */
64493
64518
  var ViewportCollection = class {
64519
+ paneDivision;
64520
+ sheetViewWidth;
64521
+ sheetViewHeight;
64522
+ zoomLevel;
64494
64523
  getters;
64495
64524
  viewports = {};
64496
64525
  gridOffsetX = 0;
@@ -64807,22 +64836,22 @@ stores.inject(MyMetaStore, storeInstance);
64807
64836
  return Object.values(this.viewports[sheetId]).filter(isDefined);
64808
64837
  }
64809
64838
  checkPositiveDimension(cmd) {
64810
- if (cmd.width < 0 || cmd.height < 0) return CommandResult.InvalidViewportSize;
64811
- return CommandResult.Success;
64839
+ if (cmd.width < 0 || cmd.height < 0) return "InvalidViewportSize";
64840
+ return "Success";
64812
64841
  }
64813
64842
  checkValuesAreDifferent(cmd) {
64814
64843
  const { height, width } = this.getSheetViewDimension();
64815
- if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return CommandResult.ValuesNotChanged;
64816
- return CommandResult.Success;
64844
+ if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return "ValuesNotChanged";
64845
+ return "Success";
64817
64846
  }
64818
64847
  checkScrollingDirection(sheetId, { offsetX, offsetY }) {
64819
64848
  const pane = this.getMainInternalViewport(sheetId);
64820
- if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return CommandResult.InvalidScrollingDirection;
64821
- return CommandResult.Success;
64849
+ if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return "InvalidScrollingDirection";
64850
+ return "Success";
64822
64851
  }
64823
64852
  checkIfViewportsWillChange(sheetId, { offsetX, offsetY }) {
64824
64853
  const { maxOffsetX, maxOffsetY } = this.getMaximumSheetOffset(sheetId);
64825
- return this.getSubViewports(sheetId).some((viewport) => viewport.willNewOffsetScrollViewport(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY))) ? CommandResult.Success : CommandResult.ViewportScrollLimitsReached;
64854
+ return this.getSubViewports(sheetId).some((viewport) => viewport.willNewOffsetScrollViewport(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY))) ? "Success" : "ViewportScrollLimitsReached";
64826
64855
  }
64827
64856
  getMainViewport(sheetId) {
64828
64857
  const viewport = this.getMainInternalViewport(sheetId);
@@ -65139,9 +65168,9 @@ stores.inject(MyMetaStore, storeInstance);
65139
65168
  return this.chainValidations(() => this.viewports.checkScrollingDirection(sheetId, cmd), () => this.viewports.checkIfViewportsWillChange(sheetId, cmd))(cmd);
65140
65169
  }
65141
65170
  case "RESIZE_SHEETVIEW": return this.chainValidations(() => this.viewports.checkValuesAreDifferent(cmd), () => this.viewports.checkPositiveDimension(cmd))(cmd);
65142
- case "SET_ZOOM": if (cmd.zoom > 2 || cmd.zoom < .5) return CommandResult.InvalidZoomLevel;
65143
- else return CommandResult.Success;
65144
- default: return CommandResult.Success;
65171
+ case "SET_ZOOM": if (cmd.zoom > 2 || cmd.zoom < .5) return "InvalidZoomLevel";
65172
+ else return "Success";
65173
+ default: return "Success";
65145
65174
  }
65146
65175
  }
65147
65176
  handleEvent(event) {
@@ -67215,9 +67244,9 @@ stores.inject(MyMetaStore, storeInstance);
67215
67244
  newName: name,
67216
67245
  oldName: env.model.getters.getSheetName(sheetId)
67217
67246
  });
67218
- if (result.reasons.includes(CommandResult.MissingSheetName)) env.raiseError(_t("The sheet name cannot be empty."), errorCallback);
67219
- else if (result.reasons.includes(CommandResult.DuplicatedSheetName)) env.raiseError(_t("A sheet with the name %s already exists. Please select another name.", name), errorCallback);
67220
- 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);
67247
+ if (result.reasons.includes("MissingSheetName")) env.raiseError(_t("The sheet name cannot be empty."), errorCallback);
67248
+ else if (result.reasons.includes("DuplicatedSheetName")) env.raiseError(_t("A sheet with the name %s already exists. Please select another name.", name), errorCallback);
67249
+ 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);
67221
67250
  }
67222
67251
 
67223
67252
  //#endregion
@@ -67275,7 +67304,7 @@ stores.inject(MyMetaStore, storeInstance);
67275
67304
  (0, _odoo_owl.onMounted)(() => {
67276
67305
  const animateLockedSheet = throttle(() => this.sheetDivRef.el?.animate(...getSheetLockAnimation(200, 1)).finished.then(() => this.iconRef.el?.animate(...getSheetLockAnimation(200, 2))), 800);
67277
67306
  this.env.model.on("command-rejected", this, async ({ command, result }) => {
67278
- if (result.isCancelledBecause(CommandResult.SheetLocked)) {
67307
+ if (result.isCancelledBecause("SheetLocked")) {
67279
67308
  if (!command || !isSheetDependent(command) && this.isSheetActive || isSheetDependent(command) && command.sheetId === this.props.sheetId) {
67280
67309
  this.scrollToSheet();
67281
67310
  await animateLockedSheet();
@@ -67412,41 +67441,41 @@ stores.inject(MyMetaStore, storeInstance);
67412
67441
  const selectionStatisticFunctions = [
67413
67442
  {
67414
67443
  name: _t("Sum"),
67415
- types: [CellValueType.number],
67444
+ types: ["number"],
67416
67445
  compute: (values, locale) => sum([[values]], locale)
67417
67446
  },
67418
67447
  {
67419
67448
  name: _t("Avg"),
67420
- types: [CellValueType.number],
67449
+ types: ["number"],
67421
67450
  compute: (values, locale) => average([[values]], locale)
67422
67451
  },
67423
67452
  {
67424
67453
  name: _t("Min"),
67425
- types: [CellValueType.number],
67454
+ types: ["number"],
67426
67455
  compute: (values, locale) => min([[values]], locale).value
67427
67456
  },
67428
67457
  {
67429
67458
  name: _t("Max"),
67430
- types: [CellValueType.number],
67459
+ types: ["number"],
67431
67460
  compute: (values, locale) => max([[values]], locale).value
67432
67461
  },
67433
67462
  {
67434
67463
  name: _t("Count"),
67435
67464
  types: [
67436
- CellValueType.number,
67437
- CellValueType.text,
67438
- CellValueType.boolean,
67439
- CellValueType.error
67465
+ "number",
67466
+ "text",
67467
+ "boolean",
67468
+ "error"
67440
67469
  ],
67441
67470
  compute: (values) => countAny([[values]])
67442
67471
  },
67443
67472
  {
67444
67473
  name: _t("Count Numbers"),
67445
67474
  types: [
67446
- CellValueType.number,
67447
- CellValueType.text,
67448
- CellValueType.boolean,
67449
- CellValueType.error
67475
+ "number",
67476
+ "text",
67477
+ "boolean",
67478
+ "error"
67450
67479
  ],
67451
67480
  compute: (values, locale) => countNumbers([[values]], locale)
67452
67481
  }
@@ -67499,7 +67528,7 @@ stores.inject(MyMetaStore, storeInstance);
67499
67528
  col,
67500
67529
  row
67501
67530
  });
67502
- if (evaluatedCell.type !== CellValueType.empty) cells.push(evaluatedCell);
67531
+ if (evaluatedCell.type !== "empty") cells.push(evaluatedCell);
67503
67532
  }
67504
67533
  return computeStatisticFnResults(selectionStatisticFunctions, cells, getters.getLocale());
67505
67534
  }
@@ -68447,6 +68476,7 @@ stores.inject(MyMetaStore, storeInstance);
68447
68476
  //#region src/components/standalone_grid_canvas/figure_renderer_store.ts
68448
68477
  /** Store that draws the figures directly onto the canvas */
68449
68478
  var FigureRendererStore = class extends DisposableStore {
68479
+ renderer;
68450
68480
  mutators = ["addLoadedImage"];
68451
68481
  getters = this.get(ModelStore).getters;
68452
68482
  loadedImages = {};
@@ -68792,7 +68822,7 @@ stores.inject(MyMetaStore, storeInstance);
68792
68822
  const coreCell = this.getters.getCell(position);
68793
68823
  if (coreCell && (coreCell.style || coreCell.isFormula || coreCell.content)) return true;
68794
68824
  const evaluatedCell = this.getters.getEvaluatedCell(position);
68795
- if (evaluatedCell && evaluatedCell.type !== CellValueType.empty) return true;
68825
+ if (evaluatedCell && evaluatedCell.type !== "empty") return true;
68796
68826
  }
68797
68827
  return false;
68798
68828
  }
@@ -69133,7 +69163,7 @@ stores.inject(MyMetaStore, storeInstance);
69133
69163
  }
69134
69164
  navigateToRange(range) {
69135
69165
  const { sheetId, zone } = range;
69136
- if (this.env.model.getters.checkZonesExistInSheet(sheetId, [zone]) !== CommandResult.Success) {
69166
+ if (this.env.model.getters.checkZonesExistInSheet(sheetId, [zone]) !== "Success") {
69137
69167
  this.env.raiseError(_t("The range you specified is outside of the sheet.\n\nIf you meant to create a named range, named range cannot have the same name as a cell reference. Please choose another name."));
69138
69168
  return;
69139
69169
  }
@@ -70018,6 +70048,7 @@ stores.inject(MyMetaStore, storeInstance);
70018
70048
  return new WebClipboardWrapper(navigator.clipboard);
70019
70049
  }
70020
70050
  var WebClipboardWrapper = class {
70051
+ clipboard;
70021
70052
  constructor(clipboard) {
70022
70053
  this.clipboard = clipboard;
70023
70054
  }
@@ -70033,12 +70064,12 @@ stores.inject(MyMetaStore, storeInstance);
70033
70064
  console.log("Failed to write on the clipboard, falling back to plain/html text. Error %s", e);
70034
70065
  try {
70035
70066
  await this.clipboard?.write([new ClipboardItem({
70036
- [ClipboardMIMEType.PlainText]: this.getBlob(clipboardContent, ClipboardMIMEType.PlainText),
70037
- [ClipboardMIMEType.Html]: this.getBlob(clipboardContent, ClipboardMIMEType.Html)
70067
+ ["text/plain"]: this.getBlob(clipboardContent, "text/plain"),
70068
+ ["text/html"]: this.getBlob(clipboardContent, "text/html")
70038
70069
  })]);
70039
70070
  } catch (e) {}
70040
70071
  }
70041
- else await this.writeText(clipboardContent[ClipboardMIMEType.PlainText] ?? "");
70072
+ else await this.writeText(clipboardContent["text/plain"] ?? "");
70042
70073
  }
70043
70074
  async writeText(text) {
70044
70075
  try {
@@ -70067,7 +70098,7 @@ stores.inject(MyMetaStore, storeInstance);
70067
70098
  }
70068
70099
  else return {
70069
70100
  status: "ok",
70070
- content: { [ClipboardMIMEType.PlainText]: await this.clipboard?.readText() }
70101
+ content: { ["text/plain"]: await this.clipboard?.readText() }
70071
70102
  };
70072
70103
  }
70073
70104
  getClipboardItems(content) {
@@ -70219,7 +70250,7 @@ stores.inject(MyMetaStore, storeInstance);
70219
70250
  bindModelEvents() {
70220
70251
  this.model.on("update", this, () => this.render(true));
70221
70252
  this.model.on("command-rejected", this, ({ result }) => {
70222
- if (result.isCancelledBecause(CommandResult.SheetLocked)) this.notificationStore.notifyUser({
70253
+ if (result.isCancelledBecause("SheetLocked")) this.notificationStore.notifyUser({
70223
70254
  type: "info",
70224
70255
  text: _t("This sheet is locked and cannot be modified. Please unlock it first."),
70225
70256
  sticky: false
@@ -70304,6 +70335,7 @@ stores.inject(MyMetaStore, storeInstance);
70304
70335
  //#endregion
70305
70336
  //#region src/collaborative/command_squisher.ts
70306
70337
  var CommandSquisher = class {
70338
+ getters;
70307
70339
  constructor(getters) {
70308
70340
  this.getters = getters;
70309
70341
  }
@@ -70410,6 +70442,7 @@ stores.inject(MyMetaStore, storeInstance);
70410
70442
  //#endregion
70411
70443
  //#region src/collaborative/readonly_transport_filter.ts
70412
70444
  var ReadonlyTransportFilter = class {
70445
+ transportService;
70413
70446
  constructor(transportService) {
70414
70447
  this.transportService = transportService;
70415
70448
  }
@@ -70441,6 +70474,8 @@ stores.inject(MyMetaStore, storeInstance);
70441
70474
  * @param operations initial operations
70442
70475
  */
70443
70476
  var Branch = class Branch {
70477
+ buildTransformation;
70478
+ operations;
70444
70479
  constructor(buildTransformation, operations = []) {
70445
70480
  this.buildTransformation = buildTransformation;
70446
70481
  this.operations = operations;
@@ -70557,6 +70592,8 @@ stores.inject(MyMetaStore, storeInstance);
70557
70592
  * to revert it).
70558
70593
  */
70559
70594
  var Operation = class {
70595
+ id;
70596
+ data;
70560
70597
  constructor(id, data) {
70561
70598
  this.id = id;
70562
70599
  this.data = data;
@@ -70566,6 +70603,8 @@ stores.inject(MyMetaStore, storeInstance);
70566
70603
  }
70567
70604
  };
70568
70605
  var LazyOperation = class LazyOperation {
70606
+ id;
70607
+ lazyData;
70569
70608
  constructor(id, lazyData) {
70570
70609
  this.id = id;
70571
70610
  this.lazyData = lazyData;
@@ -70591,6 +70630,7 @@ stores.inject(MyMetaStore, storeInstance);
70591
70630
  * ```
70592
70631
  */
70593
70632
  var OperationSequence = class OperationSequence {
70633
+ operations;
70594
70634
  constructor(operations) {
70595
70635
  this.operations = operations;
70596
70636
  }
@@ -70666,6 +70706,7 @@ stores.inject(MyMetaStore, storeInstance);
70666
70706
  *
70667
70707
  */
70668
70708
  var Tree = class {
70709
+ buildTransformation;
70669
70710
  branches;
70670
70711
  branchingOperationIds = /* @__PURE__ */ new Map();
70671
70712
  constructor(buildTransformation, initialBranch) {
@@ -71175,8 +71216,8 @@ stores.inject(MyMetaStore, storeInstance);
71175
71216
  "removeRangesSheetPrefix"
71176
71217
  ];
71177
71218
  allowDispatch(cmd) {
71178
- if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ? CommandResult.Success : CommandResult.InvalidZones;
71179
- return CommandResult.Success;
71219
+ if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ? "Success" : "InvalidZones";
71220
+ return "Success";
71180
71221
  }
71181
71222
  beforeHandle(command) {}
71182
71223
  handle(cmd) {
@@ -71461,6 +71502,7 @@ stores.inject(MyMetaStore, storeInstance);
71461
71502
  * with the new selected anchor
71462
71503
  */
71463
71504
  var SelectionStreamProcessorImpl = class {
71505
+ getters;
71464
71506
  stream;
71465
71507
  /**
71466
71508
  * "Active" anchor used as a reference to compute new anchors
@@ -71559,7 +71601,7 @@ stores.inject(MyMetaStore, storeInstance);
71559
71601
  * Set the selection to one of the cells adjacent to the current anchor cell.
71560
71602
  */
71561
71603
  moveAnchorCell(direction, step = 1) {
71562
- if (step !== "end" && step <= 0) return new DispatchResult(CommandResult.InvalidSelectionStep);
71604
+ if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
71563
71605
  const { col, row } = this.getNextAvailablePosition(direction, step);
71564
71606
  return this.selectCell(col, row);
71565
71607
  }
@@ -71593,7 +71635,7 @@ stores.inject(MyMetaStore, storeInstance);
71593
71635
  bottom: Math.max(anchorRow, row)
71594
71636
  };
71595
71637
  const expandedZone = this.getters.expandZone(sheetId, zone);
71596
- if (isEqual(this.anchor.zone, expandedZone)) return new DispatchResult(CommandResult.NoChanges);
71638
+ if (isEqual(this.anchor.zone, expandedZone)) return new DispatchResult("NoChanges");
71597
71639
  const anchor = {
71598
71640
  zone: expandedZone,
71599
71641
  cell: {
@@ -71655,7 +71697,7 @@ stores.inject(MyMetaStore, storeInstance);
71655
71697
  * of the anchor zone which moves.
71656
71698
  */
71657
71699
  resizeAnchorZone(direction, step = 1) {
71658
- if (step !== "end" && step <= 0) return new DispatchResult(CommandResult.InvalidSelectionStep);
71700
+ if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
71659
71701
  const sheetId = this.getters.getActiveSheetId();
71660
71702
  const anchor = this.anchor;
71661
71703
  const { col: anchorCol, row: anchorRow } = anchor.cell;
@@ -71902,7 +71944,7 @@ stores.inject(MyMetaStore, storeInstance);
71902
71944
  previousAnchor: deepCopy(this.anchor)
71903
71945
  };
71904
71946
  const commandResult = this.checkEventAnchorZone(event);
71905
- if (commandResult !== CommandResult.Success) return new DispatchResult(commandResult);
71947
+ if (commandResult !== "Success") return new DispatchResult(commandResult);
71906
71948
  this.anchor = event.anchor;
71907
71949
  this.stream.send(event);
71908
71950
  return DispatchResult.Success;
@@ -71912,15 +71954,15 @@ stores.inject(MyMetaStore, storeInstance);
71912
71954
  }
71913
71955
  checkAnchorZone(anchor) {
71914
71956
  const { cell, zone } = anchor;
71915
- if (!isInside(cell.col, cell.row, zone)) return CommandResult.InvalidAnchorZone;
71957
+ if (!isInside(cell.col, cell.row, zone)) return "InvalidAnchorZone";
71916
71958
  const { left, right, top, bottom } = zone;
71917
71959
  const sheetId = this.getters.getActiveSheetId();
71918
71960
  const refCol = this.getters.findVisibleHeader(sheetId, "COL", left, right);
71919
- if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return CommandResult.SelectionOutOfBound;
71920
- return CommandResult.Success;
71961
+ if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return "SelectionOutOfBound";
71962
+ return "Success";
71921
71963
  }
71922
71964
  checkAnchorZoneOrThrow(anchor) {
71923
- if (this.checkAnchorZone(anchor) === CommandResult.InvalidAnchorZone) throw new Error("The provided anchor is invalid. The cell must be part of the zone.");
71965
+ if (this.checkAnchorZone(anchor) === "InvalidAnchorZone") throw new Error("The provided anchor is invalid. The cell must be part of the zone.");
71924
71966
  }
71925
71967
  /**
71926
71968
  * ---- PRIVATE ----
@@ -72077,7 +72119,7 @@ stores.inject(MyMetaStore, storeInstance);
72077
72119
  isCellSkippableInCluster(position) {
72078
72120
  const mainPosition = this.getters.getMainCellPosition(position);
72079
72121
  const cell = this.getters.getEvaluatedCell(mainPosition);
72080
- return cell.type === CellValueType.empty || cell.type === CellValueType.text && cell.value === "";
72122
+ return cell.type === "empty" || cell.type === "text" && cell.value === "";
72081
72123
  }
72082
72124
  };
72083
72125
 
@@ -74294,14 +74336,7 @@ stores.inject(MyMetaStore, storeInstance);
74294
74336
 
74295
74337
  //#endregion
74296
74338
  //#region src/model.ts
74297
- var Status = /* @__PURE__ */ function(Status) {
74298
- Status[Status["Ready"] = 0] = "Ready";
74299
- Status[Status["Running"] = 1] = "Running";
74300
- Status[Status["RunningCore"] = 2] = "RunningCore";
74301
- Status[Status["Finalizing"] = 3] = "Finalizing";
74302
- return Status;
74303
- }(Status || {});
74304
- /**
74339
+ /**
74305
74340
  * Model
74306
74341
  *
74307
74342
  * The Model class is the owner of the state of the Spreadsheet. However, it
@@ -74346,7 +74381,7 @@ stores.inject(MyMetaStore, storeInstance);
74346
74381
  /**
74347
74382
  * Internal status of the model. Important for command handling coordination
74348
74383
  */
74349
- status = Status.Ready;
74384
+ status = 0;
74350
74385
  /**
74351
74386
  * The config object contains some configuration flag and callbacks
74352
74387
  */
@@ -74493,7 +74528,7 @@ stores.inject(MyMetaStore, storeInstance);
74493
74528
  onRemoteRevisionReceived({ commands }) {
74494
74529
  for (const command of commands) {
74495
74530
  const previousStatus = this.status;
74496
- this.status = Status.RunningCore;
74531
+ this.status = 2;
74497
74532
  this.dispatchToHandlers(this.statefulUIPlugins, command);
74498
74533
  this.status = previousStatus;
74499
74534
  }
@@ -74606,7 +74641,7 @@ stores.inject(MyMetaStore, storeInstance);
74606
74641
  return this.processCommandResults(results);
74607
74642
  }
74608
74643
  processCommandResults(results) {
74609
- if (results.some((r) => r !== CommandResult.Success)) return new DispatchResult(results.flat());
74644
+ if (results.some((r) => r !== "Success")) return new DispatchResult(results.flat());
74610
74645
  return DispatchResult.Success;
74611
74646
  }
74612
74647
  checkDispatchAllowedRemoteCommand(command) {
@@ -74620,9 +74655,9 @@ stores.inject(MyMetaStore, storeInstance);
74620
74655
  return this.uiHandlers.map((handler) => handler.allowDispatch(command));
74621
74656
  }
74622
74657
  finalize() {
74623
- this.status = Status.Finalizing;
74658
+ this.status = 3;
74624
74659
  for (const h of this.handlers) h.finalize();
74625
- this.status = Status.Ready;
74660
+ this.status = 0;
74626
74661
  this.trigger("command-finalized");
74627
74662
  }
74628
74663
  /**
@@ -74649,10 +74684,10 @@ stores.inject(MyMetaStore, storeInstance);
74649
74684
  dispatch = (type, payload) => {
74650
74685
  const command = createCommand(type, payload);
74651
74686
  const status = this.status;
74652
- if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult(CommandResult.Readonly);
74653
- if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult(CommandResult.WaitingSessionConfirmation);
74687
+ if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult("Readonly");
74688
+ if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult("WaitingSessionConfirmation");
74654
74689
  switch (status) {
74655
- case Status.Ready:
74690
+ case 0:
74656
74691
  const result = this.checkDispatchAllowed(command);
74657
74692
  if (!result.isSuccessful) {
74658
74693
  this.trigger("update");
@@ -74662,7 +74697,7 @@ stores.inject(MyMetaStore, storeInstance);
74662
74697
  });
74663
74698
  return result;
74664
74699
  }
74665
- this.status = Status.Running;
74700
+ this.status = 1;
74666
74701
  const { changes, commands } = this.state.recordChanges(() => {
74667
74702
  const start = performance.now();
74668
74703
  if (isCoreCommand(command)) this.state.addCommand(command);
@@ -74672,10 +74707,10 @@ stores.inject(MyMetaStore, storeInstance);
74672
74707
  if (time > 5) console.debug(type, time, "ms");
74673
74708
  });
74674
74709
  this.session.save(command, commands, changes);
74675
- this.status = Status.Ready;
74710
+ this.status = 0;
74676
74711
  this.trigger("update");
74677
74712
  break;
74678
- case Status.Running:
74713
+ case 1:
74679
74714
  if (isCoreCommand(command)) {
74680
74715
  const dispatchResult = this.checkDispatchAllowed(command);
74681
74716
  if (!dispatchResult.isSuccessful) return dispatchResult;
@@ -74683,8 +74718,8 @@ stores.inject(MyMetaStore, storeInstance);
74683
74718
  }
74684
74719
  this.dispatchToHandlers(this.handlers, command);
74685
74720
  break;
74686
- case Status.Finalizing: throw new Error("Cannot dispatch commands in the finalize state");
74687
- case Status.RunningCore:
74721
+ case 3: throw new Error("Cannot dispatch commands in the finalize state");
74722
+ case 2:
74688
74723
  if (isCoreCommand(command)) throw new Error(`A UI plugin cannot dispatch ${type} while handling a core command`);
74689
74724
  this.dispatchToHandlers(this.handlers, command);
74690
74725
  }
@@ -74697,7 +74732,7 @@ stores.inject(MyMetaStore, storeInstance);
74697
74732
  dispatchFromCorePlugin = (type, payload) => {
74698
74733
  const command = createCommand(type, payload);
74699
74734
  const previousStatus = this.status;
74700
- this.status = Status.RunningCore;
74735
+ this.status = 2;
74701
74736
  const handlers = this.isReplayingCommand ? this.coreHandlers : this.handlers;
74702
74737
  this.dispatchToHandlers(handlers, command);
74703
74738
  this.status = previousStatus;
@@ -74799,9 +74834,9 @@ stores.inject(MyMetaStore, storeInstance);
74799
74834
  //#endregion
74800
74835
  //#region src/helpers/figures/charts/calendar_chart.ts
74801
74836
  function checkDateGranularity(definition) {
74802
- if (!CALENDAR_CHART_GRANULARITIES.includes(definition.horizontalGroupBy)) return CommandResult.InvalidChartDefinition;
74803
- if (!CALENDAR_CHART_GRANULARITIES.includes(definition.verticalGroupBy)) return CommandResult.InvalidChartDefinition;
74804
- return CommandResult.Success;
74837
+ if (!CALENDAR_CHART_GRANULARITIES.includes(definition.horizontalGroupBy)) return "InvalidChartDefinition";
74838
+ if (!CALENDAR_CHART_GRANULARITIES.includes(definition.verticalGroupBy)) return "InvalidChartDefinition";
74839
+ return "Success";
74805
74840
  }
74806
74841
  const CalendarChart = {
74807
74842
  sequence: 110,
@@ -74892,7 +74927,7 @@ stores.inject(MyMetaStore, storeInstance);
74892
74927
  copyInSheetId: (definition) => definition,
74893
74928
  duplicateInDuplicatedSheet: (definition) => definition,
74894
74929
  transformDefinition: (definition) => definition,
74895
- validateDefinition: () => CommandResult.Success,
74930
+ validateDefinition: () => "Success",
74896
74931
  updateRanges: (definition) => definition,
74897
74932
  getContextCreation: (definition) => definition,
74898
74933
  getDefinitionForExcel(getters, definition, { dataSets, labelRange }) {
@@ -74982,7 +75017,7 @@ stores.inject(MyMetaStore, storeInstance);
74982
75017
  copyInSheetId: (definition) => definition,
74983
75018
  duplicateInDuplicatedSheet: (definition) => definition,
74984
75019
  transformDefinition: (definition) => definition,
74985
- validateDefinition: () => CommandResult.Success,
75020
+ validateDefinition: () => "Success",
74986
75021
  updateRanges: (definition) => definition,
74987
75022
  getContextCreation: (definition) => definition,
74988
75023
  getDefinitionFromContextCreation(context, dataSourceBuilder) {
@@ -75048,7 +75083,7 @@ stores.inject(MyMetaStore, storeInstance);
75048
75083
  copyInSheetId: (definition) => definition,
75049
75084
  duplicateInDuplicatedSheet: (definition) => definition,
75050
75085
  transformDefinition: (definition) => definition,
75051
- validateDefinition: () => CommandResult.Success,
75086
+ validateDefinition: () => "Success",
75052
75087
  updateRanges: (definition) => definition,
75053
75088
  getContextCreation: (definition) => definition,
75054
75089
  getDefinitionFromContextCreation(context, dataSourceBuilder) {
@@ -75109,7 +75144,7 @@ stores.inject(MyMetaStore, storeInstance);
75109
75144
  copyInSheetId: (definition) => definition,
75110
75145
  duplicateInDuplicatedSheet: (definition) => definition,
75111
75146
  transformDefinition: (definition) => definition,
75112
- validateDefinition: () => CommandResult.Success,
75147
+ validateDefinition: () => "Success",
75113
75148
  updateRanges: (definition) => definition,
75114
75149
  getContextCreation: (definition) => definition,
75115
75150
  getDefinitionFromContextCreation(context, dataSourceBuilder) {
@@ -75195,7 +75230,7 @@ stores.inject(MyMetaStore, storeInstance);
75195
75230
  copyInSheetId: (definition) => definition,
75196
75231
  duplicateInDuplicatedSheet: (definition) => definition,
75197
75232
  transformDefinition: (definition) => definition,
75198
- validateDefinition: () => CommandResult.Success,
75233
+ validateDefinition: () => "Success",
75199
75234
  updateRanges: (definition) => definition,
75200
75235
  getContextCreation: (definition) => definition,
75201
75236
  getDefinitionFromContextCreation(context, dataSourceBuilder) {
@@ -75273,7 +75308,7 @@ stores.inject(MyMetaStore, storeInstance);
75273
75308
  copyInSheetId: (definition) => definition,
75274
75309
  duplicateInDuplicatedSheet: (definition) => definition,
75275
75310
  transformDefinition: (definition) => definition,
75276
- validateDefinition: () => CommandResult.Success,
75311
+ validateDefinition: () => "Success",
75277
75312
  updateRanges: (definition) => definition,
75278
75313
  getContextCreation: (definition) => definition,
75279
75314
  getDefinitionFromContextCreation(context, dataSourceBuilder) {
@@ -75352,7 +75387,7 @@ stores.inject(MyMetaStore, storeInstance);
75352
75387
  copyInSheetId: (definition) => definition,
75353
75388
  duplicateInDuplicatedSheet: (definition) => definition,
75354
75389
  transformDefinition: (definition) => definition,
75355
- validateDefinition: () => CommandResult.Success,
75390
+ validateDefinition: () => "Success",
75356
75391
  updateRanges: (definition) => definition,
75357
75392
  getDefinitionFromContextCreation(context, dataSourceBuilder) {
75358
75393
  return {
@@ -75421,7 +75456,7 @@ stores.inject(MyMetaStore, storeInstance);
75421
75456
  copyInSheetId: (definition) => definition,
75422
75457
  duplicateInDuplicatedSheet: (definition) => definition,
75423
75458
  transformDefinition: (definition) => definition,
75424
- validateDefinition: () => CommandResult.Success,
75459
+ validateDefinition: () => "Success",
75425
75460
  updateRanges: (definition) => definition,
75426
75461
  getDefinitionFromContextCreation(context, dataSourceBuilder) {
75427
75462
  return {
@@ -75847,9 +75882,9 @@ stores.inject(MyMetaStore, storeInstance);
75847
75882
  this.dispatch("SELECT_FIGURE", { figureId });
75848
75883
  }
75849
75884
  isPasteAllowed(sheetId, target, content, option) {
75850
- if (target.length === 0) return CommandResult.EmptyTarget;
75851
- if (option?.pasteOption !== void 0) return CommandResult.WrongFigurePasteOption;
75852
- return CommandResult.Success;
75885
+ if (target.length === 0) return "EmptyTarget";
75886
+ if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
75887
+ return "Success";
75853
75888
  }
75854
75889
  };
75855
75890
 
@@ -75920,9 +75955,9 @@ stores.inject(MyMetaStore, storeInstance);
75920
75955
  this.dispatch("SELECT_FIGURE", { figureId });
75921
75956
  }
75922
75957
  isPasteAllowed(sheetId, target, content, option) {
75923
- if (target.length === 0) return CommandResult.EmptyTarget;
75924
- if (option?.pasteOption !== void 0) return CommandResult.WrongFigurePasteOption;
75925
- return CommandResult.Success;
75958
+ if (target.length === 0) return "EmptyTarget";
75959
+ if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
75960
+ return "Success";
75926
75961
  }
75927
75962
  };
75928
75963
 
@@ -76227,9 +76262,9 @@ stores.inject(MyMetaStore, storeInstance);
76227
76262
  this.dispatch("SELECT_FIGURE", { figureId });
76228
76263
  }
76229
76264
  isPasteAllowed(sheetId, target, content, option) {
76230
- if (target.length === 0) return CommandResult.EmptyTarget;
76231
- if (option?.pasteOption !== void 0) return CommandResult.WrongFigurePasteOption;
76232
- return CommandResult.Success;
76265
+ if (target.length === 0) return "EmptyTarget";
76266
+ if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
76267
+ return "Success";
76233
76268
  }
76234
76269
  };
76235
76270
 
@@ -76325,10 +76360,10 @@ stores.inject(MyMetaStore, storeInstance);
76325
76360
  //#region src/clipboard_handlers/sheet_clipboard.ts
76326
76361
  var SheetClipboardHandler = class extends AbstractCellClipboardHandler {
76327
76362
  isPasteAllowed(sheetId, target, content, options) {
76328
- if (!("cells" in content)) return CommandResult.Success;
76363
+ if (!("cells" in content)) return "Success";
76329
76364
  const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
76330
- if (doesAnyZoneCrossFrozenPane(getPasteZones(target, content.cells), xSplit, ySplit)) return CommandResult.FrozenPaneOverlap;
76331
- return CommandResult.Success;
76365
+ if (doesAnyZoneCrossFrozenPane(getPasteZones(target, content.cells), xSplit, ySplit)) return "FrozenPaneOverlap";
76366
+ return "Success";
76332
76367
  }
76333
76368
  };
76334
76369
 
@@ -79169,15 +79204,15 @@ stores.inject(MyMetaStore, storeInstance);
79169
79204
  const jsEndDate = numberToJsDate(_endDate);
79170
79205
  if (_endDate < _startDate) return new EvaluationError(_t("start_date (%s) should be on or before end_date (%s).", jsStartDate.toLocaleDateString(), jsEndDate.toLocaleDateString()));
79171
79206
  switch (_unit) {
79172
- case TIME_UNIT.WHOLE_YEARS: return getTimeDifferenceInWholeYears(jsStartDate, jsEndDate);
79173
- case TIME_UNIT.WHOLE_MONTHS: return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate);
79174
- case TIME_UNIT.WHOLE_DAYS: return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
79175
- case TIME_UNIT.MONTH_WITHOUT_WHOLE_YEARS: return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate) - getTimeDifferenceInWholeYears(jsStartDate, jsEndDate) * 12;
79176
- case TIME_UNIT.DAYS_WITHOUT_WHOLE_MONTHS:
79207
+ case "Y": return getTimeDifferenceInWholeYears(jsStartDate, jsEndDate);
79208
+ case "M": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate);
79209
+ case "D": return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
79210
+ case "YM": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate) - getTimeDifferenceInWholeYears(jsStartDate, jsEndDate) * 12;
79211
+ case "MD":
79177
79212
  let days = jsEndDate.getDate() - jsStartDate.getDate();
79178
79213
  if (days < 0) days = getDaysInMonth(new DateTime(jsEndDate.getFullYear(), jsEndDate.getMonth() - 1, 1)) - Math.abs(days);
79179
79214
  return days;
79180
- case TIME_UNIT.DAYS_BETWEEN_NO_MORE_THAN_ONE_YEAR: {
79215
+ case "YD": {
79181
79216
  if (areTwoDatesWithinOneYear(_startDate, _endDate)) return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
79182
79217
  const endDateWithinOneYear = new DateTime(jsStartDate.getFullYear(), jsEndDate.getMonth(), jsEndDate.getDate());
79183
79218
  let days = getTimeDifferenceInWholeDays(jsStartDate, endDateWithinOneYear);
@@ -79867,11 +79902,11 @@ stores.inject(MyMetaStore, storeInstance);
79867
79902
  const right = sortColumn[b];
79868
79903
  const leftCell = {
79869
79904
  value: left,
79870
- type: left === null ? CellValueType.empty : typeof left === "string" ? CellValueType.text : typeof left
79905
+ type: left === null ? "empty" : typeof left === "string" ? "text" : typeof left
79871
79906
  };
79872
79907
  const rightCell = {
79873
79908
  value: right,
79874
- type: right === null ? CellValueType.empty : typeof right === "string" ? CellValueType.text : typeof right
79909
+ type: right === null ? "empty" : typeof right === "string" ? "text" : typeof right
79875
79910
  };
79876
79911
  const result = sortingCriteria[sortingOrders[i]](leftCell, rightCell);
79877
79912
  if (result !== 0) return result;
@@ -84469,8 +84504,8 @@ exports.stores = stores;
84469
84504
  exports.tokenColors = tokenColors;
84470
84505
  exports.tokenize = tokenize;
84471
84506
 
84472
- __info__.version = "19.3.2";
84473
- __info__.date = "2026-05-11T13:52:24.823Z";
84474
- __info__.hash = "14395f7";
84507
+ __info__.version = "19.3.4";
84508
+ __info__.date = "2026-05-15T07:07:34.417Z";
84509
+ __info__.hash = "1dc7b42";
84475
84510
 
84476
84511
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);