'use client';'use strict';

var chunk436W23NL_cjs = require('./chunk-436W23NL.cjs');
var chunk6U6JVUY3_cjs = require('./chunk-6U6JVUY3.cjs');
var chunkPMYXMQ3L_cjs = require('./chunk-PMYXMQ3L.cjs');
var chunkQOC26J56_cjs = require('./chunk-QOC26J56.cjs');
var chunkYF5YSZHI_cjs = require('./chunk-YF5YSZHI.cjs');
var chunk2LH5NLJF_cjs = require('./chunk-2LH5NLJF.cjs');
var chunk5XB54L7P_cjs = require('./chunk-5XB54L7P.cjs');
var css = require('@onbeam/styled-system/css');
var recipes = require('@onbeam/styled-system/recipes');
var jsxRuntime = require('react/jsx-runtime');
var react = require('react');
var reactDialog = require('@radix-ui/react-dialog');

var b=chunk5XB54L7P_cjs.a(({as:x="div",id:N,name:y,subname:l,logo:n,detailCaption:m,detailLabel:r,className:g,isSelected:f,isDisabled:v,onClick:S,action:a,address:k,chainId:C,...P},c)=>{let t=recipes.selectModal(),s=v||f;return jsxRuntime.jsxs(x,{ref:c,tabIndex:s?-1:0,"aria-disabled":s,className:css.cx(t.listItem,t.listItemHover,g),onClick:s?void 0:()=>S?.(N),...P,children:[jsxRuntime.jsxs("div",{className:t.token,children:[jsxRuntime.jsx(chunk436W23NL_cjs.a,{as:"div",disabled:s,disableChevron:!0,icon:n,children:y}),l&&jsxRuntime.jsx("span",{className:t.tokenSubname,children:l})]}),a&&jsxRuntime.jsxs("div",{className:t.action,children:[jsxRuntime.jsx("p",{children:a.title}),jsxRuntime.jsx("div",{onClick:d=>d.stopPropagation(),onKeyDown:d=>d.stopPropagation(),children:jsxRuntime.jsx(chunk6U6JVUY3_cjs.a,{as:"span",role:"button",tabIndex:0,onClick:a.onClick,className:t.actionButton,children:a.buttonLabel})})]}),(r||m)&&jsxRuntime.jsxs("div",{className:t.detail,children:[r&&jsxRuntime.jsx("span",{className:t.detailLabel,"data-selected":f,children:r}),m&&jsxRuntime.jsx("span",{className:t.detailCaption,children:m})]})]})});b.displayName="SelectModalItem";var R=chunk5XB54L7P_cjs.a(({as:x="div",label:N,searchPlaceholder:y="search",items:l=[],selectedId:n,title:m,listTitle:r,onChange:g,onOpenChange:f,searchQuery:v,onSearch:S,sort:a,filter:k,...C},P)=>{let[c,t]=react.useState(l.find(e=>e.id===n)),s=k?l.filter(k):l,d=a?[...s].sort(a):s,p=recipes.selectModal();return react.useEffect(()=>{t(l.find(e=>e.id===n));},[l,n]),jsxRuntime.jsx(chunk2LH5NLJF_cjs.a,{description:"select an item",hideDescription:!0,trigger:jsxRuntime.jsx(chunk436W23NL_cjs.a,{icon:c?.logo,label:jsxRuntime.jsx(chunkQOC26J56_cjs.a,{children:N}),children:c?.name||"select"}),title:m,onOpenChange:e=>f?.(e),children:jsxRuntime.jsxs("div",{ref:P,...C,children:[S&&v!==void 0&&jsxRuntime.jsx(chunkYF5YSZHI_cjs.a,{type:"search",placeholder:y,className:p.search,value:v,onChange:e=>{S(e.currentTarget.value);}}),r&&jsxRuntime.jsx("span",{className:p.listTitle,children:r}),jsxRuntime.jsx("div",{className:css.cx(recipes.gridBackground(),recipes.noiseBackground(),p.box),children:jsxRuntime.jsxs("ul",{children:[d.map((e,_)=>jsxRuntime.jsxs("li",{children:[_!==0&&jsxRuntime.jsx(chunkPMYXMQ3L_cjs.a,{}),jsxRuntime.jsx(b,{as:reactDialog.Close,onClick:E=>g?.(E,e),isSelected:e.id===c?.id,...e})]},e.id)),!d.length&&jsxRuntime.jsx("li",{className:css.cx(p.listItem,p.emptyText),children:"no results were found"})]})})]})})});R.displayName="SelectModal";var U={Item:b};

exports.a = R;
exports.b = U;
//# sourceMappingURL=out.js.map
//# sourceMappingURL=chunk-HDEAOL4C.cjs.map