"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),c=require("@antsoo-lib/icons"),j=require("../_util/classNames.js"),w=require("../vc-notification/Notification.js");require("../_util/Portal.js");const O=require("./style/index.js"),F=require("./useMessage.js");let C=3,y,t,S=1,m="",p="move-up",v=!1,x=()=>document.body,N,h=!1;function I(){return S++}function $(e){e.top!==void 0&&(y=e.top,t=null),e.duration!==void 0&&(C=e.duration),e.prefixCls!==void 0&&(m=e.prefixCls),e.getContainer!==void 0&&(x=e.getContainer,t=null),e.transitionName!==void 0&&(p=e.transitionName,t=null,v=!0),e.maxCount!==void 0&&(N=e.maxCount,t=null),e.rtl!==void 0&&(h=e.rtl)}function g(e,n){if(t){n(t);return}w.default.newInstance({appContext:e.appContext,prefixCls:e.prefixCls||m,rootPrefixCls:e.rootPrefixCls,transitionName:p,hasTransitionName:v,style:{top:y},getContainer:x||e.getPopupContainer,maxCount:N,name:"message",useStyle:O.default},o=>{if(t){n(t);return}t=o,n(o)})}const P={info:c.InfoCircleFilled,success:c.CheckCircleFilled,error:c.CloseCircleFilled,warning:c.ExclamationCircleFilled,loading:c.LoadingOutlined},T=Object.keys(P);function K(e){const n=e.duration!==void 0?e.duration:C,o=e.key||I(),i=new Promise(u=>{const s=()=>(typeof e.onClose=="function"&&e.onClose(),u(!0));g(e,b=>{b.notice({key:o,duration:n,style:e.style||{},class:e.class,content:({prefixCls:f})=>{const d=P[e.type],k=d?a.createVNode(d,null,null):"",M=j.default(`${f}-custom-content`,{[`${f}-${e.type}`]:e.type,[`${f}-rtl`]:h===!0});return a.createVNode("div",{class:M},[typeof e.icon=="function"?e.icon():e.icon||k,a.createVNode("span",null,[typeof e.content=="function"?e.content():e.content])])},onClose:s,onClick:e.onClick})})}),l=()=>{t&&t.removeNotice(o)};return l.then=(u,s)=>i.then(u,s),l.promise=i,l}function L(e){return Object.prototype.toString.call(e)==="[object Object]"&&!!e.content}const r={open:K,config:$,destroy(e){if(t)if(e){const{removeNotice:n}=t;n(e)}else{const{destroy:n}=t;n(),t=null}}};function q(e,n){e[n]=(o,i,l)=>L(o)?e.open({...o,type:n}):(typeof i=="function"&&(l=i,i=void 0),e.open({content:o,duration:i,type:n,onClose:l}))}T.forEach(e=>q(r,e));r.warn=r.warning;r.useMessage=F.default;exports.attachTypeApi=q;exports.default=r;exports.getKeyThenIncreaseKey=I;exports.typeList=T;
