import{e as k,r as C,c as x,j as i}from"./index-DjCrtoJM.js";import{b as I,T as P,a as L}from"./tooltip-MvXJgTec.js";const M={sm:{button:"size-7",icon:"size-4"},md:{button:"size-9",icon:"size-5"},lg:{button:"size-12",icon:"size-6"}};function B(S){const e=k.c(27),{value:s,onValueChange:y,options:o,size:R,fullWidth:E,className:z}=S,V=R===void 0?"sm":R,u=E===void 0?!1:E;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=[],e[0]=b):b=e[0];const _=C.useRef(b);let g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g={left:0,width:0,opacity:0},e[1]=g):g=e[1];const[f,W]=C.useState(g);let h,p;e[2]!==o||e[3]!==s?(h=()=>{const t=o.findIndex(j=>j.value===s),m=_.current[t];m&&W({left:m.offsetLeft,width:m.offsetWidth,opacity:1})},p=[s,o],e[2]=o,e[3]=s,e[4]=h,e[5]=p):(h=e[4],p=e[5]),C.useEffect(h,p);const d=M[V];let n;e[6]!==z?(n=x("relative flex gap-0 bg-muted rounded-lg",z),e[6]=z,e[7]=n):n=e[7];let l;e[8]!==d||e[9]!==u||e[10]!==y||e[11]!==o||e[12]!==s?(l=o.map((t,m)=>{const j=i.jsxs("button",{ref:$=>{_.current[m]=$},type:"button",onClick:()=>y(t.value),className:x("relative z-10 flex items-center justify-center gap-2 rounded-lg transition-colors [transition-timing-function:var(--ease-out-cubic)] duration-200",u?"flex-1 h-12 px-4":d.button,!u&&t.label?"px-3":""),children:[i.jsx("span",{className:x("transition-colors ease-out duration-200 flex items-center justify-center [&>svg]:size-[1em]",d.icon,s===t.value?"text-foreground":"text-muted-foreground"),children:t.icon}),t.label&&i.jsx("span",{className:x("text-xs transition-colors ease-out duration-200 whitespace-nowrap",s===t.value?"text-foreground":"text-muted-foreground"),children:t.label})]},t.value);return t.tooltip?i.jsxs(I,{children:[i.jsx(P,{asChild:!0,children:j}),i.jsx(L,{side:"bottom",children:t.tooltip})]},t.value):j}),e[8]=d,e[9]=u,e[10]=y,e[11]=o,e[12]=s,e[13]=l):l=e[13];const w=u?"h-12":d.button;let a;e[14]!==w?(a=x("absolute z-0 bg-background rounded-lg border-shadow transition-all [transition-timing-function:var(--ease-out-cubic)] duration-200",w),e[14]=w,e[15]=a):a=e[15];const N=`${f.left}px`,T=`${f.width}px`;let r;e[16]!==f.opacity||e[17]!==N||e[18]!==T?(r={left:N,width:T,opacity:f.opacity},e[16]=f.opacity,e[17]=N,e[18]=T,e[19]=r):r=e[19];let c;e[20]!==a||e[21]!==r?(c=i.jsx("div",{className:a,style:r}),e[20]=a,e[21]=r,e[22]=c):c=e[22];let v;return e[23]!==c||e[24]!==n||e[25]!==l?(v=i.jsxs("div",{className:n,children:[l,c]}),e[23]=c,e[24]=n,e[25]=l,e[26]=v):v=e[26],v}export{B as V};
