function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}
function _object_spread(target) {
    for(var i = 1; i < arguments.length; i++){
        var source = arguments[i] != null ? arguments[i] : {};
        var ownKeys = Object.keys(source);
        if (typeof Object.getOwnPropertySymbols === "function") {
            ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
                return Object.getOwnPropertyDescriptor(source, sym).enumerable;
            }));
        }
        ownKeys.forEach(function(key) {
            _define_property(target, key, source[key]);
        });
    }
    return target;
}
function ownKeys(object, enumerableOnly) {
    var keys = Object.keys(object);
    if (Object.getOwnPropertySymbols) {
        var symbols = Object.getOwnPropertySymbols(object);
        if (enumerableOnly) {
            symbols = symbols.filter(function(sym) {
                return Object.getOwnPropertyDescriptor(object, sym).enumerable;
            });
        }
        keys.push.apply(keys, symbols);
    }
    return keys;
}
function _object_spread_props(target, source) {
    source = source != null ? source : {};
    if (Object.getOwnPropertyDescriptors) {
        Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
    } else {
        ownKeys(Object(source)).forEach(function(key) {
            Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
        });
    }
    return target;
}
import { useEditorStyleRegister } from "../../Hooks/useStyle";
var genStyle = function genStyle(token) {
    return _define_property({}, token.componentCls, {
        marginBottom: '0.75em',
        cursor: 'default',
        userSelect: 'none',
        padding: '0.75rem 0',
        borderRadius: '1em',
        maxWidth: '800px',
        border: '1px solid #e8e8e8',
        backgroundColor: '#fff',
        minWidth: '240px',
        minHeight: '200px',
        display: 'flex',
        justifyContent: 'center',
        alignItems: 'center',
        flexDirection: 'column',
        position: 'relative',
        isolation: 'isolate',
        contain: 'layout style paint',
        overflow: 'hidden',
        transition: 'height 0.3s ease, min-height 0.3s ease',
        '& [data-mermaid-container="true"]': {
            width: '100%',
            display: 'flex',
            justifyContent: 'center',
            position: 'relative',
            isolation: 'isolate',
            contain: 'layout style paint',
            overflow: 'hidden',
            transition: 'opacity 0.3s ease, height 0.3s ease, min-height 0.3s ease, max-height 0.3s ease'
        },
        '& [data-mermaid-wrapper]': {
            position: 'relative',
            width: '100%',
            maxWidth: '100%',
            overflow: 'hidden',
            isolation: 'isolate',
            contain: 'layout style paint',
            display: 'flex',
            justifyContent: 'center',
            alignItems: 'center',
            minHeight: '200px'
        },
        '& [data-mermaid-svg="true"]': {
            maxWidth: '100%',
            height: 'auto',
            overflow: 'hidden'
        },
        '&-error': {
            textAlign: 'center',
            color: 'rgba(239, 68, 68, 0.8)',
            padding: '0.5rem',
            flex: 1,
            position: 'relative',
            zIndex: 1,
            wordBreak: 'break-word',
            maxWidth: '100%',
            height: '100%',
            width: '100%',
            animation: 'agenticMermaidFadeIn 0.3s ease'
        },
        '&-empty': {
            textAlign: 'left',
            color: '#6B7280',
            padding: '0.75rem 1.5rem',
            position: 'relative',
            zIndex: 1,
            flex: 1,
            height: '100%',
            width: '100%',
            fontFamily: "ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace",
            fontSize: '0.875em',
            lineHeight: 1.7,
            animation: 'agenticMermaidFadeIn 0.3s ease'
        },
        '@keyframes agenticMermaidFadeIn': {
            from: {
                opacity: 0
            },
            to: {
                opacity: 1
            }
        },
        '& svg': {
            '& .node': {
                '& rect, & circle, & ellipse, & polygon': {
                    stroke: '#333',
                    strokeWidth: '1px',
                    fill: '#fff'
                }
            },
            '& text': {
                dominantBaseline: 'middle',
                textAnchor: 'middle'
            },
            '& .nodeLabel': {
                fontWeight: 500,
                fill: '#333 !important'
            },
            '& .edgeLabel': {
                fill: '#666 !important'
            },
            '& .flowchart-label': {
                fill: '#333 !important'
            },
            '& .label': {
                fill: '#333 !important'
            }
        }
    });
};
export function useStyle(prefixCls) {
    return useEditorStyleRegister('agentic-plugin-mermaid', function(token) {
        var editorToken = _object_spread_props(_object_spread({}, token), {
            componentCls: ".".concat(prefixCls)
        });
        return [
            genStyle(editorToken)
        ];
    });
}
