"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue"),N=require("../_util/classNames.js"),F=require("../_util/firstNotUndefined.js"),H=require("../_util/placements.js"),g=require("../_util/props-util/index.js"),A=require("../_util/raf.js"),U=require("../_util/transition.js"),T=require("../_util/vnode.js"),k=require("../_util/vue-types/index.js"),W=require("../config-provider/hooks/useConfigInject.js"),G=require("../vc-tooltip/src/Tooltip.js"),J=require("./abstractTooltipProps.js"),K=require("./style/index.js"),Q=require("./util.js"),X=require("../_util/props-util/initDefaultProps.js"),Y=(n,d)=>{const u={},f={...n};return d.forEach(p=>{n&&p in n&&(u[p]=n[p],delete f[p])}),{picked:u,omitted:f}},O=()=>({...J.default(),title:k.default.any}),Z=()=>({trigger:"hover",align:{},placement:"top",mouseEnterDelay:.1,mouseLeaveDelay:.1,arrowPointAtCenter:!1,autoAdjustOverflow:!0}),ee=r.defineComponent({compatConfig:{MODE:3},name:"ATooltip",inheritAttrs:!1,props:X.default(O(),{trigger:"hover",align:{},placement:"top",mouseEnterDelay:.1,mouseLeaveDelay:.1,arrowPointAtCenter:!1,autoAdjustOverflow:!0}),slots:Object,setup(n,{slots:d,emit:u,attrs:f,expose:p}){const{prefixCls:c,getPopupContainer:S,direction:q,rootPrefixCls:D}=W.default("tooltip",n),y=r.computed(()=>n.open??n.visible),v=r.ref(F.default([n.open,n.visible])),C=r.ref();let P;r.watch(y,e=>{A.default.cancel(P),P=A.default(()=>{v.value=!!e})});const h=()=>{const e=n.title??d.title;return!e&&e!==0},$=e=>{const o=h();y.value===void 0&&(v.value=o?!1:e),o||(u("update:visible",e),u("visibleChange",e),u("update:open",e),u("openChange",e))};p({getPopupDomNode:()=>C.value.getPopupDomNode(),open:v,forcePopupAlign:()=>C.value?.forcePopupAlign()});const w=r.computed(()=>{const{builtinPlacements:e,autoAdjustOverflow:o,arrow:i,arrowPointAtCenter:l}=n;let t=l;return typeof i=="object"&&(t=i.pointAtCenter??l),e||H.default({arrowPointAtCenter:t,autoAdjustOverflow:o})}),m=e=>e||e==="",x=e=>{const o=e.type;if(typeof o=="object"&&e.props&&((o.__ANT_BUTTON===!0||o==="button")&&m(e.props.disabled)||o.__ANT_SWITCH===!0&&(m(e.props.disabled)||m(e.props.loading))||o.__ANT_RADIO===!0&&m(e.props.disabled))){const{picked:i,omitted:l}=Y(g.getStyle(e),["position","left","right","top","bottom","float","display","zIndex"]),t={display:"inline-block",...i,cursor:"not-allowed",lineHeight:1,width:e.props&&e.props.block?"100%":void 0},s={...l,pointerEvents:"none"},a=T.cloneElement(e,{style:s},!0);return r.createVNode("span",{style:t,class:`${c.value}-disabled-compatible-wrapper`},[a])}return e},_=()=>n.title??d.title?.(),I=(e,o)=>{const i=w.value,l=Object.keys(i).find(t=>i[t].points[0]===o.points?.[0]&&i[t].points[1]===o.points?.[1]);if(l){const t=e.getBoundingClientRect(),s={top:"50%",left:"50%"};l.includes("top")||l.includes("Bottom")?s.top=`${t.height-o.offset[1]}px`:(l.includes("Top")||l.includes("bottom"))&&(s.top=`${-o.offset[1]}px`),l.includes("left")||l.includes("Right")?s.left=`${t.width-o.offset[0]}px`:(l.includes("right")||l.includes("Left"))&&(s.left=`${-o.offset[0]}px`),e.style.transformOrigin=`${s.left} ${s.top}`}},b=r.computed(()=>Q.parseColor(c.value,n.color)),j=r.computed(()=>f["data-popover-inject"]),[E,V]=K.default(c,r.computed(()=>!j.value));return()=>{const{openClassName:e,overlayClassName:o,overlayStyle:i,overlayInnerStyle:l}=n;let t=g.filterEmpty(d.default?.())??null;t=t.length===1?t[0]:t;let s=v.value;if(y.value===void 0&&h()&&(s=!1),!t)return null;const a=x(g.isValidElement(t)&&!g.isFragment(t)?t:r.createVNode("span",null,[t])),R=N.default({[e||`${c.value}-open`]:!0,[a.props&&a.props.class]:a.props&&a.props.class}),B=N.default(o,{[`${c.value}-rtl`]:q.value==="rtl"},b.value.className,V.value),L={...b.value.overlayStyle,...l},M=b.value.arrowStyle,z={...f,...n,prefixCls:c.value,arrow:!!n.arrow,getPopupContainer:S?.value,builtinPlacements:w.value,visible:s,ref:C,overlayClassName:B,overlayStyle:{...M,...i},overlayInnerStyle:L,onVisibleChange:$,onPopupAlign:I,transitionName:U.getTransitionName(D.value,"zoom-big-fast",n.transitionName)};return E(r.createVNode(G.default,z,{default:()=>[v.value?T.cloneElement(a,{class:R}):a],arrowContent:()=>r.createVNode("span",{class:`${c.value}-arrow-content`},null),overlay:_}))}}});exports.default=ee;exports.tooltipDefaultProps=Z;exports.tooltipProps=O;
