'use strict';

var jsxRuntime = require('../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.cjs');
var index = require('../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.cjs');
var React = require('react');
var skeleton_module = require('./skeleton.module.css.cjs');

const SkeletonContext = React.createContext(null);
const SkeletonBase = (props) => {
    const contextProps = React.useContext(SkeletonContext);
    const { baseColor, highlightColor, width, height = 'var(--rs-space-4)', borderRadius = 'var(--rs-radius-2)', inline = false, duration = 1.5, count = 1, enableAnimation = true, style, className, containerStyle, containerClassName } = { ...contextProps, ...props };
    const skeletonClassName = index.cx(skeleton_module.default.skeleton, inline && skeleton_module.default.inline, enableAnimation && skeleton_module.default.animate, className);
    const Container = inline ? 'span' : 'div';
    const defaultWidth = inline ? '50px' : '100%';
    return (jsxRuntime.jsxRuntimeExports.jsx(Container, { className: containerClassName, style: {
            display: inline ? 'inline-block' : 'flex',
            flexDirection: !inline ? 'column' : undefined,
            gap: !inline && count > 1 ? 'var(--rs-space-3)' : undefined,
            ...containerStyle
        }, children: Array.from({ length: count }).map((_, i) => (jsxRuntime.jsxRuntimeExports.jsx("span", { className: skeletonClassName, style: {
                width: width ?? defaultWidth,
                height,
                borderRadius,
                '--skeleton-base-color': baseColor,
                '--skeleton-highlight-color': highlightColor,
                '--skeleton-duration': `${duration}s`,
                ...style
            } }, i))) }));
};
const Provider = ({ children, ...props }) => {
    return (jsxRuntime.jsxRuntimeExports.jsx(SkeletonContext.Provider, { value: props, children: children }));
};
const Skeleton = Object.assign(SkeletonBase, { Provider });

exports.Skeleton = Skeleton;
//# sourceMappingURL=skeleton.cjs.map
