import { t as e } from "./clients-IxWZVjVW.js";
import { a as t, o as n, r, s as i } from "./components-DaDed2hn.js";
import { t as a } from "./enums-De8CDKZ1.js";
import { t as o } from "./vue-i18n-Db_oYfO8.js";
import { computed as s, createBlock as c, createCommentVNode as l, createVNode as u, defineComponent as d, mergeModels as f, mergeProps as p, openBlock as m, renderSlot as h, resolveComponent as g, unref as _, useModel as v } from "vue";
//#endregion
//#region src/components/on-demand/wt-type-extension-value-input/wt-type-extension-value-input.vue
var y = /* @__PURE__ */ d({
	__name: "wt-type-extension-value-input",
	props: /*@__PURE__*/ f({
		field: {},
		label: {},
		required: { type: Boolean },
		v: {}
	}, {
		modelValue: {},
		modelModifiers: {}
	}),
	emits: ["update:modelValue"],
	setup(d) {
		let f = v(d, "modelValue"), y = d;
		y.v?.$touch();
		let { t: b } = o(), x = s(() => y.label || b(y.field?.name || "vocabulary.labels")), S = s(() => y.required ?? y.field.required), C = s(() => f.value), w = s(() => ({
			label: x.value,
			required: S.value,
			v: y.v
		})), T = s(() => ({
			clearable: !0,
			dataKey: "id",
			searchMethod: () => O(y.field.lookup)
		})), E = s(() => ({ ...T.value })), D = (e) => {
			f.value = e;
		}, O = ({ path: t, display: n, primary: r }) => (i) => e.getSysTypeRecordsLookup({
			...i,
			path: t,
			display: n,
			primary: r
		}), k = (e) => {
			if (Object.values(e).length === 0) return D(null);
			D({
				id: e.id,
				name: e.name
			});
		}, A = (e) => {
			D(e.map((e) => ({
				id: e.id,
				name: e.name
			})));
		};
		return (e, o) => {
			let s = g("wt-input-text"), f = g("wt-input-number");
			return d.field.kind === _(a).Text ? (m(), c(s, p({ key: 0 }, w.value, {
				"model-value": C.value,
				"onUpdate:modelValue": D
			}), null, 16, ["model-value"])) : d.field.kind === _(a).Number ? (m(), c(f, p({ key: 1 }, w.value, {
				"model-value": C.value,
				"onUpdate:modelValue": D
			}), null, 16, ["model-value"])) : d.field.kind === _(a).Boolean ? h(e.$slots, _(a).Boolean, {
				key: 2,
				defaultProps: { ...w.value }
			}, () => [u(_(t), p(w.value, {
				"model-value": C.value,
				"onUpdate:modelValue": D
			}), null, 16, ["model-value"])]) : d.field.kind === _(a).Select ? h(e.$slots, _(a).Select, {
				key: 3,
				defaultProps: {
					...w.value,
					...T.value,
					value: C.value
				}
			}, () => [u(_(n), p(w.value, {
				"model-value": C.value,
				"search-method": O(d.field.lookup),
				"data-key": "id",
				"onUpdate:modelValue": k
			}), null, 16, ["model-value", "search-method"])]) : d.field.kind === _(a).Multiselect ? h(e.$slots, _(a).Multiselect, {
				key: 4,
				defaultProps: {
					...w.value,
					...E.value,
					value: C.value
				}
			}, () => [u(_(i), p({
				...w.value,
				...E.value
			}, {
				"model-value": C.value,
				"onUpdate:modelValue": A
			}), null, 16, ["model-value"])]) : d.field.kind === _(a).Calendar ? h(e.$slots, _(a).Calendar, {
				key: 5,
				defaultProps: {
					...w.value,
					value: C.value
				}
			}, () => [u(_(r), p(w.value, {
				"model-value": C.value,
				"show-time": "",
				"onUpdate:modelValue": D
			}), null, 16, ["model-value"])]) : l("", !0);
		};
	}
});
//#endregion
export { y as default };
