import{k as F,r as s,J as $,C as k,O as q,B as D,P as J,i as S,E as M,o as U}from"./main-9ymbdppi.js";import{g as Y,h as G}from"./api-426.js";import{g as E,A as K,a as Q,P as Z}from"./index-990.js";const ee=e=>{const{componentCls:n,iconCls:l,antCls:t,zIndexPopup:o,colorText:f,colorWarning:u,marginXXS:c,marginXS:i,fontSize:g,fontWeightStrong:v,colorTextHeading:y}=e;return{[n]:{zIndex:o,[`&${t}-popover`]:{fontSize:g},[`${n}-message`]:{marginBottom:i,display:"flex",flexWrap:"nowrap",alignItems:"start",[`> ${n}-message-icon ${l}`]:{color:u,fontSize:g,lineHeight:1,marginInlineEnd:i},[`${n}-title`]:{fontWeight:v,color:y,"&:only-child":{fontWeight:"normal"}},[`${n}-description`]:{marginTop:c,color:f}},[`${n}-buttons`]:{textAlign:"end",whiteSpace:"nowrap",button:{marginInlineStart:i}}}}},te=e=>{const{zIndexPopupBase:n}=e;return{zIndexPopup:n+60}},w=F("Popconfirm",e=>ee(e),te,{resetStyle:!1});var ne=function(e,n){var l={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(l[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,t=Object.getOwnPropertySymbols(e);o<t.length;o++)n.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(l[t[o]]=e[t[o]]);return l};const I=e=>{const{prefixCls:n,okButtonProps:l,cancelButtonProps:t,title:o,description:f,cancelText:u,okText:c,okType:i="primary",icon:g=s.createElement($,null),showCancel:v=!0,close:y,onConfirm:C,onCancel:O,onPopupClick:m}=e,{getPrefixCls:p}=s.useContext(k),[d]=Y("Popconfirm",q.Popconfirm),b=E(o),x=E(f);return s.createElement("div",{className:`${n}-inner-content`,onClick:m},s.createElement("div",{className:`${n}-message`},g&&s.createElement("span",{className:`${n}-message-icon`},g),s.createElement("div",{className:`${n}-message-text`},b&&s.createElement("div",{className:`${n}-title`},b),x&&s.createElement("div",{className:`${n}-description`},x))),s.createElement("div",{className:`${n}-buttons`},v&&s.createElement(D,Object.assign({onClick:O,size:"small"},t),u||(d==null?void 0:d.cancelText)),s.createElement(K,{buttonProps:Object.assign(Object.assign({size:"small"},J(i)),l),actionFn:C,close:y,prefixCls:p("btn"),quitOnNullishReturnValue:!0,emitEvent:!0},c||(d==null?void 0:d.okText))))},oe=e=>{const{prefixCls:n,placement:l,className:t,style:o}=e,f=ne(e,["prefixCls","placement","className","style"]),{getPrefixCls:u}=s.useContext(k),c=u("popconfirm",n),[i]=w(c);return i(s.createElement(Q,{placement:l,className:S(c,t),style:o,content:s.createElement(I,Object.assign({prefixCls:c},f))}))};var se=function(e,n){var l={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(l[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,t=Object.getOwnPropertySymbols(e);o<t.length;o++)n.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(l[t[o]]=e[t[o]]);return l};const le=s.forwardRef((e,n)=>{var l,t;const{prefixCls:o,placement:f="top",trigger:u="click",okType:c="primary",icon:i=s.createElement($,null),children:g,overlayClassName:v,onOpenChange:y,onVisibleChange:C,overlayStyle:O,styles:m,classNames:p}=e,d=se(e,["prefixCls","placement","trigger","okType","icon","children","overlayClassName","onOpenChange","onVisibleChange","overlayStyle","styles","classNames"]),{getPrefixCls:b,className:x,style:T,classNames:h,styles:j}=M("popconfirm"),[_,z]=G(!1,{value:(l=e.open)!==null&&l!==void 0?l:e.visible,defaultValue:(t=e.defaultOpen)!==null&&t!==void 0?t:e.defaultVisible}),P=(a,r)=>{z(a,!0),C==null||C(a),y==null||y(a,r)},B=a=>{P(!1,a)},V=a=>{var r;return(r=e.onConfirm)===null||r===void 0?void 0:r.call(void 0,a)},W=a=>{var r;P(!1,a),(r=e.onCancel)===null||r===void 0||r.call(void 0,a)},R=(a,r)=>{const{disabled:X=!1}=e;X||P(a,r)},N=b("popconfirm",o),A=S(N,x,v,h.root,p==null?void 0:p.root),H=S(h.body,p==null?void 0:p.body),[L]=w(N);return L(s.createElement(Z,Object.assign({},U(d,["title"]),{trigger:u,placement:f,onOpenChange:R,open:_,ref:n,classNames:{root:A,body:H},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},j.root),T),O),m==null?void 0:m.root),body:Object.assign(Object.assign({},j.body),m==null?void 0:m.body)},content:s.createElement(I,Object.assign({okType:c,icon:i},e,{prefixCls:N,close:B,onConfirm:V,onCancel:W})),"data-popover-inject":!0}),g))}),ae=le;ae._InternalPanelDoNotUseOrYouWillBeFired=oe;export{ae as P};
