"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.roundToClosestEvenPxValue = roundToClosestEvenPxValue;
/**
 * Reduces the given CSS width value to the next lowest even pixel value if the value is in px.
 * This is to mitigate subpixel rendering issues of embedded smart links.
 *
 * @param widthValue CSS width value to be rounded
 * @returns Reduced CSS width value where px value given, or otherwise the original value
 * @example
 */
// widthValue could be a string in px, rem or percentage, e.g. "800px", "100%", etc.
function roundToClosestEvenPxValue(widthValue) {
  try {
    if (widthValue.endsWith('px')) {
      var pxWidth = parseInt(widthValue.slice(0, -2));
      return "".concat(pxWidth - pxWidth % 2, "px");
    }
    return widthValue;
  } catch (_unused) {
    return widthValue;
  }
}