const e=require("../_util/type.js"),t=require("../_util/classNames.js"),n=require("../_util/props-util/index.js"),r=require("../config-provider/hooks/useConfigInject.js"),i=require("../_util/vue-types/index.js"),a=require("../_util/transition.js"),o=require("../_util/vnode.js"),s=require("./style/index.js");let c=require("vue"),l=require("@antsoo-lib/icons");var u={success:l.CheckCircleFilled,info:l.InfoCircleFilled,error:l.CloseCircleFilled,warning:l.ExclamationCircleFilled},d={success:l.CheckCircleOutlined,info:l.InfoCircleOutlined,error:l.CloseCircleOutlined,warning:l.ExclamationCircleOutlined},f=e.tuple(`success`,`info`,`warning`,`error`),p=()=>({type:i.default.oneOf(f),closable:{type:Boolean,default:void 0},closeText:i.default.any,message:i.default.any,description:i.default.any,afterClose:Function,showIcon:{type:Boolean,default:void 0},prefixCls:String,banner:{type:Boolean,default:void 0},icon:i.default.any,closeIcon:i.default.any,onClose:Function}),m=(0,c.defineComponent)({compatConfig:{MODE:3},name:`AAlert`,inheritAttrs:!1,props:p(),setup(e,{slots:i,emit:f,attrs:p,expose:m}){let{prefixCls:h,direction:g}=r.default(`alert`,e),[_,v]=s.default(h),y=(0,c.shallowRef)(!1),b=(0,c.shallowRef)(!1),x=(0,c.shallowRef)(),S=e=>{e.preventDefault();let t=x.value;t.style.height=`${t.offsetHeight}px`,t.style.height=`${t.offsetHeight}px`,y.value=!0,f(`close`,e)},C=()=>{y.value=!1,b.value=!0,e.afterClose?.()},w=(0,c.computed)(()=>{let{type:t}=e;return t===void 0?e.banner?`warning`:`info`:t});m({animationEnd:C});let T=(0,c.shallowRef)({});return()=>{let{banner:r,closeIcon:s=i.closeIcon?.()}=e,{closable:f,showIcon:m}=e,E=e.closeText??i.closeText?.(),D=e.description??i.description?.(),O=e.message??i.message?.(),k=e.icon??i.icon?.(),A=i.action?.();m=r&&m===void 0?!0:m;let j=(D?d:u)[w.value]||null;E&&(f=!0);let M=h.value,N=t.default(M,{[`${M}-${w.value}`]:!0,[`${M}-closing`]:y.value,[`${M}-with-description`]:!!D,[`${M}-no-icon`]:!m,[`${M}-banner`]:!!r,[`${M}-closable`]:f,[`${M}-rtl`]:g.value===`rtl`,[v.value]:!0}),P=f?(0,c.createVNode)(`button`,{type:`button`,onClick:S,class:`${M}-close-icon`,tabindex:0},[E?(0,c.createVNode)(`span`,{class:`${M}-close-text`},[E]):s===void 0?(0,c.createVNode)(l.CloseOutlined,null,null):s]):null,F=k&&(n.isValidElement(k)?o.cloneElement(k,{class:`${M}-icon`}):(0,c.createVNode)(`span`,{class:`${M}-icon`},[k]))||(0,c.createVNode)(j,{class:`${M}-icon`},null),I=a.getTransitionProps(`${M}-motion`,{appear:!1,css:!0,onAfterLeave:C,onBeforeLeave:e=>{e.style.maxHeight=`${e.offsetHeight}px`},onLeave:e=>{e.style.maxHeight=`0px`}});return _(b.value?null:(0,c.createVNode)(c.Transition,I,{default:()=>[(0,c.withDirectives)((0,c.createVNode)(`div`,{role:`alert`,...p,style:[p.style,T.value],class:[p.class,N],"data-show":!y.value,ref:x},[m?F:null,(0,c.createVNode)(`div`,{class:`${M}-content`},[O?(0,c.createVNode)(`div`,{class:`${M}-message`},[O]):null,D?(0,c.createVNode)(`div`,{class:`${M}-description`},[D]):null]),A?(0,c.createVNode)(`div`,{class:`${M}-action`},[A]):null,P]),[[c.vShow,!y.value]])]}))}}}),h=e.withInstall(m);exports.alertProps=p,exports.default=h;