import{j as l,bf as j,bg as b,bh as v,aJ as u,m as d}from"./vendor-ClLR6ncd.js";import{M as m}from"./MenuItem-CCerWMyq.js";const I=48,M=8,f={PaperProps:{style:{maxHeight:I*4.5+M,width:250}}},t=new String("All");function A({allOptionsText:c="All",options:a,disabled:x,selected:s,setSelected:r,label:i,sx:p}){const g=Object.assign({},...a.map(({label:e,value:n})=>({[n]:e}))),o=({target:{value:e}})=>{e.includes(t)&&s.length===a.length?r([]):e.includes(t)&&s.length!==a.length?r(a.map(({value:n})=>n)):r(e)},h=s.length===a.length;return l.jsx("div",{children:l.jsxs(j,{sx:p,children:[l.jsx(b,{sx:{ml:"-14px"},id:`multiple-checkbox-${i}`,children:i}),l.jsxs(v,{disabled:x,labelId:`multiple-checkbox-${i}`,multiple:!0,value:s,onChange:o,variant:"standard",renderValue:e=>h?c:e.map(n=>g[n]).join(", "),MenuProps:f,children:[l.jsxs(m,{value:t,children:[l.jsx(u,{checked:h}),l.jsx(d,{primary:c})]}),a.map(e=>l.jsxs(m,{value:e.value,disabled:e.disabled,children:[l.jsx(u,{checked:s.includes(e.value)}),l.jsx(d,{primary:e.label,secondary:e.secondary})]},e.value))]})]})})}export{A as M};
