const e=require("../_virtual/_rolldown/runtime.js"),t=require("../_util/classNames.js"),n=require("../_util/omit.js"),r=require("../config-provider/hooks/useConfigInject.js"),i=require("../_util/vue-types/index.js"),a=require("../_util/vnode.js"),o=require("../button/index.js"),s=require("./inputProps.js"),c=require("./Input.js");let l=require("vue"),u=require("@antsoo-lib/icons"),d=require("lodash-es/isPlainObject");d=e.__toESM(d,1);var f=(0,l.defineComponent)({compatConfig:{MODE:3},name:`AInputSearch`,inheritAttrs:!1,props:{...s.default(),inputPrefixCls:String,enterButton:i.default.any,onSearch:{type:Function}},setup(e,{slots:i,attrs:s,expose:f,emit:p}){let m=(0,l.shallowRef)(),h=(0,l.shallowRef)(!1);f({focus:()=>{m.value?.focus()},blur:()=>{m.value?.blur()}});let g=e=>{p(`update:value`,e.target.value),e&&e.target&&e.type===`click`&&p(`search`,e.target.value,e),p(`change`,e)},_=e=>{document.activeElement===m.value?.input&&e.preventDefault()},v=e=>{p(`search`,m.value?.input?.stateValue,e)},y=t=>{h.value||e.loading||v(t)},b=e=>{h.value=!0,p(`compositionstart`,e)},x=e=>{h.value=!1,p(`compositionend`,e)},{prefixCls:S,getPrefixCls:C,direction:w,size:T}=r.default(`input-search`,e),E=(0,l.computed)(()=>C(`input`,e.inputPrefixCls));return()=>{let{disabled:r,loading:f,addonAfter:p=i.addonAfter?.(),suffix:h=i.suffix?.(),...C}=e,{enterButton:D=i.enterButton?.()??!1}=e;D=D||D===``;let O=typeof D==`boolean`?(0,l.createVNode)(u.SearchOutlined,null,null):null,k=`${S.value}-button`,A=Array.isArray(D)?D[0]:D,j,M=A.type&&(0,d.default)(A.type)&&A.type.__ANT_BUTTON;if(M||A.tagName===`button`)j=a.cloneElement(A,{onMousedown:_,onClick:v,key:`enterButton`,...M?{class:k,size:T.value}:{}},!1);else{let e=O&&!D;j=(0,l.createVNode)(o.default,{class:k,type:D?`primary`:void 0,size:T.value,disabled:r,key:`enterButton`,onMousedown:_,onClick:v,loading:f,icon:e?O:null},{default:()=>[e?null:O||D]})}p&&(j=[j,p]);let N=t.default(S.value,{[`${S.value}-rtl`]:w.value===`rtl`,[`${S.value}-${T.value}`]:!!T.value,[`${S.value}-with-button`]:!!D},s.class);return(0,l.createVNode)(c.default,{ref:m,...n.default(C,[`onUpdate:value`,`onSearch`,`enterButton`]),...s,onPressEnter:y,onCompositionstart:b,onCompositionend:x,size:T.value,prefixCls:E.value,addonAfter:j,suffix:h,onChange:g,class:N,disabled:r},i)}}});exports.default=f;