var version = "3.3.20260216200056";

/**
 * Dot delimiter.
 */ const DOT = '.';
/**
 * Dash delimiter.
 */ const DASH = '-';
/**
 * Space delimiter.
 */ const SPACE = ' ';
/**
 * Colon delimiter.
 */ const COLON = ':';
/**
 * UTC+0.
 */ const UTC_PLUS_0 = 'UTC+0';

/**
 * Length of the generated patch version.
 *
 * Length of the `yyyymmddhhMMss` format.
 */ const GENERATED_PATCH_VERSION_LENGTH = 14;
/**
 * Returns the version of the package.
 *
 * @returns The version of the package.
 */ const getVersion = ()=>version;
/**
 * Returns the timestamp of the dnr-rulesets build, parsed from the version string.
 *
 * @returns Timestamp in milliseconds for latest build
 * or current timestamp if version parsing fails.
 *
 * @example
 * ```text
 * version → timestamp:
 * 1.2.20250215191524 → 1739664924000
 * 2.0.0 → <current timestamp>
 * ```
 */ const getVersionTimestampMs = ()=>{
    return generateTimestampFromVersion(version);
};
/**
 * Generates a timestamp from a version string.
 *
 * @param version The version string.
 *
 * @returns The timestamp in milliseconds.
 */ const generateTimestampFromVersion = (version)=>{
    // dnr-rulesets generated patch version is date and time (UTC+0) in format `yyyymmddhhMMss`
    // but if the version is not generated by dnr-rulesets, e.g. `2.0.0`, we return current timestamp
    const patchVersion = version.split(DOT).pop();
    if (!patchVersion || patchVersion.length !== GENERATED_PATCH_VERSION_LENGTH) {
        return Date.now();
    }
    const dateStr = [
        patchVersion.slice(0, 4),
        DASH,
        patchVersion.slice(4, 6),
        DASH,
        patchVersion.slice(6, 8),
        SPACE,
        patchVersion.slice(8, 10),
        COLON,
        patchVersion.slice(10, 12),
        COLON,
        patchVersion.slice(12, 14),
        SPACE,
        UTC_PLUS_0
    ].join('');
    return Date.parse(dateStr);
};

export { getVersion, getVersionTimestampMs };
