import{o as e}from"./rolldown-runtime-C_s2cVnS.js";import{c as t,h as n,l as r,m as i,n as a}from"./vendor-react-nmZsNlRz.js";import{a as o,h as s,r as c,t as l,u}from"./dropdown-menu-DPM6aa8A.js";import{t as d}from"./utils-BRwGVQJx.js";import{t as f}from"./codicon-eqX7Peys.js";import{t as p}from"./skeleton-ChBYRETS.js";import{t as m}from"./format-CYnFnnkk.js";var h=a();function g(e,n,i){let a=(0,h.c)(15),{hash:o,pathname:s,search:c}=t(),l=r(),u;if(a[0]!==i||a[1]!==e||a[2]!==c||a[3]!==n){let t=new URLSearchParams(c).get(e);u=t&&n.includes(t)?t:i,a[0]=i,a[1]=e,a[2]=c,a[3]=n,a[4]=u}else u=a[4];let d=u,f;a[5]!==i||a[6]!==o||a[7]!==e||a[8]!==l||a[9]!==s||a[10]!==c?(f=t=>{let n=new URLSearchParams(c);t===i?n.delete(e):n.set(e,t);let r=n.toString();l({hash:o,pathname:s,search:r?`?${r}`:``},{replace:!0})},a[5]=i,a[6]=o,a[7]=e,a[8]=l,a[9]=s,a[10]=c,a[11]=f):f=a[11];let p=f,m;return a[12]!==p||a[13]!==d?(m=[d,p],a[12]=p,a[13]=d,a[14]=m):m=a[14],m}var _=e(n(),1),v=e(i(),1);function y(e){let t=(0,h.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=d(`text-[0.72em] font-normal text-(--ui-text-tertiary)`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,v.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function b({active:e=!1,children:t,className:n,type:r=`button`,...i}){return(0,v.jsx)(`button`,{className:d(`group/text-tab inline-flex h-7 items-center gap-1 bg-transparent px-1 text-[length:var(--conversation-caption-font-size)] font-medium text-(--ui-text-tertiary) transition-colors hover:bg-transparent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sidebar-ring disabled:pointer-events-none disabled:opacity-50`,e&&`text-foreground`,n),"data-active":e,type:r,...i,children:_.Children.map(t,t=>_.isValidElement(t)&&t.type===y?t:(0,v.jsx)(`span`,{className:d(`underline-offset-4 decoration-current/25`,e?`underline`:`group-hover/text-tab:underline`),children:t}))})}function x(e){return e===null?(0,v.jsx)(p,{}):typeof e==`number`?m(e):e}function S(e){let t=(0,h.c)(5),{icon:n,indent:r}=e,i=r?`size-3.5`:`size-4`,a;t[0]===i?a=t[1]:(a=d(`shrink-0 text-muted-foreground/80`,i),t[0]=i,t[1]=a);let o;return t[2]!==n||t[3]!==a?(o=(0,v.jsx)(n,{className:a}),t[2]=n,t[3]=a,t[4]=o):o=t[4],o}function C({align:e=`center`,className:t,items:n}){let r=n.find(e=>e.active)??n[0];return(0,v.jsxs)(l,{children:[(0,v.jsx)(s,{asChild:!0,children:(0,v.jsxs)(`button`,{className:`flex h-7 cursor-pointer items-center gap-1.5 px-1 text-[length:var(--conversation-caption-font-size)] font-medium text-foreground [-webkit-app-region:no-drag]`,type:`button`,children:[r?.icon&&(0,v.jsx)(S,{icon:r.icon,indent:r.indent}),(0,v.jsx)(`span`,{className:`min-w-0 truncate`,children:r?.label}),r?.meta!==void 0&&(0,v.jsx)(y,{children:x(r.meta)}),(0,v.jsx)(f,{className:`text-muted-foreground`,name:`chevron-down`,size:`0.75rem`})]})}),(0,v.jsx)(c,{align:e,className:d(`w-44`,t),sideOffset:6,children:n.map((e,t)=>(0,v.jsxs)(_.Fragment,{children:[e.separatorBefore&&t>0&&(0,v.jsx)(u,{}),(0,v.jsxs)(o,{className:d(e.indent&&`pl-6`,e.active&&`text-foreground`),onSelect:e.onSelect,children:[e.icon&&(0,v.jsx)(S,{icon:e.icon,indent:e.indent}),(0,v.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.meta!==void 0&&(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:x(e.meta)})]})]},e.id))})]})}function w({align:e=`center`,onChange:t,tabs:n,value:r,wideClassName:i}){return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`div`,{className:d(`hidden min-w-0 flex-wrap items-center gap-x-2 gap-y-1 md:flex`,i),children:n.map(e=>(0,v.jsxs)(b,{active:e.id===r,"data-tour":`tab-${e.id}`,onClick:()=>t(e.id),children:[e.label,e.meta!==void 0&&(0,v.jsx)(y,{children:x(e.meta)})]},e.id))}),(0,v.jsx)(`div`,{className:`md:hidden`,children:(0,v.jsx)(C,{align:e,items:n.map(e=>({active:e.id===r,id:e.id,label:e.label,meta:e.meta,onSelect:()=>t(e.id)}))})})]})}export{g as i,C as n,b as r,w as t};