import { D as e, E as t, Ht as n, J as r, Lt as i, On as a, Pt as o, Zn as s, _ as c, b as l, g as u, gt as d, mt as f, qt as p, tr as m, v as h, vn as g, xt as _, y as v } from "./runtime-core.esm-bundler-Ci9kEgM7.js";
import { C as y, S as b, X as x, b as S, c as C, f as w, o as T, s as E } from "./Button-CzGEASGR.js";
import { t as D } from "./Label-DshmQcFV.js";
var O = { slots: { root: ``, wrapper: ``, labelWrapper: `flex content-center items-center justify-between gap-1`, label: `block font-medium text-default`, container: `relative`, description: `text-muted`, error: `mt-2 text-error`, hint: `text-muted`, help: `mt-2 text-muted` }, variants: { size: { xs: { root: `text-xs` }, sm: { root: `text-xs` }, md: { root: `text-sm` }, lg: { root: `text-sm` }, xl: { root: `text-base` } }, required: { true: { label: `after:content-['*'] after:ms-0.5 after:text-error` } }, orientation: { vertical: { container: `mt-1` }, horizontal: { root: `flex justify-between place-items-baseline gap-2` } } }, defaultVariants: { size: `md` } }, k = [`id`], A = [`id`], j = [`id`], M = [`id`], N = { __name: `FormField`, props: { as: { type: null, required: false }, name: { type: String, required: false }, errorPattern: { type: null, required: false }, label: { type: String, required: false }, description: { type: String, required: false }, help: { type: String, required: false }, error: { type: [Boolean, String], required: false, default: void 0 }, hint: { type: String, required: false }, size: { type: null, required: false }, required: { type: Boolean, required: false }, eagerValidation: { type: Boolean, required: false }, validateOnInputDelay: { type: Number, required: false }, orientation: { type: null, required: false, default: `vertical` }, class: { type: null, required: false }, ui: { type: Object, required: false } }, setup(N2) {
  let P = N2, F = i(), I = b(`formField`, P), L = x(), R = u(() => S({ extend: S(O), ...L.ui?.formField || {} })({ size: I.size, required: I.required, orientation: I.orientation })), z = r(T, null), B = u(() => I.error || z?.value?.find((e2) => e2.name === I.name || I.errorPattern && e2.name?.match(I.errorPattern))?.message), V = g(o()), H = V.value, U = r(C, void 0);
  return n(V, () => {
    U && I.name && (U.value[I.name] = { id: V.value, pattern: I.errorPattern });
  }, { immediate: true }), d(w, V), d(E, u(() => ({ error: B.value, name: I.name, size: I.size, eagerValidation: I.eagerValidation, validateOnInputDelay: I.validateOnInputDelay, errorPattern: I.errorPattern, hint: I.hint, description: I.description, help: I.help, ariaId: H }))), (n2, r2) => (f(), h(a(y), { as: a(I).as, "data-orientation": a(I).orientation, "data-slot": `root`, class: s(R.value.root({ class: [a(I).ui?.root, a(I).class] })) }, { default: p(() => [c(`div`, { "data-slot": `wrapper`, class: s(R.value.wrapper({ class: a(I).ui?.wrapper })) }, [a(I).label || F.label ? (f(), l(`div`, { key: 0, "data-slot": `labelWrapper`, class: s(R.value.labelWrapper({ class: a(I).ui?.labelWrapper })) }, [e(a(D), { for: V.value, "data-slot": `label`, class: s(R.value.label({ class: a(I).ui?.label })) }, { default: p(() => [_(n2.$slots, `label`, { label: a(I).label }, () => [t(m(a(I).label), 1)])]), _: 3 }, 8, [`for`, `class`]), a(I).hint || F.hint ? (f(), l(`span`, { key: 0, id: `${a(H)}-hint`, "data-slot": `hint`, class: s(R.value.hint({ class: a(I).ui?.hint })) }, [_(n2.$slots, `hint`, { hint: a(I).hint }, () => [t(m(a(I).hint), 1)])], 10, k)) : v(``, true)], 2)) : v(``, true), a(I).description || F.description ? (f(), l(`p`, { key: 1, id: `${a(H)}-description`, "data-slot": `description`, class: s(R.value.description({ class: a(I).ui?.description })) }, [_(n2.$slots, `description`, { description: a(I).description }, () => [t(m(a(I).description), 1)])], 10, A)) : v(``, true)], 2), c(`div`, { class: s([(a(I).label || !!F.label || a(I).description || !!F.description) && R.value.container({ class: a(I).ui?.container })]) }, [_(n2.$slots, `default`, { error: B.value }), a(I).error !== false && (typeof B.value == `string` && B.value || F.error) ? (f(), l(`div`, { key: 0, id: `${a(H)}-error`, "data-slot": `error`, class: s(R.value.error({ class: a(I).ui?.error })) }, [_(n2.$slots, `error`, { error: B.value }, () => [t(m(B.value), 1)])], 10, j)) : a(I).help || F.help ? (f(), l(`div`, { key: 1, id: `${a(H)}-help`, "data-slot": `help`, class: s(R.value.help({ class: a(I).ui?.help })) }, [_(n2.$slots, `help`, { help: a(I).help }, () => [t(m(a(I).help), 1)])], 10, M)) : v(``, true)], 2)]), _: 3 }, 8, [`as`, `data-orientation`, `class`]));
} };
export {
  N as t
};
