(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([[463],{900463(__unused_webpack_module,__webpack_exports__,__webpack_require__){(function(){if(!this.ST)return()=>{};with(this.ST)with(this.RH)with(this.G)return function(){"use strict";__webpack_require__.d(__webpack_exports__,{m:()=>e.m});var e=__webpack_require__(914022)}}).call(__webpack_require__._LM_("$root$",{__webpack_require__,__webpack_exports__}))()},914022(__unused_webpack_module,__webpack_exports__,__webpack_require__){(function(){if(!this.ST)return()=>{};with(this.ST)with(this.RH)with(this.G)return function(){"use strict";__webpack_require__.d(__webpack_exports__,{m:()=>u});var e=__webpack_require__(303280);__webpack_require__.n(e);var t=__webpack_require__(860012);var r=__webpack_require__(848574);var a=__webpack_require__(305142);var l=__webpack_require__(568894);var n=__webpack_require__(556734);var o=__webpack_require__(219384);var c=__webpack_require__(679968);var s=__webpack_require__(126528);var i=__webpack_require__(68940);let u=u=>{let f=(0,e.c)(42);let{options:m,selectedId:h,onChange:b,testId:p}=u;let[v,w]=(0,t.useState)(!1);let[k,g]=(0,t.useState)(-1);let E=(0,t.useRef)(null);let $=(0,t.useRef)(null);let y;f[0]===Symbol.for("react.memo_cache_sentinel")?(y=[],f[0]=y):y=f[0];let D=(0,t.useRef)(y);let S;if(f[1]!==m||f[2]!==h){let e;f[4]!==h?(e=e=>e.id===h,f[4]=h,f[5]=e):e=f[5],S=m.find(e),f[1]=m,f[2]=h,f[3]=S}else S=f[3];let x=S;let _;f[6]!==h?(_=e=>e.id===h,f[6]=h,f[7]=_):_=f[7];let T=m.findIndex(_);let A;let C;f[8]!==v?(A=()=>{let e=e=>{E.current&&!E.current.contains(e.target)&&(w(!1),g(-1))};return v&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},C=[v],f[8]=v,f[9]=A,f[10]=C):(A=f[9],C=f[10]),(0,t.useEffect)(A,C);let[L,I]=(0,t.useState)(v);let[M,N]=(0,t.useState)(T);(v!==L||T!==M)&&(I(v),N(T),v&&T>=0&&g(T));let R;let z;f[11]!==v||f[12]!==T?(R=()=>{v&&T>=0&&D.current[T]?.focus()},z=[v,T],f[11]=v,f[12]=T,f[13]=R,f[14]=z):(R=f[13],z=f[14]),(0,t.useEffect)(R,z);let K;f[15]===Symbol.for("react.memo_cache_sentinel")?(K=()=>{w(d)},f[15]=K):K=f[15];let H=K;let U;f[16]!==b?(U=e=>{b(e.id),w(!1),g(-1),$.current?.focus()},f[16]=b,f[17]=U):U=f[17];let j=U;let B;f[18]===Symbol.for("react.memo_cache_sentinel")?(B=e=>{switch(e.key){case"Enter":case" ":case"ArrowDown":case"ArrowUp":{e.preventDefault(),w(!0);break}default:}},f[18]=B):B=f[18];let G=B;let J;f[19]!==j||f[20]!==m?(J=(e,t)=>{switch(e.key){case"Enter":case" ":{e.preventDefault(),j(m[t]);break}case"ArrowDown":{e.preventDefault(),t<m.length-1&&(g(t+1),D.current[t+1]?.focus());break}case"ArrowUp":{e.preventDefault(),t>0&&(g(t-1),D.current[t-1]?.focus());break}case"Escape":{e.preventDefault(),w(!1),g(-1),$.current?.focus();break}case"Tab":{w(!1),g(-1);break}default:}},f[19]=j,f[20]=m,f[21]=J):J=f[21];let P=J;let V=`${p}-button`;let X=x?.label??"";let q;f[22]!==X?(q=t.createElement(i.E,{variant:r.J3.BodySm,color:r.r7.TextDefault},X),f[22]=X,f[23]=q):q=f[23];let F=v?a.$M.ArrowUp:a.$M.ArrowDown;let O;f[24]!==F?(O=t.createElement(o.I,{name:F,size:a.lK.Xs,color:a.Li.IconDefault,className:"ml-auto"}),f[24]=F,f[25]=O):O=f[25];let Q;f[26]!==v||f[27]!==V||f[28]!==q||f[29]!==O?(Q=t.createElement(c.u,{ref:$,size:l.PH.Sm,className:"flex items-center justify-start gap-1 rounded-lg bg-background-muted px-3 py-2 hover:bg-hover active:opacity-70",onClick:H,onKeyDown:G,"aria-haspopup":"listbox","aria-expanded":v,"data-testid":V},q,O),f[26]=v,f[27]=V,f[28]=q,f[29]=O,f[30]=Q):Q=f[30];let W;f[31]!==k||f[32]!==P||f[33]!==j||f[34]!==v||f[35]!==m||f[36]!==h||f[37]!==p?(W=v&&t.createElement(s.a,{className:"absolute left-0 top-full z-10 mt-1 min-w-[120px] overflow-hidden rounded-lg border border-border-muted bg-background-default shadow-lg",flexDirection:n.uV.Column,role:"listbox","aria-activedescendant":k>=0?`${p}-option-${m[k]?.id}`:undefined,"data-testid":`${p}-menu`},m.map((e,l)=>{let n=e.id===h;return t.createElement(c.u,{key:e.id,ref:e=>{D.current[l]=e},onClick:()=>j(e),onKeyDown:e=>P(e,l),className:`w-full justify-between text-left rounded-none px-3 py-2 min-w-0 h-auto active:bg-pressed ${n?"bg-hover":"bg-transparent hover:bg-hover"}`,role:"option","aria-selected":n,id:`${p}-option-${e.id}`,"data-testid":`${p}-option-${e.id}`},t.createElement(i.E,{variant:r.J3.BodySm,color:r.r7.TextDefault},e.label),n&&t.createElement(o.I,{name:a.$M.Check,size:a.lK.Sm,color:a.Li.IconDefault}))})),f[31]=k,f[32]=P,f[33]=j,f[34]=v,f[35]=m,f[36]=h,f[37]=p,f[38]=W):W=f[38];let Y;return f[39]!==Q||f[40]!==W?(Y=t.createElement(s.a,{ref:E,className:"relative"},Q,W),f[39]=Q,f[40]=W,f[41]=Y):Y=f[41],Y};function d(e){return!e}}}).call(__webpack_require__._LM_("$root$",{__webpack_require__,__webpack_exports__}))()}}]);