import{N as C,y as b,aV as k,l,Q as p,o as K,c as P,a as d,T as _,ao as V,U as F,V as v,X as f,_ as I}from"./index.2e2ba873.js";import{S as D,G as N}from"./index.f1458219.js";const T=["placeholder"],U=C({__name:"SearchBox",props:{searchPlaceholder:{type:String,default:"\u641C\u7D22\u4F60\u611F\u5174\u8DA3\u7684\u5185\u5BB9"},isSpacePage:{type:Boolean,default:!1}},emits:["confirmSearch"],setup(n,{expose:S,emit:m}){const u=n,{spaceSearchKeyword:r}=b(k()),i=l(null),c=l(!1),y=()=>{c.value=!0},x=()=>{c.value=!1},g=s=>{s.key==="Enter"&&o()};let t=!1;const o=()=>{var a;if(t)return;t=!0;const s=e.value.trim();(a=i.value)==null||a.blur(),t=!1,m("confirmSearch",s)},e=l(""),h=()=>{e.value=""},B=()=>{h(),o()};return p(r,()=>{u.isSpacePage&&(e.value=r.value)},{immediate:!0}),p(e,()=>{u.isSpacePage&&(r.value=e.value)},{immediate:!0}),S({clearSearchKeyWord:h}),(s,a)=>(K(),P("div",{class:I(["page_searchbox",{search_active:c.value}])},[d("div",{class:"page_searchbox--input no_drag",ref:"inputWrapper",onKeydown:g},[_(d("input",{type:"text",class:"input-text text1",ref_key:"searchInput",ref:i,placeholder:n.searchPlaceholder,"onUpdate:modelValue":a[0]||(a[0]=w=>e.value=w),onFocus:y,onBlur:x},null,40,T),[[V,e.value]])],544),_(v(f(D),{class:"page_searchbox--icon-close cs_pointer p_center_y",onClick:B},null,512),[[F,e.value]]),v(f(N),{class:"page_searchbox--icon-search cs_pointer p_center_y r_md",onClick:o})],2))}});export{U as _};
