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