import{r as e}from"./rolldown-runtime-hePW80VL.js";import{o as t}from"./vendor-forms-yQg41KHz.js";import{t as n}from"./vendor-react-CAGJwf-T.js";import{t as r}from"./utils-Dk_44zMo.js";var i=e(t(),1),a=n(),o=(0,i.createContext)(null);function s({tabs:e,defaultTab:t,onChange:n,children:s,className:c}){let[l,u]=(0,i.useState)(t||e[0]?.id||``),d=e=>{u(e),n?.(e)};return(0,a.jsx)(o.Provider,{value:{activeTab:l,setActiveTab:d},children:(0,a.jsxs)(`div`,{className:c,children:[(0,a.jsx)(`div`,{className:`flex border-b border-[var(--color-border)]`,role:`tablist`,children:e.map(e=>(0,a.jsxs)(`button`,{role:`tab`,"aria-selected":l===e.id,onClick:()=>d(e.id),className:r(`flex items-center gap-2 px-4 py-3 text-sm font-medium border-b-2 -mb-px transition-colors duration-[var(--transition-fast)]`,l===e.id?`border-[var(--color-primary)] text-[var(--color-primary)]`:`border-transparent text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] hover:border-slate-300`),children:[e.icon,e.label,e.badge!==void 0&&(0,a.jsx)(`span`,{className:r(`inline-flex items-center justify-center min-w-[20px] h-5 px-1.5 rounded-full text-[11px] font-semibold`,l===e.id?`bg-[var(--color-primary)]/10 text-[var(--color-primary)]`:`bg-slate-100 dark:bg-slate-800 text-[var(--color-text-muted)]`),children:e.badge})]},e.id))}),(0,a.jsx)(`div`,{className:`pt-4`,children:s})]})})}function c({id:e,children:t,className:n}){let r=(0,i.useContext)(o);if(!r)throw Error(`TabPanel must be used within Tabs`);return r.activeTab===e?(0,a.jsx)(`div`,{role:`tabpanel`,className:n,children:t}):null}export{s as n,c as t};