"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseDuration = parseDuration;
const parse_duration_1 = __importDefault(require("parse-duration"));
/**
 * Parse a human-readable duration string into seconds.
 * Supports combined formats: "1d2h", "1h30m", "30s", "7d", etc.
 * @returns duration in seconds
 */
function parseDuration(input) {
    const ms = (0, parse_duration_1.default)(input);
    if (ms == null || ms <= 0) {
        throw new Error(`Invalid duration: "${input}". Expected e.g. "15m", "1h", "7d", "1d2h".`);
    }
    return Math.round(ms / 1000);
}
