var Module;
(function(e) {
	e.merge = (e, n) => _merge(_merge({}, e), n);
})(Module ||= {});
function inject(e, n, r, i, o, s, c, l, u) {
	return _inject([
		e,
		n,
		r,
		i,
		o,
		s,
		c,
		l,
		u
	].reduce(_merge, {}));
}
var isProxy = Symbol("isProxy");
function eagerLoad(e) {
	if (e && e[isProxy]) for (let n of Object.values(e)) eagerLoad(n);
	return e;
}
function _inject(e, n) {
	let i = new Proxy({}, {
		deleteProperty: () => !1,
		set: () => {
			throw Error("Cannot set property on injected service container");
		},
		get: (a, o) => o === isProxy ? !0 : _resolve(a, o, e, n || i),
		getOwnPropertyDescriptor: (r, a) => (_resolve(r, a, e, n || i), Object.getOwnPropertyDescriptor(r, a)),
		has: (n, r) => r in e,
		ownKeys: () => [...Object.getOwnPropertyNames(e)]
	});
	return i;
}
var __requested__ = Symbol();
function _resolve(e, n, r, i) {
	if (n in e) {
		if (e[n] instanceof Error) throw Error("Construction failure. Please make sure that your dependencies are constructable. Cause: " + e[n]);
		if (e[n] === __requested__) throw Error("Cycle detected. Please make \"" + String(n) + "\" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies");
		return e[n];
	} else if (n in r) {
		let s = r[n];
		e[n] = __requested__;
		try {
			e[n] = typeof s == "function" ? s(i) : _inject(s, i);
		} catch (r) {
			throw e[n] = r instanceof Error ? r : void 0, r;
		}
		return e[n];
	} else return;
}
function _merge(e, n) {
	if (n) {
		for (let [r, i] of Object.entries(n)) if (i != null) if (typeof i == "object") {
			let n = e[r];
			typeof n == "object" && n ? e[r] = _merge(n, i) : e[r] = _merge({}, i);
		} else e[r] = i;
	}
	return e;
}
export { Module, eagerLoad, inject };
