import{r as s,j as n}from"./vendor-tanstack-BpuysabX.js";import{S as F}from"./vendor-radix-DIu41Ss_.js";import{g as x,F as u,C as p}from"./vendor-forms-Buh7U8Ay.js";import{b4 as i,i as I}from"./index-CREafGO4.js";const l=s.createContext({}),f=s.createContext({}),d=()=>{const e=s.useContext(l),t=s.useContext(f),{getFieldState:r,formState:o}=x(),m=r(e.name,o);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:a}=t;return{id:a,name:e.name,formItemId:`${a}-form-item`,formDescriptionId:`${a}-form-item-description`,formMessageId:`${a}-form-item-message`,...m}},R=u,S=({...e})=>n.jsx(l.Provider,{value:{name:e.name},children:n.jsx(p,{...e})}),C=s.forwardRef(({className:e,...t},r)=>{const o=s.useId();return n.jsx(f.Provider,{value:{id:o},children:n.jsx("div",{ref:r,className:i("space-y-2",e),...t})})});C.displayName="FormItem";const g=s.forwardRef(({className:e,...t},r)=>{const{error:o,formItemId:m}=d();return n.jsx(I,{ref:r,className:i(o&&"text-destructive",e),htmlFor:m,...t})});g.displayName="FormLabel";const j=s.forwardRef(({...e},t)=>{const{error:r,formItemId:o,formDescriptionId:m,formMessageId:a}=d();return n.jsx(F,{ref:t,id:o,"aria-describedby":r?`${m} ${a}`:`${m}`,"aria-invalid":!!r,...e})});j.displayName="FormControl";const b=s.forwardRef(({className:e,...t},r)=>{const{formDescriptionId:o}=d();return n.jsx("p",{ref:r,id:o,className:i("text-[0.8rem] text-muted-foreground",e),...t})});b.displayName="FormDescription";const v=s.forwardRef(({className:e,children:t,...r},o)=>{const{error:m,formMessageId:a}=d(),c=m?String(m?.message):t;return c?n.jsx("p",{ref:o,id:a,className:i("text-[0.8rem] font-medium text-destructive",e),...r,children:c}):null});v.displayName="FormMessage";export{R as F,v as a,S as b,C as c,g as d,j as e};
//# sourceMappingURL=form-DC8L1tSC.js.map
