import { define } from "../preactement/define";
import Button from "../../Button/Button";
import { analyticsOverrideAttrs, analyticsParentDataAttrs } from "../shared-attributes/analytics";
import { onAnalyticsEvent } from "../analytics";
import { jsx as _jsx } from "preact/compat/jsx-runtime";
const attributes = ['class-name', 'disabled', 'href', 'is-alternate', 'is-on-dark', 'size', 'type', 'variation', 'target', ...analyticsOverrideAttrs, ...analyticsParentDataAttrs];

// Mapping `onDark` to `isOnDark` because props starting with "on" indicate an event handler and tests fail due to this expectation

const Wrapper = _ref => {
  let {
    isAlternate,
    isOnDark,
    analytics,
    ...otherProps
  } = _ref;
  return /*#__PURE__*/_jsx(Button, {
    ...otherProps,
    isAlternate: isAlternate && Boolean(JSON.parse(isAlternate)),
    onDark: isOnDark && Boolean(JSON.parse(isOnDark)),
    analytics: analytics && Boolean(JSON.parse(analytics))
  });
};
define('ds-button', () => Wrapper, {
  attributes,
  events: ['onClick', onAnalyticsEvent],
  shadow: true
});