import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["children"];
import React from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import { LoadingCardLink } from '../component-lazy/LoadingCardLink';
var CardErrorBoundary = function CardErrorBoundary(_ref) {
  var children = _ref.children,
    props = _objectWithoutProperties(_ref, _excluded);
  // TODO: NAVX-4682: Add feature parity to CardWithURLRenderer
  var ErrorFallbackComponent = props.fallbackComponent;
  var errorBoundaryFallbackComponent = function errorBoundaryFallbackComponent() {
    if (ErrorFallbackComponent) {
      return /*#__PURE__*/React.createElement(ErrorFallbackComponent, null);
    }
    return /*#__PURE__*/React.createElement(LoadingCardLink, props);
  };
  return /*#__PURE__*/React.createElement(ErrorBoundary, {
    FallbackComponent: errorBoundaryFallbackComponent
  }, children);
};
export default CardErrorBoundary;