import { n as buildGatewayConnectionDetails } from "./call-BbnBxegf.js";
import { t as resolveGatewayConnectionAuth } from "./connection-auth-BHOHIxi6.js";
//#region src/gateway/client-bootstrap.ts
function resolveGatewayUrlOverrideSource(urlSource) {
	if (urlSource === "cli --url") return "cli";
	if (urlSource === "env KAIJIBOT_GATEWAY_URL") return "env";
}
async function resolveGatewayClientBootstrap(params) {
	const connection = buildGatewayConnectionDetails({
		config: params.config,
		url: params.gatewayUrl
	});
	const urlOverrideSource = resolveGatewayUrlOverrideSource(connection.urlSource);
	const auth = await resolveGatewayConnectionAuth({
		config: params.config,
		explicitAuth: params.explicitAuth,
		env: params.env ?? process.env,
		urlOverride: urlOverrideSource ? connection.url : void 0,
		urlOverrideSource
	});
	return {
		url: connection.url,
		urlSource: connection.urlSource,
		auth
	};
}
//#endregion
export { resolveGatewayClientBootstrap as t };
