import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import * as Ariakit from '@ariakit/react';
import { getClassNames } from '@websolutespa/bom-core';
import { useLabel } from '@websolutespa/bom-mixer-hooks';
import { IconLlmAside, IconLlmX } from '@websolutespa/bom-mixer-icons';
import { useLlm } from '@websolutespa/bom-mixer-llm';
import style from './page-menu.module.scss';
// export type PageMenuPlacement = 'left' | 'right';
export const PageMenu = ()=>{
    const label = useLabel();
    const { PageHistory } = useLlm((state)=>state.components);
    const asideEnabled = useLlm((state)=>state.asideEnabled);
    const history = useLlm((state)=>state.history);
    const { toggleAside } = useLlm((state)=>state.actions);
    return /*#__PURE__*/ _jsxs(Ariakit.DialogProvider, {
        open: asideEnabled,
        children: [
            /*#__PURE__*/ _jsx(Ariakit.DialogDisclosure, {
                render: /*#__PURE__*/ _jsx("button", {
                    type: "button",
                    className: getClassNames(style.menu),
                    "aria-label": asideEnabled ? label('llm.menuClose') : label('llm.menuOpen'),
                    "aria-pressed": asideEnabled,
                    onClick: ()=>toggleAside(),
                    children: /*#__PURE__*/ _jsx(IconLlmAside, {})
                })
            }),
            /*#__PURE__*/ _jsxs(Ariakit.Dialog, {
                className: style.dialog,
                "data-lenis-prevent": true,
                backdrop: /*#__PURE__*/ _jsx("div", {
                    className: style.backdrop
                }),
                onClose: ()=>toggleAside(),
                children: [
                    /*#__PURE__*/ _jsxs("div", {
                        className: style.head,
                        children: [
                            /*#__PURE__*/ _jsx(IconLlmAside, {}),
                            /*#__PURE__*/ _jsx(Ariakit.DialogHeading, {
                                className: style.title,
                                children: "Le tue ricerche"
                            }),
                            /*#__PURE__*/ _jsx(Ariakit.DialogDismiss, {
                                render: /*#__PURE__*/ _jsx("button", {
                                    className: getClassNames(style.close),
                                    children: /*#__PURE__*/ _jsx(IconLlmX, {})
                                })
                            })
                        ]
                    }),
                    /*#__PURE__*/ _jsx("div", {
                        className: style.listing,
                        children: history.length > 0 ? history.map((item, i)=>/*#__PURE__*/ _jsx(PageHistory, {
                                item: item
                            }, `history-${i}`)) : /*#__PURE__*/ _jsx("div", {
                            className: style.empty,
                            children: label('llm.historyEmpty')
                        })
                    })
                ]
            })
        ]
    });
};

//# sourceMappingURL=page-menu.js.map