"use strict";var w=(e,s,t)=>{if(!s.has(e))throw TypeError("Cannot "+t)};var r=(e,s,t)=>(w(e,s,"read from private field"),t?t.call(e):s.get(e)),h=(e,s,t)=>{if(s.has(e))throw TypeError("Cannot add the same private member more than once");s instanceof WeakSet?s.add(e):s.set(e,t)},u=(e,s,t,a)=>(w(e,s,"write to private field"),a?a.call(e,t):s.set(e,t),t);var i=(e,s,t)=>(w(e,s,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o="vavt",S=`@keyframes ${o}FadeInDown{0%{opacity:0;transform:translate3d(-50%,-100%,0)}to{opacity:1;transform:translate3d(-50%,0,0)}}@keyframes ${o}FadeOutUp{0%{opacity:1}to{opacity:0;transform:translate3d(-50%,-100%,0)}}.${o}-fid{animation-name:${o}FadeInDown;animation-duration:.3s;animation-fill-mode:both}.${o}-fou{animation-name:${o}FadeOutUp;animation-duration:.3s;animation-fill-mode:both}.${o}-message{position:fixed;left:50%;transform:translate(-50%);padding:10px 16px;border-radius:4px;color:#fff;font-size:14px;line-height:normal;transition:top .5s ease}.${o}-message.${o}-closeable{padding:10px 40px 10px 16px}.${o}-icon{width:18px;height:18px;margin-right:8px;vertical-align:sub}.${o}-icon-close{width:16px;height:16px;margin-right:0;cursor:pointer;position:absolute;right:16px;top:50%;transform:translateY(-50%)}.${o}-message-info{color:#333;background-color:#e3e3e3}.${o}-message-warning{color:#ff9104;background-color:#ffe9cc}.${o}-message-success{color:#00c852;background-color:#c1f1d5}.${o}-message-error{color:#d32f2f;background-color:#ffd8d8}:root[data-theme=dark] .${o}-message-info{color:#999;background-color:#212121}:root[data-theme=dark] .${o}-message-warning{color:#ed8500;background-color:#3c2200}:root[data-theme=dark] .${o}-message-success{color:#00c551;background-color:#003014}:root[data-theme=dark] .${o}-message-error{color:#ef1d1d;background-color:#3b0000}`,T=`${o}-message-css`,v={info:``,warning:``,success:``,error:``},A=``,k=`${o}-fou`,C=`${o}-fid`,M=":root[data-theme=dark]";var f,c,m,x,O,l,p,g,L,y;const z=(y=class{constructor(){h(this,x);h(this,l);h(this,g);h(this,f,{class:"",single:!1,offsetTop:20,duration:3e3,closeable:!1,darkSelector:M,zIndex:9999});h(this,c,new Set);h(this,m,0)}info(e,s){const t=i(this,g,L).call(this,"info",e,s);return{close:()=>{i(this,l,p).call(this,t)},update:a=>{t.ele.innerHTML=`${v.info}${a}`}}}warning(e,s){const t=i(this,g,L).call(this,"warning",e,s);return{close:()=>{i(this,l,p).call(this,t)},update:a=>{t.ele.innerHTML=`${v.warning}${a}`}}}success(e,s){const t=i(this,g,L).call(this,"success",e,s);return{close:()=>{i(this,l,p).call(this,t)},update:a=>{t.ele.innerHTML=`${v.success}${a}`}}}error(e,s){const t=i(this,g,L).call(this,"error",e,s);return{close:()=>{i(this,l,p).call(this,t)},update:a=>{t.ele.innerHTML=`${v.error}${a}`}}}closeAll(){u(this,m,0),r(this,c).forEach(({ele:e})=>{e.classList.add(k),e.addEventListener("animationend",()=>{e.remove()})}),r(this,c).clear()}config(e={}){u(this,f,{...r(this,f),...e})}},f=new WeakMap,c=new WeakMap,m=new WeakMap,x=new WeakSet,O=function(){let e=document.querySelector(`#${T}`);e||(e=document.createElement("style"),e.innerHTML=S.replace(M,r(this,f).darkSelector),e.id=T,document.head.appendChild(e))},l=new WeakSet,p=function(e){if(!r(this,c).has(e))return!1;const{ele:s,top:t}=e;s.classList.add(k);const a=e.offsetTop+e.ele.offsetHeight;u(this,m,r(this,m)-a),r(this,c).delete(e),r(this,c).forEach(d=>{d.top>t&&(d.top-=a,d.ele.style.top=`${d.top}px`)}),s.addEventListener("animationend",()=>{s.remove()})},g=new WeakSet,L=function(e,s,t={}){i(this,x,O).call(this);const a={...r(this,f),...t};a.single&&this.closeAll();const d=u(this,m,r(this,m)+a.offsetTop),n=document.createElement("div"),b={ele:n,top:d,offsetTop:a.offsetTop};if(r(this,c).add(b),n.innerHTML=`${v[e]}${s}`,a.closeable){const $=new DOMParser().parseFromString(A,"text/html").body.firstElementChild;$.addEventListener("click",()=>{i(this,l,p).call(this,b)}),n.classList.add(`${o}-closeable`),n.appendChild($)}if(n.classList.add(`${o}-message`,`${o}-message-${e}`,C),a.class&&n.classList.add(a.class),n.style.top=`${d}px`,n.style.zIndex=`${a.zIndex}`,document.body.appendChild(n),u(this,m,r(this,m)+n.offsetHeight),n.addEventListener("animationend",()=>{n.classList.remove(C)}),a.duration>0){let $=-1;const E=()=>{$=window.setTimeout(()=>{i(this,l,p).call(this,b)},a.duration)};E(),n.addEventListener("mouseenter",()=>{clearTimeout($)}),n.addEventListener("mouseleave",E)}return b},y),D=new z;exports.Message=z;exports.message=D;