import { mapSlice } from '../utils/slice';
export var transformSliceToRemoveMacroId = function transformSliceToRemoveMacroId(slice, schema) {
  var _schema$nodes = schema.nodes,
    extension = _schema$nodes.extension,
    inlineExtension = _schema$nodes.inlineExtension;
  return mapSlice(slice, function (node) {
    var _node$attrs$parameter;
    if ([extension, inlineExtension].includes(node.type) && typeof ((_node$attrs$parameter = node.attrs.parameters) === null || _node$attrs$parameter === void 0 || (_node$attrs$parameter = _node$attrs$parameter.macroMetadata) === null || _node$attrs$parameter === void 0 || (_node$attrs$parameter = _node$attrs$parameter.macroId) === null || _node$attrs$parameter === void 0 ? void 0 : _node$attrs$parameter.value) !== 'undefined') {
      // Strip the macroId. While pasting on the same page, macroId does not change until the page
      // is published and causes collision with the existing macroId where switching tabs of one
      // node changes the tabs for the other node
      delete node.attrs.parameters.macroMetadata.macroId;
    }
    return node;
  });
};