"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const React = __importStar(require("react"));
const classnames_1 = __importDefault(require("classnames"));
const action_button_1 = __importDefault(require("./action-button"));
const context_1 = require("../context");
// SVG Icon for send button using base64 image data
const ArrowUpIcon = () => {
    const context = React.useContext(context_1.ActionButtonContext);
    const prefixCls = context === null || context === void 0 ? void 0 : context.prefixCls;
    const base64Image = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAADW0lEQVR4AeyYgVXbMBRFnU5AN4ANygSlE5RuABMUJoBOABtAJ6CdADpB2QA2gA3ovYqUI4xbF1t2HI5z9Cz5S5b+0/uS7Lyr3vhvJrjpAs8KzgpOfAbmEJ24QK3uzQq2TtHEG8wKTlygV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ixCls}-send-icon` },
        React.createElement("svg", { width: "28", height: "28", viewBox: "0 0 28 28", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
            React.createElement("image", { href: base64Image, width: "28", height: "28" }))));
};
function SendButton(props, ref) {
    const { className, style, disabled: disabledFromProps, ...restProps } = props;
    const context = React.useContext(context_1.ActionButtonContext);
    const prefixCls = context === null || context === void 0 ? void 0 : context.prefixCls;
    const { icon: customIcon, disabled: disabledFromContext, ...sendButtonRestProps } = (context === null || context === void 0 ? void 0 : context.sendButtonProps) || {};
    // 编辑态等通过 sendButtonProps.disabled 传入的禁用优先，其次使用父级传入的 disabled
    const disabled = disabledFromContext !== null && disabledFromContext !== void 0 ? disabledFromContext : disabledFromProps;
    // 使用自定义图标，如果没有提供则使用默认图标
    const icon = customIcon || React.createElement(ArrowUpIcon, null);
    return (React.createElement(action_button_1.default, { icon: icon, type: "button", shape: "circle", ...sendButtonRestProps, ...restProps, action: "onSend", ref: ref, disabled: disabled, className: (0, classnames_1.default)(`${prefixCls}-send`, className, sendButtonRestProps === null || sendButtonRestProps === void 0 ? void 0 : sendButtonRestProps.className, {
            [`${prefixCls}-send-disabled`]: disabled,
        }), style: style }));
}
exports.default = React.forwardRef(SendButton);
