"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _slugid = _interopRequireDefault(require("slugid"));
const textRule = (element, parseChild) => {
  const {
    nodeName,
    nodeType
  } = element;
  if (nodeName === 'SPAN') {
    return {
      id: _slugid.default.nice(),
      text: element.textContent
    };
  }
  if (nodeName === 'STRONG' || nodeName === 'B') {
    return {
      id: _slugid.default.nice(),
      bold: true,
      text: element.textContent
    };
  }
  if (nodeName === 'CODE' && element.parentElement.nodeName !== 'PRE') {
    return {
      id: _slugid.default.nice(),
      code: true,
      text: element.textContent
    };
  }
  if (nodeName === 'DEL') {
    return {
      id: _slugid.default.nice(),
      delete: true,
      text: element.textContent
    };
  }
  if (nodeName === 'I') {
    return {
      id: _slugid.default.nice(),
      italic: true,
      text: element.textContent
    };
  }
  if (nodeName === 'INS') {
    return {
      id: _slugid.default.nice(),
      add: true,
      text: element.textContent
    };
  }
  if (nodeType === 3) {
    return {
      id: _slugid.default.nice(),
      text: element.textContent
    };
  }
  return;
};
var _default = exports.default = textRule;