"use strict";

require("core-js/modules/es.object.define-property.js");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.BaseDialog = void 0;
Object.defineProperty(exports, "FcrBasicConfirmDialog", {
  enumerable: true,
  get: function get() {
    return _basicConfirmDialog.FcrBasicConfirmDialog;
  }
});
Object.defineProperty(exports, "FcrClassDialog", {
  enumerable: true,
  get: function get() {
    return _classDialog.FcrClassDialog;
  }
});
Object.defineProperty(exports, "FcrConfirmDialog", {
  enumerable: true,
  get: function get() {
    return _confirmDialog.FcrConfirmDialog;
  }
});
Object.defineProperty(exports, "FcrDialogApi", {
  enumerable: true,
  get: function get() {
    return _confirm.FcrDialogApi;
  }
});
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _classnames = _interopRequireDefault(require("classnames"));
var _rcDialog = _interopRequireDefault(require("rc-dialog"));
var _react = require("react");
var _icon = require("../icon");
var _type = require("../icon/type");
var _basicConfirmDialog = require("./basic-confirm-dialog");
var _classDialog = require("./class-dialog");
var _confirmDialog = require("./confirm-dialog");
require("./index.css");
var _jsxRuntime = require("react/jsx-runtime");
var _confirm = require("./confirm");
var BaseDialog = exports.BaseDialog = function BaseDialog(props) {
  var visible = props.visible,
    onClose = props.onClose,
    children = props.children,
    maskClosable = props.maskClosable,
    width = props.width,
    classNames = props.classNames,
    _props$closable = props.closable,
    closable = _props$closable === void 0 ? true : _props$closable,
    closeIcon = props.closeIcon,
    _props$mask = props.mask,
    mask = _props$mask === void 0 ? true : _props$mask,
    bodyStyle = props.bodyStyle,
    wrapClassName = props.wrapClassName,
    getContainer = props.getContainer,
    _props$center = props.center,
    center = _props$center === void 0 ? true : _props$center,
    afterClose = props.afterClose,
    destroyOnClose = props.destroyOnClose,
    maskStyle = props.maskStyle,
    wrapStyle = props.wrapStyle,
    zIndex = props.zIndex,
    forceRender = props.forceRender;
  var defaultColor = 'var(--fcr_ui_scene_icontext1)';
  var hoverColor = 'var(--fcr_ui_scene_ramp_brand6)';
  var _useState = (0, _react.useState)(defaultColor),
    _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
    color = _useState2[0],
    setColor = _useState2[1];
  var handleHover = function handleHover() {
    setColor(hoverColor);
  };
  var handleLeave = function handleLeave() {
    setColor(defaultColor);
  };
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_rcDialog["default"], {
    forceRender: forceRender,
    zIndex: zIndex,
    wrapStyle: wrapStyle,
    maskStyle: maskStyle,
    destroyOnClose: destroyOnClose,
    afterClose: afterClose,
    getContainer: getContainer,
    wrapClassName: (0, _classnames["default"])({
      'fcr-dialog-center': center
    }, wrapClassName),
    bodyStyle: bodyStyle,
    mask: mask,
    className: classNames,
    width: width || 415,
    maskClosable: maskClosable,
    footer: null,
    prefixCls: "fcr-dialog",
    animation: 'zoom',
    maskAnimation: 'fade',
    closable: false,
    visible: visible,
    onClose: onClose,
    children: [closable ? closeIcon ? closeIcon : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
      onClick: onClose,
      className: (0, _classnames["default"])('fcr-dialog-close'),
      onMouseEnter: handleHover,
      onMouseLeave: handleLeave,
      children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icon.FcrIcon, {
        type: _type.FcrIconType.FCR_CLOSE,
        colors: {
          iconPrimary: color
        },
        size: 18
      })
    }) : null, children]
  });
};