import{r as c,R as U,j as t,aC as q,B as G,aD as K,aE as V}from"./index-DCzV2WLr.js";const J="_search__bar_kosm6_1",Q="_search__bar_field_container_relative_kosm6_14",T="_search__bar_field_forward_kosm6_21",X="_search__bar_field_reverse_kosm6_22",Y="_iconsWrapper_kosm6_41",e1="_clear__icon_btn_kosm6_41",t1="_action__icon_btn_kosm6_42",n1="_search__icon_btn_left_kosm6_74",r1="_search__icon_btn_kosm6_74",a1="_searchIcon_kosm6_95",c1="_searchIconWhite_kosm6_99",o1="_clearIcon_kosm6_103",s1="_filterIcon_kosm6_112",_1="_actionIcon_kosm6_118",l1="_withBackground_kosm6_132",i1="_search__bar_filter_button_display_kosm6_142",C1="_filterButtonActive_kosm6_158",h1="_filterCountBadge_kosm6_162",d1="_search__bar_filter_button_none_kosm6_181",f1="_search__bar_overall_wrapper_kosm6_185",u1="_search__button_kosm6_191",n={search__bar:J,search__bar_field_container_relative:Q,search__bar_field_forward:T,search__bar_field_reverse:X,iconsWrapper:Y,clear__icon_btn:e1,action__icon_btn:t1,search__icon_btn_left:n1,search__icon_btn:r1,searchIcon:a1,searchIconWhite:c1,clearIcon:o1,filterIcon:s1,actionIcon:_1,withBackground:l1,search__bar_filter_button_display:i1,filterButtonActive:C1,filterCountBadge:h1,search__bar_filter_button_none:d1,search__bar_overall_wrapper:f1,search__button:u1},b1=o=>c.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o},c.createElement("g",{clipPath:"url(#clip0_8450_4760)"},c.createElement("path",{d:"M1 4.75005H3.736C3.95064 5.53978 4.41917 6.23694 5.06933 6.73398C5.71948 7.23101 6.51512 7.5003 7.3335 7.5003C8.15188 7.5003 8.94752 7.23101 9.59767 6.73398C10.2478 6.23694 10.7164 5.53978 10.931 4.75005H23C23.2652 4.75005 23.5196 4.64469 23.7071 4.45715C23.8946 4.26962 24 4.01526 24 3.75005C24 3.48483 23.8946 3.23047 23.7071 3.04294C23.5196 2.8554 23.2652 2.75005 23 2.75005H10.931C10.7164 1.96031 10.2478 1.26315 9.59767 0.766114C8.94752 0.269078 8.15188 -0.000213623 7.3335 -0.000213623C6.51512 -0.000213623 5.71948 0.269078 5.06933 0.766114C4.41917 1.26315 3.95064 1.96031 3.736 2.75005H1C0.734784 2.75005 0.48043 2.8554 0.292893 3.04294C0.105357 3.23047 0 3.48483 0 3.75005C0 4.01526 0.105357 4.26962 0.292893 4.45715C0.48043 4.64469 0.734784 4.75005 1 4.75005ZM7.333 2.00005C7.67912 2.00005 8.01746 2.10268 8.30525 2.29497C8.59303 2.48727 8.81734 2.76058 8.94979 3.08035C9.08224 3.40012 9.1169 3.75199 9.04937 4.09145C8.98185 4.43092 8.81518 4.74274 8.57044 4.98748C8.3257 5.23222 8.01388 5.3989 7.67441 5.46642C7.33494 5.53394 6.98307 5.49929 6.6633 5.36683C6.34353 5.23438 6.07022 5.01008 5.87793 4.72229C5.68564 4.43451 5.583 4.09616 5.583 3.75005C5.58353 3.28608 5.76807 2.84127 6.09615 2.51319C6.42422 2.18512 6.86903 2.00057 7.333 2.00005Z",fill:"currentColor"}),c.createElement("path",{d:"M23 11H20.264C20.0497 10.2101 19.5814 9.51267 18.9313 9.01543C18.2812 8.51818 17.4855 8.24876 16.667 8.24876C15.8485 8.24876 15.0528 8.51818 14.4027 9.01543C13.7526 9.51267 13.2843 10.2101 13.07 11H1C0.734784 11 0.48043 11.1054 0.292893 11.2929C0.105357 11.4804 0 11.7348 0 12C0 12.2652 0.105357 12.5196 0.292893 12.7071C0.48043 12.8946 0.734784 13 1 13H13.07C13.2843 13.7899 13.7526 14.4873 14.4027 14.9846C15.0528 15.4818 15.8485 15.7512 16.667 15.7512C17.4855 15.7512 18.2812 15.4818 18.9313 14.9846C19.5814 14.4873 20.0497 13.7899 20.264 13H23C23.2652 13 23.5196 12.8946 23.7071 12.7071C23.8946 12.5196 24 12.2652 24 12C24 11.7348 23.8946 11.4804 23.7071 11.2929C23.5196 11.1054 23.2652 11 23 11ZM16.667 13.75C16.3209 13.75 15.9825 13.6474 15.6948 13.4551C15.407 13.2628 15.1827 12.9895 15.0502 12.6697C14.9178 12.3499 14.8831 11.9981 14.9506 11.6586C15.0181 11.3191 15.1848 11.0073 15.4296 10.7626C15.6743 10.5178 15.9861 10.3511 16.3256 10.2836C16.6651 10.2161 17.0169 10.2508 17.3367 10.3832C17.6565 10.5157 17.9298 10.74 18.1221 11.0278C18.3144 11.3155 18.417 11.6539 18.417 12C18.4165 12.464 18.2319 12.9088 17.9039 13.2369C17.5758 13.5649 17.131 13.7495 16.667 13.75Z",fill:"currentColor"}),c.createElement("path",{d:"M23 19.25H10.931C10.7164 18.4603 10.2478 17.7631 9.59767 17.2661C8.94752 16.769 8.15188 16.4997 7.3335 16.4997C6.51512 16.4997 5.71948 16.769 5.06933 17.2661C4.41917 17.7631 3.95064 18.4603 3.736 19.25H1C0.734784 19.25 0.48043 19.3554 0.292893 19.5429C0.105357 19.7304 0 19.9848 0 20.25C0 20.5152 0.105357 20.7696 0.292893 20.9571C0.48043 21.1446 0.734784 21.25 1 21.25H3.736C3.95064 22.0397 4.41917 22.7369 5.06933 23.2339C5.71948 23.731 6.51512 24.0003 7.3335 24.0003C8.15188 24.0003 8.94752 23.731 9.59767 23.2339C10.2478 22.7369 10.7164 22.0397 10.931 21.25H23C23.2652 21.25 23.5196 21.1446 23.7071 20.9571C23.8946 20.7696 24 20.5152 24 20.25C24 19.9848 23.8946 19.7304 23.7071 19.5429C23.5196 19.3554 23.2652 19.25 23 19.25ZM7.333 22C6.98688 22 6.64854 21.8974 6.36075 21.7051C6.07297 21.5128 5.84866 21.2395 5.71621 20.9197C5.58376 20.5999 5.5491 20.2481 5.61663 19.9086C5.68415 19.5691 5.85082 19.2573 6.09556 19.0126C6.3403 18.7678 6.65213 18.6012 6.99159 18.5336C7.33106 18.4661 7.68293 18.5008 8.0027 18.6332C8.32247 18.7657 8.59578 18.99 8.78807 19.2778C8.98036 19.5655 9.083 19.9039 9.083 20.25C9.08221 20.7139 8.89758 21.1585 8.56956 21.4866C8.24154 21.8146 7.79689 21.9992 7.333 22Z",fill:"currentColor"})),c.createElement("defs",null,c.createElement("clipPath",{id:"clip0_8450_4760"},c.createElement("rect",{width:24,height:24,fill:"white"}))));function L({className:o,...s}){return t.jsx("svg",{className:o,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s,children:t.jsx("path",{d:"M19.7561 18.5776L14.782 13.6034C16.1375 11.9456 16.804 9.83014 16.6435 7.6947C16.4831 5.55926 15.508 3.56717 13.92 2.1305C12.3319 0.693821 10.2525 -0.0775273 8.11167 -0.0240008C5.97088 0.0295257 3.93256 0.903832 2.41832 2.41807C0.904076 3.93232 0.0297698 5.97064 -0.0237567 8.11143C-0.0772832 10.2522 0.694065 12.3317 2.13074 13.9197C3.56742 15.5077 5.5595 16.4828 7.69494 16.6433C9.83038 16.8037 11.9458 16.1372 13.6036 14.7817L18.5778 19.7559C18.735 19.9077 18.9455 19.9917 19.164 19.9898C19.3825 19.9879 19.5915 19.9003 19.746 19.7457C19.9005 19.5912 19.9881 19.3822 19.99 19.1637C19.9919 18.9452 19.9079 18.7347 19.7561 18.5776ZM8.33364 15.0001C7.0151 15.0001 5.72617 14.6091 4.62984 13.8765C3.53351 13.144 2.67903 12.1028 2.17444 10.8846C1.66986 9.66644 1.53784 8.326 1.79507 7.03279C2.05231 5.73959 2.68724 4.5517 3.61959 3.61935C4.55194 2.687 5.73983 2.05206 7.03304 1.79483C8.32624 1.53759 9.66669 1.66961 10.8849 2.1742C12.103 2.67878 13.1442 3.53327 13.8768 4.62959C14.6093 5.72592 15.0003 7.01485 15.0003 8.3334C14.9983 10.1009 14.2953 11.7954 13.0455 13.0452C11.7957 14.2951 10.1011 14.9981 8.33364 15.0001Z",fill:"currentColor"})})}function m1({className:o,...s}){return t.jsx("svg",{className:o,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s,children:t.jsx("path",{d:"M12.9998 1.00006C12.8123 0.812591 12.558 0.707275 12.2928 0.707275C12.0277 0.707275 11.7733 0.812591 11.5858 1.00006L6.99982 5.58606L2.41382 1.00006C2.22629 0.812591 1.97198 0.707275 1.70682 0.707275C1.44165 0.707275 1.18735 0.812591 0.999818 1.00006C0.812347 1.18759 0.707031 1.4419 0.707031 1.70706C0.707031 1.97223 0.812347 2.22653 0.999818 2.41406L5.58582 7.00006L0.999818 11.5861C0.812347 11.7736 0.707031 12.0279 0.707031 12.2931C0.707031 12.5582 0.812347 12.8125 0.999818 13.0001C1.18735 13.1875 1.44165 13.2928 1.70682 13.2928C1.97198 13.2928 2.22629 13.1875 2.41382 13.0001L6.99982 8.41406L11.5858 13.0001C11.7733 13.1875 12.0277 13.2928 12.2928 13.2928C12.558 13.2928 12.8123 13.1875 12.9998 13.0001C13.1873 12.8125 13.2926 12.5582 13.2926 12.2931C13.2926 12.0279 13.1873 11.7736 12.9998 11.5861L8.41382 7.00006L12.9998 2.41406C13.1873 2.22653 13.2926 1.97223 13.2926 1.70706C13.2926 1.4419 13.1873 1.18759 12.9998 1.00006Z",fill:"currentColor"})})}const p1=(o=768)=>{const[s,w]=c.useState(window.innerWidth<o);return c.useEffect(()=>{const C=()=>w(window.innerWidth<o);return window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[o]),s},v1=({placeholder:o,type:s,filter:w,value:C,suggestions:r,onSearch:u,onSuggestionSelect:B,onInputValueChange:l,onKeyDown:E,noBtn:M=!1,onFilterClick:S,filterCount:v=0,buttonText:H="Найти",allowClear:D=!1,searchIconWithBackground:W=!0,showArrow:$=!1})=>{const[g,k]=c.useState(""),[h,_]=c.useState(!1),[i,d]=c.useState(-1),b=c.useRef(null),Z=p1(),m=C!==void 0,f=m?C:g;c.useEffect(()=>{const e=a=>{b.current&&!b.current.contains(a.target)&&_(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const A=e=>{const a=e.target.value;m||k(a),l&&l(a),a.length>0?(_(!0),d(-1)):_(!1)},R=()=>{var e,a;m||k(""),l&&l(""),_(!1),(a=(e=b.current)==null?void 0:e.querySelector("input"))==null||a.focus()},N=e=>{const a=e.label.trim().replace(/\s\s+/g," ");m||k(a),_(!1),d(-1),B?B(e):(l&&l(a),u&&u(a))},x=()=>{if(_(!1),u){const e=f.trim().replace(/\s\s+/g," ");u(e)}},p=()=>{x()},O=()=>{f.length>0&&r&&r.length>0&&_(!0)},P=e=>{E&&E(e),!e.defaultPrevented&&(h&&r&&r.length>0?e.key==="ArrowDown"?(e.preventDefault(),d(a=>(a+1)%r.length)):e.key==="ArrowUp"?(e.preventDefault(),d(a=>(a-1+r.length)%r.length)):e.key==="Enter"?(e.preventDefault(),i>=0&&i<r.length?N(r[i]):x()):e.key==="Escape"&&(e.preventDefault(),_(!1),d(-1)):e.key==="Enter"&&(e.preventDefault(),x()))},I=`searchbar-dropdown-${U.useId()}`,z=[n[`search__bar_filter_button_${w}`],v>0?n.filterButtonActive:""].filter(Boolean).join(" "),j=Z&&W,y=[n.search__icon_btn,"icon__button",j?n.withBackground:""].filter(Boolean).join(" "),F=s==="reverse"&&$&&f.length>0;return t.jsxs("div",{className:n.search__bar_overall_wrapper,ref:b,children:[t.jsxs("div",{className:n.search__bar,children:[t.jsxs("div",{className:`${n.search__bar_field_container_relative} ${n[`search__bar_field_${s}`]}`,children:[s==="reverse"&&t.jsx("button",{type:"button",className:`${y} ${n.search__icon_btn_left}`,onClick:p,"aria-label":"Search",children:t.jsx(L,{className:j?n.searchIconWhite:n.searchIcon})}),t.jsx("input",{className:"body-3",type:"text",placeholder:o,value:f,onChange:A,onFocus:O,onKeyDown:P,autoComplete:"off","aria-autocomplete":"list","aria-expanded":h,"aria-controls":h&&r&&r.length>0?I:void 0,"aria-activedescendant":h&&i!==-1&&r&&r.length>0?`${I}-item-${i}`:void 0}),t.jsxs("div",{className:n.iconsWrapper,children:[D&&f.length>0&&t.jsx("button",{type:"button",className:`${n.clear__icon_btn} icon__button`,onClick:R,"aria-label":"Clear input",children:t.jsx(m1,{className:n.clearIcon})}),F&&t.jsx("button",{type:"button",className:`${n.action__icon_btn} icon__button`,onClick:p,"aria-label":"Go",children:t.jsx(q,{className:n.actionIcon})}),s!=="reverse"&&t.jsx("button",{type:"button",className:y,onClick:p,"aria-label":"Search",children:t.jsx(L,{className:j?n.searchIconWhite:n.searchIcon})})]})]}),t.jsxs("button",{type:"button",className:z,"aria-label":"Open filters",onClick:S,children:[t.jsx(b1,{className:n.filterIcon}),v>0&&t.jsx("span",{className:n.filterCountBadge,children:v})]}),!M&&t.jsx(G,{className:n.search__button,onClick:p,children:H})]}),h&&r&&r.length>0&&t.jsx("div",{className:K.dropdownPositioned,children:t.jsx(V,{id:I,items:r,onSelectItem:N,activeIndex:i})})]})};export{v1 as S};