import { a as resolveElementPath } from "./registry-CjoawJ_B.js";
import { defineAsyncComponent, h } from "vue";
//#region src/engine/useElementLoader.ts
/**
* Vite glob entry point. Each value is a function returning a Promise
* that resolves to the .vue module. Vite turns each into its own chunk
* so the consumer only downloads the elements that get rendered.
*/
var elementModules = /* @__PURE__ */ Object.assign({
	"../components/compositions/elements/action/ButtonAction.vue": () => import("./ButtonAction-DL4N2EFZ.js").then((n) => n.n),
	"../components/compositions/elements/action/ButtonGroupAction.vue": () => import("./ButtonGroupAction-03S8USgW.js").then((n) => n.n),
	"../components/compositions/elements/action/LinkAction.vue": () => import("./LinkAction-BNIUUDyO.js").then((n) => n.n),
	"../components/compositions/elements/boolean/CheckboxBoolean.vue": () => import("./CheckboxBoolean-BmMcolTy.js").then((n) => n.n),
	"../components/compositions/elements/boolean/IconToggleBoolean.vue": () => import("./IconToggleBoolean-DnByTK30.js").then((n) => n.n),
	"../components/compositions/elements/boolean/RadioBoolean.vue": () => import("./RadioBoolean-DUpyj3e3.js").then((n) => n.n),
	"../components/compositions/elements/boolean/SwitchBoolean.vue": () => import("./SwitchBoolean-4dodQkN_.js").then((n) => n.n),
	"../components/compositions/elements/builder/ConditionsEditor.vue": () => import("./ConditionsEditor-BICfvLu6.js").then((n) => n.n),
	"../components/compositions/elements/builder/DependencyListBuilder.vue": () => import("./DependencyListBuilder-BwaxmuJX.js").then((n) => n.n),
	"../components/compositions/elements/builder/ElementListBuilder.vue": () => import("./ElementListBuilder-l8R8wqdp.js").then((n) => n.n),
	"../components/compositions/elements/builder/FormBuilder.vue": () => import("./FormBuilder-CCntZveE.js").then((n) => n.n),
	"../components/compositions/elements/builder/GridBuilder.vue": () => import("./GridBuilder-BkdsS6fB.js").then((n) => n.n),
	"../components/compositions/elements/builder/ObjectBuilder.vue": () => import("./ObjectBuilder-DKLj9zFh.js").then((n) => n.n),
	"../components/compositions/elements/builder/PresetBuilder.vue": () => import("./PresetBuilder-C7lFfxys.js").then((n) => n.n),
	"../components/compositions/elements/builder/QuizBuilder.vue": () => import("./QuizBuilder-2KBcDGAM.js").then((n) => n.n),
	"../components/compositions/elements/builder/ReactiveCanvasBuilder.vue": () => import("./ReactiveCanvasBuilder-C0M2tKNS.js").then((n) => n.n),
	"../components/compositions/elements/builder/SnippetCanvasBlock.vue": () => import("./SnippetCanvasBlock-BzZ3q7iP.js").then((n) => n.n),
	"../components/compositions/elements/card/DatatableCard.vue": () => import("./DatatableCard-DEBu_qR8.js"),
	"../components/compositions/elements/card/GridCard.vue": () => import("./GridCard-BFGcxBYs.js"),
	"../components/compositions/elements/card/InfoCard.vue": () => import("./InfoCard-BDjlMov_.js"),
	"../components/compositions/elements/card/ListCard.vue": () => import("./ListCard-BYMgRygo.js").then((n) => n.n),
	"../components/compositions/elements/card/TabCard.vue": () => import("./TabCard-DzGqbFcq.js"),
	"../components/compositions/elements/code/BuildStatus.vue": () => import("./BuildStatus-DtS1km1m.js").then((n) => n.n),
	"../components/compositions/elements/code/ChatMessage.vue": () => import("./ChatMessage-DHcQCrR7.js").then((n) => n.n),
	"../components/compositions/elements/code/FileTree.vue": () => import("./FileTree-DtEJLakV.js").then((n) => n.n),
	"../components/compositions/elements/code/GitCodeEditor.vue": () => import("./GitCodeEditor-B6ZloqYu.js").then((n) => n.n),
	"../components/compositions/elements/code/PullRequestsList.vue": () => import("./PullRequestsList-Bns4Zqba.js").then((n) => n.n),
	"../components/compositions/elements/configuration-block/DialogBlock.vue": () => import("./DialogBlock-aUJHK-mP.js").then((n) => n.n),
	"../components/compositions/elements/configuration-block/ElementsBlock.vue": () => import("./ElementsBlock-CQ4f_0NM.js").then((n) => n.n),
	"../components/compositions/elements/configuration-block/ModalBlock.vue": () => import("./ModalBlock-c1XYlBoK.js").then((n) => n.n),
	"../components/compositions/elements/configuration-block/RepeatableBlock.vue": () => import("./RepeatableBlock-Do7zdZfl.js").then((n) => n.n),
	"../components/compositions/elements/configuration-block/RepeatableRow.vue": () => import("./RepeatableRow-DZCxBLVk.js").then((n) => n.n),
	"../components/compositions/elements/display/BannerDisplay.vue": () => import("./BannerDisplay-DOlnE6P2.js").then((n) => n.n),
	"../components/compositions/elements/display/BarcodeDisplay.vue": () => import("./BarcodeDisplay-BUEUIyOk.js").then((n) => n.n),
	"../components/compositions/elements/display/CarouselDisplay.vue": () => import("./CarouselDisplay-BX_50056.js").then((n) => n.n),
	"../components/compositions/elements/display/ChartDisplay.vue": () => import("./ChartDisplay-Bygrbntn.js").then((n) => n.n),
	"../components/compositions/elements/display/HtmlDisplay.vue": () => import("./HtmlDisplay-P4EDw9bH.js").then((n) => n.n),
	"../components/compositions/elements/display/IconDisplay.vue": () => import("./IconDisplay-CODUQMY3.js").then((n) => n.n),
	"../components/compositions/elements/display/IframeDisplay.vue": () => import("./IframeDisplay-C31yGnrN.js").then((n) => n.n),
	"../components/compositions/elements/display/ImageDisplay.vue": () => import("./ImageDisplay-rTn-LL8B.js").then((n) => n.n),
	"../components/compositions/elements/display/MarkdownDisplay.vue": () => import("./MarkdownDisplay-D0Hu97Hl.js").then((n) => n.n),
	"../components/compositions/elements/display/ProgressBarDisplay.vue": () => import("./ProgressBarDisplay-DJ1inFVw.js").then((n) => n.n),
	"../components/compositions/elements/display/QrCodeDisplay.vue": () => import("./QrCodeDisplay-Cqp1pYUD.js").then((n) => n.n),
	"../components/compositions/elements/display/ReactiveCanvasDisplay.vue": () => import("./ReactiveCanvasDisplay-BqD_CaQ5.js").then((n) => n.n),
	"../components/compositions/elements/display/SpriteDisplay.vue": () => import("./SpriteDisplay-2SGbC5o4.js").then((n) => n.n),
	"../components/compositions/elements/display/TypeDisplay.vue": () => import("./TypeDisplay-DMHw3h8F.js").then((n) => n.n),
	"../components/compositions/elements/display/VideoPlayerDisplay.vue": () => import("./VideoPlayerDisplay-l_7ZWBel.js").then((n) => n.n),
	"../components/compositions/elements/editor/CodeEditor.vue": () => import("./CodeEditor-BC42_ee3.js").then((n) => n.n),
	"../components/compositions/elements/editor/HtmlEditor.vue": () => import("./HtmlEditor-CsyEOFLm.js").then((n) => n.n),
	"../components/compositions/elements/editor/ImageEditor.vue": () => import("./ImageEditor-C-T_ZrX3.js").then((n) => n.n),
	"../components/compositions/elements/editor/MarkdownEditor.vue": () => import("./MarkdownEditor-Dfeic9Ce.js").then((n) => n.n),
	"../components/compositions/elements/editor/RichTextEditor.vue": () => import("./RichTextEditor-DQKa1_u4.js").then((n) => n.n),
	"../components/compositions/elements/file/AssetPickerFile.vue": () => import("./AssetPickerFile-dH5cK_xm.js").then((n) => n.n),
	"../components/compositions/elements/file/DropzoneFile.vue": () => import("./DropzoneFile-01wL77VY.js").then((n) => n.n),
	"../components/compositions/elements/file/UploadFile.vue": () => import("./UploadFile-C1ku0FPT.js").then((n) => n.n),
	"../components/compositions/elements/input/BarcodeScannerInput.vue": () => import("./BarcodeScannerInput-DSG8LwGv.js").then((n) => n.n),
	"../components/compositions/elements/input/EmailInput.vue": () => import("./EmailInput-B8oWN-Ne.js").then((n) => n.n),
	"../components/compositions/elements/input/NumberInput.vue": () => import("./NumberInput-DMnysGiT.js").then((n) => n.n),
	"../components/compositions/elements/input/PasswordInput.vue": () => import("./PasswordInput-CEJxymes.js").then((n) => n.n),
	"../components/compositions/elements/input/RangeSliderInput.vue": () => import("./RangeSliderInput-BjnajS0j.js").then((n) => n.n),
	"../components/compositions/elements/input/SearchInput.vue": () => import("./SearchInput-tlsrS073.js").then((n) => n.n),
	"../components/compositions/elements/input/TelInput.vue": () => import("./TelInput-D4NQJXQM.js").then((n) => n.n),
	"../components/compositions/elements/input/TextInput.vue": () => import("./TextInput-B78zak94.js").then((n) => n.n),
	"../components/compositions/elements/input/TextareaInput.vue": () => import("./TextareaInput-Bwg_BXt-.js").then((n) => n.n),
	"../components/compositions/elements/input/UrlInput.vue": () => import("./UrlInput-DaPYvi5b.js").then((n) => n.n),
	"../components/compositions/elements/option-select/AutoCompleteOption.vue": () => import("./AutoCompleteOption-Bw--WwLh.js").then((n) => n.n),
	"../components/compositions/elements/option-select/CheckboxOption.vue": () => import("./CheckboxOption-Cyr6s2Pg.js").then((n) => n.n),
	"../components/compositions/elements/option-select/ListOption.vue": () => import("./ListOption-CYvYHoZ8.js").then((n) => n.n),
	"../components/compositions/elements/option-select/PillSelectOption.vue": () => import("./PillSelectOption-CVBGqNxU.js").then((n) => n.n),
	"../components/compositions/elements/option-select/RadioOption.vue": () => import("./RadioOption-DJx4s6U7.js").then((n) => n.n),
	"../components/compositions/elements/option-select/SelectMultipleOption.vue": () => import("./SelectMultipleOption-6JxZUNLW.js").then((n) => n.n),
	"../components/compositions/elements/option-select/SelectOption.vue": () => import("./SelectOption-B1isIMM1.js").then((n) => n.n),
	"../components/compositions/elements/picker/AsyncSelectPicker.vue": () => import("./AsyncSelectPicker-CyYYUzQ4.js").then((n) => n.n),
	"../components/compositions/elements/picker/ColorPicker.vue": () => import("./ColorPicker-KreVzl-q.js").then((n) => n.n),
	"../components/compositions/elements/picker/DataModelPicker.vue": () => import("./DataModelPicker-CEVbJbVY.js").then((n) => n.n),
	"../components/compositions/elements/picker/DatePicker.vue": () => import("./DatePicker-DCgG5oNZ.js").then((n) => n.n),
	"../components/compositions/elements/picker/DateTimePicker.vue": () => import("./DateTimePicker-CQySj3IG.js").then((n) => n.n),
	"../components/compositions/elements/picker/IconPicker.vue": () => import("./IconPicker-BHy-a2YR.js").then((n) => n.n),
	"../components/compositions/elements/picker/IconPickerInline.vue": () => import("./IconPickerInline-CuR56mt3.js").then((n) => n.n),
	"../components/compositions/elements/picker/IntegrationConnectorPicker.vue": () => import("./IntegrationConnectorPicker-DNdZpNXU.js").then((n) => n.n),
	"../components/compositions/elements/picker/MapPicker.vue": () => import("./MapPicker-DDd1awa4.js").then((n) => n.n),
	"../components/compositions/elements/picker/TimePicker.vue": () => import("./TimePicker-CLlTEHaV.js").then((n) => n.n),
	"../components/compositions/elements/picker/TimezonePicker.vue": () => import("./TimezonePicker-JOP7Z0iZ.js").then((n) => n.n)
});
/**
* Component cache so repeated lookups of the same (type, style) return
* the same `defineAsyncComponent` instance — important for Vue's
* keep-alive and for stability across re-renders.
*/
var componentCache = /* @__PURE__ */ new Map();
/**
* Resolves the Vue component for a given element type + style.
*
* Returns an async-wrapped component that lazy-loads the underlying
* .vue file on first render. If the (type, style) pair isn't
* registered or the file is missing, returns a Fallback component that
* renders a small warning instead of throwing — this lets a page with
* one bad element still render the rest.
*/
function getElementComponent(type) {
	const cached = componentCache.get(type);
	if (cached) return cached;
	const path = resolveElementPath(type);
	if (!path) {
		const fallback = createMissingFallback("element", type);
		componentCache.set(type, fallback);
		return fallback;
	}
	const importer = elementModules[`../components/compositions/elements/${path}.vue`];
	if (!importer) {
		const fallback = createMissingFallback("element", type, path);
		componentCache.set(type, fallback);
		return fallback;
	}
	const component = defineAsyncComponent({
		loader: async () => {
			const mod = await importer();
			return mod.default ?? mod;
		},
		errorComponent: createMissingFallback("element", type, path),
		delay: 0,
		suspensible: false
	});
	componentCache.set(type, component);
	return component;
}
/**
* Eagerly preload an element module (e.g. for above-the-fold inputs).
* Returns a Promise that resolves when the chunk is loaded.
*/
function preloadElement(type) {
	const path = resolveElementPath(type);
	if (!path) return Promise.resolve();
	const importer = elementModules[`../components/compositions/elements/${path}.vue`];
	return importer ? importer() : Promise.resolve();
}
function createMissingFallback(kind, type, path) {
	return {
		name: "MissingRendererFallback",
		setup() {
			return () => h("div", {
				class: "rounded-md border border-dashed border-destructive/40 bg-destructive/5 px-3 py-2 text-sm text-destructive",
				"data-testid": "missing-renderer",
				"data-kind": kind,
				"data-type": type
			}, [h("strong", { class: "font-semibold" }, `Unknown ${kind}: ${type}`), path ? h("div", { class: "text-xs opacity-70" }, `Expected file at src/${kind === "element" ? "elements" : "cards"}/${path}.vue`) : null]);
		}
	};
}
//#endregion
//#region src/engine/useDisplayConditions.ts
function shouldRender(cfg, item, ctx = {}) {
	if (!cfg) return true;
	if (typeof cfg.condition === "function") return Boolean(cfg.condition(item));
	if (cfg.features?.length) {
		const available = ctx.availableFeatures ?? [];
		if (!cfg.features.every((f) => available.includes(f))) return false;
	}
	if (cfg.permissions?.length) {
		const available = ctx.availablePermissions ?? [];
		if (!cfg.permissions.every((p) => available.includes(p))) return false;
	}
	if (!cfg.conditionParams?.length) return true;
	return evaluateConditionGroup(cfg.conditionParams, cfg.conditionGroupLogic ?? "AND", item);
}
function evaluateConditionGroup(params, logic, item) {
	if (params.length === 0) return true;
	const results = params.map((p) => evaluateCondition(p, item));
	return logic === "OR" ? results.some(Boolean) : results.every(Boolean);
}
function evaluateCondition(param, item) {
	if (param.subCondition) return evaluateConditionGroup(param.conditionParams ?? [], param.conditionGroupLogic ?? "AND", item);
	const left = readPath(item, param.name);
	const right = param.valueType === "model" ? readPath(item, String(param.value ?? "")) : param.value;
	return applyLogic(param.logic, left, right);
}
function applyLogic(logic, left, right) {
	switch (logic) {
		case "==": return left == right;
		case "!=": return left != right;
		case ">": return toNumber(left) > toNumber(right);
		case ">=": return toNumber(left) >= toNumber(right);
		case "<": return toNumber(left) < toNumber(right);
		case "<=": return toNumber(left) <= toNumber(right);
		case "in-array": return Array.isArray(right) ? right.includes(left) : false;
		case "not-in-array": return Array.isArray(right) ? !right.includes(left) : true;
		case "contains": return String(left ?? "").includes(String(right ?? ""));
		case "not-contains": return !String(left ?? "").includes(String(right ?? ""));
		case "starts-with": return String(left ?? "").startsWith(String(right ?? ""));
		case "ends-with": return String(left ?? "").endsWith(String(right ?? ""));
		case "matches": try {
			return new RegExp(String(right ?? "")).test(String(left ?? ""));
		} catch {
			return false;
		}
		case "is-odd": return toNumber(left) % 2 !== 0;
		case "is-even": return toNumber(left) % 2 === 0;
		case "is-truthy": return Boolean(left);
		case "is-falsy": return !left;
		case "is-null": return left === null || left === void 0;
		case "is-not-null": return left !== null && left !== void 0;
		case "g0length": return lengthOf(left) > 0;
		case "n0length": return lengthOf(left) === 0;
		case "zero-length": return lengthOf(left) === 0;
		case "length-eq-value": return lengthOf(left) === toNumber(right);
		case "length-gt-value": return lengthOf(left) > toNumber(right);
		case "length-lt-value": return lengthOf(left) < toNumber(right);
		default: return false;
	}
}
function readPath(item, path) {
	if (!path) return;
	const parts = path.split(".");
	let current = item;
	for (const part of parts) if (current && typeof current === "object" && part in current) current = current[part];
	else return;
	return current;
}
function toNumber(value) {
	if (typeof value === "number") return value;
	if (typeof value === "string" && value.trim() !== "") {
		const n = Number(value);
		return Number.isFinite(n) ? n : NaN;
	}
	return NaN;
}
function lengthOf(value) {
	if (value == null) return 0;
	if (Array.isArray(value) || typeof value === "string") return value.length;
	if (typeof value === "object") return Object.keys(value).length;
	return 0;
}
//#endregion
export { preloadElement as i, createMissingFallback as n, getElementComponent as r, shouldRender as t };

//# sourceMappingURL=useDisplayConditions-DNEDur9S.js.map