"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.composeMiddleware = void 0;
/* eslint-disable @typescript-eslint/no-explicit-any */
const composeMiddleware = (...middlewares) => {
    return async (req, ctx, handler) => {
        const composedHandler = middlewares.reduceRight((nextHandler, middleware) => () => middleware(req, ctx, nextHandler), handler);
        return composedHandler();
    };
};
exports.composeMiddleware = composeMiddleware;
/* eslint-enable @typescript-eslint/no-explicit-any */
