"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var toggle_mark_exports = {};
__export(toggle_mark_exports, {
  toggleMark: () => toggleMark
});
module.exports = __toCommonJS(toggle_mark_exports);
var import_get_mark_type = require("../helpers/get-mark-type.js");
var import_is_mark_active = require("../helpers/is-mark-active.js");
const toggleMark = (typeOrName, attributes = {}, options = {}) => ({ state, commands }) => {
  const { extendEmptyMarkRange = false } = options;
  const type = (0, import_get_mark_type.getMarkType)(typeOrName, state.schema);
  const isActive = (0, import_is_mark_active.isMarkActive)(state, type, attributes);
  if (isActive) {
    return commands.unsetMark(type, { extendEmptyMarkRange });
  }
  return commands.setMark(type, attributes);
};
//# sourceMappingURL=toggle-mark.js.map
