const e=require("../_util/warning.js"),t=require("../_util/omit.js"),n=require("../_util/props-util/index.js"),r=require("../config-provider/hooks/useConfigInject.js"),i=require("../select/index.js"),a=require("./OptGroup.js"),o=require("./Option.js");let s=require("vue");function c(e){return e?.type?.isSelectOption||e?.type?.isSelectOptGroup}var l=()=>({...t.default(i.selectProps(),[`loading`,`mode`,`optionLabelProp`,`labelInValue`]),dataSource:Array,dropdownMenuStyle:{type:Object,default:void 0},dropdownMatchSelectWidth:{type:[Number,Boolean],default:!0},prefixCls:String,showSearch:{type:Boolean,default:void 0},transitionName:String,choiceTransitionName:{type:String,default:`zoom`},autofocus:{type:Boolean,default:void 0},backfill:{type:Boolean,default:void 0},filterOption:{type:[Boolean,Function],default:!1},defaultActiveFirstOption:{type:Boolean,default:!0},status:String}),u=o.default,d=a.default,f=(0,s.defineComponent)({compatConfig:{MODE:3},name:`AAutoComplete`,inheritAttrs:!1,props:l(),slots:Object,setup(a,{slots:l,attrs:u,expose:d}){e.default(!(`dataSource`in l),`AutoComplete`,"`dataSource` slot is deprecated, please use props `options` instead."),e.default(!(`options`in l),`AutoComplete`,"`options` slot is deprecated, please use props `options` instead."),e.default(!a.dropdownClassName,`AutoComplete`,"`dropdownClassName` is deprecated, please use `popupClassName` instead.");let f=(0,s.ref)(),p=()=>{let e=n.flattenChildren(l.default?.());return e.length?e[0]:void 0};d({focus:()=>{f.value?.focus()},blur:()=>{f.value?.blur()}});let{prefixCls:m}=r.default(`select`,a);return()=>{let{size:e,dataSource:r,notFoundContent:d=l.notFoundContent?.()}=a,h,{class:g}=u,_={[g]:!!g,[`${m.value}-lg`]:e===`large`,[`${m.value}-sm`]:e===`small`,[`${m.value}-show-search`]:!0,[`${m.value}-auto-complete`]:!0};if(a.options===void 0){let e=l.dataSource?.()||l.options?.()||[];h=e.length&&c(e[0])?e:r?r.map(e=>{if(n.isValidElement(e))return e;switch(typeof e){case`string`:return(0,s.createVNode)(o.default,{key:e,value:e},{default:()=>[e]});case`object`:return(0,s.createVNode)(o.default,{key:e.value,value:e.value},{default:()=>[e.text]});default:throw Error("AutoComplete[dataSource] only supports type `string[] | Object[]`.")}}):[]}return(0,s.createVNode)(i.default,t.default({...a,...u,mode:i.default.SECRET_COMBOBOX_MODE_DO_NOT_USE,getInputElement:p,notFoundContent:d,class:_,popupClassName:a.popupClassName||a.dropdownClassName,ref:f},[`dataSource`,`loading`]),{default:()=>[h],...t.default(l,[`default`,`dataSource`,`options`])})}}}),p=Object.assign(f,{Option:o.default,OptGroup:a.default,install(e){return e.component(f.name,f),e.component(o.default.displayName,o.default),e.component(a.default.displayName,a.default),e}});exports.AutoCompleteOptGroup=d,exports.AutoCompleteOption=u,exports.autoCompleteProps=l,exports.default=p;