import utilClasses from "../../styles/utility.module.scss";
const getBorderClasses = function getBorderClasses(border, options = {}) {
  const {
    classAttributes = ['color', 'width', 'style'],
    default: defaultBorder = {
      color: 'gray-20',
      width: 1,
      style: 'solid'
    }
  } = options;
  if (!border || border === 'none') {
    return [[], {}];
  }
  const inputBorder = typeof border === 'string' ? {
    color: border
  } : border;
  const {
    color = defaultBorder.color,
    width = defaultBorder.width,
    style = defaultBorder.style
  } = inputBorder;
  const normalizedBorder = {
    color,
    width,
    style
  };
  const borderClassAttributes = new Set(classAttributes);
  const borderAttributes = ['color', 'width', 'style'].map(attr => ({
    className: borderClassAttributes.has(attr) ? `border-${attr}-${normalizedBorder[attr]}` : undefined,
    name: attr,
    value: normalizedBorder[attr]
  }));
  return borderAttributes.reduce(([classes, values], attr) => {
    if (utilClasses[attr.className]) {
      return [[...classes, attr.className], values];
    }
    return [classes, {
      ...values,
      [attr.name]: attr.value
    }];
  }, [[], {}]);
};
export default getBorderClasses;