"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.replaceNodeChildren = void 0;
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
var _slate = require("slate");
var _removeNodeChildren = require("./remove-node-children");
const replaceNodeChildren = (editor, _ref) => {
  let {
    at,
    nodes,
    insertOptions,
    removeOptions
  } = _ref;
  _slate.Editor.withoutNormalizing(editor, () => {
    (0, _removeNodeChildren.removeNodeChildren)(editor, at, removeOptions);
    _slate.Transforms.insertNodes(editor, nodes, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, insertOptions), {}, {
      at: at.concat([0])
    }));
  });
};
exports.replaceNodeChildren = replaceNodeChildren;