import{At as e,Nt as t,Q as n,Rt as r,U as i,W as a,Z as o,_ as s,at as c,ct as l,f as u,m as d,nt as f,ot as p,rt as m,vn as h,xt as g}from"./client-DrrW410h.js";import{s as _}from"./ui-CXICC9ah.js";import{i as v,o as y}from"./_plugin-vue_export-helper-2ZWAS1ss.js";import{F as b,J as x,K as S,P as C,Q as w,U as T,W as E,Y as D,q as O}from"./index-cNEa5D1b.js";function k(e){let{lineHeight:t,borderRadius:r,fontWeightStrong:i,baseColor:a,dividerColor:s,actionColor:c,textColor1:l,textColor2:u,closeColorHover:d,closeColorPressed:f,closeIconColor:p,closeIconColorHover:m,closeIconColorPressed:h,infoColor:g,successColor:_,warningColor:v,errorColor:y,fontSize:x}=e;return Object.assign(Object.assign({},b),{fontSize:x,lineHeight:t,titleFontWeight:i,borderRadius:r,border:`1px solid ${s}`,color:c,titleTextColor:l,iconColor:u,contentTextColor:u,closeBorderRadius:r,closeColorHover:d,closeColorPressed:f,closeIconColor:p,closeIconColorHover:m,closeIconColorPressed:h,borderInfo:`1px solid ${n(a,o(g,{alpha:.25}))}`,colorInfo:n(a,o(g,{alpha:.08})),titleTextColorInfo:l,iconColorInfo:g,contentTextColorInfo:u,closeColorHoverInfo:d,closeColorPressedInfo:f,closeIconColorInfo:p,closeIconColorHoverInfo:m,closeIconColorPressedInfo:h,borderSuccess:`1px solid ${n(a,o(_,{alpha:.25}))}`,colorSuccess:n(a,o(_,{alpha:.08})),titleTextColorSuccess:l,iconColorSuccess:_,contentTextColorSuccess:u,closeColorHoverSuccess:d,closeColorPressedSuccess:f,closeIconColorSuccess:p,closeIconColorHoverSuccess:m,closeIconColorPressedSuccess:h,borderWarning:`1px solid ${n(a,o(v,{alpha:.33}))}`,colorWarning:n(a,o(v,{alpha:.08})),titleTextColorWarning:l,iconColorWarning:v,contentTextColorWarning:u,closeColorHoverWarning:d,closeColorPressedWarning:f,closeIconColorWarning:p,closeIconColorHoverWarning:m,closeIconColorPressedWarning:h,borderError:`1px solid ${n(a,o(y,{alpha:.25}))}`,colorError:n(a,o(y,{alpha:.08})),titleTextColorError:l,iconColorError:y,contentTextColorError:u,closeColorHoverError:d,closeColorPressedError:f,closeIconColorError:p,closeIconColorHoverError:m,closeIconColorPressedError:h})}var A={name:`Alert`,common:u,self:k},j=m(`alert`,` line-height: var(--n-line-height); border-radius: var(--n-border-radius); position: relative; transition: background-color .3s var(--n-bezier); background-color: var(--n-color); text-align: start; word-break: break-word; `,[c(`border`,` border-radius: inherit; position: absolute; left: 0; right: 0; top: 0; bottom: 0; transition: border-color .3s var(--n-bezier); border: var(--n-border); pointer-events: none; `),p(`closable`,[m(`alert-body`,[c(`title`,` padding-right: 24px; `)])]),c(`icon`,{color:`var(--n-icon-color)`}),m(`alert-body`,{padding:`var(--n-padding)`},[c(`title`,{color:`var(--n-title-text-color)`}),c(`content`,{color:`var(--n-content-text-color)`})]),C({originalTransition:`transform .3s var(--n-bezier)`,enterToProps:{transform:`scale(1)`},leaveToProps:{transform:`scale(0.9)`}}),c(`icon`,` position: absolute; left: 0; top: 0; align-items: center; justify-content: center; display: flex; width: var(--n-icon-size); height: var(--n-icon-size); font-size: var(--n-icon-size); margin: var(--n-icon-margin); `),c(`close`,` transition: color .3s var(--n-bezier), background-color .3s var(--n-bezier); position: absolute; right: 0; top: 0; margin: var(--n-close-margin); `),p(`show-icon`,[m(`alert-body`,{paddingLeft:`calc(var(--n-icon-margin-left) + var(--n-icon-size) + var(--n-icon-margin-right))`})]),p(`right-adjust`,[m(`alert-body`,{paddingRight:`calc(var(--n-close-size) + var(--n-padding) + 2px)`})]),m(`alert-body`,` border-radius: var(--n-border-radius); transition: border-color .3s var(--n-bezier); `,[c(`title`,` transition: color .3s var(--n-bezier); font-size: 16px; line-height: 19px; font-weight: var(--n-title-font-weight); `,[f(`& +`,[c(`content`,{marginTop:`9px`})])]),c(`content`,{transition:`color .3s var(--n-bezier)`,fontSize:`var(--n-font-size)`})]),c(`icon`,{transition:`color .3s var(--n-bezier)`})]),M=e({name:`Alert`,inheritAttrs:!1,props:Object.assign(Object.assign({},d.props),{title:String,showIcon:{type:Boolean,default:!0},type:{type:String,default:`default`},bordered:{type:Boolean,default:!0},closable:Boolean,onClose:Function,onAfterLeave:Function,onAfterHide:Function}),slots:Object,setup(e){let{mergedClsPrefixRef:t,mergedBorderedRef:n,inlineThemeDisabled:r,mergedRtlRef:o}=a(e),c=d(`Alert`,`-alert`,j,A,e,t),u=s(`Alert`,o,t),f=g(()=>{let{common:{cubicBezierEaseInOut:t},self:n}=c.value,{fontSize:r,borderRadius:i,titleFontWeight:a,lineHeight:o,iconSize:s,iconMargin:u,iconMarginRtl:d,closeIconSize:f,closeBorderRadius:p,closeSize:m,closeMargin:h,closeMarginRtl:g,padding:v}=n,{type:y}=e,{left:b,right:x}=_(u);return{"--n-bezier":t,"--n-color":n[l(`color`,y)],"--n-close-icon-size":f,"--n-close-border-radius":p,"--n-close-color-hover":n[l(`closeColorHover`,y)],"--n-close-color-pressed":n[l(`closeColorPressed`,y)],"--n-close-icon-color":n[l(`closeIconColor`,y)],"--n-close-icon-color-hover":n[l(`closeIconColorHover`,y)],"--n-close-icon-color-pressed":n[l(`closeIconColorPressed`,y)],"--n-icon-color":n[l(`iconColor`,y)],"--n-border":n[l(`border`,y)],"--n-title-text-color":n[l(`titleTextColor`,y)],"--n-content-text-color":n[l(`contentTextColor`,y)],"--n-line-height":o,"--n-border-radius":i,"--n-font-size":r,"--n-title-font-weight":a,"--n-icon-size":s,"--n-icon-margin":u,"--n-icon-margin-rtl":d,"--n-close-size":m,"--n-close-margin":h,"--n-close-margin-rtl":g,"--n-padding":v,"--n-icon-margin-left":b,"--n-icon-margin-right":x}}),p=r?i(`alert`,g(()=>e.type[0]),f,e):void 0,m=h(!0),v=()=>{let{onAfterLeave:t,onAfterHide:n}=e;t&&t(),n&&n()};return{rtlEnabled:u,mergedClsPrefix:t,mergedBordered:n,visible:m,handleCloseClick:()=>{Promise.resolve(e.onClose?.call(e)).then(e=>{e!==!1&&(m.value=!1)})},handleAfterLeave:()=>{v()},mergedTheme:c,cssVars:r?void 0:f,themeClass:p?.themeClass,onRender:p?.onRender}},render(){var e;return(e=this.onRender)==null||e.call(this),t(T,{onAfterLeave:this.handleAfterLeave},{default:()=>{let{mergedClsPrefix:e,$slots:n}=this,i={class:[`${e}-alert`,this.themeClass,this.closable&&`${e}-alert--closable`,this.showIcon&&`${e}-alert--show-icon`,!this.title&&this.closable&&`${e}-alert--right-adjust`,this.rtlEnabled&&`${e}-alert--rtl`],style:this.cssVars,role:`alert`};return this.visible?t(`div`,Object.assign({},r(this.$attrs,i)),this.closable&&t(E,{clsPrefix:e,class:`${e}-alert__close`,onClick:this.handleCloseClick}),this.bordered&&t(`div`,{class:`${e}-alert__border`}),this.showIcon&&t(`div`,{class:`${e}-alert__icon`,"aria-hidden":`true`},v(n.icon,()=>[t(w,{clsPrefix:e},{default:()=>{switch(this.type){case`success`:return t(O,null);case`info`:return t(x,null);case`warning`:return t(S,null);case`error`:return t(D,null);default:return null}}})])),t(`div`,{class:[`${e}-alert-body`,this.mergedBordered&&`${e}-alert-body--bordered`]},y(n.header,n=>{let r=n||this.title;return r?t(`div`,{class:`${e}-alert-body__title`},r):null}),n.default&&t(`div`,{class:`${e}-alert-body__content`},n))):null}})}});export{M as t};