import{j as e,y,x as S,bc as I,M as c,ak as n,U as O,T as f,bw as T,F as W,W as r}from"./vendor-mui-core-CnXrAOs3.js";import{l as z}from"./arrow-down.svg-Uxqj9Lez.js";function M({fullWidth:m=!1,multiple:a=!1,required:o=!1,label:d="",placeholer:j="",options:t=[],helperText:b="",error:v=!1,margin:p="",size:u,...h}){const g=t.find(l=>l.value===h.value)?.title;return e.jsxs(y,{margin:p,fullWidth:m,error:v,children:[e.jsx(S,{size:u,children:`${d}${o?"*":""}`}),e.jsxs(I,{multiple:a,sx:{"& .MuiInputBase-input":{width:"calc(100% - 46px)","& > .MuiBox-root:first-of-type":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},input:e.jsx(T,{defaultValue:g,sx:{flex:1},required:o,label:d,inputProps:{margin:p},size:u}),renderValue:l=>{if(a)return e.jsx(n,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:l.map(i=>{const x=t.find(w=>w.value===i);return x&&x.title&&e.jsx(O,{size:"small",label:x.title},i)})});const s=t.find(i=>i.value===l);return s&&s.title&&e.jsxs(n,{children:[e.jsx(f,{component:"span",children:s.title}),e.jsx(f,{component:"span",variant:"body2",sx:{marginLeft:1,color:"text.secondary"},children:s.description})]})},IconComponent:l=>e.jsx(z,{...l,width:20,height:20}),...h,children:[e.jsx(c,{disabled:!0,children:e.jsx("em",{children:j})}),!o&&!a&&e.jsx(c,{value:"",children:"None"}),t.map(l=>l&&l.value&&e.jsx(c,{value:l.value,children:e.jsxs(n,{children:[e.jsx("span",{children:l.title}),l.description&&e.jsx(n,{sx:{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal"},children:l.description})]})},l.value))]}),e.jsx(W,{children:b})]})}M.propTypes={error:r.bool,required:r.bool,multiple:r.bool,fullWidth:r.bool,label:r.string,placeholer:r.string,options:r.array,helperText:r.string,margin:r.string,size:r.string,textDirection:r.oneOf("row","column")};export{M as S};
