!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(()=>(()=>{"use strict";var e={8619:e=>{e.exports=require("@mui/material")},2015:e=>{e.exports=require("react")}},t={};function n(l){var o=t[l];if(void 0!==o)return o.exports;var r=t[l]={exports:{}};return e[l](r,r.exports,n),r.exports}(()=>{n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t}})(),(()=>{n.d=(e,t)=>{for(var l in t)n.o(t,l)&&!n.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})}})(),(()=>{n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var l={};n.r(l),n.d(l,{default:()=>i});var o=n(2015),r=n.n(o),a=n(8619);const u=require("@mui/x-date-pickers"),i=({availableOptions:e=[],canAdd:t=!1,canEdit:n=!1,inputLabel:l="",currentSettings:i=null,onGetSettingsMeta:c,onGetSettings:s,onUpsertSettings:p,renderSelectedOptions:d,denormalizeSettings:m})=>{const[f,b]=(0,o.useState)([]),[v,g]=(0,o.useState)(!1);(0,o.useEffect)((()=>{s&&s()}),[s]),(0,o.useEffect)((()=>{if(i&&(c&&c(),i&&d&&m)){const e=d(m(i.columns)).map((e=>e.value));b(e)}}),[i]);const x=e=>{b(e),p(e),g(!1)};return t&&n&&0!==e.length?r().createElement(a.Box,null,r().createElement(a.FormControl,{fullWidth:!0},r().createElement(a.InputLabel,{id:"multi-select-label"},l),r().createElement(a.Select,{labelId:"multi-select-label",id:"multi-select",multiple:!0,fullWidth:!0,value:f,onChange:e=>(e=>{b(e),g(!0)})(e.target.value),onClose:()=>v?x(f):null,input:r().createElement(a.OutlinedInput,{label:l}),renderValue:t=>r().createElement(a.Box,{sx:{display:"flex",flexWrap:"wrap",gap:.5}},t.map((t=>{const n=e.find((e=>e.value===t));return n?r().createElement(a.Chip,{key:n.value,label:n.label,onDelete:()=>{(e=>{const t=f.filter((t=>t!==e));b(t),p(t)})(n.value)},deleteIcon:r().createElement(u.ClearIcon,{onMouseDown:e=>{e.stopPropagation()}})}):null}))),endAdornment:f.length>0&&r().createElement(a.InputAdornment,{sx:{marginRight:"10px"},position:"end"},r().createElement(a.IconButton,{onClick:()=>{x([])}},r().createElement(u.ClearIcon,null)))},e.map((({value:e,label:t})=>r().createElement(a.MenuItem,{key:e,value:e},t)))))):null};return l})()));
//# sourceMappingURL=chip-select-input.js.map