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;
}
import { Progress } from "antd";
import React, { cloneElement } from "react";
import { LoadingLottie } from "../lotties/LoadingLottie";
var defaultStrokeColor = {
    '0%': '#09D6FF',
    '28%': '#9BA0FF',
    '38%': '#D7B9FF',
    '42%': '#FFFFFF',
    '52%': '#23E800',
    '100%': '#23E800'
};
/**
 * Indicator 组件 - 加载指示器
 *
 * 根据配置显示不同的加载指示器：
 * - 如果提供了自定义 indicator，则显示自定义指示器
 * - 如果提供了 percent，则显示进度圆环
 * - 否则显示默认的 LoadingLottie 动画
 *
 * @component
 * @description 加载指示器组件，支持自定义指示器、进度显示和默认动画
 *
 * @param {IndicatorProps} props - 组件属性
 * @param {string | number} [props.size] - 指示器的大小，可以是数字（像素）或字符串（如 '1em'），继承自 LoadingLottieProps
 * @param {React.ReactNode} [props.indicator] - 自定义加载指示器
 * @param {number} [props.percent] - 加载进度百分比（0-100）
 *
 * @example
 * ```tsx
 * // 默认动画
 * <Indicator size={64} />
 *
 * // 显示进度
 * <Indicator percent={75} size={64} />
 *
 * // 自定义指示器
 * <Indicator indicator={<CustomSpinner />} />
 * ```
 *
 * @returns {React.ReactElement} 渲染的加载指示器组件
 */ function Indicator(param) {
    var indicator = param.indicator, percent = param.percent, size = param.size, style = param.style;
    if (indicator && /*#__PURE__*/ React.isValidElement(indicator)) {
        var _indicator_props;
        var indicatorProps = (_indicator_props = indicator.props) !== null && _indicator_props !== void 0 ? _indicator_props : {};
        return /*#__PURE__*/ cloneElement(indicator, {
            style: _object_spread({}, indicatorProps.style, style),
            percent: percent
        });
    }
    if (percent !== undefined && percent !== null) {
        return /*#__PURE__*/ React.createElement(Progress, {
            type: "circle",
            percent: percent,
            strokeColor: defaultStrokeColor,
            size: size,
            showInfo: false,
            strokeWidth: 12,
            style: style
        });
    }
    return /*#__PURE__*/ React.createElement(LoadingLottie, {
        size: size,
        style: style
    });
}
export default Indicator;
