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

const mapProps = props => {
  const {
    priority,
    size,
    type,
    ...newProps
  } = props;
  const priorityMapping = {
    accent: {
      primary: 'primary',
      secondary: 'secondary-neutral',
      tertiary: 'tertiary'
    },
    positive: {
      primary: 'primary',
      secondary: 'secondary-neutral',
      tertiary: 'secondary-neutral'
    },
    negative: {
      primary: 'primary',
      secondary: 'secondary',
      tertiary: 'secondary'
    }
  };
  const mappedPriority = type && priority ? priorityMapping[type]?.[priority] || priority : priority || undefined;
  const mappedSentiment = type === 'negative' ? 'negative' : undefined;
  const legacyButtonTypes = ['accent', 'negative', 'positive', 'primary', 'pay', 'secondary', 'danger', 'link'];
  const resolveSize = () => {
    if (size) {
      return {
        xs: 'sm',
        sm: 'sm',
        md: 'md',
        lg: 'lg'
      }[size] || size;
    }
    return size;
  };
  return {
    ...newProps,
    size: resolveSize(),
    priority: mappedPriority,
    sentiment: mappedSentiment || ('sentiment' in props ? props.sentiment : null),
    type: type && !legacyButtonTypes.includes(type) ? type : props.htmlType || null,
    v2: true
  };
};
const Button = /*#__PURE__*/forwardRef(({
  v2 = false,
  ...props
}, ref) => {
  if (v2) {
    const mappedProps = mapProps(props);
    return /*#__PURE__*/jsx(Button$1, {
      ...mappedProps,
      ref: ref
    });
  }
  return /*#__PURE__*/jsx(LegacyButton, {
    ...props,
    ref: ref
  });
});
Button.displayName = 'Button';

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