const e=require("../_util/type.js"),t=require("../_util/classNames.js"),n=require("../_util/vue-types/index.js"),r=require("../_util/statusUtils.js"),i=require("../form/FormItemContext.js"),a=require("../_util/vnode.js"),o=require("./util.js");let s=require("vue"),c=require("@antsoo-lib/icons");var l=[`text`,`input`],u=(0,s.defineComponent)({compatConfig:{MODE:3},name:`ClearableLabeledInput`,inheritAttrs:!1,props:{prefixCls:String,inputType:n.default.oneOf(e.tuple(`text`,`input`)),value:e.anyType(),defaultValue:e.anyType(),allowClear:{type:Boolean,default:void 0},element:e.anyType(),handleReset:Function,disabled:{type:Boolean,default:void 0},direction:{type:String},size:{type:String},suffix:e.anyType(),prefix:e.anyType(),addonBefore:e.anyType(),addonAfter:e.anyType(),readonly:{type:Boolean,default:void 0},focused:{type:Boolean,default:void 0},bordered:{type:Boolean,default:!0},triggerFocus:{type:Function},hidden:Boolean,status:String,hashId:String},setup(e,{slots:n,attrs:u}){let d=i.FormItemInputContext.useInject(),f=r=>{let{value:i,disabled:a,readonly:o,handleReset:l,suffix:u=n.suffix}=e,d=!a&&!o&&i,f=`${r}-clear-icon`;return(0,s.createVNode)(c.CloseCircleFilled,{onClick:l,onMousedown:e=>e.preventDefault(),class:t.default({[`${f}-hidden`]:!d,[`${f}-has-suffix`]:!!u},f),role:`button`},null)},p=(i,c)=>{let{value:l,allowClear:p,direction:m,bordered:h,hidden:g,status:_,addonAfter:v=n.addonAfter,addonBefore:y=n.addonBefore,hashId:b}=e,{status:x,hasFeedback:S}=d;return p?(0,s.createVNode)(`span`,{class:t.default(`${i}-affix-wrapper`,`${i}-affix-wrapper-textarea-with-clear-btn`,r.getStatusClassNames(`${i}-affix-wrapper`,r.getMergedStatus(x,_),S),{[`${i}-affix-wrapper-rtl`]:m===`rtl`,[`${i}-affix-wrapper-borderless`]:!h,[`${u.class}`]:!o.hasAddon({addonAfter:v,addonBefore:y})&&u.class},b),style:u.style,hidden:g},[a.cloneElement(c,{style:null,value:l,disabled:e.disabled}),f(i)]):a.cloneElement(c,{value:l,disabled:e.disabled})};return()=>{let{prefixCls:t,inputType:r,element:i=n.element?.()}=e;return r===l[0]?p(t,i):null}}});exports.default=u;