import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { create } from "../../../modal/modalHelper";
import { ChainListView } from "./chainListView";
import { useModal } from "../../../modal";
import { Dialog, DialogBody, DialogContent, DialogHeader, DialogTitle } from "../../../dialog/dialog";
export const ChainDialog = create((props)=>{
    const { visible, onOpenChange, hide, resolve } = useModal();
    const { onItemClick, ...rest } = props;
    const _onItemClick = async (value)=>{
        const result = onItemClick?.(value) || value;
        resolve(result);
        hide();
    };
    const _onOpenChange = (open)=>{
        if (!open) {
            resolve("cancel");
        }
        onOpenChange(open);
    };
    return /*#__PURE__*/ _jsx(Dialog, {
        open: visible,
        onOpenChange: _onOpenChange,
        children: /*#__PURE__*/ _jsxs(DialogContent, {
            onOpenAutoFocus: (event)=>event.preventDefault(),
            closable: true,
            children: [
                /*#__PURE__*/ _jsx(DialogHeader, {
                    children: /*#__PURE__*/ _jsx(DialogTitle, {
                        className: "orderly-switch-network-dialog-title",
                        children: "Switch network"
                    })
                }),
                /*#__PURE__*/ _jsx(DialogBody, {
                    className: "orderly-max-h-[335.5px] orderly-overflow-y-auto",
                    children: /*#__PURE__*/ _jsx(ChainListView, {
                        ...rest,
                        onItemClick: _onItemClick
                    })
                })
            ]
        })
    });
});

//# sourceMappingURL=chainDialog.js.map