import{R as K,bz as z,bC as H,j as t,bB as T,c1 as Y,at as Z,bZ as $,Y as q}from"./main-D6SjkSWq.js";import{C as G}from"./combobox-end-adornment-Btuckat_.js";function J(a,b){var m;const{children:Q,items:U,isAsync:W,isLoading:l,isPending:f,isFetching:C,openMenuOnFocus:g=!0,endAdornmentIcon:h,onItemSelected:X,maxItems:_,clearInputOnItemSelection:I,inputValue:ee,selectedValue:ne,onSelectionChange:te,allowCustomValue:v=!1,onInputValueChange:oe,defaultInputValue:se,selectionMode:O="single",useOptionLabelAsInputValue:F,showEmptyMessage:ae,floatingMaxHeight:L,hideEndAdornment:V=!1,blurReferenceOnItemSelection:A,clearSelectionOnInputClear:le,isOpen:ie,onOpenChange:re,prependListbox:w,listboxClassName:N,contentClassName:R,searchFieldClassName:S,onEndAdornmentClick:i,autoFocusFirstItem:ue=!0,focusLoopingMode:ce,...r}=a,o=z({...a,floatingMaxHeight:L,blurReferenceOnItemSelection:A,selectionMode:O,role:"listbox",virtualFocus:!0,clearSelectionOnInputClear:!0},b),{reference:j,listboxId:y,onInputChange:E,state:{isOpen:n,setIsOpen:u,inputValue:P,setInputValue:B,selectValues:c,selectedValues:s,setActiveCollection:D},collection:M}=o,d=s[0]?(m=M.get(s[0]))==null?void 0:m.textLabel:void 0,{handleListboxSearchFieldKeydown:k}=H(o),p=$(e=>{g&&!n&&u(!0),e.target.select()});return t.jsx(T,{prepend:w,className:N,contentClassName:R,listbox:o,mobileOverlay:Y,isLoading:l,isPending:f,onPointerDown:e=>{e.preventDefault()},children:t.jsx(Z,{inputRef:j,className:S,...r,endAdornment:V?null:t.jsx(q,{size:"md",tabIndex:-1,disabled:r.disabled,className:"pointer-events-auto",onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),i?i():(D("all"),u(!n))},children:t.jsx(G,{isLoading:l||C,icon:h})}),"aria-expanded":n?"true":"false","aria-haspopup":"listbox","aria-controls":n?y:void 0,"aria-autocomplete":"list",autoComplete:"off",autoCorrect:"off",spellCheck:"false",onChange:E,value:F&&d?d:P,onBlur:e=>{if(v)c(e.target.value);else if(!I){const x=s[0];B(c.length&&x!=null?`${x}`:"")}},onFocus:p,onClick:p,onKeyDown:e=>k(e)})})}const me=K.forwardRef(J);export{me as C};
