var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/PisellSteps/utils/index.ts
var utils_exports = {};
__export(utils_exports, {
  calculateProgress: () => calculateProgress,
  getChangeDirection: () => getChangeDirection,
  getStepStatus: () => getStepStatus,
  isStepClickable: () => isStepClickable,
  isValidStepIndex: () => isValidStepIndex,
  mergeStepClassName: () => mergeStepClassName
});
module.exports = __toCommonJS(utils_exports);
function calculateProgress(current, total) {
  if (total <= 0) return 0;
  if (current < 0) return 0;
  if (current >= total) return 100;
  return Math.round((current + 1) / total * 100);
}
function isStepClickable(index, current, status, clickable, allowClickFinished) {
  if (!clickable) {
    return false;
  }
  if (index === current) {
    return false;
  }
  if (status === "finish" || index < current) {
    return allowClickFinished;
  }
  if (status === "wait") {
    return false;
  }
  if (status === "error") {
    return true;
  }
  return true;
}
function getStepStatus(index, current, customStatus) {
  if (customStatus) {
    return customStatus;
  }
  if (index < current) {
    return "finish";
  } else if (index === current) {
    return "process";
  } else {
    return "wait";
  }
}
function mergeStepClassName(baseClass, status, customClass) {
  const classes = [baseClass];
  classes.push(`${baseClass}-${status}`);
  if (customClass) {
    classes.push(customClass);
  }
  return classes.join(" ");
}
function getChangeDirection(from, to) {
  return to > from ? "forward" : "backward";
}
function isValidStepIndex(index, total) {
  return index >= 0 && index < total;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  calculateProgress,
  getChangeDirection,
  getStepStatus,
  isStepClickable,
  isValidStepIndex,
  mergeStepClassName
});
