import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{$ as t}from"./vendor-charts-iXlq6Rne.js";import{_ as n}from"./vendor-flow-IzlrcDx6.js";import{Sn as r,jn as i,rn as a}from"./index-HkVQGc9M.js";var o=e(t(),1),s=n();function c({placeholder:e=`Search...`,value:t,onChange:n,debounceMs:c=300,className:l}){let[u,d]=(0,o.useState)(t||``),f=(0,o.useRef)(void 0);(0,o.useEffect)(()=>{t!==void 0&&d(t)},[t]);let p=(0,o.useCallback)(e=>{d(e),clearTimeout(f.current),f.current=setTimeout(()=>n(e),c)},[n,c]),m=(0,o.useCallback)(()=>{d(``),clearTimeout(f.current),n(``)},[n]);return(0,s.jsxs)(`div`,{className:a(`relative`,l),children:[(0,s.jsx)(i,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]`}),(0,s.jsx)(`input`,{type:`text`,"aria-label":`Search`,placeholder:e,value:u,onChange:e=>p(e.target.value),className:a(`h-9 w-full rounded-lg border border-[var(--color-border)] bg-[var(--color-surface)]`,`pl-9 pr-8 text-sm text-[var(--color-text-primary)] placeholder:text-[var(--color-text-muted)]`,`focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)]/30 focus:border-[var(--color-primary-light)]`,`transition-colors duration-[var(--transition-fast)]`)}),u&&(0,s.jsx)(`button`,{"aria-label":`Clear search`,onClick:m,className:`absolute right-2.5 top-1/2 -translate-y-1/2 p-0.5 rounded hover:bg-slate-100 dark:hover:bg-slate-700 transition-colors`,children:(0,s.jsx)(r,{className:`w-3.5 h-3.5 text-[var(--color-text-muted)]`})})]})}export{c as t};