import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{t}from"./react-Augu_vA3.js";import{_t as n,dt as r,et as i,vr as a}from"./forms-CL2ODv4X.js";import{t as o}from"./jsx-runtime-CTknu7_t.js";import{c as s}from"./cards-CR_9H_Xm.js";var c=e(r()),l=e(t()),u=e(o());function d(e){let t=n(),{width:r,placement:o,withoutArrow:d,tooltipElement:f,message:p,disabled:m,withoutWrapping:h,childrenWrapperClassName:g,appendToBody:_}=e,v=(0,l.useRef)(null),[y,b]=(0,l.useState)(0),[x,S]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{let e=v?.current?.offsetWidth,t=v?.current?.children[0];t&&e&&(t.offsetWidth>e?(b(e+10),S(!0)):b(t.offsetWidth+10))},[v,e.message]),(0,u.jsx)(`div`,{className:(0,c.default)(e.className,{"max-w-sm":e.size===void 0||e.size===`small`,"max-w-md":e.size===`regular`,"max-w-xl":e.size===`large`}),children:(0,u.jsx)(s,{placement:o||`top-start`,interactive:!0,appendTo:_?()=>document.body:`parent`,render:()=>(0,u.jsxs)(`div`,{className:`flex flex-col items-center`,onClick:e=>e.stopPropagation(),children:[(0,u.jsxs)(`div`,{className:(0,c.default)(`relative p-2 text-xs text-center text-white rounded-md`,{"leading-1":x,"leading-none":!x,"whitespace-normal break-all":!!p&&!h,"whitespace-nowrap":h}),style:{width:r||y,backgroundColor:t.$3,color:t.$1},children:[p,f]}),!d&&(0,u.jsx)(i,{className:`rotate-90`,element:a,size:24,style:{color:t.$3,marginTop:`-0.51rem`}})]}),disabled:m,children:(0,u.jsx)(`div`,{ref:v,className:(0,c.default)(`cursor-pointer`,{"truncate w-full":e.truncate,"flex items-center":e.centerVertically},g),children:e.children})})})}export{d as t};