import{d as h,a$ as k,b as u,w as m,g as v,o as s,a as _,E as d,t as b,r as I,aD as V,b0 as F,F as j,h as B,f as C,_ as D}from"./dVzHJMF1.js";import w from"./cMkL48JQ.js";import"./iZ-xiGRB.js";import A from"./BSLzRQpY.js";const E=["for"],N=h({__name:"Field",props:{label:{},name:{},for:{}},setup(g){const n=g,c=k();function l(r,a){if(typeof r!="object"||r===null)return!1;const e=r,t=e.props;return!!(Array.isArray(t)&&t.includes(a)||typeof t=="object"&&t!==null&&a in t||e.extends&&l(e.extends,a))}function y(r,a){const e=r.type,t={name:n.name};return l(e,"labelId")?t.labelId=n.for||n.name:l(e,"inputId")?t.inputId=n.for||n.name:t.id=n.for||n.name,typeof e=="object"||typeof e=="function"?{...t,modelValue:a.value,"onUpdate:modelValue":o=>{a.value=o}}:e==="input"||e==="textarea"||e==="select"?{...t,value:a.value,onInput:o=>{a.value=o.target.value}}:{}}return(r,a)=>{const e=D,t=w;return s(),u(v(A),{name:r.name},{default:m(o=>{var i,p;return[n.label?(s(),_("label",{key:0,class:"p-label",for:n.for||n.name},b(n.label),9,E)):d("",!0),(s(!0),_(j,null,I(((i=c.default)==null?void 0:i.call(c,o))??[],(f,x)=>(s(),u(V(F(f,y(f,o))),{key:x}))),128)),(p=o.error)!=null&&p.message?(s(),u(t,{key:1,class:"flex gap-1"},{icon:m(()=>[C(e,{name:"material-symbols:cancel",shape:"circle"})]),default:m(()=>[B(" "+b(o.error.message),1)]),_:2},1024)):d("",!0)]}),_:1},8,["name"])}}}),M=Object.assign(N,{__name:"UiFormField"});export{M as _};
