import{slicedToArray as e}from"../../../../../_virtual/_rollupPluginBabelHelpers.js";import{useState as n,useMemo as t}from"react";import{useSelect as l}from"downshift";import o from"./useDropdownFiltering.js";function i(i,r,u,s,p,g,d,a,f,c,m,I){var P=n(s||null),h=e(P,2),v=h[1],M=void 0!==p?p:h[0],O=t((function(){return M?[M]:[]}),[M]),b=o(i,m,c,O).filteredOptions,T=t((function(){return b.flatMap((function(e){return e.options}))}),[b]),x=l({items:T,itemToString:function(e){var n;return null!==(n=null==e?void 0:e.label)&&void 0!==n?n:""},isItemDisabled:function(e){return!!e.disabled},isOpen:u,initialIsOpen:r,selectedItem:M,id:I,onSelectedItemChange:function(e){var n=e.selectedItem;void 0===p&&v(n||null),n&&(null==f||f(n)),null==g||g(n||null)},onIsOpenChange:function(e){e.isOpen?null==d||d():null==a||a()}}),B=x.reset;return{isOpen:x.isOpen,inputValue:"",highlightedIndex:x.highlightedIndex,selectedItem:M,getToggleButtonProps:x.getToggleButtonProps,getLabelProps:x.getLabelProps,getMenuProps:x.getMenuProps,getInputProps:function(){return{}},getItemProps:x.getItemProps,reset:function(){void 0===p&&v(null),B(),null==g||g(null)},filteredOptions:b,openMenu:x.openMenu,toggleMenu:x.toggleMenu,closeMenu:x.closeMenu}}export{i as default};
//# sourceMappingURL=useDropdownSelect.js.map
