// This file was auto-generated by Fern from our API Definition.
import { BearerAuthProvider } from "./auth/BearerAuthProvider.mjs";
import { mergeHeaders } from "./core/headers.mjs";
import * as core from "./core/index.mjs";
export function normalizeClientOptions(options) {
    var _a;
    const headers = mergeHeaders({
        "X-Fern-Language": "JavaScript",
        "X-Fern-SDK-Name": "@whop/sdk",
        "X-Fern-SDK-Version": "1.0.13",
        "User-Agent": "@whop/sdk/1.0.13",
        "X-Fern-Runtime": core.RUNTIME.type,
        "X-Fern-Runtime-Version": core.RUNTIME.version,
        "Api-Version-Date": (_a = options === null || options === void 0 ? void 0 : options.apiVersionDate) !== null && _a !== void 0 ? _a : "2026-08-21",
        "Idempotency-Key": options === null || options === void 0 ? void 0 : options.idempotencyKey,
    }, options === null || options === void 0 ? void 0 : options.headers);
    return Object.assign(Object.assign({}, options), { logging: core.logging.createLogger(options === null || options === void 0 ? void 0 : options.logging), headers });
}
export function normalizeClientOptionsWithAuth(options) {
    var _a;
    const normalized = normalizeClientOptions(options);
    if (options.auth === false) {
        normalized.authProvider = new core.NoOpAuthProvider();
        return normalized;
    }
    if (options.auth != null) {
        if (typeof options.auth === "function") {
            normalized.authProvider = { getAuthRequest: options.auth };
            return normalized;
        }
        if (core.isAuthProvider(options.auth)) {
            normalized.authProvider = options.auth;
            return normalized;
        }
        Object.assign(normalized, options.auth);
    }
    const normalizedWithNoOpAuthProvider = withNoOpAuthProvider(normalized);
    (_a = normalized.authProvider) !== null && _a !== void 0 ? _a : (normalized.authProvider = new BearerAuthProvider(normalizedWithNoOpAuthProvider));
    return normalized;
}
function withNoOpAuthProvider(options) {
    return Object.assign(Object.assign({}, options), { authProvider: new core.NoOpAuthProvider() });
}
