import{ar as w,d as y,c7 as m,aM as N,as as j,e as f,aR as B,aP as h,av as P,ab as a,b7 as O,cn as R,I as C,aw as I,bg as $,aH as x,aK as g,aG as k,aN as _,r as F,cp as K,cr as U,N as E,cs as M,cX as V,aS as W,aW as T}from"./index-9247ed63.js";const S=w("n-popconfirm"),z={positiveText:String,negativeText:String,showIcon:{type:Boolean,default:!0},onPositiveClick:{type:Function,required:!0},onNegativeClick:{type:Function,required:!0}},b=R(z),q=y({name:"NPopconfirmPanel",props:z,setup(e){const{localeRef:n}=m("Popconfirm"),{inlineThemeDisabled:s}=N(),{mergedClsPrefixRef:t,mergedThemeRef:v,props:r}=j(S),u=f(()=>{const{common:{cubicBezierEaseInOut:o},self:{fontSize:l,iconSize:c,iconColor:d}}=v.value;return{"--n-bezier":o,"--n-font-size":l,"--n-icon-size":c,"--n-icon-color":d}}),i=s?B("popconfirm-panel",void 0,u,r):void 0;return Object.assign(Object.assign({},m("Popconfirm")),{mergedClsPrefix:t,cssVars:s?void 0:u,localizedPositiveText:f(()=>e.positiveText||n.value.positiveText),localizedNegativeText:f(()=>e.negativeText||n.value.negativeText),positiveButtonProps:h(r,"positiveButtonProps"),negativeButtonProps:h(r,"negativeButtonProps"),handlePositiveClick(o){e.onPositiveClick(o)},handleNegativeClick(o){e.onNegativeClick(o)},themeClass:i==null?void 0:i.themeClass,onRender:i==null?void 0:i.onRender})},render(){var e;const{mergedClsPrefix:n,showIcon:s,$slots:t}=this,v=P(t.action,()=>this.negativeText===null&&this.positiveText===null?[]:[this.negativeText!==null&&a(C,Object.assign({size:"small",onClick:this.handleNegativeClick},this.negativeButtonProps),{default:()=>this.localizedNegativeText}),this.positiveText!==null&&a(C,Object.assign({size:"small",type:"primary",onClick:this.handlePositiveClick},this.positiveButtonProps),{default:()=>this.localizedPositiveText})]);return(e=this.onRender)===null||e===void 0||e.call(this),a("div",{class:[`${n}-popconfirm__panel`,this.themeClass],style:this.cssVars},O(t.default,r=>s||r?a("div",{class:`${n}-popconfirm__body`},s?a("div",{class:`${n}-popconfirm__icon`},P(t.icon,()=>[a(I,{clsPrefix:n},{default:()=>a($,null)})])):null,r):null),v?a("div",{class:[`${n}-popconfirm__action`]},v):null)}}),H=x("popconfirm",[g("body",`
 font-size: var(--n-font-size);
 display: flex;
 align-items: center;
 flex-wrap: nowrap;
 position: relative;
 `,[g("icon",`
 display: flex;
 font-size: var(--n-icon-size);
 color: var(--n-icon-color);
 transition: color .3s var(--n-bezier);
 margin: 0 8px 0 0;
 `)]),g("action",`
 display: flex;
 justify-content: flex-end;
 `,[k("&:not(:first-child)","margin-top: 8px"),x("button",[k("&:not(:last-child)","margin-right: 8px;")])])]),L=Object.assign(Object.assign(Object.assign({},_.props),M),{positiveText:String,negativeText:String,showIcon:{type:Boolean,default:!0},trigger:{type:String,default:"click"},positiveButtonProps:Object,negativeButtonProps:Object,onPositiveClick:Function,onNegativeClick:Function}),G=y({name:"Popconfirm",props:L,__popover__:!0,setup(e){const{mergedClsPrefixRef:n}=N(),s=_("Popconfirm","-popconfirm",H,V,e,n),t=F(null);function v(i){var o;if(!(!((o=t.value)===null||o===void 0)&&o.getMergedShow()))return;const{onPositiveClick:l,"onUpdate:show":c}=e;Promise.resolve(l?l(i):!0).then(d=>{var p;d!==!1&&((p=t.value)===null||p===void 0||p.setShow(!1),c&&T(c,!1))})}function r(i){var o;if(!(!((o=t.value)===null||o===void 0)&&o.getMergedShow()))return;const{onNegativeClick:l,"onUpdate:show":c}=e;Promise.resolve(l?l(i):!0).then(d=>{var p;d!==!1&&((p=t.value)===null||p===void 0||p.setShow(!1),c&&T(c,!1))})}return W(S,{mergedThemeRef:s,mergedClsPrefixRef:n,props:e}),{setShow(i){var o;(o=t.value)===null||o===void 0||o.setShow(i)},syncPosition(){var i;(i=t.value)===null||i===void 0||i.syncPosition()},mergedTheme:s,popoverInstRef:t,handlePositiveClick:v,handleNegativeClick:r}},render(){const{$slots:e,$props:n,mergedTheme:s}=this;return a(E,U(n,b,{theme:s.peers.Popover,themeOverrides:s.peerOverrides.Popover,internalExtraClass:["popconfirm"],ref:"popoverInstRef"}),{trigger:e.activator||e.trigger,default:()=>{const t=K(n,b);return a(q,Object.assign(Object.assign({},t),{onPositiveClick:this.handlePositiveClick,onNegativeClick:this.handleNegativeClick}),e)}})}});export{G as N};
