//#region ../../node_modules/langium/lib/syntax-tree.js
function e(e) {
	return typeof e == "object" && !!e && typeof e.$type == "string";
}
function t(e) {
	return typeof e == "object" && !!e && typeof e.$refText == "string" && "ref" in e;
}
function n(e) {
	return typeof e == "object" && !!e && typeof e.$refText == "string" && "items" in e;
}
function r(e) {
	return typeof e == "object" && !!e && typeof e.name == "string" && typeof e.type == "string" && typeof e.path == "string";
}
function i(e) {
	return typeof e == "object" && !!e && typeof e.info == "object" && typeof e.message == "string";
}
var a = class {
	constructor() {
		this.subtypes = {}, this.allSubtypes = {};
	}
	getAllTypes() {
		return Object.keys(this.types);
	}
	getReferenceType(e) {
		let t = this.types[e.container.$type];
		if (!t) throw Error(`Type ${e.container.$type || "undefined"} not found.`);
		let n = t.properties[e.property]?.referenceType;
		if (!n) throw Error(`Property ${e.property || "undefined"} of type ${e.container.$type} is not a reference.`);
		return n;
	}
	getTypeMetaData(e) {
		return this.types[e] || {
			name: e,
			properties: {},
			superTypes: []
		};
	}
	isInstance(t, n) {
		return e(t) && this.isSubtype(t.$type, n);
	}
	isSubtype(e, t) {
		if (e === t) return !0;
		let n = this.subtypes[e];
		n ||= this.subtypes[e] = {};
		let r = n[t];
		if (r !== void 0) return r;
		{
			let r = this.types[e], i = r ? r.superTypes.some((e) => this.isSubtype(e, t)) : !1;
			return n[t] = i, i;
		}
	}
	getAllSubTypes(e) {
		let t = this.allSubtypes[e];
		if (t) return t;
		{
			let t = this.getAllTypes(), n = [];
			for (let r of t) this.isSubtype(r, e) && n.push(r);
			return this.allSubtypes[e] = n, n;
		}
	}
};
function o(e) {
	return typeof e == "object" && !!e && Array.isArray(e.content);
}
function s(e) {
	return typeof e == "object" && !!e && typeof e.tokenType == "object";
}
function c(e) {
	return o(e) && typeof e.fullText == "string";
}
//#endregion
export { a as AbstractAstReflection, e as isAstNode, r as isAstNodeDescription, o as isCompositeCstNode, s as isLeafCstNode, i as isLinkingError, n as isMultiReference, t as isReference, c as isRootCstNode };
