import e from"../_util/omit.mjs";import{triggerVNodeUpdate as t}from"../_util/vnode.mjs";import{getConfirmLocale as n}from"./locale.mjs";import r,{globalConfigForApi as i}from"../config-provider/index.mjs";import a from"./ConfirmDialog.mjs";import o from"./destroyFns.mjs";import{createVNode as s,render as c}from"vue";var l=l=>{let u=document.createDocumentFragment(),d={...e(l,[`parentContext`,`appContext`]),close:m,open:!0},f=null;function p(...e){f&&(c(null,u),f=null);let t=e.some(e=>e&&e.triggerCancel);l.onCancel&&t&&l.onCancel(()=>{},...e.slice(1));for(let e=0;e<o.length;e++)if(o[e]===m){o.splice(e,1);break}}function m(...e){d={...d,open:!1,afterClose:()=>{typeof l.afterClose==`function`&&l.afterClose(),p.apply(this,e)}},d.visible&&delete d.visible,h(d)}function h(e){d=typeof e==`function`?e(d):{...d,...e},f&&t(f,d,u)}let g=e=>{let t=i,o=t.prefixCls,c=e.prefixCls||`${o}-modal`,l=t.iconPrefixCls,u=n();return s(r,{...t,prefixCls:o},{default:()=>[s(a,{...e,rootPrefixCls:o,prefixCls:c,iconPrefixCls:l,locale:u,cancelText:e.cancelText||u.cancelText},null)]})};function _(e){let t=s(g,{...e});return t.appContext=l.parentContext||l.appContext||t.appContext,c(t,u),t}return f=_(d),o.push(m),{destroy:m,update:h}};function u(e){return{...e,type:`warning`}}function d(e){return{...e,type:`info`}}function f(e){return{...e,type:`success`}}function p(e){return{...e,type:`error`}}function m(e){return{...e,type:`confirm`}}export{l as default,m as withConfirm,p as withError,d as withInfo,f as withSuccess,u as withWarn};