import{j as n,ag as d,av as j,aw as v,ax as I,aq as E,bj as C,p as l}from"./mui-vendor-CkIVaoQP.js";import{r as c}from"./react-vendor-CmFgShSM.js";const L=48,M=8,k={PaperProps:{style:{maxHeight:L*4.5+M,width:280}}},O=({label:o,id:y,options:r,error:i,onBlur:g,onChange:m,size:b,value:S,width:t,defaultValue:s})=>{s=s||[];const[a,x]=c.useState(s);t=t||280;const h=e=>{const{target:{value:p}}=e;x(typeof p=="string"?p.split(","):p)};c.useEffect(()=>{m(a)},[a]),c.useEffect(()=>{s!=null&&s.length&&x(a)},[s]);const T=r==null?void 0:r.map(e=>e.value),u=r==null?void 0:r.map(e=>e.label);return n.jsx("div",{children:n.jsxs(d,{sx:{width:t},size:b,children:[n.jsx(j,{id:"demo-multiple-checkbox-label",children:o}),n.jsx(v,{labelId:"demo-multiple-checkbox-label",id:y,multiple:!0,value:a,onChange:h,input:n.jsx(C,{label:o}),renderValue:e=>(e==null?void 0:e.map(P=>u[T.indexOf(P)])).join(", "),MenuProps:k,error:i,onBlur:g,children:r==null?void 0:r.map(e=>n.jsx(I,{value:e.value,style:{display:"flex",padding:0},children:n.jsx(E,{style:{backgroundColor:(a==null?void 0:a.indexOf(e.value))>-1?"lightgray":"initial",padding:8},primary:e.label})},e.label))})]})})};O.propTypes={label:l.PropTypes.string,id:l.PropTypes.string,options:l.PropTypes.array,error:l.PropTypes.any,onBlur:l.PropTypes.any,onChange:l.PropTypes.any,size:l.PropTypes.any};export{O as S};