"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useStateWithStyleProps = void 0;
var _lodash = _interopRequireDefault(require("lodash"));
var _useTheme = require("./useTheme");
var _utils = require("./utils/utils");
var _react = require("react");
var _reactNative = require("react-native");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
 * Returns a state object with style properties.
 * @param props - The props to extract style properties from.
 * @param styleFunctions - An array of style functions to apply to the props.
 * @returns A state object with style properties.
 */
const useStateWithStyleProps = (props, styleFunctions) => {
  const {
    theme,
    colorMode
  } = (0, _useTheme.useTheme)();
  const dimensions = (0, _reactNative.useWindowDimensions)();

  // Compose the style functions
  const buildStyleProperties = (0, _react.useMemo)(() => (0, _utils.composeStyleProps)(styleFunctions), [styleFunctions]);

  // If props is falsy, return an empty object.
  if (_lodash.default.isEmpty(props)) {
    return {};
  }

  // Compose clean style properties from props, buildStyleProperties, theme, and dimensions.
  // Use memoization to avoid unnecessary computations.
  return (0, _utils.composeCleanStyleProps)(props, buildStyleProperties, {
    theme,
    colorMode,
    dimensions
  });
};
exports.useStateWithStyleProps = useStateWithStyleProps;
//# sourceMappingURL=useStateWithStyleProps.js.map