import { forwardRef } from 'react';
import Button$2 from '../LegacyButton/Button.mjs';
import Button$1 from '../Button/src/Button.mjs';
import { jsx } from 'react/jsx-runtime';

/* eslint-disable @typescript-eslint/no-unsafe-assignment */
const mapProps = props => {
  const {
    priority,
    size,
    type,
    as,
    ...newProps
  } = props;
  const priorityMapping = {
    accent: {
      primary: 'primary',
      secondary: 'tertiary',
      tertiary: 'minimal'
    },
    positive: {
      primary: 'primary',
      secondary: 'tertiary',
      tertiary: 'tertiary'
    },
    negative: {
      primary: 'primary',
      secondary: 'secondary',
      tertiary: 'secondary'
    }
  };
  const mappedPriority = type && priority ? priorityMapping[type]?.[priority] || priority : priority || undefined;
  const mappedAppearance = type === 'negative' ? 'negative' : undefined;
  return {
    ...newProps,
    size: size === 'xs' || size === 'sm' ? 'sm' : size === 'md' ? 'md' : size === 'lg' ? 'lg' : size,
    priority: mappedPriority,
    appearance: mappedAppearance || ('appearance' in props ? props.appearance : undefined),
    type: as === 'button' ? props.htmlType : undefined,
    href: as === 'a' ? props.href || '' : undefined
  };
};
const Button = /*#__PURE__*/forwardRef(({
  useNewButton = false,
  ...props
}, ref) => {
  if (useNewButton) {
    const mappedProps = mapProps(props);
    return /*#__PURE__*/jsx(Button$1, {
      ...mappedProps,
      ref: ref
    });
  }
  return /*#__PURE__*/jsx(Button$2, {
    ...props,
    ref: ref
  });
});
Button.displayName = 'Button';

export { Button as default };
//# sourceMappingURL=Button.mjs.map
