"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.isMatchingEventHookPath = isMatchingEventHookPath;
exports.normalizeEventHookPathForMatch = normalizeEventHookPathForMatch;
const node_path_1 = __importDefault(require("node:path"));
const config_1 = require("./config");
function isMatchingEventHookPath(input) {
    const configured = normalizeEventHookPathForMatch({
        baseDir: input.baseDir,
        allowAbsolutePath: input.allowAbsolutePath,
        hookPath: input.configuredPath,
    });
    const requested = normalizeEventHookPathForMatch({
        baseDir: input.baseDir,
        allowAbsolutePath: input.allowAbsolutePath,
        hookPath: input.requestedPath,
    });
    return configured !== null && requested !== null && configured === requested;
}
function normalizeEventHookPathForMatch(input) {
    try {
        return node_path_1.default.normalize((0, config_1.normalizeEventHookConfigPath)({
            baseDir: input.baseDir,
            hookPath: input.hookPath,
            allowAbsolutePath: input.allowAbsolutePath,
        }).absolutePath);
    }
    catch {
        return null;
    }
}
