import{r as n,j as r,al as R,am as j}from"./index-DCzV2WLr.js";const S="_container_dz4sz_1",I="_button_dz4sz_6",O="_buttonIcon_dz4sz_29",N="_buttonText_dz4sz_39",y="_icon_dz4sz_44",B="_iconOpen_dz4sz_53",W="_panel_dz4sz_57",s={container:S,button:I,buttonIcon:O,buttonText:N,icon:y,iconOpen:B,panel:W},D=({buttonText:l,children:h,rootClassName:w="",position:L="left",className:_="",icon:m,closeOnInsideClick:g=!0})=>{const[t,C]=n.useState(!1),[d,b]=n.useState({top:0,left:0,minWidth:0}),x=n.useRef(null),o=n.useRef(null),u=n.useRef(null),z=()=>{C(!t)},f=()=>{if(o.current){const e=o.current.getBoundingClientRect(),c=window.scrollX,a=window.scrollY;b({top:e.bottom+a+4,left:e.left+c,minWidth:e.width})}};n.useEffect(()=>{const e=p=>{o.current&&!o.current.contains(p.target)&&u.current&&!u.current.contains(p.target)&&C(!1)},c=()=>{t&&f()},a=()=>{t&&f()};return t&&(f(),document.addEventListener("mousedown",e),window.addEventListener("scroll",c,!0),window.addEventListener("resize",a)),()=>{document.removeEventListener("mousedown",e),window.removeEventListener("scroll",c,!0),window.removeEventListener("resize",a)}},[t]);const v=()=>{g&&setTimeout(()=>{C(!1)},0)},E=[s.container,w,_].filter(Boolean).join(" "),i={top:d.top,minWidth:d.minWidth};if(L==="right"&&o.current){const e=o.current.getBoundingClientRect(),c=document.documentElement.clientWidth-e.right;i.right=c,i.left="auto"}else i.left=d.left,i.right="auto";return r.jsxs("div",{ref:x,className:E,children:[r.jsxs("button",{ref:o,onClick:z,className:`${s.button} body-3`,"aria-haspopup":"true","aria-expanded":t,children:[m&&r.jsx("span",{className:s.buttonIcon,children:m}),r.jsx("span",{className:s.buttonText,children:l}),r.jsx(j,{className:`${s.icon} ${t?s.iconOpen:""}`})]}),t&&R.createPortal(r.jsx("div",{ref:u,className:s.panel,style:i,role:"region","aria-label":l+" content",onClick:v,children:h}),document.body)]})},P=l=>n.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...l},n.createElement("path",{d:"M7.00003 4.87434C6.76329 5.11927 6.37281 5.12591 6.12787 4.88916C6.12785 4.88915 6.12789 4.88918 6.12787 4.88916L4.38194 3.20158V10.7098C4.38194 11.0504 4.10579 11.3266 3.76514 11.3266C3.42449 11.3266 3.14834 11.0504 3.14834 10.7098V3.20158L1.40246 4.88911C1.16153 5.12993 0.770991 5.12985 0.530169 4.88892C0.289348 4.64799 0.289434 4.25745 0.530362 4.01663C0.535306 4.01169 0.540334 4.00683 0.545444 4.00206L3.33646 1.30424C3.34676 1.29425 3.35867 1.28725 3.36949 1.27809L3.37976 1.26961C3.39318 1.25881 3.40557 1.24623 3.41964 1.2367C3.42195 1.23516 3.4246 1.23414 3.42695 1.2326C3.44366 1.22159 3.46142 1.21342 3.47891 1.2042C3.49689 1.19476 3.51438 1.1844 3.533 1.17684C3.55215 1.16969 3.57164 1.16351 3.59142 1.15834C3.60754 1.15362 3.62321 1.14711 3.63962 1.14372L3.64767 1.14267C3.66731 1.13888 3.68711 1.13795 3.707 1.13607C3.72508 1.13441 3.7429 1.13135 3.76107 1.13123L3.76514 1.13086L3.76896 1.13123C3.787 1.13138 3.80477 1.13431 3.82275 1.1361C3.84261 1.13795 3.86241 1.13888 3.88205 1.14264L3.89072 1.14378C3.90675 1.14711 3.92205 1.15356 3.93781 1.15818C3.95781 1.16335 3.97753 1.16952 3.9969 1.17669C3.99968 1.17783 4.00279 1.17826 4.00553 1.17943C4.02095 1.18594 4.03499 1.19568 4.04988 1.20349C4.06802 1.21218 4.08571 1.22179 4.10287 1.23229C4.10546 1.23399 4.10832 1.23519 4.11088 1.23692C4.12322 1.24515 4.13371 1.25616 4.14539 1.26538C4.15088 1.2697 4.15622 1.27417 4.16155 1.27871C4.17207 1.28759 4.18367 1.2944 4.19369 1.30412L6.98483 4.00206C7.2299 4.23867 7.23676 4.62914 7.00015 4.87421C7.00011 4.87425 7.00007 4.8743 7.00003 4.87434ZM13.4764 9.12507C13.2397 8.88015 12.8492 8.87352 12.6043 9.11028C12.6042 9.1103 12.6043 9.11026 12.6043 9.11028L10.8583 10.7978V3.28966C10.8583 2.94901 10.5822 2.67286 10.2415 2.67286C9.90088 2.67286 9.62473 2.94901 9.62473 3.28966V10.7978L7.87885 9.11033C7.63817 8.86926 7.24764 8.86894 7.00656 9.10961C6.76549 9.35029 6.76517 9.74082 7.00584 9.9819C7.01108 9.98714 7.01641 9.9923 7.02184 9.99735L9.81285 12.6952C9.8238 12.7058 9.83642 12.7134 9.84792 12.7229C9.85646 12.7301 9.86476 12.7375 9.8737 12.7442C9.88348 12.7515 9.89261 12.7598 9.90272 12.7664C9.92069 12.7774 9.93922 12.7875 9.95823 12.7965C9.97319 12.8043 9.98713 12.8138 10.0028 12.8204L10.0094 12.8228C10.0311 12.8308 10.0533 12.8376 10.0758 12.843C10.0904 12.8471 10.1042 12.8531 10.1193 12.8561L10.1236 12.8569C10.2014 12.8723 10.2815 12.8723 10.3593 12.8569L10.3636 12.8561C10.3786 12.853 10.3925 12.8471 10.4071 12.843C10.4296 12.8376 10.4517 12.8308 10.4735 12.8228L10.48 12.8204C10.4957 12.8138 10.5097 12.8043 10.5246 12.7965C10.5437 12.7875 10.5622 12.7774 10.5802 12.7664C10.5903 12.7598 10.5994 12.7515 10.6092 12.7442C10.6181 12.7375 10.6264 12.7301 10.635 12.7229C10.6465 12.7133 10.6591 12.7057 10.67 12.6952L13.4612 9.99735C13.7063 9.76075 13.7132 9.37027 13.4765 9.1252C13.4765 9.12516 13.4765 9.12511 13.4764 9.12507Z",fill:"#31323A"}));export{D,P as S};