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