import{shallowRef as N,createVNode as g,defineComponent as A,computed as P}from"vue";import h from"../_util/classNames.mjs";import R from"../config-provider/hooks/useConfigInject.mjs";import"../vc-notification/Notification.mjs";import b from"../vc-notification/useNotification.mjs";import{PureContent as S,getCloseIcon as $}from"./PurePanel.mjs";import E from"./style/index.mjs";import{getMotion as F,getPlacementStyle as T}from"./util.mjs";const v=24,w=4.5,D=A({name:"Holder",inheritAttrs:!1,props:["prefixCls","class","type","icon","content","onAllRemoved"],setup(e,{expose:t}){const{getPrefixCls:a,getPopupContainer:s}=R("notification",e),n=P(()=>e.prefixCls||a("notification")),l=c=>T(c,e.top??v,e.bottom??v),[,r]=E(n),o=()=>h(r.value,{[`${n.value}-rtl`]:e.rtl}),i=()=>F(n.value),[f,u]=b({prefixCls:n.value,getStyles:l,getClassName:o,motion:i,closable:!0,closeIcon:$(n.value),duration:w,getContainer:()=>e.getPopupContainer?.()||s.value?.()||document.body,maxCount:e.maxCount,hashId:r.value,onAllRemoved:e.onAllRemoved});return t({...f,prefixCls:n.value,hashId:r}),u}});function H(e){const t=N(null),a=Symbol("notificationHolderKey"),s=o=>{if(!t.value)return;const{open:i,prefixCls:f,hashId:u}=t.value,c=`${f}-notice`,{message:m,description:p,icon:d,type:C,btn:y,class:x,...I}=o;return i({placement:"topRight",...I,content:()=>g(S,{prefixCls:c,icon:typeof d=="function"?d():d,type:C,message:typeof m=="function"?m():m,description:typeof p=="function"?p():p,btn:typeof y=="function"?y():y},null),class:h(C&&`${c}-${C}`,u,x)})},l={open:s,destroy:o=>{o!==void 0?t.value?.close(o):t.value?.destroy()}};return["success","info","warning","error"].forEach(o=>{l[o]=i=>s({...i,type:o})}),[l,()=>g(D,{key:a,...e,ref:t},null)]}function V(e){return H(e)}export{V as default,H as useInternalNotification};
