'use client';import { a as a$1 } from './chunk-WMAWUYGF.js';
import { a as a$2 } from './chunk-EB33T44P.js';
import { a as a$6 } from './chunk-MC4SJ7US.js';
import { a as a$4 } from './chunk-F2KWYQOD.js';
import { a as a$5 } from './chunk-CXK4UZYG.js';
import { a as a$3 } from './chunk-STMS6J6O.js';
import { a } from './chunk-TWGPE4V7.js';
import { cx } from '@onbeam/styled-system/css';
import { selectModal, gridBackground, noiseBackground } from '@onbeam/styled-system/recipes';
import { jsxs, jsx } from 'react/jsx-runtime';
import { useState, useEffect } from 'react';
import { Close } from '@radix-ui/react-dialog';

var b=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=selectModal(),s=v||f;return jsxs(x,{ref:c,tabIndex:s?-1:0,"aria-disabled":s,className:cx(t.listItem,t.listItemHover,g),onClick:s?void 0:()=>S?.(N),...P,children:[jsxs("div",{className:t.token,children:[jsx(a$1,{as:"div",disabled:s,disableChevron:!0,icon:n,children:y}),l&&jsx("span",{className:t.tokenSubname,children:l})]}),a&&jsxs("div",{className:t.action,children:[jsx("p",{children:a.title}),jsx("div",{onClick:d=>d.stopPropagation(),onKeyDown:d=>d.stopPropagation(),children:jsx(a$2,{as:"span",role:"button",tabIndex:0,onClick:a.onClick,className:t.actionButton,children:a.buttonLabel})})]}),(r||m)&&jsxs("div",{className:t.detail,children:[r&&jsx("span",{className:t.detailLabel,"data-selected":f,children:r}),m&&jsx("span",{className:t.detailCaption,children:m})]})]})});b.displayName="SelectModalItem";var R=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]=useState(l.find(e=>e.id===n)),s=k?l.filter(k):l,d=a?[...s].sort(a):s,p=selectModal();return useEffect(()=>{t(l.find(e=>e.id===n));},[l,n]),jsx(a$3,{description:"select an item",hideDescription:!0,trigger:jsx(a$1,{icon:c?.logo,label:jsx(a$4,{children:N}),children:c?.name||"select"}),title:m,onOpenChange:e=>f?.(e),children:jsxs("div",{ref:P,...C,children:[S&&v!==void 0&&jsx(a$5,{type:"search",placeholder:y,className:p.search,value:v,onChange:e=>{S(e.currentTarget.value);}}),r&&jsx("span",{className:p.listTitle,children:r}),jsx("div",{className:cx(gridBackground(),noiseBackground(),p.box),children:jsxs("ul",{children:[d.map((e,_)=>jsxs("li",{children:[_!==0&&jsx(a$6,{}),jsx(b,{as:Close,onClick:E=>g?.(E,e),isSelected:e.id===c?.id,...e})]},e.id)),!d.length&&jsx("li",{className:cx(p.listItem,p.emptyText),children:"no results were found"})]})})]})})});R.displayName="SelectModal";var U={Item:b};

export { R as a, U as b };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=chunk-D4B2D356.js.map