import"./rolldown-runtime-DIIn1E2Q.js";import{A as e,Bt as t,D as n,G as r,It as i,O as a,Pt as o,R as s,Rt as c,U as l,_ as u,et as d,j as f,kt as p,pt as m,ut as h,vt as g}from"./vendor-vue-core-DO0afONr.js";import{K as _}from"./vendor-vueuse-DUMtJaL2.js";import{t as v}from"./src-NuWuoO1R.js";var y=Symbol(`OverlayAppendTo`);function useTransformCompatOverlayProps(e={}){let t=l(y,void 0);return n(()=>({appendTo:t??`self`,...e}))}var b=[`placeholder`,`autofocus`],x=[`aria-label`],S=s({__name:`FormSearchInput`,props:r({searcher:{type:Function,default:async()=>{}},updateKey:{},autofocus:{type:Boolean,default:!1},class:{}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(n){let r=h(n,`modelValue`),s=p(!1),l=_(r,250,{maxWait:1e3});m(r,e=>{s.value=e!==l.value}),m([l,o(()=>i(n.updateKey))],(e,t,r)=>{let i=!1,a;r(()=>{i=!0,a?.()}),n.searcher(l.value,e=>a=e).catch(e=>{console.error(`[SidePanelSearch] searcher failed`,e)}).finally(()=>{i||(s.value=!1)})},{immediate:!0});function handleFocus(e){let t=e.target;t instanceof HTMLInputElement&&t.select()}return(i,o)=>(d(),f(`label`,{class:t(c(v)(`group`,`rounded-lg bg-component-node-widget-background transition-all duration-150`,`flex flex-1 items-center`,`border-0 text-base-foreground`,`focus-within:ring focus-within:ring-component-node-widget-background-highlighted/80`,n.class))},[a(`i`,{class:t(c(v)(`ml-2 size-4 shrink-0 transition-colors duration-150`,s.value?`icon-[lucide--loader-circle] animate-spin`:`icon-[lucide--search]`,r.value?.trim()===``?`text-muted-foreground group-focus-within:text-base-foreground group-hover:text-base-foreground`:`text-base-foreground`))},null,2),g(a(`input`,{"onUpdate:modelValue":o[0]||=e=>r.value=e,type:`text`,class:`mx-2 my-1.5 h-5 w-full min-w-0 border-0 bg-transparent ring-0 outline-0`,placeholder:i.$t(`g.searchPlaceholder`,{subject:``}),autofocus:i.autofocus,onFocus:handleFocus},null,40,b),[[u,r.value]]),r.value.trim().length>0?(d(),f(`button`,{key:0,class:`m-0 flex shrink-0 items-center justify-center border-0 bg-transparent p-0 pr-3 pl-1 text-muted-foreground ring-0 outline-0 transition-all duration-150 hover:scale-108 hover:text-base-foreground`,"aria-label":i.$t(`g.clear`),onClick:o[1]||=e=>r.value=``},[a(`i`,{class:t(c(v)(`icon-[lucide--delete] size-4 cursor-pointer`))},null,2)],8,x)):e(``,!0)],2))}});export{y as n,useTransformCompatOverlayProps as r,S as t};
//# sourceMappingURL=FormSearchInput-C3k2HxOB.js.map