import { merge } from "lodash-es";
function mergeSxValues(values, theme, helpers) {
  const css = values.reduce((ret, partial) => {
    if (!partial) {
      return ret;
    }
    if (Array.isArray(partial)) {
      return mergeSxValues(partial, theme, helpers);
    }
    return merge(ret, typeof partial === "function" ? partial(theme, helpers) : partial);
  }, {});
  return css;
}
function mergeSxList(sxList) {
  return (theme, helpers) => mergeSxValues(sxList, theme, helpers);
}
function mergeStylesList(stylesList) {
  return (theme, props, helpers) => {
    const css = stylesList.reduce(
      (prev, partial) => typeof partial === "function" ? merge(prev, partial(theme, props, helpers)) : merge(prev, partial),
      {}
    );
    return css;
  };
}
export {
  mergeStylesList,
  mergeSxList
};
