"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("vue"),$=require("@ant-design/icons-vue/CloseOutlined"),h=require("../_util/classNames.js"),M=require("../_util/util.js"),O=require("../config-provider/hooks/useConfigInject.js");require("../vc-notification/Notification.js");const R=require("../vc-notification/useNotification.js"),b=require("../vc-trigger/utils/motionUtil.js"),k=require("./PurePanel.js"),F=require("./style/index.js"),S=8,T=3,w=c.defineComponent({name:"Holder",inheritAttrs:!1,props:["top","prefixCls","getContainer","maxCount","duration","rtl","transitionName","onAllRemoved","animation","staticGetContainer"],setup(e,{expose:s}){const{getPrefixCls:y,getPopupContainer:m}=O.default("message",e),n=c.computed(()=>y("message",e.prefixCls)),[,p]=F.default(n),g=()=>{const r=e.top??S;return{left:"50%",transform:"translateX(-50%)",top:typeof r=="number"?`${r}px`:r}},x=()=>h.default(p.value,e.rtl?`${n.value}-rtl`:""),t=()=>b.getMotion({prefixCls:n.value,animation:e.animation??"move-up",transitionName:e.transitionName}),f=c.createVNode("span",{class:`${n.value}-close-x`},[c.createVNode($,{class:`${n.value}-close-icon`},null)]),[o,l]=R.default({getStyles:g,prefixCls:n.value,getClassName:x,motion:t,closable:!1,closeIcon:f,duration:e.duration??T,getContainer:e.staticGetContainer??m.value,maxCount:e.maxCount,onAllRemoved:e.onAllRemoved});return s({...o,prefixCls:n,hashId:p}),l}});let N=0;function q(e){const s=c.shallowRef(null),y=Symbol("messageHolderKey"),m=t=>{s.value?.close(t)},n=t=>{if(!s.value){const C=()=>{};return C.then=()=>{},C}const{open:f,prefixCls:o,hashId:l}=s.value,r=`${o}-notice`,{content:a,icon:u,type:i,key:v,class:I,onClose:P,...A}=t;let d=v;return d==null&&(N+=1,d=`antd-message-${N}`),M.wrapPromiseFn(C=>(f({...A,key:d,content:()=>c.createVNode(k.PureContent,{prefixCls:o,type:i,icon:typeof u=="function"?u():u},{default:()=>[typeof a=="function"?a():a]}),placement:"top",class:h.default(i&&`${r}-${i}`,l,I),onClose:()=>{P?.(),C()}}),()=>{m(d)}))},g={open:n,destroy:t=>{t!==void 0?m(t):s.value?.destroy()}};return["info","success","warning","error","loading"].forEach(t=>{const f=(o,l,r)=>{let a;o&&typeof o=="object"&&"content"in o?a=o:a={content:o};let u,i;typeof l=="function"?i=l:(u=l,i=r);const v={onClose:i,duration:u,...a,type:t};return n(v)};g[t]=f}),[g,()=>c.createVNode(w,{key:y,...e,ref:s},null)]}function D(e){return q(e)}exports.default=D;exports.useInternalMessage=q;
