"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),x=require("../_util/classNames.js"),V=e.defineComponent({name:"Notice",inheritAttrs:!1,props:["prefixCls","duration","updateMark","noticeKey","closeIcon","closable","props","onClick","onClose","holder","visible"],setup(o,{attrs:d,slots:v}){let a,b=!1;const f=e.computed(()=>o.duration===void 0?4.5:o.duration),m=()=>{f.value&&!b&&(a=setTimeout(()=>{p()},f.value*1e3))},r=()=>{a&&(clearTimeout(a),a=null)},p=s=>{s&&s.stopPropagation(),r();const{onClose:t,noticeKey:l}=o;t&&t(l)},T=()=>{r(),m()};return e.onMounted(()=>{m()}),e.onUnmounted(()=>{b=!0,r()}),e.watch([f,()=>o.updateMark,()=>o.visible],([s,t,l],[C,i,u])=>{(s!==C||t!==i||l!==u&&u)&&T()},{flush:"post"}),()=>{const{prefixCls:s,closable:t,closeIcon:l=v.closeIcon?.(),onClick:C,holder:i}=o,{class:u,style:h}=d,n=`${s}-notice`,$=Object.keys(d).reduce((M,c)=>((c.startsWith("data-")||c.startsWith("aria-")||c==="role")&&(M[c]=d[c]),M),{}),N=e.createVNode("div",{class:x.default(n,u,{[`${n}-closable`]:t}),style:h,onMouseenter:r,onMouseleave:m,onClick:C,...$},[e.createVNode("div",{class:`${n}-content`},[v.default?.()]),t?e.createVNode("a",{tabindex:0,onClick:p,class:`${n}-close`},[l||e.createVNode("span",{class:`${n}-close-x`},null)]):null]);return i?e.createVNode(e.Teleport,{to:i},{default:()=>N}):N}}});exports.default=V;
