import { InputField } from "./fields/InputField.js";
import { TextareaField } from "./fields/TextareaField.js";
import { CheckboxField } from "./fields/CheckboxField.js";
import { CodeViewField } from "./fields/CodeViewField.js";
import { RadioField } from "./fields/RadioField.js";
import { SelectField } from "./fields/SelectField.js";
import { SliderField } from "./fields/SliderField.js";
import { SwitchField } from "./fields/SwitchField.js";
import { c } from "react/compiler-runtime";
import React from "react";
import { jsx } from "react/jsx-runtime";
var WIDGET_REGISTRY = {
	checkbox: CheckboxField,
	radio: RadioField,
	switch: SwitchField,
	select: SelectField,
	slider: SliderField,
	text: InputField,
	textarea: TextareaField,
	"code-view": CodeViewField
}, WIDGET_NAMES = Object.keys(WIDGET_REGISTRY), resolveWidgetType = (e, o) => {
	if (o && WIDGET_NAMES.includes(o)) return o;
	let s = e;
	return s.type === "boolean" ? "checkbox" : s.enum && s.enum.length > 0 ? "select" : "text";
}, getFieldName = (e, o) => o ? `${o}.${e}` : e;
const InputController = (e) => {
	let o = c(8), { name: s, schema: l, ui: u, parentKey: d } = e, f = l, p = u;
	if (f.hidden) return null;
	let m;
	o[0] !== s || o[1] !== d ? (m = getFieldName(s, d), o[0] = s, o[1] = d, o[2] = m) : m = o[2];
	let h = m, g = WIDGET_REGISTRY[resolveWidgetType(l, p?.widget)], _ = l, v;
	return o[3] !== g || o[4] !== h || o[5] !== e || o[6] !== _ ? (v = /* @__PURE__ */ jsx(g, {
		...e,
		name: h,
		schema: _
	}), o[3] = g, o[4] = h, o[5] = e, o[6] = _, o[7] = v) : v = o[7], v;
};
export { InputController };
