"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 cell_edge_plugin_exports = {};
__export(cell_edge_plugin_exports, {
  cellEdgePlugin: () => cellEdgePlugin
});
module.exports = __toCommonJS(cell_edge_plugin_exports);
var import_is_inline_text_only = require("./../../../ricos-common-plugins/transaction-predicates/is-inline-text-only.js");
var import_state = require("./../../../tiptap/pm/state.js");
var import_decorations = require("../decorations/index.js");
const cellEdgePlugin = () => {
  const key = new import_state.PluginKey("cell-edge");
  return new import_state.Plugin({
    key,
    state: {
      init: (_config, state) => (0, import_decorations.cellEdgeDecorations)(state.doc),
      apply: (tr, prev) => {
        if (!tr.docChanged) {
          return prev;
        }
        if ((0, import_is_inline_text_only.isInlineTextOnly)(tr)) {
          return prev.map(tr.mapping, tr.doc);
        }
        return (0, import_decorations.cellEdgeDecorations)(tr.doc);
      }
    },
    props: {
      decorations(state) {
        return key.getState(state);
      }
    }
  });
};
//# sourceMappingURL=cell-edge-plugin.js.map
