import{createVNode as s}from"vue";import w from"@ant-design/icons-vue/CheckCircleOutlined";import P from"@ant-design/icons-vue/CloseCircleOutlined";import T from"@ant-design/icons-vue/CloseOutlined";import E from"@ant-design/icons-vue/ExclamationCircleOutlined";import R from"@ant-design/icons-vue/InfoCircleOutlined";import j from"../_util/classNames.mjs";import{renderHelper as d}from"../_util/util.mjs";import{globalConfig as S}from"../config-provider/index.mjs";import B from"../vc-notification/Notification.mjs";import"../_util/Portal.mjs";import D from"./style/index.mjs";import G from"./useNotification.mjs";import{getPlacementStyle as H}from"./util.mjs";const m={};let y=4.5,I="24px",h="24px",v="",N="topRight",b=()=>document.body,g=null,x=!1,O;function V(o){const{duration:e,placement:n,bottom:i,top:c,getContainer:r,closeIcon:u,prefixCls:a}=o;a!==void 0&&(v=a),e!==void 0&&(y=e),n!==void 0&&(N=n),i!==void 0&&(h=typeof i=="number"?`${i}px`:i),c!==void 0&&(I=typeof c=="number"?`${c}px`:c),r!==void 0&&(b=r),u!==void 0&&(g=u),o.rtl!==void 0&&(x=o.rtl),o.maxCount!==void 0&&(O=o.maxCount)}function q({prefixCls:o,placement:e=N,getContainer:n=b,top:i,bottom:c,closeIcon:r=g,appContext:u},a){const{getPrefixCls:$}=S(),t=$("notification",o||v),l=`${t}-${e}-${x}`,C=m[l];if(C){Promise.resolve(C).then(f=>{a(f)});return}const k=j(`${t}-${e}`,{[`${t}-rtl`]:x===!0});B.newInstance({name:"notification",prefixCls:o||v,useStyle:D,class:k,style:H(e,i??I,c??h),appContext:u,getContainer:n,closeIcon:({prefixCls:f})=>s("span",{class:`${f}-close-x`},[d(r,{},s(T,{class:`${f}-close-icon`},null))]),maxCount:O,hasTransitionName:!0},f=>{m[l]=f,a(f)})}const A={success:w,info:R,error:P,warning:E};function F(o){const{icon:e,type:n,description:i,message:c,btn:r}=o,u=o.duration===void 0?y:o.duration;q(o,a=>{a.notice({content:({prefixCls:$})=>{const t=`${$}-notice`;let l=null;if(e)l=()=>s("span",{class:`${t}-icon`},[d(e)]);else if(n){const C=A[n];l=()=>s(C,{class:`${t}-icon ${t}-icon-${n}`},null)}return s("div",{class:l?`${t}-with-icon`:""},[l&&l(),s("div",{class:`${t}-message`},[!i&&l?s("span",{class:`${t}-message-single-line-auto-margin`},null):null,d(c)]),s("div",{class:`${t}-description`},[d(i)]),r?s("span",{class:`${t}-btn`},[d(r)]):null])},duration:u,closable:!0,onClose:o.onClose,onClick:o.onClick,key:o.key,style:o.style||{},class:o.class})})}const p={open:F,close(o){Object.keys(m).forEach(e=>Promise.resolve(m[e]).then(n=>{n.removeNotice(o)}))},config:V,destroy(){Object.keys(m).forEach(o=>{Promise.resolve(m[o]).then(e=>{e.destroy()}),delete m[o]})}},J=["success","info","warning","error"];J.forEach(o=>{p[o]=e=>p.open({...e,type:o})});p.warn=p.warning;p.useNotification=G;export{p as default};
