"use strict";

function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Bubble = void 0;
var _react = _interopRequireDefault(require("react"));
var _styledComponents = _interopRequireWildcard(require("styled-components"));
var _consts = require("./consts");
var _utils = require("../../../common/utils");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var getColor = function getColor(props) {
  var barColor = props.barColor,
    theme = props.theme;
  if ((0, _utils.isFunction)(barColor)) {
    return barColor(theme);
  }
  return 'transparent';
};
var barStyles = (0, _styledComponents.css)(["position:relative;border:0;&::before{content:'';display:block;width:100%;height:", "px;background:", ";position:absolute;top:0;left:0;border-top-left-radius:", ";border-top-right-radius:", ";}"], function (p) {
  return p.theme.spacing.unit(2);
}, function (p) {
  return getColor(p);
}, function (p) {
  return p.theme.borderRadius8;
}, function (p) {
  return p.theme.borderRadius8;
});
var Card = _styledComponents.default.div.withConfig({
  displayName: "Bubble__Card",
  componentId: "sc-1cvddga-0"
})(["width:350px;min-height:", "px;padding:", "px;background:", ";border:", "px solid ", ";position:fixed;z-index:", ";display:flex;box-sizing:border-box;border-radius:", ";", ";", "{", "}"], function (p) {
  return p.theme.spacing.unit(35);
}, function (p) {
  return p.theme.spacing.unit(5);
}, function (p) {
  return p.theme.color.bubbleBackground;
}, _consts.BORDER_SIZE, function (p) {
  return p.theme.color.bubbleBorder;
}, function (p) {
  return p.theme.zIndex.modal + 1;
}, function (p) {
  return p.theme.borderRadius8;
}, function (p) {
  return p.barColor ? barStyles : "";
}, function (_ref) {
  var theme = _ref.theme;
  return theme.media.lessThan(theme.breakpoints.sm);
}, function (p) {
  return p.feedbackWidgetMode && " // !important to override popper inline styles\n        width: 94.5% !important;\n        transform: none !important;\n        inset: auto auto 0px 0px !important;\n        position: fixed !important;\n        margin: 0 ".concat(p.theme.spacing.unit(3), "px ").concat(p.theme.spacing.unit(3), "px\n        ").concat(p.theme.spacing.unit(3), "px !important;\n        border: 1px ").concat(p.theme.colorTokens.neutral.border_medium, " solid !important;\n        border-radius: ").concat(p.theme.borderRadius8, " !important; \n        ");
});
var Bubble = exports.Bubble = _react.default.forwardRef(function (_ref2, ref) {
  var children = _ref2.children,
    className = _ref2.className,
    style = _ref2.style,
    barColor = _ref2.barColor,
    feedbackWidgetMode = _ref2.feedbackWidgetMode;
  return _react.default.createElement(Card, {
    className: className,
    style: style,
    ref: ref,
    barColor: barColor,
    feedbackWidgetMode: feedbackWidgetMode
  }, children);
});