"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.PromptInputSubmitButton = PromptInputSubmitButton;
var _react = _interopRequireDefault(require("react"));
var _reactNative = require("react-native");
var _useTheme = require("../theme/use-theme.js");
var _context = require("./context.js");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function PromptInputSubmitButton({
  isLoading,
  onStop,
  emptyAction,
  submitIcon,
  stopIcon,
  style,
  testID
}) {
  const {
    onSubmit,
    value,
    attachments
  } = (0, _context.usePromptInput)();
  const theme = (0, _useTheme.useTheme)();
  const hasContent = value.trim().length > 0 || attachments.length > 0;
  if (isLoading && onStop) {
    return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
      onPress: onStop,
      activeOpacity: 0.7,
      style: [{
        width: 32,
        height: 32,
        borderRadius: 16,
        backgroundColor: theme.colors.primary,
        alignItems: 'center',
        justifyContent: 'center'
      }, style],
      testID: testID,
      children: stopIcon ?? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
        style: {
          fontSize: 12,
          color: theme.colors.primaryForeground,
          fontWeight: '700'
        },
        children: "\u25A0"
      })
    });
  }
  if (!hasContent && emptyAction) {
    return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
      children: emptyAction
    });
  }
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
    onPress: onSubmit,
    disabled: !hasContent,
    activeOpacity: 0.7,
    style: [{
      width: 32,
      height: 32,
      borderRadius: 16,
      backgroundColor: theme.colors.primary,
      alignItems: 'center',
      justifyContent: 'center',
      opacity: hasContent ? 1 : 0.4
    }, style],
    testID: testID,
    children: submitIcon ?? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
      style: {
        fontSize: 16,
        color: theme.colors.primaryForeground,
        fontWeight: '700'
      },
      children: "\u2191"
    })
  });
}
PromptInputSubmitButton.displayName = 'PromptInputSubmitButton';
//# sourceMappingURL=SubmitButton.js.map