"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _react = _interopRequireDefault(require("react"));

var _react2 = require("@emotion/react");

var _ui = require("../../../../ui");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function InsertionPoint(props) {
  return (0, _react2.jsx)("div", _extends({
    css: /*#__PURE__*/(0, _react2.css)("height:32px;cursor:text;position:relative;z-index:", _ui.zIndex.zIndex1, ";margin-top:-16px;;label:InsertionPoint;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy93aWRnZXRzL21hcmtkb3duL01hcmtkb3duQ29udHJvbC9jb21wb25lbnRzL1ZvaWRCbG9jay5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFTYyIsImZpbGUiOiIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvd2lkZ2V0cy9tYXJrZG93bi9NYXJrZG93bkNvbnRyb2wvY29tcG9uZW50cy9Wb2lkQmxvY2suanMiLCJzb3VyY2VzQ29udGVudCI6WyIvKiBlc2xpbnQtZGlzYWJsZSByZWFjdC9wcm9wLXR5cGVzICovXG5pbXBvcnQgUmVhY3QgZnJvbSAncmVhY3QnO1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuXG5pbXBvcnQgeyB6SW5kZXggfSBmcm9tICcuLi8uLi8uLi8uLi91aSc7XG5cbmZ1bmN0aW9uIEluc2VydGlvblBvaW50KHByb3BzKSB7XG4gIHJldHVybiAoXG4gICAgPGRpdlxuICAgICAgY3NzPXtjc3NgXG4gICAgICAgIGhlaWdodDogMzJweDtcbiAgICAgICAgY3Vyc29yOiB0ZXh0O1xuICAgICAgICBwb3NpdGlvbjogcmVsYXRpdmU7XG4gICAgICAgIHotaW5kZXg6ICR7ekluZGV4LnpJbmRleDF9O1xuICAgICAgICBtYXJnaW4tdG9wOiAtMTZweDtcbiAgICAgIGB9XG4gICAgICB7Li4ucHJvcHN9XG4gICAgLz5cbiAgKTtcbn1cblxuZnVuY3Rpb24gVm9pZEJsb2NrKHsgZWRpdG9yLCBhdHRyaWJ1dGVzLCBub2RlLCBjaGlsZHJlbiB9KSB7XG4gIGZ1bmN0aW9uIGhhbmRsZUNsaWNrKGV2ZW50KSB7XG4gICAgZXZlbnQuc3RvcFByb3BhZ2F0aW9uKCk7XG4gIH1cblxuICByZXR1cm4gKFxuICAgIDxkaXYgey4uLmF0dHJpYnV0ZXN9IG9uQ2xpY2s9e2hhbmRsZUNsaWNrfT5cbiAgICAgIHshZWRpdG9yLmNhbkluc2VydEJlZm9yZU5vZGUobm9kZSkgJiYgKFxuICAgICAgICA8SW5zZXJ0aW9uUG9pbnQgb25DbGljaz17KCkgPT4gZWRpdG9yLmZvcmNlSW5zZXJ0QmVmb3JlTm9kZShub2RlKX0gLz5cbiAgICAgICl9XG4gICAgICB7Y2hpbGRyZW59XG4gICAgICB7IWVkaXRvci5jYW5JbnNlcnRBZnRlck5vZGUobm9kZSkgJiYgKFxuICAgICAgICA8SW5zZXJ0aW9uUG9pbnQgb25DbGljaz17KCkgPT4gZWRpdG9yLmZvcmNlSW5zZXJ0QWZ0ZXJOb2RlKG5vZGUpfSAvPlxuICAgICAgKX1cbiAgICA8L2Rpdj5cbiAgKTtcbn1cblxuZXhwb3J0IGRlZmF1bHQgVm9pZEJsb2NrO1xuIl19 */"))
  }, props));
}

function VoidBlock(_ref) {
  let {
    editor,
    attributes,
    node,
    children
  } = _ref;

  function handleClick(event) {
    event.stopPropagation();
  }

  return (0, _react2.jsx)("div", _extends({}, attributes, {
    onClick: handleClick
  }), !editor.canInsertBeforeNode(node) && (0, _react2.jsx)(InsertionPoint, {
    onClick: () => editor.forceInsertBeforeNode(node)
  }), children, !editor.canInsertAfterNode(node) && (0, _react2.jsx)(InsertionPoint, {
    onClick: () => editor.forceInsertAfterNode(node)
  }));
}

var _default = VoidBlock;
exports.default = _default;