//#region src/config/runtime-overrides.ts
let overrides = {};
function getConfigOverrides() {
	return overrides;
}
function resetConfigOverrides() {
	overrides = {};
}
function setConfigOverride(path, value) {
	let cursor = overrides;
	for (let i = 0; i < path.length - 1; i++) {
		const key = path[i];
		if (typeof cursor[key] !== "object" || cursor[key] === null) cursor[key] = {};
		cursor = cursor[key];
	}
	cursor[path[path.length - 1]] = value;
}
function unsetConfigOverride(path) {
	let cursor = overrides;
	for (let i = 0; i < path.length - 1; i++) {
		const next = cursor[path[i]];
		if (typeof next !== "object" || next === null) return;
		cursor = next;
	}
	delete cursor[path[path.length - 1]];
}
/** Deep-merge overrides on top of base config (process lifetime only). */
function applyConfigOverrides(base) {
	return deepMerge(base, overrides);
}
function deepMerge(base, override) {
	if (typeof base !== "object" || base === null || typeof override !== "object" || override === null) return override ?? base;
	const result = { ...base };
	for (const [key, value] of Object.entries(override)) result[key] = deepMerge(result[key], value);
	return result;
}
//#endregion
export { applyConfigOverrides, getConfigOverrides, resetConfigOverrides, setConfigOverride, unsetConfigOverride };

//# sourceMappingURL=runtime-overrides.js.map