import e from"./vue-types/index.mjs";import{styleObjectToString as t}from"../vc-util/Dom/css.mjs";import n from"./BaseInputInner.mjs";import{computed as r,createVNode as i,defineComponent as a,ref as o,shallowRef as s,watch as c}from"vue";var l=a({compatConfig:{MODE:3},inheritAttrs:!1,props:{disabled:e.looseBool,type:e.string,value:e.any,lazy:e.bool.def(!0),tag:{type:String,default:`input`},size:e.string,style:e.oneOfType([String,Object]),class:e.string},emits:[`change`,`input`,`blur`,`keydown`,`focus`,`compositionstart`,`compositionend`,`keyup`,`paste`,`mousedown`],setup(e,{emit:a,attrs:l,expose:u}){let d=s(null),f=o(),p=o(!1);c([()=>e.value,p],()=>{p.value||(f.value=e.value)},{immediate:!0});let m=e=>{a(`change`,e)},h=e=>{p.value=!0,e.target.composing=!0,a(`compositionstart`,e)},g=e=>{p.value=!1,e.target.composing=!1,a(`compositionend`,e);let t=document.createEvent(`HTMLEvents`);t.initEvent(`input`,!0,!0),e.target.dispatchEvent(t),m(e)},_=t=>{if(p.value&&e.lazy){f.value=t.target.value;return}a(`input`,t)},v=e=>{a(`blur`,e)},y=e=>{a(`focus`,e)},b=()=>{d.value&&d.value.focus()},x=()=>{d.value&&d.value.blur()},S=e=>{a(`keydown`,e)},C=e=>{a(`keyup`,e)};u({focus:b,blur:x,input:r(()=>d.value?.input),setSelectionRange:(e,t,n)=>{d.value?.setSelectionRange(e,t,n)},select:()=>{d.value?.select()},getSelectionStart:()=>d.value?.getSelectionStart(),getSelectionEnd:()=>d.value?.getSelectionEnd(),getScrollTop:()=>d.value?.getScrollTop()});let w=e=>{a(`mousedown`,e)},T=e=>{a(`paste`,e)},E=r(()=>e.style&&typeof e.style!=`string`?t(e.style):e.style);return()=>{let{style:t,lazy:r,...a}=e;return i(n,{...a,...l,style:E.value,onInput:_,onChange:m,onBlur:v,onFocus:y,ref:d,value:f.value,onCompositionstart:h,onCompositionend:g,onKeyup:C,onKeydown:S,onPaste:T,onMousedown:w},null)}}});export{l as default};