import{cF as I,cG as L,f as T,cH as U,r as e,cJ as q,dW as F,j as A,cL as G,cM as H}from"./index-7414fd54.js";import{i as J,a as N}from"./OutlinedInput-dd801d4f.js";import{F as K}from"./useFormControl-99b033b3.js";function O(n){return I("MuiFormControl",n)}L("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=T("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=q({props:o,name:"MuiFormControl"}),{children:s,className:B,color:u="primary",component:h="div",disabled:i=!1,error:c=!1,focused:S,fullWidth:d=!1,hiddenLabel:m=!1,margin:D="none",required:f=!1,size:p="medium",variant:g="outlined",...P}=a,v={...a,color:u,component:h,disabled:i,error:c,fullWidth:d,hiddenLabel:m,margin:D,required:f,size:p,variant:g},$=Q(v),[x,k]=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}),[y,W]=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}),[E,C]=e.useState(!1);i&&E&&C(!1);const M=S!==void 0&&!i?S:E;let b;e.useRef(!1);const R=e.useCallback(()=>{W(!0)},[]),w=e.useCallback(()=>{W(!1)},[]),z=e.useMemo(()=>({adornedStart:x,setAdornedStart:k,color:u,disabled:i,error:c,filled:y,focused:M,fullWidth:d,hiddenLabel:m,size:p,onBlur:()=>{C(!1)},onFocus:()=>{C(!0)},onEmpty:w,onFilled:R,registerEffect:b,required:f,variant:g}),[x,u,i,c,y,M,d,m,b,w,R,f,p,g]);return A.jsx(K.Provider,{value:z,children:A.jsx(V,{as:h,ownerState:v,className:G($.root,B),ref:r,...P,children:s})})}),ee=X;export{ee as F};
