import{m as v,v as R,t as w,k as F,h as G,r as u,j as a,aA as V,W as A,bc as D}from"./index-6o6UQuBv.js";const Q=v.form.withConfig({componentId:"sc-7af633b1-0"})(["width:100%;display:flex;justify-content:space-between;align-items:center;margin:16px 0 0 auto;gap:8px;display:grid;grid-template-columns:1fr 2fr;","{width:60%;margin:20px 0 0 auto;}"],R.SM),W=v.div.withConfig({componentId:"sc-7af633b1-1"})(["width:100%;height:100%;> div{height:100%;> div:first-of-type{height:100%;}}"]),Y=v.div.withConfig({componentId:"sc-7af633b1-2"})(["width:100%;height:100%;position:relative;input{height:100%;padding:var(--spacing-10) var(--spacing-40) var(--spacing-10) var(--spacing-16);background-color:",";}button{position:absolute;top:50%;right:12px;transform:translateY(-50%);svg{width:16px;height:16px;path{stroke:",";}}}"],w.lightGray,w.darkGray),p={SearchForm:Q,SelectContainer:W,InputContainer:Y},z=({searchTypeList:r,customKeyInfo:n,isOnlyKeywordUsable:s,placeholder:j="검색어 입력",containerStyle:b})=>{const f=(n==null?void 0:n.searchType)??"searchType",h=(n==null?void 0:n.searchKeyword)??"searchKeyword",{t:C}=F(),[c,E]=G(),M=c.get(f)??"",S=u.useMemo(()=>{var e;return s?((e=r.find(o=>c.has(o.value)))==null?void 0:e.value)??"":h},[c,r,h,s]),l=c.get(S)??"",[t,k]=u.useState(()=>s?r.find(e=>e.value===S)??r[0]??null:r.find(e=>e.value===M)??r[0]??null),i=u.useRef(null),P=e=>{e.preventDefault(),i.current&&E(o=>{var x;if(s){const d=new URLSearchParams(o);return r.forEach(g=>{var m;if(g.value===(t==null?void 0:t.value)){d.set(g.value,((m=i.current)==null?void 0:m.value)??"");return}d.delete(g.value)}),d.toString()}return{...Object.fromEntries(o),[h]:((x=i.current)==null?void 0:x.value)??"",[f]:(t==null?void 0:t.value)??""}},{replace:!0})};return u.useEffect(()=>{i.current&&l&&(i.current.value=l)},[l]),a.jsxs(p.SearchForm,{onSubmit:P,style:b,children:[a.jsx(p.SelectContainer,{children:a.jsx(V,{options:r,value:t,onChange:e=>{k(e)}})}),a.jsxs(p.InputContainer,{children:[a.jsx(A,{ref:i,placeholder:C(j)}),a.jsx("button",{children:a.jsx(D,{})})]})]})};export{z as M};