@odoo/o-spreadsheet 16.4.18 → 16.4.20

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.
@@ -447,7 +447,7 @@ function isBoolean(str) {
447
447
  const upperCased = str.toUpperCase();
448
448
  return upperCased === "TRUE" || upperCased === "FALSE";
449
449
  }
450
- const MARKDOWN_LINK_REGEX = /^\[([^\[]+)\]\((.+)\)$/;
450
+ const MARKDOWN_LINK_REGEX = /^\[(.+)\]\((.+)\)$/;
451
451
  //link must start with http or https
452
452
  //https://stackoverflow.com/a/3809435/4760614
453
453
  const WEB_LINK_REGEX = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;
@@ -2215,27 +2215,30 @@ function roundFormat(format) {
2215
2215
  }
2216
2216
  function createLargeNumberFormat(format, magnitude, postFix, locale) {
2217
2217
  const internalFormat = parseFormat(format || "#,##0");
2218
- const largeNumberFormat = internalFormat
2219
- .map((formatPart) => {
2220
- if (formatPart.type === "NUMBER") {
2221
- return [
2222
- {
2223
- ...formatPart,
2224
- format: {
2225
- ...formatPart.format,
2226
- magnitude,
2227
- decimalPart: undefined,
2228
- },
2229
- },
2230
- {
2231
- type: "STRING",
2232
- format: postFix,
2233
- },
2234
- ];
2218
+ const largeNumberFormat = [];
2219
+ for (let i = 0; i < internalFormat.length; i++) {
2220
+ const formatPart = internalFormat[i];
2221
+ if (formatPart.type !== "NUMBER") {
2222
+ largeNumberFormat.push(formatPart);
2223
+ continue;
2235
2224
  }
2236
- return formatPart;
2237
- })
2238
- .flat();
2225
+ largeNumberFormat.push({
2226
+ ...formatPart,
2227
+ format: {
2228
+ ...formatPart.format,
2229
+ magnitude,
2230
+ decimalPart: undefined,
2231
+ },
2232
+ });
2233
+ largeNumberFormat.push({
2234
+ type: "STRING",
2235
+ format: postFix,
2236
+ });
2237
+ const nextFormatPart = internalFormat[i + 1];
2238
+ if (nextFormatPart?.type === "STRING" && ["k", "m", "b"].includes(nextFormatPart.format)) {
2239
+ i++;
2240
+ }
2241
+ }
2239
2242
  return convertInternalFormatToFormat(largeNumberFormat);
2240
2243
  }
2241
2244
  function changeDecimalPlaces(format, step, locale) {
@@ -4254,71 +4257,72 @@ var CommandResult;
4254
4257
  CommandResult[CommandResult["InputAlreadyFocused"] = 30] = "InputAlreadyFocused";
4255
4258
  CommandResult[CommandResult["MaximumRangesReached"] = 31] = "MaximumRangesReached";
4256
4259
  CommandResult[CommandResult["MinimumRangesReached"] = 32] = "MinimumRangesReached";
4257
- CommandResult[CommandResult["InvalidChartDefinition"] = 33] = "InvalidChartDefinition";
4258
- CommandResult[CommandResult["InvalidDataSet"] = 34] = "InvalidDataSet";
4259
- CommandResult[CommandResult["InvalidLabelRange"] = 35] = "InvalidLabelRange";
4260
- CommandResult[CommandResult["InvalidScorecardKeyValue"] = 36] = "InvalidScorecardKeyValue";
4261
- CommandResult[CommandResult["InvalidScorecardBaseline"] = 37] = "InvalidScorecardBaseline";
4262
- CommandResult[CommandResult["InvalidGaugeDataRange"] = 38] = "InvalidGaugeDataRange";
4263
- CommandResult[CommandResult["EmptyGaugeRangeMin"] = 39] = "EmptyGaugeRangeMin";
4264
- CommandResult[CommandResult["GaugeRangeMinNaN"] = 40] = "GaugeRangeMinNaN";
4265
- CommandResult[CommandResult["EmptyGaugeRangeMax"] = 41] = "EmptyGaugeRangeMax";
4266
- CommandResult[CommandResult["GaugeRangeMaxNaN"] = 42] = "GaugeRangeMaxNaN";
4267
- CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 43] = "GaugeRangeMinBiggerThanRangeMax";
4268
- CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 44] = "GaugeLowerInflectionPointNaN";
4269
- CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 45] = "GaugeUpperInflectionPointNaN";
4270
- CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 46] = "GaugeLowerBiggerThanUpper";
4271
- CommandResult[CommandResult["InvalidAutofillSelection"] = 47] = "InvalidAutofillSelection";
4272
- CommandResult[CommandResult["WrongComposerSelection"] = 48] = "WrongComposerSelection";
4273
- CommandResult[CommandResult["MinBiggerThanMax"] = 49] = "MinBiggerThanMax";
4274
- CommandResult[CommandResult["LowerBiggerThanUpper"] = 50] = "LowerBiggerThanUpper";
4275
- CommandResult[CommandResult["MidBiggerThanMax"] = 51] = "MidBiggerThanMax";
4276
- CommandResult[CommandResult["MinBiggerThanMid"] = 52] = "MinBiggerThanMid";
4277
- CommandResult[CommandResult["FirstArgMissing"] = 53] = "FirstArgMissing";
4278
- CommandResult[CommandResult["SecondArgMissing"] = 54] = "SecondArgMissing";
4279
- CommandResult[CommandResult["MinNaN"] = 55] = "MinNaN";
4280
- CommandResult[CommandResult["MidNaN"] = 56] = "MidNaN";
4281
- CommandResult[CommandResult["MaxNaN"] = 57] = "MaxNaN";
4282
- CommandResult[CommandResult["ValueUpperInflectionNaN"] = 58] = "ValueUpperInflectionNaN";
4283
- CommandResult[CommandResult["ValueLowerInflectionNaN"] = 59] = "ValueLowerInflectionNaN";
4284
- CommandResult[CommandResult["MinInvalidFormula"] = 60] = "MinInvalidFormula";
4285
- CommandResult[CommandResult["MidInvalidFormula"] = 61] = "MidInvalidFormula";
4286
- CommandResult[CommandResult["MaxInvalidFormula"] = 62] = "MaxInvalidFormula";
4287
- CommandResult[CommandResult["ValueUpperInvalidFormula"] = 63] = "ValueUpperInvalidFormula";
4288
- CommandResult[CommandResult["ValueLowerInvalidFormula"] = 64] = "ValueLowerInvalidFormula";
4289
- CommandResult[CommandResult["InvalidSortZone"] = 65] = "InvalidSortZone";
4290
- CommandResult[CommandResult["WaitingSessionConfirmation"] = 66] = "WaitingSessionConfirmation";
4291
- CommandResult[CommandResult["MergeOverlap"] = 67] = "MergeOverlap";
4292
- CommandResult[CommandResult["TooManyHiddenElements"] = 68] = "TooManyHiddenElements";
4293
- CommandResult[CommandResult["Readonly"] = 69] = "Readonly";
4294
- CommandResult[CommandResult["InvalidViewportSize"] = 70] = "InvalidViewportSize";
4295
- CommandResult[CommandResult["InvalidScrollingDirection"] = 71] = "InvalidScrollingDirection";
4296
- CommandResult[CommandResult["FigureDoesNotExist"] = 72] = "FigureDoesNotExist";
4297
- CommandResult[CommandResult["InvalidConditionalFormatId"] = 73] = "InvalidConditionalFormatId";
4298
- CommandResult[CommandResult["InvalidCellPopover"] = 74] = "InvalidCellPopover";
4299
- CommandResult[CommandResult["EmptyTarget"] = 75] = "EmptyTarget";
4300
- CommandResult[CommandResult["InvalidFreezeQuantity"] = 76] = "InvalidFreezeQuantity";
4301
- CommandResult[CommandResult["FrozenPaneOverlap"] = 77] = "FrozenPaneOverlap";
4302
- CommandResult[CommandResult["ValuesNotChanged"] = 78] = "ValuesNotChanged";
4303
- CommandResult[CommandResult["InvalidFilterZone"] = 79] = "InvalidFilterZone";
4304
- CommandResult[CommandResult["FilterOverlap"] = 80] = "FilterOverlap";
4305
- CommandResult[CommandResult["FilterNotFound"] = 81] = "FilterNotFound";
4306
- CommandResult[CommandResult["MergeInFilter"] = 82] = "MergeInFilter";
4307
- CommandResult[CommandResult["NonContinuousTargets"] = 83] = "NonContinuousTargets";
4308
- CommandResult[CommandResult["DuplicatedFigureId"] = 84] = "DuplicatedFigureId";
4309
- CommandResult[CommandResult["InvalidSelectionStep"] = 85] = "InvalidSelectionStep";
4310
- CommandResult[CommandResult["DuplicatedChartId"] = 86] = "DuplicatedChartId";
4311
- CommandResult[CommandResult["ChartDoesNotExist"] = 87] = "ChartDoesNotExist";
4312
- CommandResult[CommandResult["InvalidHeaderIndex"] = 88] = "InvalidHeaderIndex";
4313
- CommandResult[CommandResult["InvalidQuantity"] = 89] = "InvalidQuantity";
4314
- CommandResult[CommandResult["MoreThanOneColumnSelected"] = 90] = "MoreThanOneColumnSelected";
4315
- CommandResult[CommandResult["EmptySplitSeparator"] = 91] = "EmptySplitSeparator";
4316
- CommandResult[CommandResult["SplitWillOverwriteContent"] = 92] = "SplitWillOverwriteContent";
4317
- CommandResult[CommandResult["NoSplitSeparatorInSelection"] = 93] = "NoSplitSeparatorInSelection";
4318
- CommandResult[CommandResult["NoActiveSheet"] = 94] = "NoActiveSheet";
4319
- CommandResult[CommandResult["InvalidLocale"] = 95] = "InvalidLocale";
4320
- CommandResult[CommandResult["AlreadyInPaintingFormatMode"] = 96] = "AlreadyInPaintingFormatMode";
4321
- CommandResult[CommandResult["NoChanges"] = 97] = "NoChanges";
4260
+ CommandResult[CommandResult["InvalidInputId"] = 33] = "InvalidInputId";
4261
+ CommandResult[CommandResult["InvalidChartDefinition"] = 34] = "InvalidChartDefinition";
4262
+ CommandResult[CommandResult["InvalidDataSet"] = 35] = "InvalidDataSet";
4263
+ CommandResult[CommandResult["InvalidLabelRange"] = 36] = "InvalidLabelRange";
4264
+ CommandResult[CommandResult["InvalidScorecardKeyValue"] = 37] = "InvalidScorecardKeyValue";
4265
+ CommandResult[CommandResult["InvalidScorecardBaseline"] = 38] = "InvalidScorecardBaseline";
4266
+ CommandResult[CommandResult["InvalidGaugeDataRange"] = 39] = "InvalidGaugeDataRange";
4267
+ CommandResult[CommandResult["EmptyGaugeRangeMin"] = 40] = "EmptyGaugeRangeMin";
4268
+ CommandResult[CommandResult["GaugeRangeMinNaN"] = 41] = "GaugeRangeMinNaN";
4269
+ CommandResult[CommandResult["EmptyGaugeRangeMax"] = 42] = "EmptyGaugeRangeMax";
4270
+ CommandResult[CommandResult["GaugeRangeMaxNaN"] = 43] = "GaugeRangeMaxNaN";
4271
+ CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 44] = "GaugeRangeMinBiggerThanRangeMax";
4272
+ CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 45] = "GaugeLowerInflectionPointNaN";
4273
+ CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 46] = "GaugeUpperInflectionPointNaN";
4274
+ CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 47] = "GaugeLowerBiggerThanUpper";
4275
+ CommandResult[CommandResult["InvalidAutofillSelection"] = 48] = "InvalidAutofillSelection";
4276
+ CommandResult[CommandResult["WrongComposerSelection"] = 49] = "WrongComposerSelection";
4277
+ CommandResult[CommandResult["MinBiggerThanMax"] = 50] = "MinBiggerThanMax";
4278
+ CommandResult[CommandResult["LowerBiggerThanUpper"] = 51] = "LowerBiggerThanUpper";
4279
+ CommandResult[CommandResult["MidBiggerThanMax"] = 52] = "MidBiggerThanMax";
4280
+ CommandResult[CommandResult["MinBiggerThanMid"] = 53] = "MinBiggerThanMid";
4281
+ CommandResult[CommandResult["FirstArgMissing"] = 54] = "FirstArgMissing";
4282
+ CommandResult[CommandResult["SecondArgMissing"] = 55] = "SecondArgMissing";
4283
+ CommandResult[CommandResult["MinNaN"] = 56] = "MinNaN";
4284
+ CommandResult[CommandResult["MidNaN"] = 57] = "MidNaN";
4285
+ CommandResult[CommandResult["MaxNaN"] = 58] = "MaxNaN";
4286
+ CommandResult[CommandResult["ValueUpperInflectionNaN"] = 59] = "ValueUpperInflectionNaN";
4287
+ CommandResult[CommandResult["ValueLowerInflectionNaN"] = 60] = "ValueLowerInflectionNaN";
4288
+ CommandResult[CommandResult["MinInvalidFormula"] = 61] = "MinInvalidFormula";
4289
+ CommandResult[CommandResult["MidInvalidFormula"] = 62] = "MidInvalidFormula";
4290
+ CommandResult[CommandResult["MaxInvalidFormula"] = 63] = "MaxInvalidFormula";
4291
+ CommandResult[CommandResult["ValueUpperInvalidFormula"] = 64] = "ValueUpperInvalidFormula";
4292
+ CommandResult[CommandResult["ValueLowerInvalidFormula"] = 65] = "ValueLowerInvalidFormula";
4293
+ CommandResult[CommandResult["InvalidSortZone"] = 66] = "InvalidSortZone";
4294
+ CommandResult[CommandResult["WaitingSessionConfirmation"] = 67] = "WaitingSessionConfirmation";
4295
+ CommandResult[CommandResult["MergeOverlap"] = 68] = "MergeOverlap";
4296
+ CommandResult[CommandResult["TooManyHiddenElements"] = 69] = "TooManyHiddenElements";
4297
+ CommandResult[CommandResult["Readonly"] = 70] = "Readonly";
4298
+ CommandResult[CommandResult["InvalidViewportSize"] = 71] = "InvalidViewportSize";
4299
+ CommandResult[CommandResult["InvalidScrollingDirection"] = 72] = "InvalidScrollingDirection";
4300
+ CommandResult[CommandResult["FigureDoesNotExist"] = 73] = "FigureDoesNotExist";
4301
+ CommandResult[CommandResult["InvalidConditionalFormatId"] = 74] = "InvalidConditionalFormatId";
4302
+ CommandResult[CommandResult["InvalidCellPopover"] = 75] = "InvalidCellPopover";
4303
+ CommandResult[CommandResult["EmptyTarget"] = 76] = "EmptyTarget";
4304
+ CommandResult[CommandResult["InvalidFreezeQuantity"] = 77] = "InvalidFreezeQuantity";
4305
+ CommandResult[CommandResult["FrozenPaneOverlap"] = 78] = "FrozenPaneOverlap";
4306
+ CommandResult[CommandResult["ValuesNotChanged"] = 79] = "ValuesNotChanged";
4307
+ CommandResult[CommandResult["InvalidFilterZone"] = 80] = "InvalidFilterZone";
4308
+ CommandResult[CommandResult["FilterOverlap"] = 81] = "FilterOverlap";
4309
+ CommandResult[CommandResult["FilterNotFound"] = 82] = "FilterNotFound";
4310
+ CommandResult[CommandResult["MergeInFilter"] = 83] = "MergeInFilter";
4311
+ CommandResult[CommandResult["NonContinuousTargets"] = 84] = "NonContinuousTargets";
4312
+ CommandResult[CommandResult["DuplicatedFigureId"] = 85] = "DuplicatedFigureId";
4313
+ CommandResult[CommandResult["InvalidSelectionStep"] = 86] = "InvalidSelectionStep";
4314
+ CommandResult[CommandResult["DuplicatedChartId"] = 87] = "DuplicatedChartId";
4315
+ CommandResult[CommandResult["ChartDoesNotExist"] = 88] = "ChartDoesNotExist";
4316
+ CommandResult[CommandResult["InvalidHeaderIndex"] = 89] = "InvalidHeaderIndex";
4317
+ CommandResult[CommandResult["InvalidQuantity"] = 90] = "InvalidQuantity";
4318
+ CommandResult[CommandResult["MoreThanOneColumnSelected"] = 91] = "MoreThanOneColumnSelected";
4319
+ CommandResult[CommandResult["EmptySplitSeparator"] = 92] = "EmptySplitSeparator";
4320
+ CommandResult[CommandResult["SplitWillOverwriteContent"] = 93] = "SplitWillOverwriteContent";
4321
+ CommandResult[CommandResult["NoSplitSeparatorInSelection"] = 94] = "NoSplitSeparatorInSelection";
4322
+ CommandResult[CommandResult["NoActiveSheet"] = 95] = "NoActiveSheet";
4323
+ CommandResult[CommandResult["InvalidLocale"] = 96] = "InvalidLocale";
4324
+ CommandResult[CommandResult["AlreadyInPaintingFormatMode"] = 97] = "AlreadyInPaintingFormatMode";
4325
+ CommandResult[CommandResult["NoChanges"] = 98] = "NoChanges";
4322
4326
  })(CommandResult || (CommandResult = {}));
4323
4327
 
4324
4328
  const borderStyles = ["thin", "medium", "thick", "dashed", "dotted"];
@@ -16103,11 +16107,11 @@ function checkDataset(definition) {
16103
16107
  if (definition.dataSets) {
16104
16108
  const invalidRanges = definition.dataSets.find((range) => !rangeReference.test(range)) !== undefined;
16105
16109
  if (invalidRanges) {
16106
- return 34 /* CommandResult.InvalidDataSet */;
16110
+ return 35 /* CommandResult.InvalidDataSet */;
16107
16111
  }
16108
16112
  const zones = definition.dataSets.map(toUnboundedZone);
16109
16113
  if (zones.some((zone) => zone.top !== zone.bottom && isFullRow(zone))) {
16110
- return 34 /* CommandResult.InvalidDataSet */;
16114
+ return 35 /* CommandResult.InvalidDataSet */;
16111
16115
  }
16112
16116
  }
16113
16117
  return 0 /* CommandResult.Success */;
@@ -16116,7 +16120,7 @@ function checkLabelRange(definition) {
16116
16120
  if (definition.labelRange) {
16117
16121
  const invalidLabels = !rangeReference.test(definition.labelRange || "");
16118
16122
  if (invalidLabels) {
16119
- return 35 /* CommandResult.InvalidLabelRange */;
16123
+ return 36 /* CommandResult.InvalidLabelRange */;
16120
16124
  }
16121
16125
  }
16122
16126
  return 0 /* CommandResult.Success */;
@@ -16203,22 +16207,22 @@ function getChartPositionAtCenterOfViewport(getters, chartSize) {
16203
16207
  const CfTerms = {
16204
16208
  Errors: {
16205
16209
  [26 /* CommandResult.InvalidRange */]: _lt("The range is invalid"),
16206
- [53 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
16207
- [54 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
16208
- [55 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
16209
- [56 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
16210
- [57 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
16211
- [58 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
16212
- [59 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
16213
- [49 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
16214
- [52 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
16215
- [51 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
16216
- [50 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
16217
- [60 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
16218
- [62 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
16219
- [61 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
16220
- [63 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
16221
- [64 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
16210
+ [54 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
16211
+ [55 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
16212
+ [56 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
16213
+ [57 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
16214
+ [58 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
16215
+ [59 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
16216
+ [60 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
16217
+ [50 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
16218
+ [53 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
16219
+ [52 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
16220
+ [51 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
16221
+ [61 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
16222
+ [63 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
16223
+ [62 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
16224
+ [64 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
16225
+ [65 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
16222
16226
  [25 /* CommandResult.EmptyRange */]: _lt("A range needs to be defined"),
16223
16227
  Unexpected: _lt("The rule is invalid for an unknown reason"),
16224
16228
  },
@@ -16246,20 +16250,20 @@ const ChartTerms = {
16246
16250
  Errors: {
16247
16251
  Unexpected: _lt("The chart definition is invalid for an unknown reason"),
16248
16252
  // BASIC CHART ERRORS (LINE | BAR | PIE)
16249
- [34 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
16250
- [35 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
16253
+ [35 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
16254
+ [36 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
16251
16255
  // SCORECARD CHART ERRORS
16252
- [36 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
16253
- [37 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
16256
+ [37 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
16257
+ [38 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
16254
16258
  // GAUGE CHART ERRORS
16255
- [38 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
16256
- [39 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
16257
- [40 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
16258
- [41 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
16259
- [42 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
16260
- [43 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
16261
- [44 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
16262
- [45 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
16259
+ [39 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
16260
+ [40 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
16261
+ [41 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
16262
+ [42 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
16263
+ [43 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
16264
+ [44 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
16265
+ [45 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
16266
+ [46 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
16263
16267
  },
16264
16268
  };
16265
16269
  const CustomCurrencyTerms = {
@@ -16269,9 +16273,9 @@ const MergeErrorMessage = _lt("Merged cells are preventing this operation. Unmer
16269
16273
  const SplitToColumnsTerms = {
16270
16274
  Errors: {
16271
16275
  Unexpected: _lt("Cannot split the selection for an unknown reason"),
16272
- [93 /* CommandResult.NoSplitSeparatorInSelection */]: _lt("There is no match for the selected separator in the selection"),
16273
- [90 /* CommandResult.MoreThanOneColumnSelected */]: _lt("Only a selection from a single column can be split"),
16274
- [92 /* CommandResult.SplitWillOverwriteContent */]: _lt("Splitting will overwrite existing content"),
16276
+ [94 /* CommandResult.NoSplitSeparatorInSelection */]: _lt("There is no match for the selected separator in the selection"),
16277
+ [91 /* CommandResult.MoreThanOneColumnSelected */]: _lt("Only a selection from a single column can be split"),
16278
+ [93 /* CommandResult.SplitWillOverwriteContent */]: _lt("Splitting will overwrite existing content"),
16275
16279
  },
16276
16280
  };
16277
16281
 
@@ -16676,7 +16680,7 @@ function createBarChartRuntime(chart, getters) {
16676
16680
 
16677
16681
  function isDataRangeValid(definition) {
16678
16682
  return definition.dataRange && !rangeReference.test(definition.dataRange)
16679
- ? 38 /* CommandResult.InvalidGaugeDataRange */
16683
+ ? 39 /* CommandResult.InvalidGaugeDataRange */
16680
16684
  : 0 /* CommandResult.Success */;
16681
16685
  }
16682
16686
  function checkRangeLimits(check, batchValidations) {
@@ -16708,7 +16712,7 @@ function checkInflectionPointsValue(check, batchValidations) {
16708
16712
  function checkRangeMinBiggerThanRangeMax(definition) {
16709
16713
  if (definition.sectionRule) {
16710
16714
  if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) {
16711
- return 43 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
16715
+ return 44 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
16712
16716
  }
16713
16717
  }
16714
16718
  return 0 /* CommandResult.Success */;
@@ -16717,9 +16721,9 @@ function checkEmpty(value, valueName) {
16717
16721
  if (value === "") {
16718
16722
  switch (valueName) {
16719
16723
  case "rangeMin":
16720
- return 39 /* CommandResult.EmptyGaugeRangeMin */;
16724
+ return 40 /* CommandResult.EmptyGaugeRangeMin */;
16721
16725
  case "rangeMax":
16722
- return 41 /* CommandResult.EmptyGaugeRangeMax */;
16726
+ return 42 /* CommandResult.EmptyGaugeRangeMax */;
16723
16727
  }
16724
16728
  }
16725
16729
  return 0 /* CommandResult.Success */;
@@ -16728,13 +16732,13 @@ function checkNaN(value, valueName) {
16728
16732
  if (isNaN(value)) {
16729
16733
  switch (valueName) {
16730
16734
  case "rangeMin":
16731
- return 40 /* CommandResult.GaugeRangeMinNaN */;
16735
+ return 41 /* CommandResult.GaugeRangeMinNaN */;
16732
16736
  case "rangeMax":
16733
- return 42 /* CommandResult.GaugeRangeMaxNaN */;
16737
+ return 43 /* CommandResult.GaugeRangeMaxNaN */;
16734
16738
  case "lowerInflectionPointValue":
16735
- return 44 /* CommandResult.GaugeLowerInflectionPointNaN */;
16739
+ return 45 /* CommandResult.GaugeLowerInflectionPointNaN */;
16736
16740
  case "upperInflectionPointValue":
16737
- return 45 /* CommandResult.GaugeUpperInflectionPointNaN */;
16741
+ return 46 /* CommandResult.GaugeUpperInflectionPointNaN */;
16738
16742
  }
16739
16743
  }
16740
16744
  return 0 /* CommandResult.Success */;
@@ -17530,12 +17534,12 @@ function createPieChartRuntime(chart, getters) {
17530
17534
 
17531
17535
  function checkKeyValue(definition) {
17532
17536
  return definition.keyValue && !rangeReference.test(definition.keyValue)
17533
- ? 36 /* CommandResult.InvalidScorecardKeyValue */
17537
+ ? 37 /* CommandResult.InvalidScorecardKeyValue */
17534
17538
  : 0 /* CommandResult.Success */;
17535
17539
  }
17536
17540
  function checkBaseline(definition) {
17537
17541
  return definition.baseline && !rangeReference.test(definition.baseline)
17538
- ? 37 /* CommandResult.InvalidScorecardBaseline */
17542
+ ? 38 /* CommandResult.InvalidScorecardBaseline */
17539
17543
  : 0 /* CommandResult.Success */;
17540
17544
  }
17541
17545
  class ScorecardChart extends AbstractChart {
@@ -18062,7 +18066,7 @@ const AddMergeInteractiveContent = {
18062
18066
  };
18063
18067
  function interactiveAddMerge(env, sheetId, target) {
18064
18068
  const result = env.model.dispatch("ADD_MERGE", { sheetId, target });
18065
- if (result.isCancelledBecause(82 /* CommandResult.MergeInFilter */)) {
18069
+ if (result.isCancelledBecause(83 /* CommandResult.MergeInFilter */)) {
18066
18070
  env.raiseError(AddMergeInteractiveContent.MergeInFilter);
18067
18071
  }
18068
18072
  else if (result.isCancelledBecause(3 /* CommandResult.MergeIsDestructive */)) {
@@ -18089,7 +18093,7 @@ function handlePasteResult(env, result) {
18089
18093
  else if (result.reasons.includes(23 /* CommandResult.WrongFigurePasteOption */)) {
18090
18094
  env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
18091
18095
  }
18092
- else if (result.reasons.includes(77 /* CommandResult.FrozenPaneOverlap */)) {
18096
+ else if (result.reasons.includes(78 /* CommandResult.FrozenPaneOverlap */)) {
18093
18097
  env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
18094
18098
  }
18095
18099
  }
@@ -19264,7 +19268,7 @@ function interactiveSortSelection(env, sheetId, anchor, zone, sortDirection) {
19264
19268
  });
19265
19269
  }
19266
19270
  }
19267
- if (result.isCancelledBecause(65 /* CommandResult.InvalidSortZone */)) {
19271
+ if (result.isCancelledBecause(66 /* CommandResult.InvalidSortZone */)) {
19268
19272
  const { col, row } = anchor;
19269
19273
  env.model.selection.selectZone({ cell: { col, row }, zone });
19270
19274
  env.raiseError(_lt("Cannot sort. To sort, select only cells or only merges that have the same size."));
@@ -19278,13 +19282,13 @@ const AddFilterInteractiveContent = {
19278
19282
  };
19279
19283
  function interactiveAddFilter(env, sheetId, target) {
19280
19284
  const result = env.model.dispatch("CREATE_FILTER_TABLE", { target, sheetId });
19281
- if (result.isCancelledBecause(80 /* CommandResult.FilterOverlap */)) {
19285
+ if (result.isCancelledBecause(81 /* CommandResult.FilterOverlap */)) {
19282
19286
  env.raiseError(AddFilterInteractiveContent.filterOverlap);
19283
19287
  }
19284
- else if (result.isCancelledBecause(82 /* CommandResult.MergeInFilter */)) {
19288
+ else if (result.isCancelledBecause(83 /* CommandResult.MergeInFilter */)) {
19285
19289
  env.raiseError(AddFilterInteractiveContent.mergeInFilter);
19286
19290
  }
19287
- else if (result.isCancelledBecause(83 /* CommandResult.NonContinuousTargets */)) {
19291
+ else if (result.isCancelledBecause(84 /* CommandResult.NonContinuousTargets */)) {
19288
19292
  env.raiseError(AddFilterInteractiveContent.nonContinuousTargets);
19289
19293
  }
19290
19294
  }
@@ -19721,7 +19725,7 @@ function interactiveFreezeColumnsRows(env, dimension, base) {
19721
19725
  const sheetId = env.model.getters.getActiveSheetId();
19722
19726
  const cmd = dimension === "COL" ? "FREEZE_COLUMNS" : "FREEZE_ROWS";
19723
19727
  const result = env.model.dispatch(cmd, { sheetId, quantity: base });
19724
- if (result.isCancelledBecause(67 /* CommandResult.MergeOverlap */)) {
19728
+ if (result.isCancelledBecause(68 /* CommandResult.MergeOverlap */)) {
19725
19729
  env.raiseError(MergeErrorMessage);
19726
19730
  }
19727
19731
  }
@@ -20861,10 +20865,10 @@ class LineBarPieConfigPanel extends Component {
20861
20865
  return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
20862
20866
  }
20863
20867
  get isDatasetInvalid() {
20864
- return !!this.state.datasetDispatchResult?.isCancelledBecause(34 /* CommandResult.InvalidDataSet */);
20868
+ return !!this.state.datasetDispatchResult?.isCancelledBecause(35 /* CommandResult.InvalidDataSet */);
20865
20869
  }
20866
20870
  get isLabelInvalid() {
20867
- return !!this.state.labelsDispatchResult?.isCancelledBecause(35 /* CommandResult.InvalidLabelRange */);
20871
+ return !!this.state.labelsDispatchResult?.isCancelledBecause(36 /* CommandResult.InvalidLabelRange */);
20868
20872
  }
20869
20873
  onUpdateDataSetsHaveTitle(ev) {
20870
20874
  this.props.updateChart(this.props.figureId, {
@@ -21538,7 +21542,7 @@ class GaugeChartConfigPanel extends Component {
21538
21542
  return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
21539
21543
  }
21540
21544
  get isDataRangeInvalid() {
21541
- return !!this.state.dataRangeDispatchResult?.isCancelledBecause(38 /* CommandResult.InvalidGaugeDataRange */);
21545
+ return !!this.state.dataRangeDispatchResult?.isCancelledBecause(39 /* CommandResult.InvalidGaugeDataRange */);
21542
21546
  }
21543
21547
  onDataRangeChanged(ranges) {
21544
21548
  this.dataRange = ranges[0];
@@ -21622,25 +21626,25 @@ class GaugeChartDesignPanel extends Component {
21622
21626
  });
21623
21627
  }
21624
21628
  isRangeMinInvalid() {
21625
- return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(39 /* CommandResult.EmptyGaugeRangeMin */) ||
21626
- this.state.sectionRuleDispatchResult?.isCancelledBecause(40 /* CommandResult.GaugeRangeMinNaN */) ||
21627
- this.state.sectionRuleDispatchResult?.isCancelledBecause(43 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */));
21629
+ return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(40 /* CommandResult.EmptyGaugeRangeMin */) ||
21630
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(41 /* CommandResult.GaugeRangeMinNaN */) ||
21631
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(44 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */));
21628
21632
  }
21629
21633
  isRangeMaxInvalid() {
21630
- return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(41 /* CommandResult.EmptyGaugeRangeMax */) ||
21631
- this.state.sectionRuleDispatchResult?.isCancelledBecause(42 /* CommandResult.GaugeRangeMaxNaN */) ||
21632
- this.state.sectionRuleDispatchResult?.isCancelledBecause(43 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */));
21634
+ return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(42 /* CommandResult.EmptyGaugeRangeMax */) ||
21635
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(43 /* CommandResult.GaugeRangeMaxNaN */) ||
21636
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(44 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */));
21633
21637
  }
21634
21638
  // ---------------------------------------------------------------------------
21635
21639
  // COLOR_SECTION_TEMPLATE
21636
21640
  // ---------------------------------------------------------------------------
21637
21641
  get isLowerInflectionPointInvalid() {
21638
- return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(44 /* CommandResult.GaugeLowerInflectionPointNaN */) ||
21639
- this.state.sectionRuleDispatchResult?.isCancelledBecause(46 /* CommandResult.GaugeLowerBiggerThanUpper */));
21642
+ return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(45 /* CommandResult.GaugeLowerInflectionPointNaN */) ||
21643
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(47 /* CommandResult.GaugeLowerBiggerThanUpper */));
21640
21644
  }
21641
21645
  get isUpperInflectionPointInvalid() {
21642
- return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(45 /* CommandResult.GaugeUpperInflectionPointNaN */) ||
21643
- this.state.sectionRuleDispatchResult?.isCancelledBecause(46 /* CommandResult.GaugeLowerBiggerThanUpper */));
21646
+ return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(46 /* CommandResult.GaugeUpperInflectionPointNaN */) ||
21647
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(47 /* CommandResult.GaugeLowerBiggerThanUpper */));
21644
21648
  }
21645
21649
  updateSectionColor(target, color) {
21646
21650
  const sectionRule = deepCopy(this.state.sectionRule);
@@ -21728,10 +21732,10 @@ class ScorecardChartConfigPanel extends Component {
21728
21732
  return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
21729
21733
  }
21730
21734
  get isKeyValueInvalid() {
21731
- return !!this.state.keyValueDispatchResult?.isCancelledBecause(36 /* CommandResult.InvalidScorecardKeyValue */);
21735
+ return !!this.state.keyValueDispatchResult?.isCancelledBecause(37 /* CommandResult.InvalidScorecardKeyValue */);
21732
21736
  }
21733
21737
  get isBaselineInvalid() {
21734
- return !!this.state.keyValueDispatchResult?.isCancelledBecause(37 /* CommandResult.InvalidScorecardBaseline */);
21738
+ return !!this.state.keyValueDispatchResult?.isCancelledBecause(38 /* CommandResult.InvalidScorecardBaseline */);
21735
21739
  }
21736
21740
  onKeyValueRangeChanged(ranges) {
21737
21741
  this.keyValue = ranges[0];
@@ -22626,10 +22630,10 @@ class ConditionalFormattingPanel extends Component {
22626
22630
  * Cell Is Rule
22627
22631
  ****************************************************************************/
22628
22632
  get isValue1Invalid() {
22629
- return !!this.state.errors?.includes(53 /* CommandResult.FirstArgMissing */);
22633
+ return !!this.state.errors?.includes(54 /* CommandResult.FirstArgMissing */);
22630
22634
  }
22631
22635
  get isValue2Invalid() {
22632
- return !!this.state.errors?.includes(54 /* CommandResult.SecondArgMissing */);
22636
+ return !!this.state.errors?.includes(55 /* CommandResult.SecondArgMissing */);
22633
22637
  }
22634
22638
  toggleStyle(tool) {
22635
22639
  const style = this.state.rules.cellIs.style;
@@ -22646,17 +22650,17 @@ class ConditionalFormattingPanel extends Component {
22646
22650
  isValueInvalid(threshold) {
22647
22651
  switch (threshold) {
22648
22652
  case "minimum":
22649
- return (this.state.errors.includes(60 /* CommandResult.MinInvalidFormula */) ||
22650
- this.state.errors.includes(52 /* CommandResult.MinBiggerThanMid */) ||
22651
- this.state.errors.includes(49 /* CommandResult.MinBiggerThanMax */) ||
22652
- this.state.errors.includes(55 /* CommandResult.MinNaN */));
22653
+ return (this.state.errors.includes(61 /* CommandResult.MinInvalidFormula */) ||
22654
+ this.state.errors.includes(53 /* CommandResult.MinBiggerThanMid */) ||
22655
+ this.state.errors.includes(50 /* CommandResult.MinBiggerThanMax */) ||
22656
+ this.state.errors.includes(56 /* CommandResult.MinNaN */));
22653
22657
  case "midpoint":
22654
- return (this.state.errors.includes(61 /* CommandResult.MidInvalidFormula */) ||
22655
- this.state.errors.includes(56 /* CommandResult.MidNaN */) ||
22656
- this.state.errors.includes(51 /* CommandResult.MidBiggerThanMax */));
22658
+ return (this.state.errors.includes(62 /* CommandResult.MidInvalidFormula */) ||
22659
+ this.state.errors.includes(57 /* CommandResult.MidNaN */) ||
22660
+ this.state.errors.includes(52 /* CommandResult.MidBiggerThanMax */));
22657
22661
  case "maximum":
22658
- return (this.state.errors.includes(62 /* CommandResult.MaxInvalidFormula */) ||
22659
- this.state.errors.includes(57 /* CommandResult.MaxNaN */));
22662
+ return (this.state.errors.includes(63 /* CommandResult.MaxInvalidFormula */) ||
22663
+ this.state.errors.includes(58 /* CommandResult.MaxNaN */));
22660
22664
  default:
22661
22665
  return false;
22662
22666
  }
@@ -22704,13 +22708,13 @@ class ConditionalFormattingPanel extends Component {
22704
22708
  isInflectionPointInvalid(inflectionPoint) {
22705
22709
  switch (inflectionPoint) {
22706
22710
  case "lowerInflectionPoint":
22707
- return (this.state.errors.includes(59 /* CommandResult.ValueLowerInflectionNaN */) ||
22708
- this.state.errors.includes(64 /* CommandResult.ValueLowerInvalidFormula */) ||
22709
- this.state.errors.includes(50 /* CommandResult.LowerBiggerThanUpper */));
22711
+ return (this.state.errors.includes(60 /* CommandResult.ValueLowerInflectionNaN */) ||
22712
+ this.state.errors.includes(65 /* CommandResult.ValueLowerInvalidFormula */) ||
22713
+ this.state.errors.includes(51 /* CommandResult.LowerBiggerThanUpper */));
22710
22714
  case "upperInflectionPoint":
22711
- return (this.state.errors.includes(58 /* CommandResult.ValueUpperInflectionNaN */) ||
22712
- this.state.errors.includes(63 /* CommandResult.ValueUpperInvalidFormula */) ||
22713
- this.state.errors.includes(50 /* CommandResult.LowerBiggerThanUpper */));
22715
+ return (this.state.errors.includes(59 /* CommandResult.ValueUpperInflectionNaN */) ||
22716
+ this.state.errors.includes(64 /* CommandResult.ValueUpperInvalidFormula */) ||
22717
+ this.state.errors.includes(51 /* CommandResult.LowerBiggerThanUpper */));
22714
22718
  default:
22715
22719
  return true;
22716
22720
  }
@@ -23073,7 +23077,7 @@ const SplitToColumnsInteractiveContent = {
23073
23077
  };
23074
23078
  function interactiveSplitToColumns(env, separator, addNewColumns) {
23075
23079
  let result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", { separator, addNewColumns });
23076
- if (result.isCancelledBecause(92 /* CommandResult.SplitWillOverwriteContent */)) {
23080
+ if (result.isCancelledBecause(93 /* CommandResult.SplitWillOverwriteContent */)) {
23077
23081
  env.askConfirmation(SplitToColumnsInteractiveContent.SplitIsDestructive, () => {
23078
23082
  result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", {
23079
23083
  separator,
@@ -23137,8 +23141,8 @@ class SplitIntoColumnsPanel extends Component {
23137
23141
  const errors = new Set();
23138
23142
  for (const reason of cancelledReasons) {
23139
23143
  switch (reason) {
23140
- case 92 /* CommandResult.SplitWillOverwriteContent */:
23141
- case 91 /* CommandResult.EmptySplitSeparator */:
23144
+ case 93 /* CommandResult.SplitWillOverwriteContent */:
23145
+ case 92 /* CommandResult.EmptySplitSeparator */:
23142
23146
  break;
23143
23147
  default:
23144
23148
  errors.add(SplitToColumnsTerms.Errors[reason] || SplitToColumnsTerms.Errors.Unexpected);
@@ -23153,8 +23157,8 @@ class SplitIntoColumnsPanel extends Component {
23153
23157
  addNewColumns: this.state.addNewColumns,
23154
23158
  force: false,
23155
23159
  }).reasons;
23156
- if (cancelledReasons.includes(92 /* CommandResult.SplitWillOverwriteContent */)) {
23157
- warnings.push(SplitToColumnsTerms.Errors[92 /* CommandResult.SplitWillOverwriteContent */]);
23160
+ if (cancelledReasons.includes(93 /* CommandResult.SplitWillOverwriteContent */)) {
23161
+ warnings.push(SplitToColumnsTerms.Errors[93 /* CommandResult.SplitWillOverwriteContent */]);
23158
23162
  }
23159
23163
  return warnings;
23160
23164
  }
@@ -24374,6 +24378,9 @@ class Composer extends Component {
24374
24378
  const token = tokens.filter((token) => token.value.includes(currentSelectedText) &&
24375
24379
  token.start <= currentSelection.start &&
24376
24380
  token.end >= currentSelection.end)[0];
24381
+ if (!token) {
24382
+ return;
24383
+ }
24377
24384
  if (token.type === "REFERENCE") {
24378
24385
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", {
24379
24386
  start: token.start,
@@ -31678,7 +31685,7 @@ class BordersPlugin extends CorePlugin {
31678
31685
  const currentBorder = this.getCellBorder(cmd);
31679
31686
  const areAllNewBordersUndefined = !cmd.border?.bottom && !cmd.border?.left && !cmd.border?.right && !cmd.border?.top;
31680
31687
  if ((!currentBorder && areAllNewBordersUndefined) || deepEquals(currentBorder, cmd.border)) {
31681
- return 97 /* CommandResult.NoChanges */;
31688
+ return 98 /* CommandResult.NoChanges */;
31682
31689
  }
31683
31690
  return 0 /* CommandResult.Success */;
31684
31691
  }
@@ -32189,9 +32196,9 @@ class CellPlugin extends CorePlugin {
32189
32196
  checkUselessClearCell(cmd) {
32190
32197
  const cell = this.getters.getCell(cmd);
32191
32198
  if (!cell)
32192
- return 97 /* CommandResult.NoChanges */;
32199
+ return 98 /* CommandResult.NoChanges */;
32193
32200
  if (!cell.content && !cell.style && !cell.format) {
32194
- return 97 /* CommandResult.NoChanges */;
32201
+ return 98 /* CommandResult.NoChanges */;
32195
32202
  }
32196
32203
  return 0 /* CommandResult.Success */;
32197
32204
  }
@@ -32416,13 +32423,13 @@ class ChartPlugin extends CorePlugin {
32416
32423
  }
32417
32424
  checkChartDuplicate(cmd) {
32418
32425
  return this.getters.getFigureSheetId(cmd.id)
32419
- ? 86 /* CommandResult.DuplicatedChartId */
32426
+ ? 87 /* CommandResult.DuplicatedChartId */
32420
32427
  : 0 /* CommandResult.Success */;
32421
32428
  }
32422
32429
  checkChartExists(cmd) {
32423
32430
  return this.getters.getFigureSheetId(cmd.id)
32424
32431
  ? 0 /* CommandResult.Success */
32425
- : 87 /* CommandResult.ChartDoesNotExist */;
32432
+ : 88 /* CommandResult.ChartDoesNotExist */;
32426
32433
  }
32427
32434
  }
32428
32435
 
@@ -32634,10 +32641,10 @@ class ConditionalFormatPlugin extends CorePlugin {
32634
32641
  return 28 /* CommandResult.InvalidSheetId */;
32635
32642
  const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
32636
32643
  if (ruleIndex === -1)
32637
- return 73 /* CommandResult.InvalidConditionalFormatId */;
32644
+ return 74 /* CommandResult.InvalidConditionalFormatId */;
32638
32645
  const cfIndex2 = direction === "up" ? ruleIndex - 1 : ruleIndex + 1;
32639
32646
  if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) {
32640
- return 73 /* CommandResult.InvalidConditionalFormatId */;
32647
+ return 74 /* CommandResult.InvalidConditionalFormatId */;
32641
32648
  }
32642
32649
  return 0 /* CommandResult.Success */;
32643
32650
  }
@@ -32678,10 +32685,10 @@ class ConditionalFormatPlugin extends CorePlugin {
32678
32685
  const errors = [];
32679
32686
  const isEmpty = (value) => value === undefined || value === "";
32680
32687
  if (expectedNumber >= 1 && isEmpty(rule.values[0])) {
32681
- errors.push(53 /* CommandResult.FirstArgMissing */);
32688
+ errors.push(54 /* CommandResult.FirstArgMissing */);
32682
32689
  }
32683
32690
  if (expectedNumber >= 2 && isEmpty(rule.values[1])) {
32684
- errors.push(54 /* CommandResult.SecondArgMissing */);
32691
+ errors.push(55 /* CommandResult.SecondArgMissing */);
32685
32692
  }
32686
32693
  return errors.length ? errors : 0 /* CommandResult.Success */;
32687
32694
  }
@@ -32693,15 +32700,15 @@ class ConditionalFormatPlugin extends CorePlugin {
32693
32700
  (threshold.value === "" || isNaN(threshold.value))) {
32694
32701
  switch (thresholdName) {
32695
32702
  case "min":
32696
- return 55 /* CommandResult.MinNaN */;
32703
+ return 56 /* CommandResult.MinNaN */;
32697
32704
  case "max":
32698
- return 57 /* CommandResult.MaxNaN */;
32705
+ return 58 /* CommandResult.MaxNaN */;
32699
32706
  case "mid":
32700
- return 56 /* CommandResult.MidNaN */;
32707
+ return 57 /* CommandResult.MidNaN */;
32701
32708
  case "upperInflectionPoint":
32702
- return 58 /* CommandResult.ValueUpperInflectionNaN */;
32709
+ return 59 /* CommandResult.ValueUpperInflectionNaN */;
32703
32710
  case "lowerInflectionPoint":
32704
- return 59 /* CommandResult.ValueLowerInflectionNaN */;
32711
+ return 60 /* CommandResult.ValueLowerInflectionNaN */;
32705
32712
  }
32706
32713
  }
32707
32714
  return 0 /* CommandResult.Success */;
@@ -32715,15 +32722,15 @@ class ConditionalFormatPlugin extends CorePlugin {
32715
32722
  catch (error) {
32716
32723
  switch (thresholdName) {
32717
32724
  case "min":
32718
- return 60 /* CommandResult.MinInvalidFormula */;
32725
+ return 61 /* CommandResult.MinInvalidFormula */;
32719
32726
  case "max":
32720
- return 62 /* CommandResult.MaxInvalidFormula */;
32727
+ return 63 /* CommandResult.MaxInvalidFormula */;
32721
32728
  case "mid":
32722
- return 61 /* CommandResult.MidInvalidFormula */;
32729
+ return 62 /* CommandResult.MidInvalidFormula */;
32723
32730
  case "upperInflectionPoint":
32724
- return 63 /* CommandResult.ValueUpperInvalidFormula */;
32731
+ return 64 /* CommandResult.ValueUpperInvalidFormula */;
32725
32732
  case "lowerInflectionPoint":
32726
- return 64 /* CommandResult.ValueLowerInvalidFormula */;
32733
+ return 65 /* CommandResult.ValueLowerInvalidFormula */;
32727
32734
  }
32728
32735
  }
32729
32736
  return 0 /* CommandResult.Success */;
@@ -32740,7 +32747,7 @@ class ConditionalFormatPlugin extends CorePlugin {
32740
32747
  if (["number", "percentage", "percentile"].includes(rule.lowerInflectionPoint.type) &&
32741
32748
  rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type &&
32742
32749
  Number(minValue) > Number(maxValue)) {
32743
- return 50 /* CommandResult.LowerBiggerThanUpper */;
32750
+ return 51 /* CommandResult.LowerBiggerThanUpper */;
32744
32751
  }
32745
32752
  return 0 /* CommandResult.Success */;
32746
32753
  }
@@ -32750,7 +32757,7 @@ class ConditionalFormatPlugin extends CorePlugin {
32750
32757
  if (["number", "percentage", "percentile"].includes(rule.minimum.type) &&
32751
32758
  rule.minimum.type === rule.maximum.type &&
32752
32759
  stringToNumber(minValue) >= stringToNumber(maxValue)) {
32753
- return 49 /* CommandResult.MinBiggerThanMax */;
32760
+ return 50 /* CommandResult.MinBiggerThanMax */;
32754
32761
  }
32755
32762
  return 0 /* CommandResult.Success */;
32756
32763
  }
@@ -32761,7 +32768,7 @@ class ConditionalFormatPlugin extends CorePlugin {
32761
32768
  ["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
32762
32769
  rule.midpoint.type === rule.maximum.type &&
32763
32770
  stringToNumber(midValue) >= stringToNumber(maxValue)) {
32764
- return 51 /* CommandResult.MidBiggerThanMax */;
32771
+ return 52 /* CommandResult.MidBiggerThanMax */;
32765
32772
  }
32766
32773
  return 0 /* CommandResult.Success */;
32767
32774
  }
@@ -32772,7 +32779,7 @@ class ConditionalFormatPlugin extends CorePlugin {
32772
32779
  ["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
32773
32780
  rule.minimum.type === rule.midpoint.type &&
32774
32781
  stringToNumber(minValue) >= stringToNumber(midValue)) {
32775
- return 52 /* CommandResult.MinBiggerThanMid */;
32782
+ return 53 /* CommandResult.MinBiggerThanMid */;
32776
32783
  }
32777
32784
  return 0 /* CommandResult.Success */;
32778
32785
  }
@@ -32904,13 +32911,13 @@ class FigurePlugin extends CorePlugin {
32904
32911
  }
32905
32912
  checkFigureExists(sheetId, figureId) {
32906
32913
  if (this.figures[sheetId]?.[figureId] === undefined) {
32907
- return 72 /* CommandResult.FigureDoesNotExist */;
32914
+ return 73 /* CommandResult.FigureDoesNotExist */;
32908
32915
  }
32909
32916
  return 0 /* CommandResult.Success */;
32910
32917
  }
32911
32918
  checkFigureDuplicate(figureId) {
32912
32919
  if (Object.values(this.figures).find((sheet) => sheet?.[figureId])) {
32913
- return 84 /* CommandResult.DuplicatedFigureId */;
32920
+ return 85 /* CommandResult.DuplicatedFigureId */;
32914
32921
  }
32915
32922
  return 0 /* CommandResult.Success */;
32916
32923
  }
@@ -33022,12 +33029,12 @@ class FiltersPlugin extends CorePlugin {
33022
33029
  switch (cmd.type) {
33023
33030
  case "CREATE_FILTER_TABLE":
33024
33031
  if (!areZonesContinuous(...cmd.target)) {
33025
- return 83 /* CommandResult.NonContinuousTargets */;
33032
+ return 84 /* CommandResult.NonContinuousTargets */;
33026
33033
  }
33027
33034
  const zone = union(...cmd.target);
33028
33035
  const checkFilterOverlap = () => {
33029
33036
  if (this.getFilterTables(cmd.sheetId).some((filter) => overlap(filter.zone, zone))) {
33030
- return 80 /* CommandResult.FilterOverlap */;
33037
+ return 81 /* CommandResult.FilterOverlap */;
33031
33038
  }
33032
33039
  return 0 /* CommandResult.Success */;
33033
33040
  };
@@ -33035,7 +33042,7 @@ class FiltersPlugin extends CorePlugin {
33035
33042
  const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, zone);
33036
33043
  for (let merge of mergesInTarget) {
33037
33044
  if (overlap(zone, merge)) {
33038
- return 82 /* CommandResult.MergeInFilter */;
33045
+ return 83 /* CommandResult.MergeInFilter */;
33039
33046
  }
33040
33047
  }
33041
33048
  return 0 /* CommandResult.Success */;
@@ -33045,7 +33052,7 @@ class FiltersPlugin extends CorePlugin {
33045
33052
  for (let merge of cmd.target) {
33046
33053
  for (let filterTable of this.getFilterTables(cmd.sheetId)) {
33047
33054
  if (overlap(filterTable.zone, merge)) {
33048
- return 82 /* CommandResult.MergeInFilter */;
33055
+ return 83 /* CommandResult.MergeInFilter */;
33049
33056
  }
33050
33057
  }
33051
33058
  }
@@ -33414,10 +33421,10 @@ class HeaderVisibilityPlugin extends CorePlugin {
33414
33421
  : this.getters.getNumberRows(cmd.sheetId);
33415
33422
  const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
33416
33423
  if (hiddenElements.size >= elements) {
33417
- return 68 /* CommandResult.TooManyHiddenElements */;
33424
+ return 69 /* CommandResult.TooManyHiddenElements */;
33418
33425
  }
33419
33426
  else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
33420
- return 88 /* CommandResult.InvalidHeaderIndex */;
33427
+ return 89 /* CommandResult.InvalidHeaderIndex */;
33421
33428
  }
33422
33429
  else {
33423
33430
  return 0 /* CommandResult.Success */;
@@ -33981,7 +33988,7 @@ class MergePlugin extends CorePlugin {
33981
33988
  for (const zone of target) {
33982
33989
  for (const zone2 of target) {
33983
33990
  if (zone !== zone2 && overlap(zone, zone2)) {
33984
- return 67 /* CommandResult.MergeOverlap */;
33991
+ return 68 /* CommandResult.MergeOverlap */;
33985
33992
  }
33986
33993
  }
33987
33994
  }
@@ -33995,7 +34002,7 @@ class MergePlugin extends CorePlugin {
33995
34002
  for (const zone of target) {
33996
34003
  if ((zone.left < xSplit && zone.right >= xSplit) ||
33997
34004
  (zone.top < ySplit && zone.bottom >= ySplit)) {
33998
- return 77 /* CommandResult.FrozenPaneOverlap */;
34005
+ return 78 /* CommandResult.FrozenPaneOverlap */;
33999
34006
  }
34000
34007
  }
34001
34008
  return 0 /* CommandResult.Success */;
@@ -34518,9 +34525,9 @@ class RangeAdapter {
34518
34525
  * Get a Xc string that represent a part of a range
34519
34526
  */
34520
34527
  getRangePartString(range, part) {
34521
- const colFixed = range.parts && range.parts[part].colFixed ? "$" : "";
34528
+ const colFixed = range.parts && range.parts[part]?.colFixed ? "$" : "";
34522
34529
  const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
34523
- const rowFixed = range.parts && range.parts[part].rowFixed ? "$" : "";
34530
+ const rowFixed = range.parts && range.parts[part]?.rowFixed ? "$" : "";
34524
34531
  const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
34525
34532
  let str = "";
34526
34533
  if (range.isFullCol) {
@@ -34628,10 +34635,10 @@ class SheetPlugin extends CorePlugin {
34628
34635
  ? this.getNumberCols(cmd.sheetId)
34629
34636
  : this.getNumberRows(cmd.sheetId);
34630
34637
  if (cmd.base < 0 || cmd.base >= elements) {
34631
- return 88 /* CommandResult.InvalidHeaderIndex */;
34638
+ return 89 /* CommandResult.InvalidHeaderIndex */;
34632
34639
  }
34633
34640
  else if (cmd.quantity <= 0) {
34634
- return 89 /* CommandResult.InvalidQuantity */;
34641
+ return 90 /* CommandResult.InvalidQuantity */;
34635
34642
  }
34636
34643
  return 0 /* CommandResult.Success */;
34637
34644
  case "REMOVE_COLUMNS_ROWS": {
@@ -34639,7 +34646,7 @@ class SheetPlugin extends CorePlugin {
34639
34646
  ? this.getNumberCols(cmd.sheetId)
34640
34647
  : this.getNumberRows(cmd.sheetId);
34641
34648
  if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
34642
- return 88 /* CommandResult.InvalidHeaderIndex */;
34649
+ return 89 /* CommandResult.InvalidHeaderIndex */;
34643
34650
  }
34644
34651
  else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
34645
34652
  return 8 /* CommandResult.NotEnoughElements */;
@@ -35119,18 +35126,18 @@ class SheetPlugin extends CorePlugin {
35119
35126
  checkRowFreezeQuantity(cmd) {
35120
35127
  return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId)
35121
35128
  ? 0 /* CommandResult.Success */
35122
- : 76 /* CommandResult.InvalidFreezeQuantity */;
35129
+ : 77 /* CommandResult.InvalidFreezeQuantity */;
35123
35130
  }
35124
35131
  checkColFreezeQuantity(cmd) {
35125
35132
  return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId)
35126
35133
  ? 0 /* CommandResult.Success */
35127
- : 76 /* CommandResult.InvalidFreezeQuantity */;
35134
+ : 77 /* CommandResult.InvalidFreezeQuantity */;
35128
35135
  }
35129
35136
  checkRowFreezeOverlapMerge(cmd) {
35130
35137
  const merges = this.getters.getMerges(cmd.sheetId);
35131
35138
  for (let merge of merges) {
35132
35139
  if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) {
35133
- return 67 /* CommandResult.MergeOverlap */;
35140
+ return 68 /* CommandResult.MergeOverlap */;
35134
35141
  }
35135
35142
  }
35136
35143
  return 0 /* CommandResult.Success */;
@@ -35139,7 +35146,7 @@ class SheetPlugin extends CorePlugin {
35139
35146
  const merges = this.getters.getMerges(cmd.sheetId);
35140
35147
  for (let merge of merges) {
35141
35148
  if (merge.left < cmd.quantity && cmd.quantity <= merge.right) {
35142
- return 67 /* CommandResult.MergeOverlap */;
35149
+ return 68 /* CommandResult.MergeOverlap */;
35143
35150
  }
35144
35151
  }
35145
35152
  return 0 /* CommandResult.Success */;
@@ -35460,7 +35467,7 @@ class SettingsPlugin extends CorePlugin {
35460
35467
  allowDispatch(cmd) {
35461
35468
  switch (cmd.type) {
35462
35469
  case "UPDATE_LOCALE":
35463
- return isValidLocale(cmd.locale) ? 0 /* CommandResult.Success */ : 95 /* CommandResult.InvalidLocale */;
35470
+ return isValidLocale(cmd.locale) ? 0 /* CommandResult.Success */ : 96 /* CommandResult.InvalidLocale */;
35464
35471
  }
35465
35472
  return 0 /* CommandResult.Success */;
35466
35473
  }
@@ -35541,22 +35548,17 @@ class CompilationParametersBuilder {
35541
35548
  * The `compute` of the formula's function must process it completely
35542
35549
  */
35543
35550
  refFn(range, isMeta, functionName, paramNumber) {
35551
+ this.assertRangeValid(range);
35544
35552
  if (isMeta) {
35545
35553
  // Use zoneToXc of zone instead of getRangeString to avoid sending unbounded ranges
35546
35554
  return { value: zoneToXc(range.zone) };
35547
35555
  }
35548
- if (!isZoneValid(range.zone)) {
35549
- throw new InvalidReferenceError();
35550
- }
35551
35556
  // if the formula definition could have accepted a range, we would pass through the _range function and not here
35552
35557
  if (range.zone.bottom !== range.zone.top || range.zone.left !== range.zone.right) {
35553
35558
  throw new Error(paramNumber
35554
35559
  ? _lt("Function %s expects the parameter %s to be a single value or a single cell reference, not a range.", functionName.toString(), paramNumber.toString())
35555
35560
  : _lt("Function %s expects its parameters to be single values or single cell references, not ranges.", functionName.toString()));
35556
35561
  }
35557
- if (range.invalidSheetName) {
35558
- throw new Error(_lt("Invalid sheet name: %s", range.invalidSheetName));
35559
- }
35560
35562
  return this.readCell(range);
35561
35563
  }
35562
35564
  readCell(range) {
@@ -35591,10 +35593,10 @@ class CompilationParametersBuilder {
35591
35593
  * Note that each col is possibly sparse: it only contain the values of cells
35592
35594
  * that are actually present in the grid.
35593
35595
  */
35594
- range({ sheetId, zone }) {
35595
- if (!isZoneValid(zone)) {
35596
- throw new InvalidReferenceError();
35597
- }
35596
+ range(range) {
35597
+ this.assertRangeValid(range);
35598
+ const sheetId = range.sheetId;
35599
+ const zone = range.zone;
35598
35600
  // Performance issue: Avoid fetching data on positions that are out of the spreadsheet
35599
35601
  // e.g. A1:ZZZ9999 in a sheet with 10 cols and 10 rows should ignore everything past J10 and return a 10x10 array
35600
35602
  const sheetZone = this.getters.getSheetZone(sheetId);
@@ -35637,6 +35639,14 @@ class CompilationParametersBuilder {
35637
35639
  this.rangeCache[cacheKey] = result;
35638
35640
  return result;
35639
35641
  }
35642
+ assertRangeValid(range) {
35643
+ if (!isZoneValid(range.zone)) {
35644
+ throw new InvalidReferenceError();
35645
+ }
35646
+ if (range.invalidSheetName) {
35647
+ throw new Error(_lt("Invalid sheet name: %s", range.invalidSheetName));
35648
+ }
35649
+ }
35640
35650
  }
35641
35651
 
35642
35652
  function quickselect(arr, k, left, right, compare) {
@@ -37915,7 +37925,7 @@ class AutofillPlugin extends UIPlugin {
37915
37925
  if (this.lastCellSelected.col !== undefined && this.lastCellSelected.row !== undefined) {
37916
37926
  return 0 /* CommandResult.Success */;
37917
37927
  }
37918
- return 47 /* CommandResult.InvalidAutofillSelection */;
37928
+ return 48 /* CommandResult.InvalidAutofillSelection */;
37919
37929
  case "AUTOFILL_AUTO":
37920
37930
  const zone = this.getters.getSelectedZone();
37921
37931
  return zone.top === zone.bottom
@@ -38534,7 +38544,7 @@ class CellPopoverPlugin extends UIPlugin {
38534
38544
  cellPopoverRegistry.get(cmd.popoverType);
38535
38545
  }
38536
38546
  catch (error) {
38537
- return 74 /* CommandResult.InvalidCellPopover */;
38547
+ return 75 /* CommandResult.InvalidCellPopover */;
38538
38548
  }
38539
38549
  return 0 /* CommandResult.Success */;
38540
38550
  default:
@@ -40674,27 +40684,6 @@ class SelectionInputPlugin extends UIPlugin {
40674
40684
  // ---------------------------------------------------------------------------
40675
40685
  // Command Handling
40676
40686
  // ---------------------------------------------------------------------------
40677
- allowDispatch(cmd) {
40678
- switch (cmd.type) {
40679
- case "ADD_RANGE":
40680
- case "ADD_EMPTY_RANGE":
40681
- if (this.inputHasSingleRange && this.ranges.length === 1) {
40682
- return 31 /* CommandResult.MaximumRangesReached */;
40683
- }
40684
- break;
40685
- case "REMOVE_RANGE":
40686
- if (this.ranges.length === 1) {
40687
- return 32 /* CommandResult.MinimumRangesReached */;
40688
- }
40689
- break;
40690
- case "CHANGE_RANGE":
40691
- if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
40692
- return 31 /* CommandResult.MaximumRangesReached */;
40693
- }
40694
- break;
40695
- }
40696
- return 0 /* CommandResult.Success */;
40697
- }
40698
40687
  handleEvent(event) {
40699
40688
  const inputSheetId = this.activeSheet;
40700
40689
  const sheetId = this.getters.getActiveSheetId();
@@ -40914,6 +40903,15 @@ class SelectionInputsManagerPlugin extends UIPlugin {
40914
40903
  // Command Handling
40915
40904
  // ---------------------------------------------------------------------------
40916
40905
  allowDispatch(cmd) {
40906
+ switch (cmd.type) {
40907
+ case "FOCUS_RANGE":
40908
+ case "CHANGE_RANGE":
40909
+ case "ADD_EMPTY_RANGE":
40910
+ case "REMOVE_RANGE":
40911
+ if (!this.inputs[cmd.id]) {
40912
+ return 33 /* CommandResult.InvalidInputId */;
40913
+ }
40914
+ }
40917
40915
  switch (cmd.type) {
40918
40916
  case "FOCUS_RANGE":
40919
40917
  const index = this.currentInput?.getIndex(cmd.rangeId);
@@ -40921,9 +40919,25 @@ class SelectionInputsManagerPlugin extends UIPlugin {
40921
40919
  return 30 /* CommandResult.InputAlreadyFocused */;
40922
40920
  }
40923
40921
  break;
40924
- }
40925
- if (this.currentInput) {
40926
- return this.currentInput.allowDispatch(cmd);
40922
+ case "ADD_RANGE":
40923
+ case "ADD_EMPTY_RANGE":
40924
+ const input = this.inputs[cmd.id];
40925
+ if (input.inputHasSingleRange && input.ranges.length === 1) {
40926
+ return 31 /* CommandResult.MaximumRangesReached */;
40927
+ }
40928
+ break;
40929
+ case "REMOVE_RANGE":
40930
+ if (this.inputs[cmd.id].ranges.length === 1) {
40931
+ return 32 /* CommandResult.MinimumRangesReached */;
40932
+ }
40933
+ break;
40934
+ case "CHANGE_RANGE": {
40935
+ const input = this.inputs[cmd.id];
40936
+ if (input.inputHasSingleRange && cmd.value.split(",").length > 1) {
40937
+ return 31 /* CommandResult.MaximumRangesReached */;
40938
+ }
40939
+ break;
40940
+ }
40927
40941
  }
40928
40942
  return 0 /* CommandResult.Success */;
40929
40943
  }
@@ -41053,7 +41067,7 @@ class SortPlugin extends UIPlugin {
41053
41067
  /*Test the presence of single cells*/
41054
41068
  const singleCells = positions(zone).some(({ col, row }) => !this.getters.isInMerge({ sheetId, col, row }));
41055
41069
  if (singleCells) {
41056
- return 65 /* CommandResult.InvalidSortZone */;
41070
+ return 66 /* CommandResult.InvalidSortZone */;
41057
41071
  }
41058
41072
  return 0 /* CommandResult.Success */;
41059
41073
  }
@@ -41072,7 +41086,7 @@ class SortPlugin extends UIPlugin {
41072
41086
  ];
41073
41087
  return widthCurrent === widthFirst && heightCurrent === heightFirst;
41074
41088
  })) {
41075
- return 65 /* CommandResult.InvalidSortZone */;
41089
+ return 66 /* CommandResult.InvalidSortZone */;
41076
41090
  }
41077
41091
  return 0 /* CommandResult.Success */;
41078
41092
  }
@@ -41510,7 +41524,7 @@ class SheetUIPlugin extends UIPlugin {
41510
41524
  const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.tryGetActiveSheetId();
41511
41525
  const zones = this.getters.getCommandZones(cmd);
41512
41526
  if (!sheetId && zones.length > 0) {
41513
- return 94 /* CommandResult.NoActiveSheet */;
41527
+ return 95 /* CommandResult.NoActiveSheet */;
41514
41528
  }
41515
41529
  if (sheetId && zones.length > 0) {
41516
41530
  return this.getters.checkZonesExistInSheet(sheetId, zones);
@@ -41992,13 +42006,13 @@ class SplitToColumnsPlugin extends UIPlugin {
41992
42006
  }
41993
42007
  checkSingleColSelected() {
41994
42008
  if (!this.getters.isSingleColSelected()) {
41995
- return 90 /* CommandResult.MoreThanOneColumnSelected */;
42009
+ return 91 /* CommandResult.MoreThanOneColumnSelected */;
41996
42010
  }
41997
42011
  return 0 /* CommandResult.Success */;
41998
42012
  }
41999
42013
  checkNonEmptySelector(cmd) {
42000
42014
  if (cmd.separator === "") {
42001
- return 91 /* CommandResult.EmptySplitSeparator */;
42015
+ return 92 /* CommandResult.EmptySplitSeparator */;
42002
42016
  }
42003
42017
  return 0 /* CommandResult.Success */;
42004
42018
  }
@@ -42009,7 +42023,7 @@ class SplitToColumnsPlugin extends UIPlugin {
42009
42023
  const selection = this.getters.getSelectedZones()[0];
42010
42024
  const splitted = this.getSplittedCols(selection, cmd.separator);
42011
42025
  if (this.willSplittedColsOverwriteContent(selection, splitted)) {
42012
- return 92 /* CommandResult.SplitWillOverwriteContent */;
42026
+ return 93 /* CommandResult.SplitWillOverwriteContent */;
42013
42027
  }
42014
42028
  return 0 /* CommandResult.Success */;
42015
42029
  }
@@ -42020,7 +42034,7 @@ class SplitToColumnsPlugin extends UIPlugin {
42020
42034
  return 0 /* CommandResult.Success */;
42021
42035
  }
42022
42036
  }
42023
- return 93 /* CommandResult.NoSplitSeparatorInSelection */;
42037
+ return 94 /* CommandResult.NoSplitSeparatorInSelection */;
42024
42038
  }
42025
42039
  }
42026
42040
 
@@ -42168,7 +42182,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
42168
42182
  for (const zone of this.getPasteZones(target)) {
42169
42183
  if ((zone.left < xSplit && zone.right >= xSplit) ||
42170
42184
  (zone.top < ySplit && zone.bottom >= ySplit)) {
42171
- return 77 /* CommandResult.FrozenPaneOverlap */;
42185
+ return 78 /* CommandResult.FrozenPaneOverlap */;
42172
42186
  }
42173
42187
  }
42174
42188
  return 0 /* CommandResult.Success */;
@@ -42620,7 +42634,7 @@ class ClipboardFigureState {
42620
42634
  }
42621
42635
  isPasteAllowed(target, option) {
42622
42636
  if (target.length === 0) {
42623
- return 75 /* CommandResult.EmptyTarget */;
42637
+ return 76 /* CommandResult.EmptyTarget */;
42624
42638
  }
42625
42639
  if (option?.pasteOption !== undefined) {
42626
42640
  return 23 /* CommandResult.WrongFigurePasteOption */;
@@ -42853,7 +42867,7 @@ class ClipboardPlugin extends UIPlugin {
42853
42867
  }
42854
42868
  case "ACTIVATE_PAINT_FORMAT": {
42855
42869
  if (this.paintFormatStatus !== "inactive") {
42856
- return 96 /* CommandResult.AlreadyInPaintingFormatMode */;
42870
+ return 97 /* CommandResult.AlreadyInPaintingFormatMode */;
42857
42871
  }
42858
42872
  }
42859
42873
  }
@@ -43431,7 +43445,7 @@ class EditionPlugin extends UIPlugin {
43431
43445
  validateSelection(length, start, end) {
43432
43446
  return start >= 0 && start <= length && end >= 0 && end <= length
43433
43447
  ? 0 /* CommandResult.Success */
43434
- : 48 /* CommandResult.WrongComposerSelection */;
43448
+ : 49 /* CommandResult.WrongComposerSelection */;
43435
43449
  }
43436
43450
  onColumnsRemoved(cmd) {
43437
43451
  if (cmd.elements.includes(this.col) && this.mode !== "inactive") {
@@ -43743,9 +43757,10 @@ class EditionPlugin extends UIPlugin {
43743
43757
  */
43744
43758
  getReferencedRanges() {
43745
43759
  const editionSheetId = this.getters.getCurrentEditedCell().sheetId;
43746
- return this.currentTokens
43760
+ const referenceRanges = this.currentTokens
43747
43761
  .filter((token) => token.type === "REFERENCE")
43748
43762
  .map((token) => this.getters.getRangeFromSheetXC(editionSheetId, token.value));
43763
+ return referenceRanges.filter((range) => !range.invalidSheetName && !range.invalidXc);
43749
43764
  }
43750
43765
  /**
43751
43766
  * Function used to determine when composer selection can start.
@@ -43812,7 +43827,7 @@ class FilterEvaluationPlugin extends UIPlugin {
43812
43827
  switch (cmd.type) {
43813
43828
  case "UPDATE_FILTER":
43814
43829
  if (!this.getters.getFilterId(cmd)) {
43815
- return 81 /* CommandResult.FilterNotFound */;
43830
+ return 82 /* CommandResult.FilterNotFound */;
43816
43831
  }
43817
43832
  break;
43818
43833
  }
@@ -44607,7 +44622,7 @@ class GridSelectionPlugin extends UIPlugin {
44607
44622
  const headers = [cmd.base, ...cmd.elements];
44608
44623
  const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
44609
44624
  if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
44610
- return 88 /* CommandResult.InvalidHeaderIndex */;
44625
+ return 89 /* CommandResult.InvalidHeaderIndex */;
44611
44626
  }
44612
44627
  return 0 /* CommandResult.Success */;
44613
44628
  }
@@ -45423,7 +45438,7 @@ class SheetViewPlugin extends UIPlugin {
45423
45438
  }
45424
45439
  checkPositiveDimension(cmd) {
45425
45440
  if (cmd.width < 0 || cmd.height < 0) {
45426
- return 70 /* CommandResult.InvalidViewportSize */;
45441
+ return 71 /* CommandResult.InvalidViewportSize */;
45427
45442
  }
45428
45443
  return 0 /* CommandResult.Success */;
45429
45444
  }
@@ -45433,7 +45448,7 @@ class SheetViewPlugin extends UIPlugin {
45433
45448
  cmd.gridOffsetY === this.gridOffsetY &&
45434
45449
  cmd.width === width &&
45435
45450
  cmd.height === height) {
45436
- return 78 /* CommandResult.ValuesNotChanged */;
45451
+ return 79 /* CommandResult.ValuesNotChanged */;
45437
45452
  }
45438
45453
  return 0 /* CommandResult.Success */;
45439
45454
  }
@@ -45441,7 +45456,7 @@ class SheetViewPlugin extends UIPlugin {
45441
45456
  const pane = this.getMainInternalViewport(this.getters.getActiveSheetId());
45442
45457
  if ((!pane.canScrollHorizontally && offsetX > 0) ||
45443
45458
  (!pane.canScrollVertically && offsetY > 0)) {
45444
- return 71 /* CommandResult.InvalidScrollingDirection */;
45459
+ return 72 /* CommandResult.InvalidScrollingDirection */;
45445
45460
  }
45446
45461
  return 0 /* CommandResult.Success */;
45447
45462
  }
@@ -48900,7 +48915,7 @@ class SelectionStreamProcessorImpl {
48900
48915
  */
48901
48916
  moveAnchorCell(direction, step = 1) {
48902
48917
  if (step !== "end" && step <= 0) {
48903
- return new DispatchResult(85 /* CommandResult.InvalidSelectionStep */);
48918
+ return new DispatchResult(86 /* CommandResult.InvalidSelectionStep */);
48904
48919
  }
48905
48920
  const { col, row } = this.getNextAvailablePosition(direction, step);
48906
48921
  return this.selectCell(col, row);
@@ -48946,7 +48961,7 @@ class SelectionStreamProcessorImpl {
48946
48961
  */
48947
48962
  resizeAnchorZone(direction, step = 1) {
48948
48963
  if (step !== "end" && step <= 0) {
48949
- return new DispatchResult(85 /* CommandResult.InvalidSelectionStep */);
48964
+ return new DispatchResult(86 /* CommandResult.InvalidSelectionStep */);
48950
48965
  }
48951
48966
  const sheetId = this.getters.getActiveSheetId();
48952
48967
  const anchor = this.anchor;
@@ -51303,10 +51318,10 @@ class Model extends EventBus {
51303
51318
  const command = createCommand(type, payload);
51304
51319
  let status = this.status;
51305
51320
  if (this.getters.isReadonly() && !canExecuteInReadonly(command)) {
51306
- return new DispatchResult(69 /* CommandResult.Readonly */);
51321
+ return new DispatchResult(70 /* CommandResult.Readonly */);
51307
51322
  }
51308
51323
  if (!this.session.canApplyOptimisticUpdate()) {
51309
- return new DispatchResult(66 /* CommandResult.WaitingSessionConfirmation */);
51324
+ return new DispatchResult(67 /* CommandResult.WaitingSessionConfirmation */);
51310
51325
  }
51311
51326
  switch (status) {
51312
51327
  case 0 /* Status.Ready */:
@@ -51561,6 +51576,6 @@ const constants = {
51561
51576
  export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
51562
51577
 
51563
51578
 
51564
- __info__.version = '16.4.18';
51565
- __info__.date = '2024-01-12T13:43:10.143Z';
51566
- __info__.hash = 'f438e08';
51579
+ __info__.version = '16.4.20';
51580
+ __info__.date = '2024-01-29T13:50:12.345Z';
51581
+ __info__.hash = '06c0ecf';