/**
 * @license MIT
 * author: Cube Dev Team
 * @cube-dev/ui-kit v0.0.0-canary-c2a807a
 * Released under the MIT license.
 */

import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Flow } from '../../layout/Flow.js';
import { Grid } from '../../layout/Grid.js';
import { Space } from '../../layout/Space.js';
import { Placeholder } from '../Placeholder/Placeholder.js';
const LAYOUT_MAP = {
    page({ lines, children, isStatic = false, rootProps, }) {
        return (_jsxs(Flow, { gap: "4x", ...rootProps, children: [_jsxs(Space, { placeContent: "space-between", children: [_jsx(Placeholder, { isStatic: isStatic, width: "100px 25% 300px" }), _jsx(Placeholder, { isStatic: isStatic, width: "50px 10% 150px" })] }), _jsx(Flow, { gap: "2x", children: children ||
                        Array(lines || 5)
                            .fill(0)
                            .map((item, i) => _jsx(Placeholder, { isStatic: isStatic }, i)) })] }));
    },
    content({ children, lines, isStatic = false, rootProps, }) {
        return (_jsx(Flow, { gap: "2x", ...rootProps, children: children ||
                Array(lines || 5)
                    .fill(0)
                    .map((item, i) => _jsx(Placeholder, { isStatic: isStatic }, i)) }));
    },
    topbar({ isStatic = false, rootProps }) {
        return (_jsxs(Space, { gap: "4x", placeContent: "space-between", height: "6x", padding: "1x", border: "bottom", ...rootProps, children: [_jsxs(Space, { children: [_jsx(Placeholder, { circle: true, isStatic: isStatic, size: "4x" }), _jsx(Placeholder, { isStatic: isStatic, width: "20x" })] }), _jsxs(Space, { children: [_jsx(Placeholder, { isStatic: isStatic, width: "10x" }), _jsx(Placeholder, { circle: true, isStatic: isStatic, size: "4x" })] })] }));
    },
    menu({ lines, isStatic = false, rootProps }) {
        return (_jsx(Flow, { gap: "3.25x", padding: "3x 1x", ...rootProps, children: Array(lines || 5)
                .fill(0)
                .map((item, i) => (_jsx(Placeholder, { isStatic: isStatic }, i))) }));
    },
    stats({ cards, isStatic = false, rootProps }) {
        return (_jsx(Space, { gap: "4x", ...rootProps, children: Array(cards || 3)
                .fill(0)
                .map((item, i) => (_jsx(Placeholder, { isStatic: isStatic, radius: "1r", width: "20x", height: "12x", flexGrow: 1 }, i))) }));
    },
    tabs({ tabs, children, lines, isStatic = false, rootProps, }) {
        return (_jsxs(Flow, { gap: "4x", ...rootProps, children: [_jsx(Space, { children: Array(tabs || 3)
                        .fill(0)
                        .map((item, i) => (_jsx(Placeholder, { isStatic: isStatic, width: "15x" }, i))) }), _jsx(Flow, { gap: "2x", children: children ||
                        Array(lines || 5)
                            .fill(0)
                            .map((item, i) => _jsx(Placeholder, { isStatic: isStatic }, i)) })] }));
    },
    table({ rows, columns, isStatic = false, rootProps, }) {
        columns = columns || 5;
        rows = rows || 5;
        return (_jsx(Grid, { columns: `repeat(${columns}, 1fr)`, gap: "3x", padding: "1x 0", ...rootProps, children: Array(rows)
                .fill(0)
                .map((item, i) => {
                return Array(columns)
                    .fill(0)
                    .map((item, j) => {
                    return (_jsx(Placeholder, { isStatic: isStatic, size: !i ? '3x' : '2x' }, `${i}.${j}`));
                });
            }) }));
    },
    chart({ columns, isStatic = false, rootProps }) {
        columns = columns || 12;
        const heightMap = [1, 4, 2, 5, 8, 9, 5, 3, 4, 2, 6, 7, 2];
        return (_jsx(Grid, { columns: `repeat(${columns}, 1fr)`, gap: "3x", padding: "1x 0", placeItems: "end stretch", height: "40x", ...rootProps, children: Array(columns)
                .fill(0)
                .map((item, i) => {
                return (_jsx(Placeholder, { isStatic: isStatic, height: `${heightMap[i % 12] * 10}%`, width: "max 6x" }, i));
            }) }));
    },
};
export function Skeleton({ layout, isStatic, columns, rows, lines, tabs, cards, ...props }) {
    layout = layout || 'page';
    return LAYOUT_MAP[layout] ? (LAYOUT_MAP[layout]({
        isStatic,
        columns,
        rows,
        lines,
        tabs,
        cards,
        rootProps: { qa: 'Skeleton', ...props },
    })) : (_jsx(Placeholder, { qa: "Skeleton", isStatic: isStatic, ...props }));
}

        