"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.NestedTableRowPlaceholderStates = void 0;
var _react = _interopRequireDefault(require("react"));
var _mobxReactLite = require("mobx-react-lite");
var _designSystem = require("@wix/design-system");
var _ErrorState = require("../ErrorState");
var _CollectionEmptyState = require("../EmptyState/CollectionEmptyState");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/NestedTable/NestedTableRowPlaceholderStates.tsx";
function _NestedTableRowPlaceholderStates(props) {
  const {
    state
  } = props;
  const {
    initTask,
    showLoadingState,
    showEmptyState,
    showErrorState,
    errorStatus
  } = state;
  let child;
  if (initTask.status.isError) {
    child = /*#__PURE__*/_react.default.createElement(_ErrorState.ErrorState, {
      state: state,
      errorStatus: initTask.errorStatus,
      dataHook: "error-state",
      image: undefined,
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 27,
        columnNumber: 7
      }
    });
  } else if (showLoadingState) {
    child = /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
      padding: "12px",
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 36,
        columnNumber: 7
      }
    }, /*#__PURE__*/_react.default.createElement(_designSystem.Loader, {
      dataHook: "loading-state",
      size: "small",
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 37,
        columnNumber: 9
      }
    }));
  } else if (showErrorState && errorStatus) {
    child = /*#__PURE__*/_react.default.createElement(_ErrorState.ErrorState, {
      state: state,
      dataHook: "error-state",
      image: undefined,
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 42,
        columnNumber: 7
      }
    });
  } else if (showEmptyState) {
    child = /*#__PURE__*/_react.default.createElement(_CollectionEmptyState.CollectionEmptyState, {
      dataHook: "empty-state",
      image: null,
      addNewCta: {
        onClick: () => {
          state.levelDescriptor.onAddNewClick == null || state.levelDescriptor.onAddNewClick();
        }
      },
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 46,
        columnNumber: 7
      }
    });
  }
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, child);
}
const NestedTableRowPlaceholderStates = exports.NestedTableRowPlaceholderStates = (0, _mobxReactLite.observer)(_NestedTableRowPlaceholderStates);
//# sourceMappingURL=NestedTableRowPlaceholderStates.js.map