"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),R=require("../_util/Portal.js"),V=require("../_util/classNames.js"),j=require("../_util/transition.js"),S=require("./Notice.js");let g=0;const _=Date.now();function L(){const t=g;return g+=1,`rcNotification_${_}_${t}`}const O=n.defineComponent({name:"HookNotification",inheritAttrs:!1,props:["prefixCls","transitionName","animation","maxCount","closeIcon","hashId","remove","notices","getStyles","getClassName","onAllRemoved","getContainer"],setup(t,{attrs:u,slots:k}){const m=new Map,v=n.computed(()=>t.notices),C=n.computed(()=>{let e=t.transitionName;if(!e&&t.animation)switch(typeof t.animation){case"string":e=t.animation;break;case"function":e=t.animation().name;break;case"object":e=t.animation.name;break;default:e=`${t.prefixCls}-fade`;break}return j.getTransitionGroupProps(e)}),P=e=>t.remove(e),r=n.ref({});n.watch(v,()=>{const e={};Object.keys(r.value).forEach(o=>{e[o]=[]}),t.notices.forEach(o=>{const{placement:s="topRight"}=o.notice;s&&(e[s]=e[s]||[],e[s].push(o))}),r.value=e});const b=n.computed(()=>Object.keys(r.value));return()=>{const{prefixCls:e,closeIcon:o=k.closeIcon?.({prefixCls:e})}=t,s=b.value.map(c=>{const y=r.value[c],h=t.getClassName?.(c),I=t.getStyles?.(c),x=y.map(({notice:a,holderCallback:N},w)=>{const A=w===v.value.length-1?a.updateMark:void 0,{key:i,userPassKey:M}=a,{content:f}=a,d={prefixCls:e,closeIcon:typeof o=="function"?o({prefixCls:e}):o,...a,...a.props,key:i,noticeKey:M||i,updateMark:A,onClose:l=>{P(l),a.onClose?.()},onClick:a.onClick};return N?n.createVNode("div",{key:i,class:`${e}-hook-holder`,ref:l=>{typeof i>"u"||(l?(m.set(i,l),N(l,d)):m.delete(i))}},null):n.createVNode(S.default,{...d,class:V.default(d.class,t.hashId)},{default:()=>[typeof f=="function"?f({prefixCls:e}):f]})}),$={[e]:1,[`${e}-${c}`]:1,[u.class]:!!u.class,[t.hashId]:!0,[h]:!!h};function q(){y.length>0||(Reflect.deleteProperty(r.value,c),t.onAllRemoved?.())}return n.createVNode("div",{key:c,class:$,style:u.style||I||{top:"65px",left:"50%"}},[n.createVNode(n.TransitionGroup,{tag:"div",...C.value,onAfterLeave:q},{default:()=>[x]})])});return n.createVNode(R.default,{getContainer:t.getContainer},{default:()=>[s]})}}});exports.default=O;exports.getUuid=L;
