"use strict";

var _define = require("../preactement/define");
var _Dialog = require("../../Dialog");
var _wrapperUtils = require("../wrapperUtils");
var _analytics = require("../shared-attributes/analytics");
var _utils = require("../utils");
var _analytics2 = require("../analytics");
var _jsxRuntime = require("preact/compat/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', ..._analytics.analyticsOverrideAttrs];
const Wrapper = _ref => {
  let {
    alert,
    analytics,
    backdropClickExits,
    children,
    dialogCloseLabel,
    isOpen,
    rootId,
    size,
    ...otherProps
  } = _ref;
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dialog.Dialog, {
    id: rootId,
    alert: (0, _wrapperUtils.parseBooleanAttr)(alert),
    ariaCloseLabel: dialogCloseLabel,
    backdropClickExits: (0, _wrapperUtils.parseBooleanAttr)(backdropClickExits),
    isOpen: (0, _wrapperUtils.parseBooleanAttr)(isOpen),
    size: (0, _utils.isPossibleValue)(size, _Dialog.availableSizes) ? size : undefined,
    ...otherProps,
    analytics: analytics && Boolean(JSON.parse(analytics)),
    children: children
  });
};
(0, _define.define)('ds-modal-dialog', () => Wrapper, {
  attributes,
  events: [_analytics2.onAnalyticsEvent, 'onExit'],
  shadow: true
});