import{bh as I,bi as T,d as q,bo as U,r as e,bk as L,cF as F,j as A,bm as G,bn as H}from"./index-60a3c753.js";import{i as J,a as N}from"./OutlinedInput-3a884178.js";import{F as K}from"./useFormControl-e13b5747.js";function O(n){return I("MuiFormControl",n)}T("MuiFormControl",["root","marginNone","marginNormal","marginDense","fullWidth","disabled"]);const Q=n=>{const{classes:o,margin:r,fullWidth:a}=n,s={root:["root",r!=="none"&&`margin${U(r)}`,a&&"fullWidth"]};return H(s,O,o)},V=q("div",{name:"MuiFormControl",slot:"Root",overridesResolver:(n,o)=>{const{ownerState:r}=n;return[o.root,o[`margin${U(r.margin)}`],r.fullWidth&&o.fullWidth]}})({display:"inline-flex",flexDirection:"column",position:"relative",minWidth:0,padding:0,margin:0,border:0,verticalAlign:"top",variants:[{props:{margin:"normal"},style:{marginTop:16,marginBottom:8}},{props:{margin:"dense"},style:{marginTop:8,marginBottom:4}},{props:{fullWidth:!0},style:{width:"100%"}}]}),X=e.forwardRef(function(o,r){const a=L({props:o,name:"MuiFormControl"}),{children:s,className:k,color:u="primary",component:h="div",disabled:i=!1,error:d=!1,focused:S,fullWidth:m=!1,hiddenLabel:c=!1,margin:B="none",required:f=!1,size:p="medium",variant:g="outlined",...D}=a,b={...a,color:u,component:h,disabled:i,error:d,fullWidth:m,hiddenLabel:c,margin:B,required:f,size:p,variant:g},P=Q(b),[v,$]=e.useState(()=>{let l=!1;return s&&e.Children.forEach(s,t=>{if(!F(t,["Input","Select"]))return;const j=F(t,["Select"])?t.props.input:t;j&&J(j.props)&&(l=!0)}),l}),[x,y]=e.useState(()=>{let l=!1;return s&&e.Children.forEach(s,t=>{F(t,["Input","Select"])&&(N(t.props,!0)||N(t.props.inputProps,!0))&&(l=!0)}),l}),[W,C]=e.useState(!1);i&&W&&C(!1);const E=S!==void 0&&!i?S:W;let M;e.useRef(!1);const R=e.useCallback(()=>{y(!0)},[]),w=e.useCallback(()=>{y(!1)},[]),z=e.useMemo(()=>({adornedStart:v,setAdornedStart:$,color:u,disabled:i,error:d,filled:x,focused:E,fullWidth:m,hiddenLabel:c,size:p,onBlur:()=>{C(!1)},onFocus:()=>{C(!0)},onEmpty:w,onFilled:R,registerEffect:M,required:f,variant:g}),[v,u,i,d,x,E,m,c,M,w,R,f,p,g]);return A.jsx(K.Provider,{value:z,children:A.jsx(V,{as:h,ownerState:b,className:G(P.root,k),ref:r,...D,children:s})})}),ee=X;export{ee as F};
