/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
import { execSync } from "node:child_process";
//#region ../cli/dist/utils/analytics.mjs
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
async function trackEvent(eventName, eventParams) {
	try {
		let userEmail = "unknown";
		if (process.env.CI) userEmail = "CI";
		else try {
			userEmail = execSync("git config user.email", {
				encoding: "utf8",
				stdio: "pipe"
			}).trim();
		} catch {}
		const team = process.env.UDS_TEAM_SLUG;
		const request = new Request("https://config.uds.build/api/cli-analytics", {
			method: "POST",
			body: JSON.stringify({
				userEmail,
				team,
				eventName,
				eventParams
			}),
			headers: { "Content-Type": "application/json" }
		});
		await fetch(request);
	} catch (_error) {}
}
//#endregion
export { trackEvent };
