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