/* index.tsx generated by @compiled/babel-plugin v0.39.1 */
"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
require("./index.compiled.css");
var _react = _interopRequireWildcard(require("react"));
var React = _react;
var _runtime = require("@compiled/react/runtime");
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _userAgent = require("@atlaskit/linking-common/user-agent");
var _constants = require("../../../../../../constants");
var _flexibleUiContext = require("../../../../../../state/flexible-ui-context");
var _elements = require("../../../elements");
var _actionGroup = _interopRequireDefault(require("../../action-group"));
var _block = _interopRequireDefault(require("../../block"));
var _elementGroup = _interopRequireDefault(require("../../element-group"));
var _utils = require("../../utils");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
var actionGroupStyles = null;
var safariStyles = null;
var FooterBlockResolvedView = function FooterBlockResolvedView(props) {
  var actions = props.actions,
    testId = props.testId,
    onActionMenuOpenChange = props.onActionMenuOpenChange,
    _props$size = props.size,
    size = _props$size === void 0 ? _constants.SmartLinkSize.Medium : _props$size,
    hideProvider = props.hideProvider;
  var context = (0, _flexibleUiContext.useFlexibleUiContext)();
  var hasActions = (0, _react.useMemo)(function () {
    var _filterActionItems;
    return ((_filterActionItems = (0, _utils.filterActionItems)(actions, context)) === null || _filterActionItems === void 0 ? void 0 : _filterActionItems.length) > 0;
  }, [actions, context]);

  // eslint-disable-next-line react-hooks/rules-of-hooks
  var _useMemo = (0, _react.useMemo)(function () {
      return (0, _userAgent.browser)();
    }, []),
    _useMemo$safari = _useMemo.safari,
    safari = _useMemo$safari === void 0 ? false : _useMemo$safari;
  var onDropdownOpenChange = (0, _react.useCallback)(function (isOpen) {
    if (onActionMenuOpenChange) {
      onActionMenuOpenChange({
        isOpen: isOpen
      });
    }
  }, [onActionMenuOpenChange]);
  return /*#__PURE__*/React.createElement(_block.default, (0, _extends2.default)({}, props, {
    testId: "".concat(testId, "-resolved-view")
  }), !hideProvider && /*#__PURE__*/React.createElement(_elements.Provider, {
    appearance: "subtle",
    testId: "".concat(testId, "-provider")
  }), actions && hasActions ? /*#__PURE__*/React.createElement(_elementGroup.default, {
    testId: "smart-element-group-actions",
    align: _constants.SmartLinkAlignment.Right,
    direction: _constants.SmartLinkDirection.Horizontal,
    width: _constants.SmartLinkWidth.Flexible,
    className: (0, _runtime.ax)([size === _constants.SmartLinkSize.XLarge && "_c71lxy5q", safari && "_4t3i1osq"])
  }, /*#__PURE__*/React.createElement(_actionGroup.default, {
    onDropdownOpenChange: onDropdownOpenChange,
    items: actions,
    appearance: "default",
    size: size
  })) : null);
};
var _default = exports.default = FooterBlockResolvedView;