import{bA as O,d as y,bU as m,v as a,bq as S,bV as h,F as _,aB as j,a as f,L as w,H as P,bk as R,B as C,bL as I,cr as $,q as x,bn as g,p as b,bO as F,bP as U,bQ as q,J as z,r as L,dp as V,R as k,bT as E,aF as K}from"./index-DGnN4tUo.js";const B=O("n-popconfirm"),N={positiveText:String,negativeText:String,showIcon:{type:Boolean,default:!0},onPositiveClick:{type:Function,required:!0},onNegativeClick:{type:Function,required:!0}},T=R(N),H=y({name:"NPopconfirmPanel",props:N,setup(o){const{localeRef:n}=h("Popconfirm"),{inlineThemeDisabled:s}=_(),{mergedClsPrefixRef:t,mergedThemeRef:v,props:r}=j(B),u=f(()=>{const{common:{cubicBezierEaseInOut:e},self:{fontSize:l,iconSize:c,iconColor:d}}=v.value;return{"--n-bezier":e,"--n-font-size":l,"--n-icon-size":c,"--n-icon-color":d}}),i=s?w("popconfirm-panel",void 0,u,r):void 0;return Object.assign(Object.assign({},h("Popconfirm")),{mergedClsPrefix:t,cssVars:s?void 0:u,localizedPositiveText:f(()=>o.positiveText||n.value.positiveText),localizedNegativeText:f(()=>o.negativeText||n.value.negativeText),positiveButtonProps:P(r,"positiveButtonProps"),negativeButtonProps:P(r,"negativeButtonProps"),handlePositiveClick(e){o.onPositiveClick(e)},handleNegativeClick(e){o.onNegativeClick(e)},themeClass:i==null?void 0:i.themeClass,onRender:i==null?void 0:i.onRender})},render(){var o;const{mergedClsPrefix:n,showIcon:s,$slots:t}=this,v=m(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(o=this.onRender)===null||o===void 0||o.call(this),a("div",{class:[`${n}-popconfirm__panel`,this.themeClass],style:this.cssVars},S(t.default,r=>s||r?a("div",{class:`${n}-popconfirm__body`},s?a("div",{class:`${n}-popconfirm__icon`},m(t.icon,()=>[a(I,{clsPrefix:n},{default:()=>a($,null)})])):null,r):null),v?a("div",{class:[`${n}-popconfirm__action`]},v):null)}}),M=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;
 `,[b("&:not(:first-child)","margin-top: 8px"),x("button",[b("&:not(:last-child)","margin-right: 8px;")])])]),W=Object.assign(Object.assign(Object.assign({},z.props),E),{positiveText:String,negativeText:String,showIcon:{type:Boolean,default:!0},trigger:{type:String,default:"click"},positiveButtonProps:Object,negativeButtonProps:Object,onPositiveClick:Function,onNegativeClick:Function}),D=y({name:"Popconfirm",props:W,slots:Object,__popover__:!0,setup(o){const{mergedClsPrefixRef:n}=_(),s=z("Popconfirm","-popconfirm",M,V,o,n),t=L(null);function v(i){var e;if(!(!((e=t.value)===null||e===void 0)&&e.getMergedShow()))return;const{onPositiveClick:l,"onUpdate:show":c}=o;Promise.resolve(l?l(i):!0).then(d=>{var p;d!==!1&&((p=t.value)===null||p===void 0||p.setShow(!1),c&&k(c,!1))})}function r(i){var e;if(!(!((e=t.value)===null||e===void 0)&&e.getMergedShow()))return;const{onNegativeClick:l,"onUpdate:show":c}=o;Promise.resolve(l?l(i):!0).then(d=>{var p;d!==!1&&((p=t.value)===null||p===void 0||p.setShow(!1),c&&k(c,!1))})}return K(B,{mergedThemeRef:s,mergedClsPrefixRef:n,props:o}),{setShow(i){var e;(e=t.value)===null||e===void 0||e.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:o,$props:n,mergedTheme:s}=this;return a(F,U(n,T,{theme:s.peers.Popover,themeOverrides:s.peerOverrides.Popover,internalExtraClass:["popconfirm"],ref:"popoverInstRef"}),{trigger:o.trigger,default:()=>{const t=q(n,T);return a(H,Object.assign(Object.assign({},t),{onPositiveClick:this.handlePositiveClick,onNegativeClick:this.handleNegativeClick}),o)}})}});export{D as N};
