import { W as e, n as t, r as n, y as r } from "./transform-oFwtbFM_.js";
//#region src/language-server/services/common/metadata-utils.ts
var i = class {
	constructor(e) {
		this.metadataCollection = e;
	}
	componentNames() {
		return Object.keys(this.metadataCollection);
	}
	getComponent(e) {
		let t = this.metadataCollection[e];
		return t ? new a(t) : null;
	}
}, a = class {
	constructor(e) {
		this.metadata = e;
	}
	getProp(e) {
		return this.metadata.props[e] ?? s[e];
	}
	getAttr(e) {
		if (t.test(e)) {
			let t = n(e), r = this.metadata.events?.[t];
			if (r) return r;
		}
		return this.metadata.props?.[e] || this.metadata.apis?.[e] || o(e) || s[e];
	}
	getAttrForKind({ name: e, kind: t }) {
		switch (t) {
			case "api": return this.metadata.apis[e];
			case "event": return this.metadata.events[e];
			case "prop": return this.metadata.props[e];
			case "implicit": return s[e];
			case "layout": return o(e);
		}
	}
	getAllAttributes() {
		let e = [];
		for (let t of Object.keys(this.metadata.props ?? {})) e.push({
			name: t,
			kind: "prop"
		});
		for (let t of Object.keys(this.metadata.events ?? {})) e.push({
			name: t,
			kind: "event"
		});
		for (let t of Object.keys(this.metadata.apis ?? {})) e.push({
			name: t,
			kind: "api"
		});
		for (let t of r) e.push({
			name: t,
			kind: "layout"
		});
		for (let t of Object.keys(s)) e.push({
			name: t,
			kind: "implicit"
		});
		return e;
	}
	getEvent(e) {
		return this.metadata.events?.[e];
	}
	getApi(e) {
		return this.metadata.apis?.[e];
	}
	get events() {
		return this.metadata.events;
	}
	get apis() {
		return this.metadata.apis;
	}
	get contextVars() {
		return this.metadata.contextVars;
	}
	get allowArbitraryProps() {
		return this.metadata.allowArbitraryProps;
	}
	get shortDescription() {
		return this.metadata.shortDescription;
	}
	getMetadata() {
		return this.metadata;
	}
};
function o(t) {
	let n = { description: "Layout property. Not yet documented" };
	if (r.includes(t)) return n;
	for (let i of e) {
		let e = "-" + i.value;
		if (t.endsWith(e)) {
			let i = t.slice(0, -e.length);
			if (r.includes(i)) return n;
		}
	}
	return null;
}
var s = {
	inspect: {
		description: "Determines whether the component can be inspected or not",
		defaultValue: !1,
		valueType: "boolean"
	},
	data: { description: "Specifies the data source for a component. Can be a URL string (fetched automatically), a DataSource or an expression to evaluate. Changes to this property trigger UI updates once data is loaded." },
	when: {
		description: "Specifies a condition that must be met for the component to be displayed",
		defaultValue: !0,
		valueType: "boolean"
	}
};
function c(e) {
	return "on" + e[0].toUpperCase() + e.substring(1);
}
//#endregion
export { a as ComponentMetadataProvider, i as MetadataProvider, c as addOnPrefix };

//# sourceMappingURL=metadata-utils.js.map