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

import { mergeStyles } from '../utils/merge-styles.js';
import { createStaticStyle, isStaticStyle } from './types.js';
/**
 * Build-time only function for zero-runtime static site generation.
 *
 * This function is transformed by the Babel plugin:
 * - `tastyStatic(styles)` → StaticStyle object with className
 * - `tastyStatic(base, styles)` → StaticStyle object with merged styles
 * - `tastyStatic(selector, styles)` → removed entirely
 *
 * At runtime (during development/build), this function returns a placeholder.
 * In production, all calls are replaced/removed by the build plugin.
 */
export function tastyStatic(stylesOrBaseOrSelector, styles) {
    // This code only executes if the Babel plugin hasn't processed the file yet.
    // In a properly configured build, this function is never called at runtime.
    if (typeof stylesOrBaseOrSelector === 'string') {
        // Selector mode: tastyStatic(selector, styles)
        // The plugin will remove this call entirely
        if (process.env.NODE_ENV !== 'production') {
            console.warn(`[tasty] tastyStatic('${stylesOrBaseOrSelector}', styles) was called at runtime. ` +
                'This indicates the Babel plugin is not configured. ' +
                'Add @cube-dev/ui-kit/tasty/zero/babel to your Babel config.');
        }
        return; // void
    }
    if (isStaticStyle(stylesOrBaseOrSelector)) {
        // Extension mode: tastyStatic(base, styles)
        if (process.env.NODE_ENV !== 'production') {
            console.warn('[tasty] tastyStatic(base, styles) was called at runtime. ' +
                'This indicates the Babel plugin is not configured. ' +
                'Add @cube-dev/ui-kit/tasty/zero/babel to your Babel config.');
        }
        // Merge styles for dev mode preview (won't have real classNames)
        const mergedStyles = mergeStyles(stylesOrBaseOrSelector.styles, styles || {});
        return createStaticStyle('__TASTY_STATIC_NOT_TRANSFORMED__', mergedStyles);
    }
    // Styles mode: tastyStatic(styles)
    if (process.env.NODE_ENV !== 'production') {
        console.warn('[tasty] tastyStatic(styles) was called at runtime. ' +
            'This indicates the Babel plugin is not configured. ' +
            'Add @cube-dev/ui-kit/tasty/zero/babel to your Babel config.');
    }
    // Return placeholder - styles won't be applied without the plugin
    return createStaticStyle('__TASTY_STATIC_NOT_TRANSFORMED__', stylesOrBaseOrSelector);
}

        