import{_ as r,o as O,w as B,a as E,i as x,b as j,f as G}from"./bootstrap-Bqxdt4iG.js";import _,{selectProps as M}from"./index-32EZ6Zls.js";import{a1 as F,L as P,p as f}from"../jse/index-index-BUJ_4tQs.js";import"./index-BZFH0uEW.js";import"./Trigger-CftQioxV.js";import"./ResizeObserver.es-CDE7jhPe.js";import"./BaseInput-hWv8kcd0.js";import"./css-BPcmMxJM.js";import"./Overflow-CeWBpt44.js";import"./index-BNdxtbnh.js";import"./isMobile-8sZ0LT6r.js";import"./DownOutlined-Dq3ZoN1L.js";import"./CheckOutlined-CyOADmg7.js";import"./SearchOutlined-D1HVVwei.js";import"./move-DY-9c5GY.js";import"./slide-DUltH_8g.js";import"./useMergedState-mzgb8Um4.js";import"./FormItemContext-DjC4AFm9.js";import"./statusUtils-BYtfCLmZ.js";const n=()=>null;n.isSelectOption=!0;n.displayName="AAutoCompleteOption";const u=()=>null;u.isSelectOptGroup=!0;u.displayName="AAutoCompleteOptGroup";function $(e){var s,o;return((s=e==null?void 0:e.type)===null||s===void 0?void 0:s.isSelectOption)||((o=e==null?void 0:e.type)===null||o===void 0?void 0:o.isSelectOptGroup)}const k=()=>r(r({},O(M(),["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}),ne=n,ae=u,v=F({compatConfig:{MODE:3},name:"AAutoComplete",inheritAttrs:!1,props:k(),slots:Object,setup(e,s){let{slots:o,attrs:C,expose:b}=s;B(!e.dropdownClassName);const d=P(),A=()=>{var t;const a=G((t=o.default)===null||t===void 0?void 0:t.call(o));return a.length?a[0]:void 0};b({focus:()=>{var t;(t=d.value)===null||t===void 0||t.focus()},blur:()=>{var t;(t=d.value)===null||t===void 0||t.blur()}});const{prefixCls:i}=E("select",e);return()=>{var t,a,p;const{size:S,dataSource:y,notFoundContent:N=(t=o.notFoundContent)===null||t===void 0?void 0:t.call(o)}=e;let c;const{class:g}=C,h={[g]:!!g,[`${i.value}-lg`]:S==="large",[`${i.value}-sm`]:S==="small",[`${i.value}-show-search`]:!0,[`${i.value}-auto-complete`]:!0};if(e.options===void 0){const m=((a=o.dataSource)===null||a===void 0?void 0:a.call(o))||((p=o.options)===null||p===void 0?void 0:p.call(o))||[];m.length&&$(m[0])?c=m:c=y?y.map(l=>{if(x(l))return l;switch(typeof l){case"string":return f(n,{key:l,value:l},{default:()=>[l]});case"object":return f(n,{key:l.value,value:l.value},{default:()=>[l.text]});default:throw new Error("AutoComplete[dataSource] only supports type `string[] | Object[]`.")}}):[]}const w=O(r(r(r({},e),C),{mode:_.SECRET_COMBOBOX_MODE_DO_NOT_USE,getInputElement:A,notFoundContent:N,class:h,popupClassName:e.popupClassName||e.dropdownClassName,ref:d}),["dataSource","loading"]);return f(_,w,j({default:()=>[c]},O(o,["default","dataSource","options"])))}}}),re=r(v,{Option:n,OptGroup:u,install(e){return e.component(v.name,v),e.component(n.displayName,n),e.component(u.displayName,u),e}});export{ae as AutoCompleteOptGroup,ne as AutoCompleteOption,k as autoCompleteProps,re as default};
