"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _styleFunctions = require("../../../theme/src/style-functions");
var _vectorIcons = require("@expo/vector-icons");
var _responsiveSize = _interopRequireDefault(require("../../../utils/responsive-size"));
var _pearl = require("../../../pearl");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
const iconStyleFunctions = [_styleFunctions.colorStyleFunction, _styleFunctions.backgroundColorStyleFunction, _styleFunctions.spacingStyleFunction, _styleFunctions.layoutStyleFunction, _styleFunctions.opacityStyleFunction, _styleFunctions.visibleStyleFunction];

// BaseIconProps defines the basic properties for the Icon component

// Mapping of icon families to their respective components
const iconFamilyMapping = {
  AntDesign: _vectorIcons.AntDesign,
  Entypo: _vectorIcons.Entypo,
  EvilIcons: _vectorIcons.EvilIcons,
  Feather: _vectorIcons.Feather,
  FontAwesome: _vectorIcons.FontAwesome,
  FontAwesome5: _vectorIcons.FontAwesome5,
  Fontisto: _vectorIcons.Fontisto,
  Foundation: _vectorIcons.Foundation,
  Ionicons: _vectorIcons.Ionicons,
  MaterialCommunityIcons: _vectorIcons.MaterialCommunityIcons,
  MaterialIcons: _vectorIcons.MaterialIcons,
  Octicons: _vectorIcons.Octicons,
  SimpleLineIcons: _vectorIcons.SimpleLineIcons,
  Zocial: _vectorIcons.Zocial
};

// CustomIcon is a wrapper around the icon components that allows for additional customization
const CustomIcon = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef(({
  iconFamily,
  iconName,
  accessibilityLabel = undefined,
  rawSize = undefined,
  ...props
}, ref) => {
  // Select the appropriate icon component based on the iconFamily prop
  const IconToUse = iconFamilyMapping[iconFamily];
  return /*#__PURE__*/_react.default.createElement(IconToUse, _extends({
    accessible: true,
    accessibilityLabel: accessibilityLabel ? accessibilityLabel : `${iconName} Icon`,
    name: iconName
  }, props, {
    ref: ref,
    size: (0, _responsiveSize.default)(rawSize)
  }));
}));

/** The `Icon` component can used to add Expo Icons to your app and customize them using style props. */
const Icon = (0, _pearl.pearl)(CustomIcon, {
  componentName: "Icon",
  type: "atom",
  animatable: true
}, iconStyleFunctions);
Icon.displayName = "Icon";
var _default = exports.default = Icon;
//# sourceMappingURL=icon.js.map