const NUMERIC_VALUE_PATTERN = /-?\d+(?:\.\d+)?/;
const DEFAULT_MAX = 100;
const getCellNumericValue = (label, options) => {
  const rawLabel = label ?? "";
  const match = rawLabel.match(NUMERIC_VALUE_PATTERN);
  if (!match) {
    return {
      rawLabel,
      parsedValue: null,
      clampedValue: 0,
      hasParsedValue: false
    };
  }
  const parsedValue = Number(match[0]);
  if (!Number.isFinite(parsedValue) || parsedValue < 0) {
    return {
      rawLabel,
      parsedValue: null,
      clampedValue: 0,
      hasParsedValue: false
    };
  }
  return {
    rawLabel,
    parsedValue,
    clampedValue: Math.min(parsedValue, options?.max ?? DEFAULT_MAX),
    hasParsedValue: true
  };
};
export {
  getCellNumericValue
};
//# sourceMappingURL=cell-numeric-value.js.map
