import{o as e}from"./rolldown-runtime-C_s2cVnS.js";import{a as t}from"./i18n-CsN8OUP9.js";import{h as n,m as r}from"./vendor-react-nmZsNlRz.js";import{n as i,t as a}from"./IconSearch-K9MAHGUb.js";import{t as o}from"./button-C_jHykqW.js";import{r as s}from"./tooltip-vc4SoMXn.js";import{t as c}from"./utils-BRwGVQJx.js";import{t as l}from"./codicon-eqX7Peys.js";var u=e(n(),1),d=e(r(),1);function f({placeholder:e,value:n,onChange:r,hints:f,containerClassName:p,inputClassName:m,loading:h=!1,onClear:g,inputRef:_,trailingAction:v,"aria-label":y}){let{t:b}=t(),x=g??(()=>r(``)),[S]=(0,u.useState)(()=>Math.floor(Math.random()*4096)),C=f?.length??0,w=C>0?f[S%C]:e;return(0,d.jsxs)(`div`,{className:c(`inline-flex min-w-0 max-w-full items-center gap-1.5 border-b border-transparent px-0.5 transition-[color,border-color,opacity]`,!n&&`opacity-30 focus-within:opacity-100`,p),children:[(0,d.jsx)(a,{className:`pointer-events-none size-3.5 shrink-0 text-muted-foreground/70`}),(0,d.jsx)(`input`,{"aria-label":y??e,className:c(`h-7 min-w-0 max-w-full bg-transparent text-xs text-foreground [field-sizing:content] placeholder:text-muted-foreground focus:outline-none`,m),onChange:e=>r(e.target.value),placeholder:w,ref:_,type:`text`,value:n}),v,h?(0,d.jsx)(i,{className:`pointer-events-none size-3.5 shrink-0 animate-spin text-muted-foreground/70`}):n?(0,d.jsx)(s,{label:b.ui.search.clear,children:(0,d.jsx)(o,{"aria-label":b.ui.search.clear,className:`shrink-0 text-muted-foreground/85 hover:bg-accent/60 hover:text-foreground`,onClick:x,size:`icon-xs`,variant:`ghost`,children:(0,d.jsx)(l,{name:`close`,size:`0.875rem`})})}):null]})}export{f as t};