const getPercentage = (currentVal, recommendedVal) => {
  if (currentVal === 0) {
    return 0;
  }
  const changeValue = recommendedVal - currentVal;
  return parseFloat((changeValue / currentVal * 100).toFixed(2));
};
const getRecommendedValue = (currentValues, recommendedValues, key1, key2) => {
  let currentVal = currentValues[key1]?.[key2]?.amount || 0;
  const currentFormat = currentValues[key1]?.[key2]?.format || "";
  let recommendedVal = recommendedValues[key1]?.[key2]?.amount || 0;
  const recommendedFormat = recommendedValues[key1]?.[key2]?.format || "";
  if (recommendedVal === 0) {
    return "-";
  }
  if (currentFormat && recommendedFormat && currentFormat !== recommendedFormat) {
    if (key2 === "cpu") {
      const getMultiplier = (units) => {
        return units === null || units === "cores" ? 1e3 : 1;
      };
      currentVal = currentVal * getMultiplier(currentFormat || "cores");
      recommendedVal = recommendedVal * getMultiplier(recommendedFormat || "cores");
    } else if (key2 === "memory") {
      const getMultiplier = (units) => {
        switch (units.toLowerCase()) {
          case "ei":
            return Math.pow(2, 60);
          case "pi":
            return Math.pow(2, 50);
          case "ti":
            return Math.pow(2, 40);
          case "gi":
            return Math.pow(2, 30);
          case "mi":
            return Math.pow(2, 20);
          case "ki":
            return Math.pow(2, 10);
          default:
            return 1;
        }
      };
      currentVal = currentVal * getMultiplier(currentFormat || "bytes");
      recommendedVal = recommendedVal * getMultiplier(recommendedFormat || "byes");
    }
  }
  const percentage = getPercentage(currentVal, recommendedVal);
  const paddingValue = { cpu: 20, memory: 17 };
  const percentageSign = percentage > 0 ? "+" : "";
  const formattedRecommendedValue = `${recommendedVal}${recommendedFormat}`.padEnd(paddingValue[key2]);
  const formattedPercentageValue = `# ${percentageSign}${percentage}%`;
  return `${formattedRecommendedValue}${formattedPercentageValue}`;
};
const isEmptyObject = (obj) => {
  if (obj) {
    return Object.keys(obj).length === 0;
  }
  return true;
};

export { getRecommendedValue, isEmptyObject };
//# sourceMappingURL=utils.esm.js.map
