"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Loading;
var _react = _interopRequireDefault(require("react"));
var _styles = require("./styles");
var DefaultLoadingIcon = /*#__PURE__*/_react.default.memo(function () {
  return /*#__PURE__*/_react.default.createElement("svg", {
    style: {
      margin: 'auto',
      display: 'block',
      width: 40,
      height: 40
    },
    viewBox: "0 0 100 100",
    preserveAspectRatio: "xMidYMid"
  }, /*#__PURE__*/_react.default.createElement("circle", {
    cx: "50",
    cy: "50",
    r: "40",
    fill: "none",
    stroke: "#23a7fa",
    strokeDasharray: "188 64",
    strokeLinecap: "round",
    strokeWidth: "10"
  }, /*#__PURE__*/_react.default.createElement("animateTransform", {
    attributeName: "transform",
    dur: "1.5s",
    keyTimes: "0;1",
    repeatCount: "indefinite",
    type: "rotate",
    values: "0 50 50;360 50 50"
  })));
});
function DefaultLoadingContentWrapper(_ref) {
  var children = _ref.children,
    visible = _ref.visible;
  return /*#__PURE__*/_react.default.createElement("div", {
    className: _styles.Classes.loadingContentWrapper,
    style: {
      filter: visible ? 'blur(1px)' : 'none'
    }
  }, children);
}
function Loading(_ref2) {
  var visible = _ref2.visible,
    children = _ref2.children,
    _ref2$LoadingContentW = _ref2.LoadingContentWrapper,
    LoadingContentWrapper = _ref2$LoadingContentW === void 0 ? DefaultLoadingContentWrapper : _ref2$LoadingContentW,
    _ref2$LoadingIcon = _ref2.LoadingIcon,
    LoadingIcon = _ref2$LoadingIcon === void 0 ? DefaultLoadingIcon : _ref2$LoadingIcon;
  return /*#__PURE__*/_react.default.createElement("div", {
    className: _styles.Classes.loadingWrapper
  }, visible && (/*#__PURE__*/_react.default.createElement("div", {
    className: _styles.Classes.loadingIndicatorWrapper
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _styles.Classes.loadingIndicator
  }, /*#__PURE__*/_react.default.createElement(LoadingIcon, null)))), /*#__PURE__*/_react.default.createElement(LoadingContentWrapper, {
    visible: visible,
    children: children
  }));
}