import { define } from '../preactement/define';
import { availableSizes, Dialog } from '../../Dialog';
import { parseBooleanAttr } from '../wrapperUtils';
import { analyticsOverrideAttrs } from '../shared-attributes/analytics';
import { isPossibleValue } from '../utils';
import { onAnalyticsEvent } from '../analytics';
import { jsx as _jsx } from "react/jsx-runtime";
const attributes = ['actions-class-name', 'alert', 'backdrop-click-exits', 'dialog-close-label', 'class-name', 'header-class-name', 'heading', 'root-id', 'is-open', 'size', ...analyticsOverrideAttrs];
const Wrapper = _ref => {
  let {
    alert,
    analytics,
    backdropClickExits,
    children,
    dialogCloseLabel,
    isOpen,
    rootId,
    size,
    ...otherProps
  } = _ref;
  return /*#__PURE__*/_jsx(Dialog, {
    id: rootId,
    alert: parseBooleanAttr(alert),
    ariaCloseLabel: dialogCloseLabel,
    backdropClickExits: parseBooleanAttr(backdropClickExits),
    isOpen: parseBooleanAttr(isOpen),
    size: isPossibleValue(size, availableSizes) ? size : undefined,
    ...otherProps,
    analytics: analytics && Boolean(JSON.parse(analytics)),
    children: children
  });
};
define('ds-modal-dialog', () => Wrapper, {
  attributes,
  events: [onAnalyticsEvent, 'onExit'],
  shadow: true
});