/**
 * Handles local script rules in JS module format.
 *
 * This format is primarily used for Manifest V3 where it is highly recommended
 * to provide local script rules. If not provided during build, all
 * script rules (except scriptlets) will not be injected to ensure compliance
 * with Chrome Web Store policies.
 *
 * The primary purpose is to enable runtime checking of JS rules to determine
 * whether a rule comes from built-in filters or is a custom rule.
 *
 * NOTE: Script rules are NOT deduplicated. It is critical to keep script rules
 * exactly as they were parsed from the filter rules because they will be
 * checked in runtime as-is to verify their origin.
 */
declare class LocalScriptRulesJs {
    /**
     * Filename for the local script rules JS file.
     */
    static readonly FILENAME = "local_script_rules.js";
    /**
     * Placeholder property marker for inserting new rules without AST parsing.
     * Using a property instead of a comment ensures it survives beautification.
     * Note: Terser removes quotes from valid identifier property names.
     */
    private static readonly PLACEHOLDER_MARKER;
    /**
     * Indentation level for the local script rules JS file.
     */
    private static readonly INDENT_LEVEL;
    /**
     * Validates JavaScript code as an ES6 module.
     *
     * @param code JavaScript code to validate.
     *
     * @throws Error if code is invalid JavaScript.
     */
    private static validateModule;
    /**
     * Validates JavaScript code as a script (allows return statements outside functions).
     *
     * @param code JavaScript code to validate.
     *
     * @throws Error if code is invalid JavaScript.
     */
    private static validateScript;
    /**
     * Calculates unique ID for the text.
     *
     * @param text Text to calculate unique ID for.
     *
     * @returns Unique ID.
     */
    private static calculateUniqueId;
    /**
     * Escapes a string for use as a JavaScript string literal.
     *
     * @param str String to escape.
     *
     * @returns Escaped string.
     */
    private static escapeJsString;
    /**
     * Wraps the content in an named export.
     *
     * @param content Content to wrap.
     *
     * @returns Content wrapped in named export.
     */
    private static wrapInNamedExport;
    /**
     * Wraps the script code with a try-catch block and a check to avoid multiple executions.
     *
     * @param uniqueId Unique ID for the script.
     * @param code Script code.
     *
     * @returns Wrapped script code.
     */
    private static wrapScriptCode;
    /**
     * Wraps a single rule with error handling and execution protection.
     *
     * @param rule Script code.
     *
     * @returns Wrapped script code or null if validation fails.
     */
    private static wrapRule;
    /**
     * Wraps JS rules with double execution protection and error handling.
     *
     * @param scriptRules Set of script rules to process.
     *
     * @returns Wrapped rules as strings.
     */
    private static wrapRules;
    /**
     * Beautifies JS content with Terser.
     *
     * @param content JS content to beautify.
     *
     * @returns Beautified JS content.
     */
    private static beautifyJsContent;
    /**
     * Parses filter rules and extracts JS injection rules.
     *
     * @param filterRules Array of filter rule strings.
     *
     * @returns Set of extracted JS rule bodies.
     */
    static parse(filterRules: string[]): Set<string>;
    /**
     * Serializes JS rules into a formatted ES6 module string.
     *
     * @param rules Set of JS rule bodies.
     *
     * @returns Serialized and beautified rules as an ES6 module export string.
     */
    static serialize(rules: Set<string>): Promise<string>;
    /**
     * Extends a JS file content with new rules by inserting them before the placeholder.
     * This avoids the need for AST deserialization, making extension much faster.
     *
     * @param existingContent Existing JS module content.
     * @param newRuleStrings Array of new filter rule strings to parse and add.
     *
     * @returns Updated JS module content with new rules inserted.
     */
    static extend(existingContent: string, newRuleStrings: string[]): Promise<string>;
}

export { LocalScriptRulesJs };
