import{D as Y,E as Z,B as _,G as q,bM as Q,d as U,P as v,H as oo,ai as w,J as eo,a6 as no,a1 as lo,a8 as to,a2 as io,ao,bW as so,c6 as ro,c5 as co,y as uo,g as s,K as go,aX as po,aY as mo,aZ as fo,aj as vo,ax as $o,ay as yo,z as j}from"./app-CgV11GBz.js";import{c as ho}from"./useFlexGapSupport-CWWB0EO1.js";const B=(o,e,n,i,a)=>({backgroundColor:o,border:`${i.lineWidth}px ${i.lineType} ${e}`,[`${a}-icon`]:{color:n}}),Co=o=>{const{componentCls:e,motionDurationSlow:n,marginXS:i,marginSM:a,fontSize:u,fontSizeLG:r,lineHeight:g,borderRadiusLG:$,motionEaseInOutCirc:c,alertIconSizeLG:d,colorText:m,paddingContentVerticalSM:f,alertPaddingHorizontal:y,paddingMD:C,paddingContentHorizontalLG:x}=o;return{[e]:_(_({},q(o)),{position:"relative",display:"flex",alignItems:"center",padding:`${f}px ${y}px`,wordWrap:"break-word",borderRadius:$,[`&${e}-rtl`]:{direction:"rtl"},[`${e}-content`]:{flex:1,minWidth:0},[`${e}-icon`]:{marginInlineEnd:i,lineHeight:0},"&-description":{display:"none",fontSize:u,lineHeight:g},"&-message":{color:m},[`&${e}-motion-leave`]:{overflow:"hidden",opacity:1,transition:`max-height ${n} ${c}, opacity ${n} ${c},
        padding-top ${n} ${c}, padding-bottom ${n} ${c},
        margin-bottom ${n} ${c}`},[`&${e}-motion-leave-active`]:{maxHeight:0,marginBottom:"0 !important",paddingTop:0,paddingBottom:0,opacity:0}}),[`${e}-with-description`]:{alignItems:"flex-start",paddingInline:x,paddingBlock:C,[`${e}-icon`]:{marginInlineEnd:a,fontSize:d,lineHeight:0},[`${e}-message`]:{display:"block",marginBottom:i,color:m,fontSize:r},[`${e}-description`]:{display:"block"}},[`${e}-banner`]:{marginBottom:0,border:"0 !important",borderRadius:0}}},xo=o=>{const{componentCls:e,colorSuccess:n,colorSuccessBorder:i,colorSuccessBg:a,colorWarning:u,colorWarningBorder:r,colorWarningBg:g,colorError:$,colorErrorBorder:c,colorErrorBg:d,colorInfo:m,colorInfoBorder:f,colorInfoBg:y}=o;return{[e]:{"&-success":B(a,i,n,o,e),"&-info":B(y,f,m,o,e),"&-warning":B(g,r,u,o,e),"&-error":_(_({},B(d,c,$,o,e)),{[`${e}-description > pre`]:{margin:0,padding:0}})}}},So=o=>{const{componentCls:e,iconCls:n,motionDurationMid:i,marginXS:a,fontSizeIcon:u,colorIcon:r,colorIconHover:g}=o;return{[e]:{"&-action":{marginInlineStart:a},[`${e}-close-icon`]:{marginInlineStart:a,padding:0,overflow:"hidden",fontSize:u,lineHeight:`${u}px`,backgroundColor:"transparent",border:"none",outline:"none",cursor:"pointer",[`${n}-close`]:{color:r,transition:`color ${i}`,"&:hover":{color:g}}},"&-close-text":{color:r,transition:`color ${i}`,"&:hover":{color:g}}}}},Io=o=>[Co(o),xo(o),So(o)],bo=Y("Alert",o=>{const{fontSizeHeading3:e}=o,n=Z(o,{alertIconSizeLG:e,alertPaddingHorizontal:12});return[Io(n)]}),wo={success:co,info:ro,error:so,warning:ao},Bo={success:io,info:to,error:lo,warning:no},_o=vo("success","info","warning","error"),Ho=()=>({type:v.oneOf(_o),closable:{type:Boolean,default:void 0},closeText:v.any,message:v.any,description:v.any,afterClose:Function,showIcon:{type:Boolean,default:void 0},prefixCls:String,banner:{type:Boolean,default:void 0},icon:v.any,closeIcon:v.any,onClose:Function}),To=U({compatConfig:{MODE:3},name:"AAlert",inheritAttrs:!1,props:Ho(),setup(o,e){let{slots:n,emit:i,attrs:a,expose:u}=e;const{prefixCls:r,direction:g}=oo("alert",o),[$,c]=bo(r),d=w(!1),m=w(!1),f=w(),y=t=>{t.preventDefault();const p=f.value;p.style.height=`${p.offsetHeight}px`,p.style.height=`${p.offsetHeight}px`,d.value=!0,i("close",t)},C=()=>{var t;d.value=!1,m.value=!0,(t=o.afterClose)===null||t===void 0||t.call(o)},x=eo(()=>{const{type:t}=o;return t!==void 0?t:o.banner?"warning":"info"});u({animationEnd:C});const N=w({});return()=>{var t,p,H,T,z,E,A,O,L,M;const{banner:P,closeIcon:W=(t=n.closeIcon)===null||t===void 0?void 0:t.call(n)}=o;let{closable:D,showIcon:h}=o;const F=(p=o.closeText)!==null&&p!==void 0?p:(H=n.closeText)===null||H===void 0?void 0:H.call(n),S=(T=o.description)!==null&&T!==void 0?T:(z=n.description)===null||z===void 0?void 0:z.call(n),G=(E=o.message)!==null&&E!==void 0?E:(A=n.message)===null||A===void 0?void 0:A.call(n),I=(O=o.icon)!==null&&O!==void 0?O:(L=n.icon)===null||L===void 0?void 0:L.call(n),R=(M=n.action)===null||M===void 0?void 0:M.call(n);h=P&&h===void 0?!0:h;const V=(S?Bo:wo)[x.value]||null;F&&(D=!0);const l=r.value,k=uo(l,{[`${l}-${x.value}`]:!0,[`${l}-closing`]:d.value,[`${l}-with-description`]:!!S,[`${l}-no-icon`]:!h,[`${l}-banner`]:!!P,[`${l}-closable`]:D,[`${l}-rtl`]:g.value==="rtl",[c.value]:!0}),X=D?s("button",{type:"button",onClick:y,class:`${l}-close-icon`,tabindex:0},[F?s("span",{class:`${l}-close-text`},[F]):W===void 0?s(go,null,null):W]):null,J=I&&(po(I)?ho(I,{class:`${l}-icon`}):s("span",{class:`${l}-icon`},[I]))||s(V,{class:`${l}-icon`},null),K=mo(`${l}-motion`,{appear:!1,css:!0,onAfterLeave:C,onBeforeLeave:b=>{b.style.maxHeight=`${b.offsetHeight}px`},onLeave:b=>{b.style.maxHeight="0px"}});return $(m.value?null:s(fo,K,{default:()=>[$o(s("div",j(j({role:"alert"},a),{},{style:[a.style,N.value],class:[a.class,k],"data-show":!d.value,ref:f}),[h?J:null,s("div",{class:`${l}-content`},[G?s("div",{class:`${l}-message`},[G]):null,S?s("div",{class:`${l}-description`},[S]):null]),R?s("div",{class:`${l}-action`},[R]):null,X]),[[yo,!d.value]])]}))}}}),Ao=Q(To);export{Ao as _};
