"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.RadioIndicator = void 0;
var _react = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _useTheme = require("../theme/use-theme.js");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
const RadioIndicatorComponent = ({
  selected,
  size = 20,
  selectedColor,
  borderColor,
  style,
  testID
}) => {
  const theme = (0, _useTheme.useTheme)();
  const resolvedSelectedColor = selectedColor ?? theme.colors.primary;
  const resolvedBorderColor = borderColor ?? theme.colors.border;
  // The inner dot sits on `resolvedSelectedColor`. When that is the theme
  // primary, use the preset's readable foreground (white for blue, black for
  // yellow). A caller-supplied custom color falls back to white.
  const dotColor = selectedColor == null ? theme.colors.primaryForeground : '#FFFFFF';
  const dotSize = size * 0.5;
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
    testID: testID,
    style: [{
      width: size,
      height: size,
      borderRadius: size / 2,
      borderWidth: selected ? 0 : 2,
      borderColor: selected ? undefined : resolvedBorderColor,
      backgroundColor: selected ? resolvedSelectedColor : 'transparent',
      alignItems: 'center',
      justifyContent: 'center'
    }, style],
    children: selected && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
      style: {
        width: dotSize,
        height: dotSize,
        borderRadius: dotSize / 2,
        backgroundColor: dotColor
      }
    })
  });
};
const RadioIndicator = exports.RadioIndicator = /*#__PURE__*/(0, _react.memo)(RadioIndicatorComponent);
RadioIndicator.displayName = 'RadioIndicator';
//# sourceMappingURL=RadioIndicator.js.map