@jvs-milkdown/components 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/lib/table-block/dnd/prepare-dnd-context.d.ts.map +1 -1
- package/lib/table-block/index.js +8 -4
- package/lib/table-block/index.js.map +1 -1
- package/lib/table-block/view/component.d.ts.map +1 -1
- package/lib/table-block/view/drag.d.ts.map +1 -1
- package/lib/table-block/view/operation.d.ts +2 -2
- package/lib/table-block/view/operation.d.ts.map +1 -1
- package/lib/table-block/view/pointer.d.ts +2 -2
- package/lib/table-block/view/pointer.d.ts.map +1 -1
- package/lib/table-block/view/types.d.ts +0 -4
- package/lib/table-block/view/types.d.ts.map +1 -1
- package/lib/table-block/view/utils.d.ts +0 -9
- package/lib/table-block/view/utils.d.ts.map +1 -1
- package/lib/table-block/view/view.d.ts.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +53 -79
- package/src/table-block/view/component.tsx +12 -10
- package/src/table-block/view/types.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/__internal__/meta.ts","../../src/table-block/config.ts","../../../../node_modules/.pnpm/prosemirror-model@1.25.4/node_modules/prosemirror-model/dist/index.js","../../../../node_modules/.pnpm/prosemirror-transform@1.11.0/node_modules/prosemirror-transform/dist/index.js","../../../../node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.js","../../../../node_modules/.pnpm/w3c-keyname@2.2.8/node_modules/w3c-keyname/index.js","../../../../node_modules/.pnpm/prosemirror-keymap@1.2.3/node_modules/prosemirror-keymap/dist/index.js","../../../../node_modules/.pnpm/prosemirror-tables@1.8.5/node_modules/prosemirror-tables/dist/index.js","../../src/__internal__/keep-alive.ts","../../src/__internal__/components/icon.tsx","../../src/table-block/dnd/prepare-dnd-context.ts","../../src/table-block/dnd/preview.ts","../../src/table-block/dnd/create-drag-handler.ts","../../src/table-block/view/utils.ts","../../src/table-block/dnd/calc-drag-over.ts","../../src/table-block/dnd/drag-over-handler.ts","../../src/table-block/view/drag.ts","../../src/table-block/view/operation.ts","../../src/table-block/view/pointer.ts","../../src/table-block/view/component.tsx","../../src/table-block/view/view.ts","../../src/table-block/index.ts"],"sourcesContent":["import type { Meta, MilkdownPlugin } from '@jvs-milkdown/ctx'\n\nexport function withMeta<T extends MilkdownPlugin>(\n plugin: T,\n meta: Partial<Meta> & Pick<Meta, 'displayName'>\n): T {\n Object.assign(plugin, {\n meta: {\n package: '@jvs-milkdown/components',\n ...meta,\n },\n })\n\n return plugin\n}\n","import { $ctx } from '@jvs-milkdown/utils'\n\nimport { withMeta } from '../__internal__/meta'\n\nexport type RenderType =\n | 'add_row'\n | 'add_col'\n | 'delete_row'\n | 'delete_col'\n | 'align_col_left'\n | 'align_col_center'\n | 'align_col_right'\n | 'col_drag_handle'\n | 'row_drag_handle'\n | 'merge_cells'\n | 'split_cell'\n\nexport interface TableBlockConfig {\n renderButton: (renderType: RenderType) => string\n}\n\nconst defaultTableBlockConfig: TableBlockConfig = {\n renderButton: (renderType) => {\n switch (renderType) {\n case 'add_row':\n return '+'\n case 'add_col':\n return '+'\n case 'delete_row':\n return '-'\n case 'delete_col':\n return '-'\n case 'align_col_left':\n return 'left'\n case 'align_col_center':\n return 'center'\n case 'align_col_right':\n return 'right'\n case 'col_drag_handle':\n return '='\n case 'row_drag_handle':\n return '='\n case 'merge_cells':\n return '⊞'\n case 'split_cell':\n return '⊟'\n }\n },\n}\n\nexport const tableBlockConfig = $ctx(\n { ...defaultTableBlockConfig },\n 'tableBlockConfigCtx'\n)\n\nwithMeta(tableBlockConfig, {\n displayName: 'Config<table-block>',\n group: 'TableBlock',\n})\n","import OrderedMap from 'orderedmap';\n\nfunction findDiffStart(a, b, pos) {\n for (let i = 0;; i++) {\n if (i == a.childCount || i == b.childCount)\n return a.childCount == b.childCount ? null : pos;\n let childA = a.child(i), childB = b.child(i);\n if (childA == childB) {\n pos += childA.nodeSize;\n continue;\n }\n if (!childA.sameMarkup(childB))\n return pos;\n if (childA.isText && childA.text != childB.text) {\n for (let j = 0; childA.text[j] == childB.text[j]; j++)\n pos++;\n return pos;\n }\n if (childA.content.size || childB.content.size) {\n let inner = findDiffStart(childA.content, childB.content, pos + 1);\n if (inner != null)\n return inner;\n }\n pos += childA.nodeSize;\n }\n}\nfunction findDiffEnd(a, b, posA, posB) {\n for (let iA = a.childCount, iB = b.childCount;;) {\n if (iA == 0 || iB == 0)\n return iA == iB ? null : { a: posA, b: posB };\n let childA = a.child(--iA), childB = b.child(--iB), size = childA.nodeSize;\n if (childA == childB) {\n posA -= size;\n posB -= size;\n continue;\n }\n if (!childA.sameMarkup(childB))\n return { a: posA, b: posB };\n if (childA.isText && childA.text != childB.text) {\n let same = 0, minSize = Math.min(childA.text.length, childB.text.length);\n while (same < minSize && childA.text[childA.text.length - same - 1] == childB.text[childB.text.length - same - 1]) {\n same++;\n posA--;\n posB--;\n }\n return { a: posA, b: posB };\n }\n if (childA.content.size || childB.content.size) {\n let inner = findDiffEnd(childA.content, childB.content, posA - 1, posB - 1);\n if (inner)\n return inner;\n }\n posA -= size;\n posB -= size;\n }\n}\n\n/**\nA fragment represents a node's collection of child nodes.\n\nLike nodes, fragments are persistent data structures, and you\nshould not mutate them or their content. Rather, you create new\ninstances whenever needed. The API tries to make this easy.\n*/\nclass Fragment {\n /**\n @internal\n */\n constructor(\n /**\n The child nodes in this fragment.\n */\n content, size) {\n this.content = content;\n this.size = size || 0;\n if (size == null)\n for (let i = 0; i < content.length; i++)\n this.size += content[i].nodeSize;\n }\n /**\n Invoke a callback for all descendant nodes between the given two\n positions (relative to start of this fragment). Doesn't descend\n into a node when the callback returns `false`.\n */\n nodesBetween(from, to, f, nodeStart = 0, parent) {\n for (let i = 0, pos = 0; pos < to; i++) {\n let child = this.content[i], end = pos + child.nodeSize;\n if (end > from && f(child, nodeStart + pos, parent || null, i) !== false && child.content.size) {\n let start = pos + 1;\n child.nodesBetween(Math.max(0, from - start), Math.min(child.content.size, to - start), f, nodeStart + start);\n }\n pos = end;\n }\n }\n /**\n Call the given callback for every descendant node. `pos` will be\n relative to the start of the fragment. The callback may return\n `false` to prevent traversal of a given node's children.\n */\n descendants(f) {\n this.nodesBetween(0, this.size, f);\n }\n /**\n Extract the text between `from` and `to`. See the same method on\n [`Node`](https://prosemirror.net/docs/ref/#model.Node.textBetween).\n */\n textBetween(from, to, blockSeparator, leafText) {\n let text = \"\", first = true;\n this.nodesBetween(from, to, (node, pos) => {\n let nodeText = node.isText ? node.text.slice(Math.max(from, pos) - pos, to - pos)\n : !node.isLeaf ? \"\"\n : leafText ? (typeof leafText === \"function\" ? leafText(node) : leafText)\n : node.type.spec.leafText ? node.type.spec.leafText(node)\n : \"\";\n if (node.isBlock && (node.isLeaf && nodeText || node.isTextblock) && blockSeparator) {\n if (first)\n first = false;\n else\n text += blockSeparator;\n }\n text += nodeText;\n }, 0);\n return text;\n }\n /**\n Create a new fragment containing the combined content of this\n fragment and the other.\n */\n append(other) {\n if (!other.size)\n return this;\n if (!this.size)\n return other;\n let last = this.lastChild, first = other.firstChild, content = this.content.slice(), i = 0;\n if (last.isText && last.sameMarkup(first)) {\n content[content.length - 1] = last.withText(last.text + first.text);\n i = 1;\n }\n for (; i < other.content.length; i++)\n content.push(other.content[i]);\n return new Fragment(content, this.size + other.size);\n }\n /**\n Cut out the sub-fragment between the two given positions.\n */\n cut(from, to = this.size) {\n if (from == 0 && to == this.size)\n return this;\n let result = [], size = 0;\n if (to > from)\n for (let i = 0, pos = 0; pos < to; i++) {\n let child = this.content[i], end = pos + child.nodeSize;\n if (end > from) {\n if (pos < from || end > to) {\n if (child.isText)\n child = child.cut(Math.max(0, from - pos), Math.min(child.text.length, to - pos));\n else\n child = child.cut(Math.max(0, from - pos - 1), Math.min(child.content.size, to - pos - 1));\n }\n result.push(child);\n size += child.nodeSize;\n }\n pos = end;\n }\n return new Fragment(result, size);\n }\n /**\n @internal\n */\n cutByIndex(from, to) {\n if (from == to)\n return Fragment.empty;\n if (from == 0 && to == this.content.length)\n return this;\n return new Fragment(this.content.slice(from, to));\n }\n /**\n Create a new fragment in which the node at the given index is\n replaced by the given node.\n */\n replaceChild(index, node) {\n let current = this.content[index];\n if (current == node)\n return this;\n let copy = this.content.slice();\n let size = this.size + node.nodeSize - current.nodeSize;\n copy[index] = node;\n return new Fragment(copy, size);\n }\n /**\n Create a new fragment by prepending the given node to this\n fragment.\n */\n addToStart(node) {\n return new Fragment([node].concat(this.content), this.size + node.nodeSize);\n }\n /**\n Create a new fragment by appending the given node to this\n fragment.\n */\n addToEnd(node) {\n return new Fragment(this.content.concat(node), this.size + node.nodeSize);\n }\n /**\n Compare this fragment to another one.\n */\n eq(other) {\n if (this.content.length != other.content.length)\n return false;\n for (let i = 0; i < this.content.length; i++)\n if (!this.content[i].eq(other.content[i]))\n return false;\n return true;\n }\n /**\n The first child of the fragment, or `null` if it is empty.\n */\n get firstChild() { return this.content.length ? this.content[0] : null; }\n /**\n The last child of the fragment, or `null` if it is empty.\n */\n get lastChild() { return this.content.length ? this.content[this.content.length - 1] : null; }\n /**\n The number of child nodes in this fragment.\n */\n get childCount() { return this.content.length; }\n /**\n Get the child node at the given index. Raise an error when the\n index is out of range.\n */\n child(index) {\n let found = this.content[index];\n if (!found)\n throw new RangeError(\"Index \" + index + \" out of range for \" + this);\n return found;\n }\n /**\n Get the child node at the given index, if it exists.\n */\n maybeChild(index) {\n return this.content[index] || null;\n }\n /**\n Call `f` for every child node, passing the node, its offset\n into this parent node, and its index.\n */\n forEach(f) {\n for (let i = 0, p = 0; i < this.content.length; i++) {\n let child = this.content[i];\n f(child, p, i);\n p += child.nodeSize;\n }\n }\n /**\n Find the first position at which this fragment and another\n fragment differ, or `null` if they are the same.\n */\n findDiffStart(other, pos = 0) {\n return findDiffStart(this, other, pos);\n }\n /**\n Find the first position, searching from the end, at which this\n fragment and the given fragment differ, or `null` if they are\n the same. Since this position will not be the same in both\n nodes, an object with two separate positions is returned.\n */\n findDiffEnd(other, pos = this.size, otherPos = other.size) {\n return findDiffEnd(this, other, pos, otherPos);\n }\n /**\n Find the index and inner offset corresponding to a given relative\n position in this fragment. The result object will be reused\n (overwritten) the next time the function is called. @internal\n */\n findIndex(pos) {\n if (pos == 0)\n return retIndex(0, pos);\n if (pos == this.size)\n return retIndex(this.content.length, pos);\n if (pos > this.size || pos < 0)\n throw new RangeError(`Position ${pos} outside of fragment (${this})`);\n for (let i = 0, curPos = 0;; i++) {\n let cur = this.child(i), end = curPos + cur.nodeSize;\n if (end >= pos) {\n if (end == pos)\n return retIndex(i + 1, end);\n return retIndex(i, curPos);\n }\n curPos = end;\n }\n }\n /**\n Return a debugging string that describes this fragment.\n */\n toString() { return \"<\" + this.toStringInner() + \">\"; }\n /**\n @internal\n */\n toStringInner() { return this.content.join(\", \"); }\n /**\n Create a JSON-serializeable representation of this fragment.\n */\n toJSON() {\n return this.content.length ? this.content.map(n => n.toJSON()) : null;\n }\n /**\n Deserialize a fragment from its JSON representation.\n */\n static fromJSON(schema, value) {\n if (!value)\n return Fragment.empty;\n if (!Array.isArray(value))\n throw new RangeError(\"Invalid input for Fragment.fromJSON\");\n return new Fragment(value.map(schema.nodeFromJSON));\n }\n /**\n Build a fragment from an array of nodes. Ensures that adjacent\n text nodes with the same marks are joined together.\n */\n static fromArray(array) {\n if (!array.length)\n return Fragment.empty;\n let joined, size = 0;\n for (let i = 0; i < array.length; i++) {\n let node = array[i];\n size += node.nodeSize;\n if (i && node.isText && array[i - 1].sameMarkup(node)) {\n if (!joined)\n joined = array.slice(0, i);\n joined[joined.length - 1] = node\n .withText(joined[joined.length - 1].text + node.text);\n }\n else if (joined) {\n joined.push(node);\n }\n }\n return new Fragment(joined || array, size);\n }\n /**\n Create a fragment from something that can be interpreted as a\n set of nodes. For `null`, it returns the empty fragment. For a\n fragment, the fragment itself. For a node or array of nodes, a\n fragment containing those nodes.\n */\n static from(nodes) {\n if (!nodes)\n return Fragment.empty;\n if (nodes instanceof Fragment)\n return nodes;\n if (Array.isArray(nodes))\n return this.fromArray(nodes);\n if (nodes.attrs)\n return new Fragment([nodes], nodes.nodeSize);\n throw new RangeError(\"Can not convert \" + nodes + \" to a Fragment\" +\n (nodes.nodesBetween ? \" (looks like multiple versions of prosemirror-model were loaded)\" : \"\"));\n }\n}\n/**\nAn empty fragment. Intended to be reused whenever a node doesn't\ncontain anything (rather than allocating a new empty fragment for\neach leaf node).\n*/\nFragment.empty = new Fragment([], 0);\nconst found = { index: 0, offset: 0 };\nfunction retIndex(index, offset) {\n found.index = index;\n found.offset = offset;\n return found;\n}\n\nfunction compareDeep(a, b) {\n if (a === b)\n return true;\n if (!(a && typeof a == \"object\") ||\n !(b && typeof b == \"object\"))\n return false;\n let array = Array.isArray(a);\n if (Array.isArray(b) != array)\n return false;\n if (array) {\n if (a.length != b.length)\n return false;\n for (let i = 0; i < a.length; i++)\n if (!compareDeep(a[i], b[i]))\n return false;\n }\n else {\n for (let p in a)\n if (!(p in b) || !compareDeep(a[p], b[p]))\n return false;\n for (let p in b)\n if (!(p in a))\n return false;\n }\n return true;\n}\n\n/**\nA mark is a piece of information that can be attached to a node,\nsuch as it being emphasized, in code font, or a link. It has a\ntype and optionally a set of attributes that provide further\ninformation (such as the target of the link). Marks are created\nthrough a `Schema`, which controls which types exist and which\nattributes they have.\n*/\nclass Mark {\n /**\n @internal\n */\n constructor(\n /**\n The type of this mark.\n */\n type, \n /**\n The attributes associated with this mark.\n */\n attrs) {\n this.type = type;\n this.attrs = attrs;\n }\n /**\n Given a set of marks, create a new set which contains this one as\n well, in the right position. If this mark is already in the set,\n the set itself is returned. If any marks that are set to be\n [exclusive](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) with this mark are present,\n those are replaced by this one.\n */\n addToSet(set) {\n let copy, placed = false;\n for (let i = 0; i < set.length; i++) {\n let other = set[i];\n if (this.eq(other))\n return set;\n if (this.type.excludes(other.type)) {\n if (!copy)\n copy = set.slice(0, i);\n }\n else if (other.type.excludes(this.type)) {\n return set;\n }\n else {\n if (!placed && other.type.rank > this.type.rank) {\n if (!copy)\n copy = set.slice(0, i);\n copy.push(this);\n placed = true;\n }\n if (copy)\n copy.push(other);\n }\n }\n if (!copy)\n copy = set.slice();\n if (!placed)\n copy.push(this);\n return copy;\n }\n /**\n Remove this mark from the given set, returning a new set. If this\n mark is not in the set, the set itself is returned.\n */\n removeFromSet(set) {\n for (let i = 0; i < set.length; i++)\n if (this.eq(set[i]))\n return set.slice(0, i).concat(set.slice(i + 1));\n return set;\n }\n /**\n Test whether this mark is in the given set of marks.\n */\n isInSet(set) {\n for (let i = 0; i < set.length; i++)\n if (this.eq(set[i]))\n return true;\n return false;\n }\n /**\n Test whether this mark has the same type and attributes as\n another mark.\n */\n eq(other) {\n return this == other ||\n (this.type == other.type && compareDeep(this.attrs, other.attrs));\n }\n /**\n Convert this mark to a JSON-serializeable representation.\n */\n toJSON() {\n let obj = { type: this.type.name };\n for (let _ in this.attrs) {\n obj.attrs = this.attrs;\n break;\n }\n return obj;\n }\n /**\n Deserialize a mark from JSON.\n */\n static fromJSON(schema, json) {\n if (!json)\n throw new RangeError(\"Invalid input for Mark.fromJSON\");\n let type = schema.marks[json.type];\n if (!type)\n throw new RangeError(`There is no mark type ${json.type} in this schema`);\n let mark = type.create(json.attrs);\n type.checkAttrs(mark.attrs);\n return mark;\n }\n /**\n Test whether two sets of marks are identical.\n */\n static sameSet(a, b) {\n if (a == b)\n return true;\n if (a.length != b.length)\n return false;\n for (let i = 0; i < a.length; i++)\n if (!a[i].eq(b[i]))\n return false;\n return true;\n }\n /**\n Create a properly sorted mark set from null, a single mark, or an\n unsorted array of marks.\n */\n static setFrom(marks) {\n if (!marks || Array.isArray(marks) && marks.length == 0)\n return Mark.none;\n if (marks instanceof Mark)\n return [marks];\n let copy = marks.slice();\n copy.sort((a, b) => a.type.rank - b.type.rank);\n return copy;\n }\n}\n/**\nThe empty set of marks.\n*/\nMark.none = [];\n\n/**\nError type raised by [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) when\ngiven an invalid replacement.\n*/\nclass ReplaceError extends Error {\n}\n/*\nReplaceError = function(this: any, message: string) {\n let err = Error.call(this, message)\n ;(err as any).__proto__ = ReplaceError.prototype\n return err\n} as any\n\nReplaceError.prototype = Object.create(Error.prototype)\nReplaceError.prototype.constructor = ReplaceError\nReplaceError.prototype.name = \"ReplaceError\"\n*/\n/**\nA slice represents a piece cut out of a larger document. It\nstores not only a fragment, but also the depth up to which nodes on\nboth side are ‘open’ (cut through).\n*/\nclass Slice {\n /**\n Create a slice. When specifying a non-zero open depth, you must\n make sure that there are nodes of at least that depth at the\n appropriate side of the fragment—i.e. if the fragment is an\n empty paragraph node, `openStart` and `openEnd` can't be greater\n than 1.\n \n It is not necessary for the content of open nodes to conform to\n the schema's content constraints, though it should be a valid\n start/end/middle for such a node, depending on which sides are\n open.\n */\n constructor(\n /**\n The slice's content.\n */\n content, \n /**\n The open depth at the start of the fragment.\n */\n openStart, \n /**\n The open depth at the end.\n */\n openEnd) {\n this.content = content;\n this.openStart = openStart;\n this.openEnd = openEnd;\n }\n /**\n The size this slice would add when inserted into a document.\n */\n get size() {\n return this.content.size - this.openStart - this.openEnd;\n }\n /**\n @internal\n */\n insertAt(pos, fragment) {\n let content = insertInto(this.content, pos + this.openStart, fragment);\n return content && new Slice(content, this.openStart, this.openEnd);\n }\n /**\n @internal\n */\n removeBetween(from, to) {\n return new Slice(removeRange(this.content, from + this.openStart, to + this.openStart), this.openStart, this.openEnd);\n }\n /**\n Tests whether this slice is equal to another slice.\n */\n eq(other) {\n return this.content.eq(other.content) && this.openStart == other.openStart && this.openEnd == other.openEnd;\n }\n /**\n @internal\n */\n toString() {\n return this.content + \"(\" + this.openStart + \",\" + this.openEnd + \")\";\n }\n /**\n Convert a slice to a JSON-serializable representation.\n */\n toJSON() {\n if (!this.content.size)\n return null;\n let json = { content: this.content.toJSON() };\n if (this.openStart > 0)\n json.openStart = this.openStart;\n if (this.openEnd > 0)\n json.openEnd = this.openEnd;\n return json;\n }\n /**\n Deserialize a slice from its JSON representation.\n */\n static fromJSON(schema, json) {\n if (!json)\n return Slice.empty;\n let openStart = json.openStart || 0, openEnd = json.openEnd || 0;\n if (typeof openStart != \"number\" || typeof openEnd != \"number\")\n throw new RangeError(\"Invalid input for Slice.fromJSON\");\n return new Slice(Fragment.fromJSON(schema, json.content), openStart, openEnd);\n }\n /**\n Create a slice from a fragment by taking the maximum possible\n open value on both side of the fragment.\n */\n static maxOpen(fragment, openIsolating = true) {\n let openStart = 0, openEnd = 0;\n for (let n = fragment.firstChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.firstChild)\n openStart++;\n for (let n = fragment.lastChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.lastChild)\n openEnd++;\n return new Slice(fragment, openStart, openEnd);\n }\n}\n/**\nThe empty slice.\n*/\nSlice.empty = new Slice(Fragment.empty, 0, 0);\nfunction removeRange(content, from, to) {\n let { index, offset } = content.findIndex(from), child = content.maybeChild(index);\n let { index: indexTo, offset: offsetTo } = content.findIndex(to);\n if (offset == from || child.isText) {\n if (offsetTo != to && !content.child(indexTo).isText)\n throw new RangeError(\"Removing non-flat range\");\n return content.cut(0, from).append(content.cut(to));\n }\n if (index != indexTo)\n throw new RangeError(\"Removing non-flat range\");\n return content.replaceChild(index, child.copy(removeRange(child.content, from - offset - 1, to - offset - 1)));\n}\nfunction insertInto(content, dist, insert, parent) {\n let { index, offset } = content.findIndex(dist), child = content.maybeChild(index);\n if (offset == dist || child.isText) {\n if (parent && !parent.canReplace(index, index, insert))\n return null;\n return content.cut(0, dist).append(insert).append(content.cut(dist));\n }\n let inner = insertInto(child.content, dist - offset - 1, insert, child);\n return inner && content.replaceChild(index, child.copy(inner));\n}\nfunction replace($from, $to, slice) {\n if (slice.openStart > $from.depth)\n throw new ReplaceError(\"Inserted content deeper than insertion position\");\n if ($from.depth - slice.openStart != $to.depth - slice.openEnd)\n throw new ReplaceError(\"Inconsistent open depths\");\n return replaceOuter($from, $to, slice, 0);\n}\nfunction replaceOuter($from, $to, slice, depth) {\n let index = $from.index(depth), node = $from.node(depth);\n if (index == $to.index(depth) && depth < $from.depth - slice.openStart) {\n let inner = replaceOuter($from, $to, slice, depth + 1);\n return node.copy(node.content.replaceChild(index, inner));\n }\n else if (!slice.content.size) {\n return close(node, replaceTwoWay($from, $to, depth));\n }\n else if (!slice.openStart && !slice.openEnd && $from.depth == depth && $to.depth == depth) { // Simple, flat case\n let parent = $from.parent, content = parent.content;\n return close(parent, content.cut(0, $from.parentOffset).append(slice.content).append(content.cut($to.parentOffset)));\n }\n else {\n let { start, end } = prepareSliceForReplace(slice, $from);\n return close(node, replaceThreeWay($from, start, end, $to, depth));\n }\n}\nfunction checkJoin(main, sub) {\n if (!sub.type.compatibleContent(main.type))\n throw new ReplaceError(\"Cannot join \" + sub.type.name + \" onto \" + main.type.name);\n}\nfunction joinable($before, $after, depth) {\n let node = $before.node(depth);\n checkJoin(node, $after.node(depth));\n return node;\n}\nfunction addNode(child, target) {\n let last = target.length - 1;\n if (last >= 0 && child.isText && child.sameMarkup(target[last]))\n target[last] = child.withText(target[last].text + child.text);\n else\n target.push(child);\n}\nfunction addRange($start, $end, depth, target) {\n let node = ($end || $start).node(depth);\n let startIndex = 0, endIndex = $end ? $end.index(depth) : node.childCount;\n if ($start) {\n startIndex = $start.index(depth);\n if ($start.depth > depth) {\n startIndex++;\n }\n else if ($start.textOffset) {\n addNode($start.nodeAfter, target);\n startIndex++;\n }\n }\n for (let i = startIndex; i < endIndex; i++)\n addNode(node.child(i), target);\n if ($end && $end.depth == depth && $end.textOffset)\n addNode($end.nodeBefore, target);\n}\nfunction close(node, content) {\n node.type.checkContent(content);\n return node.copy(content);\n}\nfunction replaceThreeWay($from, $start, $end, $to, depth) {\n let openStart = $from.depth > depth && joinable($from, $start, depth + 1);\n let openEnd = $to.depth > depth && joinable($end, $to, depth + 1);\n let content = [];\n addRange(null, $from, depth, content);\n if (openStart && openEnd && $start.index(depth) == $end.index(depth)) {\n checkJoin(openStart, openEnd);\n addNode(close(openStart, replaceThreeWay($from, $start, $end, $to, depth + 1)), content);\n }\n else {\n if (openStart)\n addNode(close(openStart, replaceTwoWay($from, $start, depth + 1)), content);\n addRange($start, $end, depth, content);\n if (openEnd)\n addNode(close(openEnd, replaceTwoWay($end, $to, depth + 1)), content);\n }\n addRange($to, null, depth, content);\n return new Fragment(content);\n}\nfunction replaceTwoWay($from, $to, depth) {\n let content = [];\n addRange(null, $from, depth, content);\n if ($from.depth > depth) {\n let type = joinable($from, $to, depth + 1);\n addNode(close(type, replaceTwoWay($from, $to, depth + 1)), content);\n }\n addRange($to, null, depth, content);\n return new Fragment(content);\n}\nfunction prepareSliceForReplace(slice, $along) {\n let extra = $along.depth - slice.openStart, parent = $along.node(extra);\n let node = parent.copy(slice.content);\n for (let i = extra - 1; i >= 0; i--)\n node = $along.node(i).copy(Fragment.from(node));\n return { start: node.resolveNoCache(slice.openStart + extra),\n end: node.resolveNoCache(node.content.size - slice.openEnd - extra) };\n}\n\n/**\nYou can [_resolve_](https://prosemirror.net/docs/ref/#model.Node.resolve) a position to get more\ninformation about it. Objects of this class represent such a\nresolved position, providing various pieces of context\ninformation, and some helper methods.\n\nThroughout this interface, methods that take an optional `depth`\nparameter will interpret undefined as `this.depth` and negative\nnumbers as `this.depth + value`.\n*/\nclass ResolvedPos {\n /**\n @internal\n */\n constructor(\n /**\n The position that was resolved.\n */\n pos, \n /**\n @internal\n */\n path, \n /**\n The offset this position has into its parent node.\n */\n parentOffset) {\n this.pos = pos;\n this.path = path;\n this.parentOffset = parentOffset;\n this.depth = path.length / 3 - 1;\n }\n /**\n @internal\n */\n resolveDepth(val) {\n if (val == null)\n return this.depth;\n if (val < 0)\n return this.depth + val;\n return val;\n }\n /**\n The parent node that the position points into. Note that even if\n a position points into a text node, that node is not considered\n the parent—text nodes are ‘flat’ in this model, and have no content.\n */\n get parent() { return this.node(this.depth); }\n /**\n The root node in which the position was resolved.\n */\n get doc() { return this.node(0); }\n /**\n The ancestor node at the given level. `p.node(p.depth)` is the\n same as `p.parent`.\n */\n node(depth) { return this.path[this.resolveDepth(depth) * 3]; }\n /**\n The index into the ancestor at the given level. If this points\n at the 3rd node in the 2nd paragraph on the top level, for\n example, `p.index(0)` is 1 and `p.index(1)` is 2.\n */\n index(depth) { return this.path[this.resolveDepth(depth) * 3 + 1]; }\n /**\n The index pointing after this position into the ancestor at the\n given level.\n */\n indexAfter(depth) {\n depth = this.resolveDepth(depth);\n return this.index(depth) + (depth == this.depth && !this.textOffset ? 0 : 1);\n }\n /**\n The (absolute) position at the start of the node at the given\n level.\n */\n start(depth) {\n depth = this.resolveDepth(depth);\n return depth == 0 ? 0 : this.path[depth * 3 - 1] + 1;\n }\n /**\n The (absolute) position at the end of the node at the given\n level.\n */\n end(depth) {\n depth = this.resolveDepth(depth);\n return this.start(depth) + this.node(depth).content.size;\n }\n /**\n The (absolute) position directly before the wrapping node at the\n given level, or, when `depth` is `this.depth + 1`, the original\n position.\n */\n before(depth) {\n depth = this.resolveDepth(depth);\n if (!depth)\n throw new RangeError(\"There is no position before the top-level node\");\n return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1];\n }\n /**\n The (absolute) position directly after the wrapping node at the\n given level, or the original position when `depth` is `this.depth + 1`.\n */\n after(depth) {\n depth = this.resolveDepth(depth);\n if (!depth)\n throw new RangeError(\"There is no position after the top-level node\");\n return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1] + this.path[depth * 3].nodeSize;\n }\n /**\n When this position points into a text node, this returns the\n distance between the position and the start of the text node.\n Will be zero for positions that point between nodes.\n */\n get textOffset() { return this.pos - this.path[this.path.length - 1]; }\n /**\n Get the node directly after the position, if any. If the position\n points into a text node, only the part of that node after the\n position is returned.\n */\n get nodeAfter() {\n let parent = this.parent, index = this.index(this.depth);\n if (index == parent.childCount)\n return null;\n let dOff = this.pos - this.path[this.path.length - 1], child = parent.child(index);\n return dOff ? parent.child(index).cut(dOff) : child;\n }\n /**\n Get the node directly before the position, if any. If the\n position points into a text node, only the part of that node\n before the position is returned.\n */\n get nodeBefore() {\n let index = this.index(this.depth);\n let dOff = this.pos - this.path[this.path.length - 1];\n if (dOff)\n return this.parent.child(index).cut(0, dOff);\n return index == 0 ? null : this.parent.child(index - 1);\n }\n /**\n Get the position at the given index in the parent node at the\n given depth (which defaults to `this.depth`).\n */\n posAtIndex(index, depth) {\n depth = this.resolveDepth(depth);\n let node = this.path[depth * 3], pos = depth == 0 ? 0 : this.path[depth * 3 - 1] + 1;\n for (let i = 0; i < index; i++)\n pos += node.child(i).nodeSize;\n return pos;\n }\n /**\n Get the marks at this position, factoring in the surrounding\n marks' [`inclusive`](https://prosemirror.net/docs/ref/#model.MarkSpec.inclusive) property. If the\n position is at the start of a non-empty node, the marks of the\n node after it (if any) are returned.\n */\n marks() {\n let parent = this.parent, index = this.index();\n // In an empty parent, return the empty array\n if (parent.content.size == 0)\n return Mark.none;\n // When inside a text node, just return the text node's marks\n if (this.textOffset)\n return parent.child(index).marks;\n let main = parent.maybeChild(index - 1), other = parent.maybeChild(index);\n // If the `after` flag is true of there is no node before, make\n // the node after this position the main reference.\n if (!main) {\n let tmp = main;\n main = other;\n other = tmp;\n }\n // Use all marks in the main node, except those that have\n // `inclusive` set to false and are not present in the other node.\n let marks = main.marks;\n for (var i = 0; i < marks.length; i++)\n if (marks[i].type.spec.inclusive === false && (!other || !marks[i].isInSet(other.marks)))\n marks = marks[i--].removeFromSet(marks);\n return marks;\n }\n /**\n Get the marks after the current position, if any, except those\n that are non-inclusive and not present at position `$end`. This\n is mostly useful for getting the set of marks to preserve after a\n deletion. Will return `null` if this position is at the end of\n its parent node or its parent node isn't a textblock (in which\n case no marks should be preserved).\n */\n marksAcross($end) {\n let after = this.parent.maybeChild(this.index());\n if (!after || !after.isInline)\n return null;\n let marks = after.marks, next = $end.parent.maybeChild($end.index());\n for (var i = 0; i < marks.length; i++)\n if (marks[i].type.spec.inclusive === false && (!next || !marks[i].isInSet(next.marks)))\n marks = marks[i--].removeFromSet(marks);\n return marks;\n }\n /**\n The depth up to which this position and the given (non-resolved)\n position share the same parent nodes.\n */\n sharedDepth(pos) {\n for (let depth = this.depth; depth > 0; depth--)\n if (this.start(depth) <= pos && this.end(depth) >= pos)\n return depth;\n return 0;\n }\n /**\n Returns a range based on the place where this position and the\n given position diverge around block content. If both point into\n the same textblock, for example, a range around that textblock\n will be returned. If they point into different blocks, the range\n around those blocks in their shared ancestor is returned. You can\n pass in an optional predicate that will be called with a parent\n node to see if a range into that parent is acceptable.\n */\n blockRange(other = this, pred) {\n if (other.pos < this.pos)\n return other.blockRange(this);\n for (let d = this.depth - (this.parent.inlineContent || this.pos == other.pos ? 1 : 0); d >= 0; d--)\n if (other.pos <= this.end(d) && (!pred || pred(this.node(d))))\n return new NodeRange(this, other, d);\n return null;\n }\n /**\n Query whether the given position shares the same parent node.\n */\n sameParent(other) {\n return this.pos - this.parentOffset == other.pos - other.parentOffset;\n }\n /**\n Return the greater of this and the given position.\n */\n max(other) {\n return other.pos > this.pos ? other : this;\n }\n /**\n Return the smaller of this and the given position.\n */\n min(other) {\n return other.pos < this.pos ? other : this;\n }\n /**\n @internal\n */\n toString() {\n let str = \"\";\n for (let i = 1; i <= this.depth; i++)\n str += (str ? \"/\" : \"\") + this.node(i).type.name + \"_\" + this.index(i - 1);\n return str + \":\" + this.parentOffset;\n }\n /**\n @internal\n */\n static resolve(doc, pos) {\n if (!(pos >= 0 && pos <= doc.content.size))\n throw new RangeError(\"Position \" + pos + \" out of range\");\n let path = [];\n let start = 0, parentOffset = pos;\n for (let node = doc;;) {\n let { index, offset } = node.content.findIndex(parentOffset);\n let rem = parentOffset - offset;\n path.push(node, index, start + offset);\n if (!rem)\n break;\n node = node.child(index);\n if (node.isText)\n break;\n parentOffset = rem - 1;\n start += offset + 1;\n }\n return new ResolvedPos(pos, path, parentOffset);\n }\n /**\n @internal\n */\n static resolveCached(doc, pos) {\n let cache = resolveCache.get(doc);\n if (cache) {\n for (let i = 0; i < cache.elts.length; i++) {\n let elt = cache.elts[i];\n if (elt.pos == pos)\n return elt;\n }\n }\n else {\n resolveCache.set(doc, cache = new ResolveCache);\n }\n let result = cache.elts[cache.i] = ResolvedPos.resolve(doc, pos);\n cache.i = (cache.i + 1) % resolveCacheSize;\n return result;\n }\n}\nclass ResolveCache {\n constructor() {\n this.elts = [];\n this.i = 0;\n }\n}\nconst resolveCacheSize = 12, resolveCache = new WeakMap();\n/**\nRepresents a flat range of content, i.e. one that starts and\nends in the same node.\n*/\nclass NodeRange {\n /**\n Construct a node range. `$from` and `$to` should point into the\n same node until at least the given `depth`, since a node range\n denotes an adjacent set of nodes in a single parent node.\n */\n constructor(\n /**\n A resolved position along the start of the content. May have a\n `depth` greater than this object's `depth` property, since\n these are the positions that were used to compute the range,\n not re-resolved positions directly at its boundaries.\n */\n $from, \n /**\n A position along the end of the content. See\n caveat for [`$from`](https://prosemirror.net/docs/ref/#model.NodeRange.$from).\n */\n $to, \n /**\n The depth of the node that this range points into.\n */\n depth) {\n this.$from = $from;\n this.$to = $to;\n this.depth = depth;\n }\n /**\n The position at the start of the range.\n */\n get start() { return this.$from.before(this.depth + 1); }\n /**\n The position at the end of the range.\n */\n get end() { return this.$to.after(this.depth + 1); }\n /**\n The parent node that the range points into.\n */\n get parent() { return this.$from.node(this.depth); }\n /**\n The start index of the range in the parent node.\n */\n get startIndex() { return this.$from.index(this.depth); }\n /**\n The end index of the range in the parent node.\n */\n get endIndex() { return this.$to.indexAfter(this.depth); }\n}\n\nconst emptyAttrs = Object.create(null);\n/**\nThis class represents a node in the tree that makes up a\nProseMirror document. So a document is an instance of `Node`, with\nchildren that are also instances of `Node`.\n\nNodes are persistent data structures. Instead of changing them, you\ncreate new ones with the content you want. Old ones keep pointing\nat the old document shape. This is made cheaper by sharing\nstructure between the old and new data as much as possible, which a\ntree shape like this (without back pointers) makes easy.\n\n**Do not** directly mutate the properties of a `Node` object. See\n[the guide](https://prosemirror.net/docs/guide/#doc) for more information.\n*/\nclass Node {\n /**\n @internal\n */\n constructor(\n /**\n The type of node that this is.\n */\n type, \n /**\n An object mapping attribute names to values. The kind of\n attributes allowed and required are\n [determined](https://prosemirror.net/docs/ref/#model.NodeSpec.attrs) by the node type.\n */\n attrs, \n // A fragment holding the node's children.\n content, \n /**\n The marks (things like whether it is emphasized or part of a\n link) applied to this node.\n */\n marks = Mark.none) {\n this.type = type;\n this.attrs = attrs;\n this.marks = marks;\n this.content = content || Fragment.empty;\n }\n /**\n The array of this node's child nodes.\n */\n get children() { return this.content.content; }\n /**\n The size of this node, as defined by the integer-based [indexing\n scheme](https://prosemirror.net/docs/guide/#doc.indexing). For text nodes, this is the\n amount of characters. For other leaf nodes, it is one. For\n non-leaf nodes, it is the size of the content plus two (the\n start and end token).\n */\n get nodeSize() { return this.isLeaf ? 1 : 2 + this.content.size; }\n /**\n The number of children that the node has.\n */\n get childCount() { return this.content.childCount; }\n /**\n Get the child node at the given index. Raises an error when the\n index is out of range.\n */\n child(index) { return this.content.child(index); }\n /**\n Get the child node at the given index, if it exists.\n */\n maybeChild(index) { return this.content.maybeChild(index); }\n /**\n Call `f` for every child node, passing the node, its offset\n into this parent node, and its index.\n */\n forEach(f) { this.content.forEach(f); }\n /**\n Invoke a callback for all descendant nodes recursively between\n the given two positions that are relative to start of this\n node's content. The callback is invoked with the node, its\n position relative to the original node (method receiver),\n its parent node, and its child index. When the callback returns\n false for a given node, that node's children will not be\n recursed over. The last parameter can be used to specify a\n starting position to count from.\n */\n nodesBetween(from, to, f, startPos = 0) {\n this.content.nodesBetween(from, to, f, startPos, this);\n }\n /**\n Call the given callback for every descendant node. Doesn't\n descend into a node when the callback returns `false`.\n */\n descendants(f) {\n this.nodesBetween(0, this.content.size, f);\n }\n /**\n Concatenates all the text nodes found in this fragment and its\n children.\n */\n get textContent() {\n return (this.isLeaf && this.type.spec.leafText)\n ? this.type.spec.leafText(this)\n : this.textBetween(0, this.content.size, \"\");\n }\n /**\n Get all text between positions `from` and `to`. When\n `blockSeparator` is given, it will be inserted to separate text\n from different block nodes. If `leafText` is given, it'll be\n inserted for every non-text leaf node encountered, otherwise\n [`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec.leafText) will be used.\n */\n textBetween(from, to, blockSeparator, leafText) {\n return this.content.textBetween(from, to, blockSeparator, leafText);\n }\n /**\n Returns this node's first child, or `null` if there are no\n children.\n */\n get firstChild() { return this.content.firstChild; }\n /**\n Returns this node's last child, or `null` if there are no\n children.\n */\n get lastChild() { return this.content.lastChild; }\n /**\n Test whether two nodes represent the same piece of document.\n */\n eq(other) {\n return this == other || (this.sameMarkup(other) && this.content.eq(other.content));\n }\n /**\n Compare the markup (type, attributes, and marks) of this node to\n those of another. Returns `true` if both have the same markup.\n */\n sameMarkup(other) {\n return this.hasMarkup(other.type, other.attrs, other.marks);\n }\n /**\n Check whether this node's markup correspond to the given type,\n attributes, and marks.\n */\n hasMarkup(type, attrs, marks) {\n return this.type == type &&\n compareDeep(this.attrs, attrs || type.defaultAttrs || emptyAttrs) &&\n Mark.sameSet(this.marks, marks || Mark.none);\n }\n /**\n Create a new node with the same markup as this node, containing\n the given content (or empty, if no content is given).\n */\n copy(content = null) {\n if (content == this.content)\n return this;\n return new Node(this.type, this.attrs, content, this.marks);\n }\n /**\n Create a copy of this node, with the given set of marks instead\n of the node's own marks.\n */\n mark(marks) {\n return marks == this.marks ? this : new Node(this.type, this.attrs, this.content, marks);\n }\n /**\n Create a copy of this node with only the content between the\n given positions. If `to` is not given, it defaults to the end of\n the node.\n */\n cut(from, to = this.content.size) {\n if (from == 0 && to == this.content.size)\n return this;\n return this.copy(this.content.cut(from, to));\n }\n /**\n Cut out the part of the document between the given positions, and\n return it as a `Slice` object.\n */\n slice(from, to = this.content.size, includeParents = false) {\n if (from == to)\n return Slice.empty;\n let $from = this.resolve(from), $to = this.resolve(to);\n let depth = includeParents ? 0 : $from.sharedDepth(to);\n let start = $from.start(depth), node = $from.node(depth);\n let content = node.content.cut($from.pos - start, $to.pos - start);\n return new Slice(content, $from.depth - depth, $to.depth - depth);\n }\n /**\n Replace the part of the document between the given positions with\n the given slice. The slice must 'fit', meaning its open sides\n must be able to connect to the surrounding content, and its\n content nodes must be valid children for the node they are placed\n into. If any of this is violated, an error of type\n [`ReplaceError`](https://prosemirror.net/docs/ref/#model.ReplaceError) is thrown.\n */\n replace(from, to, slice) {\n return replace(this.resolve(from), this.resolve(to), slice);\n }\n /**\n Find the node directly after the given position.\n */\n nodeAt(pos) {\n for (let node = this;;) {\n let { index, offset } = node.content.findIndex(pos);\n node = node.maybeChild(index);\n if (!node)\n return null;\n if (offset == pos || node.isText)\n return node;\n pos -= offset + 1;\n }\n }\n /**\n Find the (direct) child node after the given offset, if any,\n and return it along with its index and offset relative to this\n node.\n */\n childAfter(pos) {\n let { index, offset } = this.content.findIndex(pos);\n return { node: this.content.maybeChild(index), index, offset };\n }\n /**\n Find the (direct) child node before the given offset, if any,\n and return it along with its index and offset relative to this\n node.\n */\n childBefore(pos) {\n if (pos == 0)\n return { node: null, index: 0, offset: 0 };\n let { index, offset } = this.content.findIndex(pos);\n if (offset < pos)\n return { node: this.content.child(index), index, offset };\n let node = this.content.child(index - 1);\n return { node, index: index - 1, offset: offset - node.nodeSize };\n }\n /**\n Resolve the given position in the document, returning an\n [object](https://prosemirror.net/docs/ref/#model.ResolvedPos) with information about its context.\n */\n resolve(pos) { return ResolvedPos.resolveCached(this, pos); }\n /**\n @internal\n */\n resolveNoCache(pos) { return ResolvedPos.resolve(this, pos); }\n /**\n Test whether a given mark or mark type occurs in this document\n between the two given positions.\n */\n rangeHasMark(from, to, type) {\n let found = false;\n if (to > from)\n this.nodesBetween(from, to, node => {\n if (type.isInSet(node.marks))\n found = true;\n return !found;\n });\n return found;\n }\n /**\n True when this is a block (non-inline node)\n */\n get isBlock() { return this.type.isBlock; }\n /**\n True when this is a textblock node, a block node with inline\n content.\n */\n get isTextblock() { return this.type.isTextblock; }\n /**\n True when this node allows inline content.\n */\n get inlineContent() { return this.type.inlineContent; }\n /**\n True when this is an inline node (a text node or a node that can\n appear among text).\n */\n get isInline() { return this.type.isInline; }\n /**\n True when this is a text node.\n */\n get isText() { return this.type.isText; }\n /**\n True when this is a leaf node.\n */\n get isLeaf() { return this.type.isLeaf; }\n /**\n True when this is an atom, i.e. when it does not have directly\n editable content. This is usually the same as `isLeaf`, but can\n be configured with the [`atom` property](https://prosemirror.net/docs/ref/#model.NodeSpec.atom)\n on a node's spec (typically used when the node is displayed as\n an uneditable [node view](https://prosemirror.net/docs/ref/#view.NodeView)).\n */\n get isAtom() { return this.type.isAtom; }\n /**\n Return a string representation of this node for debugging\n purposes.\n */\n toString() {\n if (this.type.spec.toDebugString)\n return this.type.spec.toDebugString(this);\n let name = this.type.name;\n if (this.content.size)\n name += \"(\" + this.content.toStringInner() + \")\";\n return wrapMarks(this.marks, name);\n }\n /**\n Get the content match in this node at the given index.\n */\n contentMatchAt(index) {\n let match = this.type.contentMatch.matchFragment(this.content, 0, index);\n if (!match)\n throw new Error(\"Called contentMatchAt on a node with invalid content\");\n return match;\n }\n /**\n Test whether replacing the range between `from` and `to` (by\n child index) with the given replacement fragment (which defaults\n to the empty fragment) would leave the node's content valid. You\n can optionally pass `start` and `end` indices into the\n replacement fragment.\n */\n canReplace(from, to, replacement = Fragment.empty, start = 0, end = replacement.childCount) {\n let one = this.contentMatchAt(from).matchFragment(replacement, start, end);\n let two = one && one.matchFragment(this.content, to);\n if (!two || !two.validEnd)\n return false;\n for (let i = start; i < end; i++)\n if (!this.type.allowsMarks(replacement.child(i).marks))\n return false;\n return true;\n }\n /**\n Test whether replacing the range `from` to `to` (by index) with\n a node of the given type would leave the node's content valid.\n */\n canReplaceWith(from, to, type, marks) {\n if (marks && !this.type.allowsMarks(marks))\n return false;\n let start = this.contentMatchAt(from).matchType(type);\n let end = start && start.matchFragment(this.content, to);\n return end ? end.validEnd : false;\n }\n /**\n Test whether the given node's content could be appended to this\n node. If that node is empty, this will only return true if there\n is at least one node type that can appear in both nodes (to avoid\n merging completely incompatible nodes).\n */\n canAppend(other) {\n if (other.content.size)\n return this.canReplace(this.childCount, this.childCount, other.content);\n else\n return this.type.compatibleContent(other.type);\n }\n /**\n Check whether this node and its descendants conform to the\n schema, and raise an exception when they do not.\n */\n check() {\n this.type.checkContent(this.content);\n this.type.checkAttrs(this.attrs);\n let copy = Mark.none;\n for (let i = 0; i < this.marks.length; i++) {\n let mark = this.marks[i];\n mark.type.checkAttrs(mark.attrs);\n copy = mark.addToSet(copy);\n }\n if (!Mark.sameSet(copy, this.marks))\n throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(m => m.type.name)}`);\n this.content.forEach(node => node.check());\n }\n /**\n Return a JSON-serializeable representation of this node.\n */\n toJSON() {\n let obj = { type: this.type.name };\n for (let _ in this.attrs) {\n obj.attrs = this.attrs;\n break;\n }\n if (this.content.size)\n obj.content = this.content.toJSON();\n if (this.marks.length)\n obj.marks = this.marks.map(n => n.toJSON());\n return obj;\n }\n /**\n Deserialize a node from its JSON representation.\n */\n static fromJSON(schema, json) {\n if (!json)\n throw new RangeError(\"Invalid input for Node.fromJSON\");\n let marks = undefined;\n if (json.marks) {\n if (!Array.isArray(json.marks))\n throw new RangeError(\"Invalid mark data for Node.fromJSON\");\n marks = json.marks.map(schema.markFromJSON);\n }\n if (json.type == \"text\") {\n if (typeof json.text != \"string\")\n throw new RangeError(\"Invalid text node in JSON\");\n return schema.text(json.text, marks);\n }\n let content = Fragment.fromJSON(schema, json.content);\n let node = schema.nodeType(json.type).create(json.attrs, content, marks);\n node.type.checkAttrs(node.attrs);\n return node;\n }\n}\nNode.prototype.text = undefined;\nclass TextNode extends Node {\n /**\n @internal\n */\n constructor(type, attrs, content, marks) {\n super(type, attrs, null, marks);\n if (!content)\n throw new RangeError(\"Empty text nodes are not allowed\");\n this.text = content;\n }\n toString() {\n if (this.type.spec.toDebugString)\n return this.type.spec.toDebugString(this);\n return wrapMarks(this.marks, JSON.stringify(this.text));\n }\n get textContent() { return this.text; }\n textBetween(from, to) { return this.text.slice(from, to); }\n get nodeSize() { return this.text.length; }\n mark(marks) {\n return marks == this.marks ? this : new TextNode(this.type, this.attrs, this.text, marks);\n }\n withText(text) {\n if (text == this.text)\n return this;\n return new TextNode(this.type, this.attrs, text, this.marks);\n }\n cut(from = 0, to = this.text.length) {\n if (from == 0 && to == this.text.length)\n return this;\n return this.withText(this.text.slice(from, to));\n }\n eq(other) {\n return this.sameMarkup(other) && this.text == other.text;\n }\n toJSON() {\n let base = super.toJSON();\n base.text = this.text;\n return base;\n }\n}\nfunction wrapMarks(marks, str) {\n for (let i = marks.length - 1; i >= 0; i--)\n str = marks[i].type.name + \"(\" + str + \")\";\n return str;\n}\n\n/**\nInstances of this class represent a match state of a node type's\n[content expression](https://prosemirror.net/docs/ref/#model.NodeSpec.content), and can be used to\nfind out whether further content matches here, and whether a given\nposition is a valid end of the node.\n*/\nclass ContentMatch {\n /**\n @internal\n */\n constructor(\n /**\n True when this match state represents a valid end of the node.\n */\n validEnd) {\n this.validEnd = validEnd;\n /**\n @internal\n */\n this.next = [];\n /**\n @internal\n */\n this.wrapCache = [];\n }\n /**\n @internal\n */\n static parse(string, nodeTypes) {\n let stream = new TokenStream(string, nodeTypes);\n if (stream.next == null)\n return ContentMatch.empty;\n let expr = parseExpr(stream);\n if (stream.next)\n stream.err(\"Unexpected trailing text\");\n let match = dfa(nfa(expr));\n checkForDeadEnds(match, stream);\n return match;\n }\n /**\n Match a node type, returning a match after that node if\n successful.\n */\n matchType(type) {\n for (let i = 0; i < this.next.length; i++)\n if (this.next[i].type == type)\n return this.next[i].next;\n return null;\n }\n /**\n Try to match a fragment. Returns the resulting match when\n successful.\n */\n matchFragment(frag, start = 0, end = frag.childCount) {\n let cur = this;\n for (let i = start; cur && i < end; i++)\n cur = cur.matchType(frag.child(i).type);\n return cur;\n }\n /**\n @internal\n */\n get inlineContent() {\n return this.next.length != 0 && this.next[0].type.isInline;\n }\n /**\n Get the first matching node type at this match position that can\n be generated.\n */\n get defaultType() {\n for (let i = 0; i < this.next.length; i++) {\n let { type } = this.next[i];\n if (!(type.isText || type.hasRequiredAttrs()))\n return type;\n }\n return null;\n }\n /**\n @internal\n */\n compatible(other) {\n for (let i = 0; i < this.next.length; i++)\n for (let j = 0; j < other.next.length; j++)\n if (this.next[i].type == other.next[j].type)\n return true;\n return false;\n }\n /**\n Try to match the given fragment, and if that fails, see if it can\n be made to match by inserting nodes in front of it. When\n successful, return a fragment of inserted nodes (which may be\n empty if nothing had to be inserted). When `toEnd` is true, only\n return a fragment if the resulting match goes to the end of the\n content expression.\n */\n fillBefore(after, toEnd = false, startIndex = 0) {\n let seen = [this];\n function search(match, types) {\n let finished = match.matchFragment(after, startIndex);\n if (finished && (!toEnd || finished.validEnd))\n return Fragment.from(types.map(tp => tp.createAndFill()));\n for (let i = 0; i < match.next.length; i++) {\n let { type, next } = match.next[i];\n if (!(type.isText || type.hasRequiredAttrs()) && seen.indexOf(next) == -1) {\n seen.push(next);\n let found = search(next, types.concat(type));\n if (found)\n return found;\n }\n }\n return null;\n }\n return search(this, []);\n }\n /**\n Find a set of wrapping node types that would allow a node of the\n given type to appear at this position. The result may be empty\n (when it fits directly) and will be null when no such wrapping\n exists.\n */\n findWrapping(target) {\n for (let i = 0; i < this.wrapCache.length; i += 2)\n if (this.wrapCache[i] == target)\n return this.wrapCache[i + 1];\n let computed = this.computeWrapping(target);\n this.wrapCache.push(target, computed);\n return computed;\n }\n /**\n @internal\n */\n computeWrapping(target) {\n let seen = Object.create(null), active = [{ match: this, type: null, via: null }];\n while (active.length) {\n let current = active.shift(), match = current.match;\n if (match.matchType(target)) {\n let result = [];\n for (let obj = current; obj.type; obj = obj.via)\n result.push(obj.type);\n return result.reverse();\n }\n for (let i = 0; i < match.next.length; i++) {\n let { type, next } = match.next[i];\n if (!type.isLeaf && !type.hasRequiredAttrs() && !(type.name in seen) && (!current.type || next.validEnd)) {\n active.push({ match: type.contentMatch, type, via: current });\n seen[type.name] = true;\n }\n }\n }\n return null;\n }\n /**\n The number of outgoing edges this node has in the finite\n automaton that describes the content expression.\n */\n get edgeCount() {\n return this.next.length;\n }\n /**\n Get the _n_th outgoing edge from this node in the finite\n automaton that describes the content expression.\n */\n edge(n) {\n if (n >= this.next.length)\n throw new RangeError(`There's no ${n}th edge in this content match`);\n return this.next[n];\n }\n /**\n @internal\n */\n toString() {\n let seen = [];\n function scan(m) {\n seen.push(m);\n for (let i = 0; i < m.next.length; i++)\n if (seen.indexOf(m.next[i].next) == -1)\n scan(m.next[i].next);\n }\n scan(this);\n return seen.map((m, i) => {\n let out = i + (m.validEnd ? \"*\" : \" \") + \" \";\n for (let i = 0; i < m.next.length; i++)\n out += (i ? \", \" : \"\") + m.next[i].type.name + \"->\" + seen.indexOf(m.next[i].next);\n return out;\n }).join(\"\\n\");\n }\n}\n/**\n@internal\n*/\nContentMatch.empty = new ContentMatch(true);\nclass TokenStream {\n constructor(string, nodeTypes) {\n this.string = string;\n this.nodeTypes = nodeTypes;\n this.inline = null;\n this.pos = 0;\n this.tokens = string.split(/\\s*(?=\\b|\\W|$)/);\n if (this.tokens[this.tokens.length - 1] == \"\")\n this.tokens.pop();\n if (this.tokens[0] == \"\")\n this.tokens.shift();\n }\n get next() { return this.tokens[this.pos]; }\n eat(tok) { return this.next == tok && (this.pos++ || true); }\n err(str) { throw new SyntaxError(str + \" (in content expression '\" + this.string + \"')\"); }\n}\nfunction parseExpr(stream) {\n let exprs = [];\n do {\n exprs.push(parseExprSeq(stream));\n } while (stream.eat(\"|\"));\n return exprs.length == 1 ? exprs[0] : { type: \"choice\", exprs };\n}\nfunction parseExprSeq(stream) {\n let exprs = [];\n do {\n exprs.push(parseExprSubscript(stream));\n } while (stream.next && stream.next != \")\" && stream.next != \"|\");\n return exprs.length == 1 ? exprs[0] : { type: \"seq\", exprs };\n}\nfunction parseExprSubscript(stream) {\n let expr = parseExprAtom(stream);\n for (;;) {\n if (stream.eat(\"+\"))\n expr = { type: \"plus\", expr };\n else if (stream.eat(\"*\"))\n expr = { type: \"star\", expr };\n else if (stream.eat(\"?\"))\n expr = { type: \"opt\", expr };\n else if (stream.eat(\"{\"))\n expr = parseExprRange(stream, expr);\n else\n break;\n }\n return expr;\n}\nfunction parseNum(stream) {\n if (/\\D/.test(stream.next))\n stream.err(\"Expected number, got '\" + stream.next + \"'\");\n let result = Number(stream.next);\n stream.pos++;\n return result;\n}\nfunction parseExprRange(stream, expr) {\n let min = parseNum(stream), max = min;\n if (stream.eat(\",\")) {\n if (stream.next != \"}\")\n max = parseNum(stream);\n else\n max = -1;\n }\n if (!stream.eat(\"}\"))\n stream.err(\"Unclosed braced range\");\n return { type: \"range\", min, max, expr };\n}\nfunction resolveName(stream, name) {\n let types = stream.nodeTypes, type = types[name];\n if (type)\n return [type];\n let result = [];\n for (let typeName in types) {\n let type = types[typeName];\n if (type.isInGroup(name))\n result.push(type);\n }\n if (result.length == 0)\n stream.err(\"No node type or group '\" + name + \"' found\");\n return result;\n}\nfunction parseExprAtom(stream) {\n if (stream.eat(\"(\")) {\n let expr = parseExpr(stream);\n if (!stream.eat(\")\"))\n stream.err(\"Missing closing paren\");\n return expr;\n }\n else if (!/\\W/.test(stream.next)) {\n let exprs = resolveName(stream, stream.next).map(type => {\n if (stream.inline == null)\n stream.inline = type.isInline;\n else if (stream.inline != type.isInline)\n stream.err(\"Mixing inline and block content\");\n return { type: \"name\", value: type };\n });\n stream.pos++;\n return exprs.length == 1 ? exprs[0] : { type: \"choice\", exprs };\n }\n else {\n stream.err(\"Unexpected token '\" + stream.next + \"'\");\n }\n}\n// Construct an NFA from an expression as returned by the parser. The\n// NFA is represented as an array of states, which are themselves\n// arrays of edges, which are `{term, to}` objects. The first state is\n// the entry state and the last node is the success state.\n//\n// Note that unlike typical NFAs, the edge ordering in this one is\n// significant, in that it is used to contruct filler content when\n// necessary.\nfunction nfa(expr) {\n let nfa = [[]];\n connect(compile(expr, 0), node());\n return nfa;\n function node() { return nfa.push([]) - 1; }\n function edge(from, to, term) {\n let edge = { term, to };\n nfa[from].push(edge);\n return edge;\n }\n function connect(edges, to) {\n edges.forEach(edge => edge.to = to);\n }\n function compile(expr, from) {\n if (expr.type == \"choice\") {\n return expr.exprs.reduce((out, expr) => out.concat(compile(expr, from)), []);\n }\n else if (expr.type == \"seq\") {\n for (let i = 0;; i++) {\n let next = compile(expr.exprs[i], from);\n if (i == expr.exprs.length - 1)\n return next;\n connect(next, from = node());\n }\n }\n else if (expr.type == \"star\") {\n let loop = node();\n edge(from, loop);\n connect(compile(expr.expr, loop), loop);\n return [edge(loop)];\n }\n else if (expr.type == \"plus\") {\n let loop = node();\n connect(compile(expr.expr, from), loop);\n connect(compile(expr.expr, loop), loop);\n return [edge(loop)];\n }\n else if (expr.type == \"opt\") {\n return [edge(from)].concat(compile(expr.expr, from));\n }\n else if (expr.type == \"range\") {\n let cur = from;\n for (let i = 0; i < expr.min; i++) {\n let next = node();\n connect(compile(expr.expr, cur), next);\n cur = next;\n }\n if (expr.max == -1) {\n connect(compile(expr.expr, cur), cur);\n }\n else {\n for (let i = expr.min; i < expr.max; i++) {\n let next = node();\n edge(cur, next);\n connect(compile(expr.expr, cur), next);\n cur = next;\n }\n }\n return [edge(cur)];\n }\n else if (expr.type == \"name\") {\n return [edge(from, undefined, expr.value)];\n }\n else {\n throw new Error(\"Unknown expr type\");\n }\n }\n}\nfunction cmp(a, b) { return b - a; }\n// Get the set of nodes reachable by null edges from `node`. Omit\n// nodes with only a single null-out-edge, since they may lead to\n// needless duplicated nodes.\nfunction nullFrom(nfa, node) {\n let result = [];\n scan(node);\n return result.sort(cmp);\n function scan(node) {\n let edges = nfa[node];\n if (edges.length == 1 && !edges[0].term)\n return scan(edges[0].to);\n result.push(node);\n for (let i = 0; i < edges.length; i++) {\n let { term, to } = edges[i];\n if (!term && result.indexOf(to) == -1)\n scan(to);\n }\n }\n}\n// Compiles an NFA as produced by `nfa` into a DFA, modeled as a set\n// of state objects (`ContentMatch` instances) with transitions\n// between them.\nfunction dfa(nfa) {\n let labeled = Object.create(null);\n return explore(nullFrom(nfa, 0));\n function explore(states) {\n let out = [];\n states.forEach(node => {\n nfa[node].forEach(({ term, to }) => {\n if (!term)\n return;\n let set;\n for (let i = 0; i < out.length; i++)\n if (out[i][0] == term)\n set = out[i][1];\n nullFrom(nfa, to).forEach(node => {\n if (!set)\n out.push([term, set = []]);\n if (set.indexOf(node) == -1)\n set.push(node);\n });\n });\n });\n let state = labeled[states.join(\",\")] = new ContentMatch(states.indexOf(nfa.length - 1) > -1);\n for (let i = 0; i < out.length; i++) {\n let states = out[i][1].sort(cmp);\n state.next.push({ type: out[i][0], next: labeled[states.join(\",\")] || explore(states) });\n }\n return state;\n }\n}\nfunction checkForDeadEnds(match, stream) {\n for (let i = 0, work = [match]; i < work.length; i++) {\n let state = work[i], dead = !state.validEnd, nodes = [];\n for (let j = 0; j < state.next.length; j++) {\n let { type, next } = state.next[j];\n nodes.push(type.name);\n if (dead && !(type.isText || type.hasRequiredAttrs()))\n dead = false;\n if (work.indexOf(next) == -1)\n work.push(next);\n }\n if (dead)\n stream.err(\"Only non-generatable nodes (\" + nodes.join(\", \") + \") in a required position (see https://prosemirror.net/docs/guide/#generatable)\");\n }\n}\n\n// For node types where all attrs have a default value (or which don't\n// have any attributes), build up a single reusable default attribute\n// object, and use it for all nodes that don't specify specific\n// attributes.\nfunction defaultAttrs(attrs) {\n let defaults = Object.create(null);\n for (let attrName in attrs) {\n let attr = attrs[attrName];\n if (!attr.hasDefault)\n return null;\n defaults[attrName] = attr.default;\n }\n return defaults;\n}\nfunction computeAttrs(attrs, value) {\n let built = Object.create(null);\n for (let name in attrs) {\n let given = value && value[name];\n if (given === undefined) {\n let attr = attrs[name];\n if (attr.hasDefault)\n given = attr.default;\n else\n throw new RangeError(\"No value supplied for attribute \" + name);\n }\n built[name] = given;\n }\n return built;\n}\nfunction checkAttrs(attrs, values, type, name) {\n for (let name in values)\n if (!(name in attrs))\n throw new RangeError(`Unsupported attribute ${name} for ${type} of type ${name}`);\n for (let name in attrs) {\n let attr = attrs[name];\n if (attr.validate)\n attr.validate(values[name]);\n }\n}\nfunction initAttrs(typeName, attrs) {\n let result = Object.create(null);\n if (attrs)\n for (let name in attrs)\n result[name] = new Attribute(typeName, name, attrs[name]);\n return result;\n}\n/**\nNode types are objects allocated once per `Schema` and used to\n[tag](https://prosemirror.net/docs/ref/#model.Node.type) `Node` instances. They contain information\nabout the node type, such as its name and what kind of node it\nrepresents.\n*/\nclass NodeType {\n /**\n @internal\n */\n constructor(\n /**\n The name the node type has in this schema.\n */\n name, \n /**\n A link back to the `Schema` the node type belongs to.\n */\n schema, \n /**\n The spec that this type is based on\n */\n spec) {\n this.name = name;\n this.schema = schema;\n this.spec = spec;\n /**\n The set of marks allowed in this node. `null` means all marks\n are allowed.\n */\n this.markSet = null;\n this.groups = spec.group ? spec.group.split(\" \") : [];\n this.attrs = initAttrs(name, spec.attrs);\n this.defaultAttrs = defaultAttrs(this.attrs);\n this.contentMatch = null;\n this.inlineContent = null;\n this.isBlock = !(spec.inline || name == \"text\");\n this.isText = name == \"text\";\n }\n /**\n True if this is an inline type.\n */\n get isInline() { return !this.isBlock; }\n /**\n True if this is a textblock type, a block that contains inline\n content.\n */\n get isTextblock() { return this.isBlock && this.inlineContent; }\n /**\n True for node types that allow no content.\n */\n get isLeaf() { return this.contentMatch == ContentMatch.empty; }\n /**\n True when this node is an atom, i.e. when it does not have\n directly editable content.\n */\n get isAtom() { return this.isLeaf || !!this.spec.atom; }\n /**\n Return true when this node type is part of the given\n [group](https://prosemirror.net/docs/ref/#model.NodeSpec.group).\n */\n isInGroup(group) {\n return this.groups.indexOf(group) > -1;\n }\n /**\n The node type's [whitespace](https://prosemirror.net/docs/ref/#model.NodeSpec.whitespace) option.\n */\n get whitespace() {\n return this.spec.whitespace || (this.spec.code ? \"pre\" : \"normal\");\n }\n /**\n Tells you whether this node type has any required attributes.\n */\n hasRequiredAttrs() {\n for (let n in this.attrs)\n if (this.attrs[n].isRequired)\n return true;\n return false;\n }\n /**\n Indicates whether this node allows some of the same content as\n the given node type.\n */\n compatibleContent(other) {\n return this == other || this.contentMatch.compatible(other.contentMatch);\n }\n /**\n @internal\n */\n computeAttrs(attrs) {\n if (!attrs && this.defaultAttrs)\n return this.defaultAttrs;\n else\n return computeAttrs(this.attrs, attrs);\n }\n /**\n Create a `Node` of this type. The given attributes are\n checked and defaulted (you can pass `null` to use the type's\n defaults entirely, if no required attributes exist). `content`\n may be a `Fragment`, a node, an array of nodes, or\n `null`. Similarly `marks` may be `null` to default to the empty\n set of marks.\n */\n create(attrs = null, content, marks) {\n if (this.isText)\n throw new Error(\"NodeType.create can't construct text nodes\");\n return new Node(this, this.computeAttrs(attrs), Fragment.from(content), Mark.setFrom(marks));\n }\n /**\n Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content\n against the node type's content restrictions, and throw an error\n if it doesn't match.\n */\n createChecked(attrs = null, content, marks) {\n content = Fragment.from(content);\n this.checkContent(content);\n return new Node(this, this.computeAttrs(attrs), content, Mark.setFrom(marks));\n }\n /**\n Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but see if it is\n necessary to add nodes to the start or end of the given fragment\n to make it fit the node. If no fitting wrapping can be found,\n return null. Note that, due to the fact that required nodes can\n always be created, this will always succeed if you pass null or\n `Fragment.empty` as content.\n */\n createAndFill(attrs = null, content, marks) {\n attrs = this.computeAttrs(attrs);\n content = Fragment.from(content);\n if (content.size) {\n let before = this.contentMatch.fillBefore(content);\n if (!before)\n return null;\n content = before.append(content);\n }\n let matched = this.contentMatch.matchFragment(content);\n let after = matched && matched.fillBefore(Fragment.empty, true);\n if (!after)\n return null;\n return new Node(this, attrs, content.append(after), Mark.setFrom(marks));\n }\n /**\n Returns true if the given fragment is valid content for this node\n type.\n */\n validContent(content) {\n let result = this.contentMatch.matchFragment(content);\n if (!result || !result.validEnd)\n return false;\n for (let i = 0; i < content.childCount; i++)\n if (!this.allowsMarks(content.child(i).marks))\n return false;\n return true;\n }\n /**\n Throws a RangeError if the given fragment is not valid content for this\n node type.\n @internal\n */\n checkContent(content) {\n if (!this.validContent(content))\n throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0, 50)}`);\n }\n /**\n @internal\n */\n checkAttrs(attrs) {\n checkAttrs(this.attrs, attrs, \"node\", this.name);\n }\n /**\n Check whether the given mark type is allowed in this node.\n */\n allowsMarkType(markType) {\n return this.markSet == null || this.markSet.indexOf(markType) > -1;\n }\n /**\n Test whether the given set of marks are allowed in this node.\n */\n allowsMarks(marks) {\n if (this.markSet == null)\n return true;\n for (let i = 0; i < marks.length; i++)\n if (!this.allowsMarkType(marks[i].type))\n return false;\n return true;\n }\n /**\n Removes the marks that are not allowed in this node from the given set.\n */\n allowedMarks(marks) {\n if (this.markSet == null)\n return marks;\n let copy;\n for (let i = 0; i < marks.length; i++) {\n if (!this.allowsMarkType(marks[i].type)) {\n if (!copy)\n copy = marks.slice(0, i);\n }\n else if (copy) {\n copy.push(marks[i]);\n }\n }\n return !copy ? marks : copy.length ? copy : Mark.none;\n }\n /**\n @internal\n */\n static compile(nodes, schema) {\n let result = Object.create(null);\n nodes.forEach((name, spec) => result[name] = new NodeType(name, schema, spec));\n let topType = schema.spec.topNode || \"doc\";\n if (!result[topType])\n throw new RangeError(\"Schema is missing its top node type ('\" + topType + \"')\");\n if (!result.text)\n throw new RangeError(\"Every schema needs a 'text' type\");\n for (let _ in result.text.attrs)\n throw new RangeError(\"The text node type should not have attributes\");\n return result;\n }\n}\nfunction validateType(typeName, attrName, type) {\n let types = type.split(\"|\");\n return (value) => {\n let name = value === null ? \"null\" : typeof value;\n if (types.indexOf(name) < 0)\n throw new RangeError(`Expected value of type ${types} for attribute ${attrName} on type ${typeName}, got ${name}`);\n };\n}\n// Attribute descriptors\nclass Attribute {\n constructor(typeName, attrName, options) {\n this.hasDefault = Object.prototype.hasOwnProperty.call(options, \"default\");\n this.default = options.default;\n this.validate = typeof options.validate == \"string\" ? validateType(typeName, attrName, options.validate) : options.validate;\n }\n get isRequired() {\n return !this.hasDefault;\n }\n}\n// Marks\n/**\nLike nodes, marks (which are associated with nodes to signify\nthings like emphasis or being part of a link) are\n[tagged](https://prosemirror.net/docs/ref/#model.Mark.type) with type objects, which are\ninstantiated once per `Schema`.\n*/\nclass MarkType {\n /**\n @internal\n */\n constructor(\n /**\n The name of the mark type.\n */\n name, \n /**\n @internal\n */\n rank, \n /**\n The schema that this mark type instance is part of.\n */\n schema, \n /**\n The spec on which the type is based.\n */\n spec) {\n this.name = name;\n this.rank = rank;\n this.schema = schema;\n this.spec = spec;\n this.attrs = initAttrs(name, spec.attrs);\n this.excluded = null;\n let defaults = defaultAttrs(this.attrs);\n this.instance = defaults ? new Mark(this, defaults) : null;\n }\n /**\n Create a mark of this type. `attrs` may be `null` or an object\n containing only some of the mark's attributes. The others, if\n they have defaults, will be added.\n */\n create(attrs = null) {\n if (!attrs && this.instance)\n return this.instance;\n return new Mark(this, computeAttrs(this.attrs, attrs));\n }\n /**\n @internal\n */\n static compile(marks, schema) {\n let result = Object.create(null), rank = 0;\n marks.forEach((name, spec) => result[name] = new MarkType(name, rank++, schema, spec));\n return result;\n }\n /**\n When there is a mark of this type in the given set, a new set\n without it is returned. Otherwise, the input set is returned.\n */\n removeFromSet(set) {\n for (var i = 0; i < set.length; i++)\n if (set[i].type == this) {\n set = set.slice(0, i).concat(set.slice(i + 1));\n i--;\n }\n return set;\n }\n /**\n Tests whether there is a mark of this type in the given set.\n */\n isInSet(set) {\n for (let i = 0; i < set.length; i++)\n if (set[i].type == this)\n return set[i];\n }\n /**\n @internal\n */\n checkAttrs(attrs) {\n checkAttrs(this.attrs, attrs, \"mark\", this.name);\n }\n /**\n Queries whether a given mark type is\n [excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.\n */\n excludes(other) {\n return this.excluded.indexOf(other) > -1;\n }\n}\n/**\nA document schema. Holds [node](https://prosemirror.net/docs/ref/#model.NodeType) and [mark\ntype](https://prosemirror.net/docs/ref/#model.MarkType) objects for the nodes and marks that may\noccur in conforming documents, and provides functionality for\ncreating and deserializing such documents.\n\nWhen given, the type parameters provide the names of the nodes and\nmarks in this schema.\n*/\nclass Schema {\n /**\n Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).\n */\n constructor(spec) {\n /**\n The [linebreak\n replacement](https://prosemirror.net/docs/ref/#model.NodeSpec.linebreakReplacement) node defined\n in this schema, if any.\n */\n this.linebreakReplacement = null;\n /**\n An object for storing whatever values modules may want to\n compute and cache per schema. (If you want to store something\n in it, try to use property names unlikely to clash.)\n */\n this.cached = Object.create(null);\n let instanceSpec = this.spec = {};\n for (let prop in spec)\n instanceSpec[prop] = spec[prop];\n instanceSpec.nodes = OrderedMap.from(spec.nodes),\n instanceSpec.marks = OrderedMap.from(spec.marks || {}),\n this.nodes = NodeType.compile(this.spec.nodes, this);\n this.marks = MarkType.compile(this.spec.marks, this);\n let contentExprCache = Object.create(null);\n for (let prop in this.nodes) {\n if (prop in this.marks)\n throw new RangeError(prop + \" can not be both a node and a mark\");\n let type = this.nodes[prop], contentExpr = type.spec.content || \"\", markExpr = type.spec.marks;\n type.contentMatch = contentExprCache[contentExpr] ||\n (contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes));\n type.inlineContent = type.contentMatch.inlineContent;\n if (type.spec.linebreakReplacement) {\n if (this.linebreakReplacement)\n throw new RangeError(\"Multiple linebreak nodes defined\");\n if (!type.isInline || !type.isLeaf)\n throw new RangeError(\"Linebreak replacement nodes must be inline leaf nodes\");\n this.linebreakReplacement = type;\n }\n type.markSet = markExpr == \"_\" ? null :\n markExpr ? gatherMarks(this, markExpr.split(\" \")) :\n markExpr == \"\" || !type.inlineContent ? [] : null;\n }\n for (let prop in this.marks) {\n let type = this.marks[prop], excl = type.spec.excludes;\n type.excluded = excl == null ? [type] : excl == \"\" ? [] : gatherMarks(this, excl.split(\" \"));\n }\n this.nodeFromJSON = json => Node.fromJSON(this, json);\n this.markFromJSON = json => Mark.fromJSON(this, json);\n this.topNodeType = this.nodes[this.spec.topNode || \"doc\"];\n this.cached.wrappings = Object.create(null);\n }\n /**\n Create a node in this schema. The `type` may be a string or a\n `NodeType` instance. Attributes will be extended with defaults,\n `content` may be a `Fragment`, `null`, a `Node`, or an array of\n nodes.\n */\n node(type, attrs = null, content, marks) {\n if (typeof type == \"string\")\n type = this.nodeType(type);\n else if (!(type instanceof NodeType))\n throw new RangeError(\"Invalid node type: \" + type);\n else if (type.schema != this)\n throw new RangeError(\"Node type from different schema used (\" + type.name + \")\");\n return type.createChecked(attrs, content, marks);\n }\n /**\n Create a text node in the schema. Empty text nodes are not\n allowed.\n */\n text(text, marks) {\n let type = this.nodes.text;\n return new TextNode(type, type.defaultAttrs, text, Mark.setFrom(marks));\n }\n /**\n Create a mark with the given type and attributes.\n */\n mark(type, attrs) {\n if (typeof type == \"string\")\n type = this.marks[type];\n return type.create(attrs);\n }\n /**\n @internal\n */\n nodeType(name) {\n let found = this.nodes[name];\n if (!found)\n throw new RangeError(\"Unknown node type: \" + name);\n return found;\n }\n}\nfunction gatherMarks(schema, marks) {\n let found = [];\n for (let i = 0; i < marks.length; i++) {\n let name = marks[i], mark = schema.marks[name], ok = mark;\n if (mark) {\n found.push(mark);\n }\n else {\n for (let prop in schema.marks) {\n let mark = schema.marks[prop];\n if (name == \"_\" || (mark.spec.group && mark.spec.group.split(\" \").indexOf(name) > -1))\n found.push(ok = mark);\n }\n }\n if (!ok)\n throw new SyntaxError(\"Unknown mark type: '\" + marks[i] + \"'\");\n }\n return found;\n}\n\nfunction isTagRule(rule) { return rule.tag != null; }\nfunction isStyleRule(rule) { return rule.style != null; }\n/**\nA DOM parser represents a strategy for parsing DOM content into a\nProseMirror document conforming to a given schema. Its behavior is\ndefined by an array of [rules](https://prosemirror.net/docs/ref/#model.ParseRule).\n*/\nclass DOMParser {\n /**\n Create a parser that targets the given schema, using the given\n parsing rules.\n */\n constructor(\n /**\n The schema into which the parser parses.\n */\n schema, \n /**\n The set of [parse rules](https://prosemirror.net/docs/ref/#model.ParseRule) that the parser\n uses, in order of precedence.\n */\n rules) {\n this.schema = schema;\n this.rules = rules;\n /**\n @internal\n */\n this.tags = [];\n /**\n @internal\n */\n this.styles = [];\n let matchedStyles = this.matchedStyles = [];\n rules.forEach(rule => {\n if (isTagRule(rule)) {\n this.tags.push(rule);\n }\n else if (isStyleRule(rule)) {\n let prop = /[^=]*/.exec(rule.style)[0];\n if (matchedStyles.indexOf(prop) < 0)\n matchedStyles.push(prop);\n this.styles.push(rule);\n }\n });\n // Only normalize list elements when lists in the schema can't directly contain themselves\n this.normalizeLists = !this.tags.some(r => {\n if (!/^(ul|ol)\\b/.test(r.tag) || !r.node)\n return false;\n let node = schema.nodes[r.node];\n return node.contentMatch.matchType(node);\n });\n }\n /**\n Parse a document from the content of a DOM node.\n */\n parse(dom, options = {}) {\n let context = new ParseContext(this, options, false);\n context.addAll(dom, Mark.none, options.from, options.to);\n return context.finish();\n }\n /**\n Parses the content of the given DOM node, like\n [`parse`](https://prosemirror.net/docs/ref/#model.DOMParser.parse), and takes the same set of\n options. But unlike that method, which produces a whole node,\n this one returns a slice that is open at the sides, meaning that\n the schema constraints aren't applied to the start of nodes to\n the left of the input and the end of nodes at the end.\n */\n parseSlice(dom, options = {}) {\n let context = new ParseContext(this, options, true);\n context.addAll(dom, Mark.none, options.from, options.to);\n return Slice.maxOpen(context.finish());\n }\n /**\n @internal\n */\n matchTag(dom, context, after) {\n for (let i = after ? this.tags.indexOf(after) + 1 : 0; i < this.tags.length; i++) {\n let rule = this.tags[i];\n if (matches(dom, rule.tag) &&\n (rule.namespace === undefined || dom.namespaceURI == rule.namespace) &&\n (!rule.context || context.matchesContext(rule.context))) {\n if (rule.getAttrs) {\n let result = rule.getAttrs(dom);\n if (result === false)\n continue;\n rule.attrs = result || undefined;\n }\n return rule;\n }\n }\n }\n /**\n @internal\n */\n matchStyle(prop, value, context, after) {\n for (let i = after ? this.styles.indexOf(after) + 1 : 0; i < this.styles.length; i++) {\n let rule = this.styles[i], style = rule.style;\n if (style.indexOf(prop) != 0 ||\n rule.context && !context.matchesContext(rule.context) ||\n // Test that the style string either precisely matches the prop,\n // or has an '=' sign after the prop, followed by the given\n // value.\n style.length > prop.length &&\n (style.charCodeAt(prop.length) != 61 || style.slice(prop.length + 1) != value))\n continue;\n if (rule.getAttrs) {\n let result = rule.getAttrs(value);\n if (result === false)\n continue;\n rule.attrs = result || undefined;\n }\n return rule;\n }\n }\n /**\n @internal\n */\n static schemaRules(schema) {\n let result = [];\n function insert(rule) {\n let priority = rule.priority == null ? 50 : rule.priority, i = 0;\n for (; i < result.length; i++) {\n let next = result[i], nextPriority = next.priority == null ? 50 : next.priority;\n if (nextPriority < priority)\n break;\n }\n result.splice(i, 0, rule);\n }\n for (let name in schema.marks) {\n let rules = schema.marks[name].spec.parseDOM;\n if (rules)\n rules.forEach(rule => {\n insert(rule = copy(rule));\n if (!(rule.mark || rule.ignore || rule.clearMark))\n rule.mark = name;\n });\n }\n for (let name in schema.nodes) {\n let rules = schema.nodes[name].spec.parseDOM;\n if (rules)\n rules.forEach(rule => {\n insert(rule = copy(rule));\n if (!(rule.node || rule.ignore || rule.mark))\n rule.node = name;\n });\n }\n return result;\n }\n /**\n Construct a DOM parser using the parsing rules listed in a\n schema's [node specs](https://prosemirror.net/docs/ref/#model.NodeSpec.parseDOM), reordered by\n [priority](https://prosemirror.net/docs/ref/#model.GenericParseRule.priority).\n */\n static fromSchema(schema) {\n return schema.cached.domParser ||\n (schema.cached.domParser = new DOMParser(schema, DOMParser.schemaRules(schema)));\n }\n}\nconst blockTags = {\n address: true, article: true, aside: true, blockquote: true, canvas: true,\n dd: true, div: true, dl: true, fieldset: true, figcaption: true, figure: true,\n footer: true, form: true, h1: true, h2: true, h3: true, h4: true, h5: true,\n h6: true, header: true, hgroup: true, hr: true, li: true, noscript: true, ol: true,\n output: true, p: true, pre: true, section: true, table: true, tfoot: true, ul: true\n};\nconst ignoreTags = {\n head: true, noscript: true, object: true, script: true, style: true, title: true\n};\nconst listTags = { ol: true, ul: true };\n// Using a bitfield for node context options\nconst OPT_PRESERVE_WS = 1, OPT_PRESERVE_WS_FULL = 2, OPT_OPEN_LEFT = 4;\nfunction wsOptionsFor(type, preserveWhitespace, base) {\n if (preserveWhitespace != null)\n return (preserveWhitespace ? OPT_PRESERVE_WS : 0) |\n (preserveWhitespace === \"full\" ? OPT_PRESERVE_WS_FULL : 0);\n return type && type.whitespace == \"pre\" ? OPT_PRESERVE_WS | OPT_PRESERVE_WS_FULL : base & ~OPT_OPEN_LEFT;\n}\nclass NodeContext {\n constructor(type, attrs, marks, solid, match, options) {\n this.type = type;\n this.attrs = attrs;\n this.marks = marks;\n this.solid = solid;\n this.options = options;\n this.content = [];\n // Marks applied to the node's children\n this.activeMarks = Mark.none;\n this.match = match || (options & OPT_OPEN_LEFT ? null : type.contentMatch);\n }\n findWrapping(node) {\n if (!this.match) {\n if (!this.type)\n return [];\n let fill = this.type.contentMatch.fillBefore(Fragment.from(node));\n if (fill) {\n this.match = this.type.contentMatch.matchFragment(fill);\n }\n else {\n let start = this.type.contentMatch, wrap;\n if (wrap = start.findWrapping(node.type)) {\n this.match = start;\n return wrap;\n }\n else {\n return null;\n }\n }\n }\n return this.match.findWrapping(node.type);\n }\n finish(openEnd) {\n if (!(this.options & OPT_PRESERVE_WS)) { // Strip trailing whitespace\n let last = this.content[this.content.length - 1], m;\n if (last && last.isText && (m = /[ \\t\\r\\n\\u000c]+$/.exec(last.text))) {\n let text = last;\n if (last.text.length == m[0].length)\n this.content.pop();\n else\n this.content[this.content.length - 1] = text.withText(text.text.slice(0, text.text.length - m[0].length));\n }\n }\n let content = Fragment.from(this.content);\n if (!openEnd && this.match)\n content = content.append(this.match.fillBefore(Fragment.empty, true));\n return this.type ? this.type.create(this.attrs, content, this.marks) : content;\n }\n inlineContext(node) {\n if (this.type)\n return this.type.inlineContent;\n if (this.content.length)\n return this.content[0].isInline;\n return node.parentNode && !blockTags.hasOwnProperty(node.parentNode.nodeName.toLowerCase());\n }\n}\nclass ParseContext {\n constructor(\n // The parser we are using.\n parser, \n // The options passed to this parse.\n options, isOpen) {\n this.parser = parser;\n this.options = options;\n this.isOpen = isOpen;\n this.open = 0;\n this.localPreserveWS = false;\n let topNode = options.topNode, topContext;\n let topOptions = wsOptionsFor(null, options.preserveWhitespace, 0) | (isOpen ? OPT_OPEN_LEFT : 0);\n if (topNode)\n topContext = new NodeContext(topNode.type, topNode.attrs, Mark.none, true, options.topMatch || topNode.type.contentMatch, topOptions);\n else if (isOpen)\n topContext = new NodeContext(null, null, Mark.none, true, null, topOptions);\n else\n topContext = new NodeContext(parser.schema.topNodeType, null, Mark.none, true, null, topOptions);\n this.nodes = [topContext];\n this.find = options.findPositions;\n this.needsBlock = false;\n }\n get top() {\n return this.nodes[this.open];\n }\n // Add a DOM node to the content. Text is inserted as text node,\n // otherwise, the node is passed to `addElement` or, if it has a\n // `style` attribute, `addElementWithStyles`.\n addDOM(dom, marks) {\n if (dom.nodeType == 3)\n this.addTextNode(dom, marks);\n else if (dom.nodeType == 1)\n this.addElement(dom, marks);\n }\n addTextNode(dom, marks) {\n let value = dom.nodeValue;\n let top = this.top, preserveWS = (top.options & OPT_PRESERVE_WS_FULL) ? \"full\"\n : this.localPreserveWS || (top.options & OPT_PRESERVE_WS) > 0;\n let { schema } = this.parser;\n if (preserveWS === \"full\" ||\n top.inlineContext(dom) ||\n /[^ \\t\\r\\n\\u000c]/.test(value)) {\n if (!preserveWS) {\n value = value.replace(/[ \\t\\r\\n\\u000c]+/g, \" \");\n // If this starts with whitespace, and there is no node before it, or\n // a hard break, or a text node that ends with whitespace, strip the\n // leading space.\n if (/^[ \\t\\r\\n\\u000c]/.test(value) && this.open == this.nodes.length - 1) {\n let nodeBefore = top.content[top.content.length - 1];\n let domNodeBefore = dom.previousSibling;\n if (!nodeBefore ||\n (domNodeBefore && domNodeBefore.nodeName == 'BR') ||\n (nodeBefore.isText && /[ \\t\\r\\n\\u000c]$/.test(nodeBefore.text)))\n value = value.slice(1);\n }\n }\n else if (preserveWS === \"full\") {\n value = value.replace(/\\r\\n?/g, \"\\n\");\n }\n else if (schema.linebreakReplacement && /[\\r\\n]/.test(value) && this.top.findWrapping(schema.linebreakReplacement.create())) {\n let lines = value.split(/\\r?\\n|\\r/);\n for (let i = 0; i < lines.length; i++) {\n if (i)\n this.insertNode(schema.linebreakReplacement.create(), marks, true);\n if (lines[i])\n this.insertNode(schema.text(lines[i]), marks, !/\\S/.test(lines[i]));\n }\n value = \"\";\n }\n else {\n value = value.replace(/\\r?\\n|\\r/g, \" \");\n }\n if (value)\n this.insertNode(schema.text(value), marks, !/\\S/.test(value));\n this.findInText(dom);\n }\n else {\n this.findInside(dom);\n }\n }\n // Try to find a handler for the given tag and use that to parse. If\n // none is found, the element's content nodes are added directly.\n addElement(dom, marks, matchAfter) {\n let outerWS = this.localPreserveWS, top = this.top;\n if (dom.tagName == \"PRE\" || /pre/.test(dom.style && dom.style.whiteSpace))\n this.localPreserveWS = true;\n let name = dom.nodeName.toLowerCase(), ruleID;\n if (listTags.hasOwnProperty(name) && this.parser.normalizeLists)\n normalizeList(dom);\n let rule = (this.options.ruleFromNode && this.options.ruleFromNode(dom)) ||\n (ruleID = this.parser.matchTag(dom, this, matchAfter));\n out: if (rule ? rule.ignore : ignoreTags.hasOwnProperty(name)) {\n this.findInside(dom);\n this.ignoreFallback(dom, marks);\n }\n else if (!rule || rule.skip || rule.closeParent) {\n if (rule && rule.closeParent)\n this.open = Math.max(0, this.open - 1);\n else if (rule && rule.skip.nodeType)\n dom = rule.skip;\n let sync, oldNeedsBlock = this.needsBlock;\n if (blockTags.hasOwnProperty(name)) {\n if (top.content.length && top.content[0].isInline && this.open) {\n this.open--;\n top = this.top;\n }\n sync = true;\n if (!top.type)\n this.needsBlock = true;\n }\n else if (!dom.firstChild) {\n this.leafFallback(dom, marks);\n break out;\n }\n let innerMarks = rule && rule.skip ? marks : this.readStyles(dom, marks);\n if (innerMarks)\n this.addAll(dom, innerMarks);\n if (sync)\n this.sync(top);\n this.needsBlock = oldNeedsBlock;\n }\n else {\n let innerMarks = this.readStyles(dom, marks);\n if (innerMarks)\n this.addElementByRule(dom, rule, innerMarks, rule.consuming === false ? ruleID : undefined);\n }\n this.localPreserveWS = outerWS;\n }\n // Called for leaf DOM nodes that would otherwise be ignored\n leafFallback(dom, marks) {\n if (dom.nodeName == \"BR\" && this.top.type && this.top.type.inlineContent)\n this.addTextNode(dom.ownerDocument.createTextNode(\"\\n\"), marks);\n }\n // Called for ignored nodes\n ignoreFallback(dom, marks) {\n // Ignored BR nodes should at least create an inline context\n if (dom.nodeName == \"BR\" && (!this.top.type || !this.top.type.inlineContent))\n this.findPlace(this.parser.schema.text(\"-\"), marks, true);\n }\n // Run any style parser associated with the node's styles. Either\n // return an updated array of marks, or null to indicate some of the\n // styles had a rule with `ignore` set.\n readStyles(dom, marks) {\n let styles = dom.style;\n // Because many properties will only show up in 'normalized' form\n // in `style.item` (i.e. text-decoration becomes\n // text-decoration-line, text-decoration-color, etc), we directly\n // query the styles mentioned in our rules instead of iterating\n // over the items.\n if (styles && styles.length)\n for (let i = 0; i < this.parser.matchedStyles.length; i++) {\n let name = this.parser.matchedStyles[i], value = styles.getPropertyValue(name);\n if (value)\n for (let after = undefined;;) {\n let rule = this.parser.matchStyle(name, value, this, after);\n if (!rule)\n break;\n if (rule.ignore)\n return null;\n if (rule.clearMark)\n marks = marks.filter(m => !rule.clearMark(m));\n else\n marks = marks.concat(this.parser.schema.marks[rule.mark].create(rule.attrs));\n if (rule.consuming === false)\n after = rule;\n else\n break;\n }\n }\n return marks;\n }\n // Look up a handler for the given node. If none are found, return\n // false. Otherwise, apply it, use its return value to drive the way\n // the node's content is wrapped, and return true.\n addElementByRule(dom, rule, marks, continueAfter) {\n let sync, nodeType;\n if (rule.node) {\n nodeType = this.parser.schema.nodes[rule.node];\n if (!nodeType.isLeaf) {\n let inner = this.enter(nodeType, rule.attrs || null, marks, rule.preserveWhitespace);\n if (inner) {\n sync = true;\n marks = inner;\n }\n }\n else if (!this.insertNode(nodeType.create(rule.attrs), marks, dom.nodeName == \"BR\")) {\n this.leafFallback(dom, marks);\n }\n }\n else {\n let markType = this.parser.schema.marks[rule.mark];\n marks = marks.concat(markType.create(rule.attrs));\n }\n let startIn = this.top;\n if (nodeType && nodeType.isLeaf) {\n this.findInside(dom);\n }\n else if (continueAfter) {\n this.addElement(dom, marks, continueAfter);\n }\n else if (rule.getContent) {\n this.findInside(dom);\n rule.getContent(dom, this.parser.schema).forEach(node => this.insertNode(node, marks, false));\n }\n else {\n let contentDOM = dom;\n if (typeof rule.contentElement == \"string\")\n contentDOM = dom.querySelector(rule.contentElement);\n else if (typeof rule.contentElement == \"function\")\n contentDOM = rule.contentElement(dom);\n else if (rule.contentElement)\n contentDOM = rule.contentElement;\n this.findAround(dom, contentDOM, true);\n this.addAll(contentDOM, marks);\n this.findAround(dom, contentDOM, false);\n }\n if (sync && this.sync(startIn))\n this.open--;\n }\n // Add all child nodes between `startIndex` and `endIndex` (or the\n // whole node, if not given). If `sync` is passed, use it to\n // synchronize after every block element.\n addAll(parent, marks, startIndex, endIndex) {\n let index = startIndex || 0;\n for (let dom = startIndex ? parent.childNodes[startIndex] : parent.firstChild, end = endIndex == null ? null : parent.childNodes[endIndex]; dom != end; dom = dom.nextSibling, ++index) {\n this.findAtPoint(parent, index);\n this.addDOM(dom, marks);\n }\n this.findAtPoint(parent, index);\n }\n // Try to find a way to fit the given node type into the current\n // context. May add intermediate wrappers and/or leave non-solid\n // nodes that we're in.\n findPlace(node, marks, cautious) {\n let route, sync;\n for (let depth = this.open, penalty = 0; depth >= 0; depth--) {\n let cx = this.nodes[depth];\n let found = cx.findWrapping(node);\n if (found && (!route || route.length > found.length + penalty)) {\n route = found;\n sync = cx;\n if (!found.length)\n break;\n }\n if (cx.solid) {\n if (cautious)\n break;\n penalty += 2;\n }\n }\n if (!route)\n return null;\n this.sync(sync);\n for (let i = 0; i < route.length; i++)\n marks = this.enterInner(route[i], null, marks, false);\n return marks;\n }\n // Try to insert the given node, adjusting the context when needed.\n insertNode(node, marks, cautious) {\n if (node.isInline && this.needsBlock && !this.top.type) {\n let block = this.textblockFromContext();\n if (block)\n marks = this.enterInner(block, null, marks);\n }\n let innerMarks = this.findPlace(node, marks, cautious);\n if (innerMarks) {\n this.closeExtra();\n let top = this.top;\n if (top.match)\n top.match = top.match.matchType(node.type);\n let nodeMarks = Mark.none;\n for (let m of innerMarks.concat(node.marks))\n if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, node.type))\n nodeMarks = m.addToSet(nodeMarks);\n top.content.push(node.mark(nodeMarks));\n return true;\n }\n return false;\n }\n // Try to start a node of the given type, adjusting the context when\n // necessary.\n enter(type, attrs, marks, preserveWS) {\n let innerMarks = this.findPlace(type.create(attrs), marks, false);\n if (innerMarks)\n innerMarks = this.enterInner(type, attrs, marks, true, preserveWS);\n return innerMarks;\n }\n // Open a node of the given type\n enterInner(type, attrs, marks, solid = false, preserveWS) {\n this.closeExtra();\n let top = this.top;\n top.match = top.match && top.match.matchType(type);\n let options = wsOptionsFor(type, preserveWS, top.options);\n if ((top.options & OPT_OPEN_LEFT) && top.content.length == 0)\n options |= OPT_OPEN_LEFT;\n let applyMarks = Mark.none;\n marks = marks.filter(m => {\n if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, type)) {\n applyMarks = m.addToSet(applyMarks);\n return false;\n }\n return true;\n });\n this.nodes.push(new NodeContext(type, attrs, applyMarks, solid, null, options));\n this.open++;\n return marks;\n }\n // Make sure all nodes above this.open are finished and added to\n // their parents\n closeExtra(openEnd = false) {\n let i = this.nodes.length - 1;\n if (i > this.open) {\n for (; i > this.open; i--)\n this.nodes[i - 1].content.push(this.nodes[i].finish(openEnd));\n this.nodes.length = this.open + 1;\n }\n }\n finish() {\n this.open = 0;\n this.closeExtra(this.isOpen);\n return this.nodes[0].finish(!!(this.isOpen || this.options.topOpen));\n }\n sync(to) {\n for (let i = this.open; i >= 0; i--) {\n if (this.nodes[i] == to) {\n this.open = i;\n return true;\n }\n else if (this.localPreserveWS) {\n this.nodes[i].options |= OPT_PRESERVE_WS;\n }\n }\n return false;\n }\n get currentPos() {\n this.closeExtra();\n let pos = 0;\n for (let i = this.open; i >= 0; i--) {\n let content = this.nodes[i].content;\n for (let j = content.length - 1; j >= 0; j--)\n pos += content[j].nodeSize;\n if (i)\n pos++;\n }\n return pos;\n }\n findAtPoint(parent, offset) {\n if (this.find)\n for (let i = 0; i < this.find.length; i++) {\n if (this.find[i].node == parent && this.find[i].offset == offset)\n this.find[i].pos = this.currentPos;\n }\n }\n findInside(parent) {\n if (this.find)\n for (let i = 0; i < this.find.length; i++) {\n if (this.find[i].pos == null && parent.nodeType == 1 && parent.contains(this.find[i].node))\n this.find[i].pos = this.currentPos;\n }\n }\n findAround(parent, content, before) {\n if (parent != content && this.find)\n for (let i = 0; i < this.find.length; i++) {\n if (this.find[i].pos == null && parent.nodeType == 1 && parent.contains(this.find[i].node)) {\n let pos = content.compareDocumentPosition(this.find[i].node);\n if (pos & (before ? 2 : 4))\n this.find[i].pos = this.currentPos;\n }\n }\n }\n findInText(textNode) {\n if (this.find)\n for (let i = 0; i < this.find.length; i++) {\n if (this.find[i].node == textNode)\n this.find[i].pos = this.currentPos - (textNode.nodeValue.length - this.find[i].offset);\n }\n }\n // Determines whether the given context string matches this context.\n matchesContext(context) {\n if (context.indexOf(\"|\") > -1)\n return context.split(/\\s*\\|\\s*/).some(this.matchesContext, this);\n let parts = context.split(\"/\");\n let option = this.options.context;\n let useRoot = !this.isOpen && (!option || option.parent.type == this.nodes[0].type);\n let minDepth = -(option ? option.depth + 1 : 0) + (useRoot ? 0 : 1);\n let match = (i, depth) => {\n for (; i >= 0; i--) {\n let part = parts[i];\n if (part == \"\") {\n if (i == parts.length - 1 || i == 0)\n continue;\n for (; depth >= minDepth; depth--)\n if (match(i - 1, depth))\n return true;\n return false;\n }\n else {\n let next = depth > 0 || (depth == 0 && useRoot) ? this.nodes[depth].type\n : option && depth >= minDepth ? option.node(depth - minDepth).type\n : null;\n if (!next || (next.name != part && !next.isInGroup(part)))\n return false;\n depth--;\n }\n }\n return true;\n };\n return match(parts.length - 1, this.open);\n }\n textblockFromContext() {\n let $context = this.options.context;\n if ($context)\n for (let d = $context.depth; d >= 0; d--) {\n let deflt = $context.node(d).contentMatchAt($context.indexAfter(d)).defaultType;\n if (deflt && deflt.isTextblock && deflt.defaultAttrs)\n return deflt;\n }\n for (let name in this.parser.schema.nodes) {\n let type = this.parser.schema.nodes[name];\n if (type.isTextblock && type.defaultAttrs)\n return type;\n }\n }\n}\n// Kludge to work around directly nested list nodes produced by some\n// tools and allowed by browsers to mean that the nested list is\n// actually part of the list item above it.\nfunction normalizeList(dom) {\n for (let child = dom.firstChild, prevItem = null; child; child = child.nextSibling) {\n let name = child.nodeType == 1 ? child.nodeName.toLowerCase() : null;\n if (name && listTags.hasOwnProperty(name) && prevItem) {\n prevItem.appendChild(child);\n child = prevItem;\n }\n else if (name == \"li\") {\n prevItem = child;\n }\n else if (name) {\n prevItem = null;\n }\n }\n}\n// Apply a CSS selector.\nfunction matches(dom, selector) {\n return (dom.matches || dom.msMatchesSelector || dom.webkitMatchesSelector || dom.mozMatchesSelector).call(dom, selector);\n}\nfunction copy(obj) {\n let copy = {};\n for (let prop in obj)\n copy[prop] = obj[prop];\n return copy;\n}\n// Used when finding a mark at the top level of a fragment parse.\n// Checks whether it would be reasonable to apply a given mark type to\n// a given node, by looking at the way the mark occurs in the schema.\nfunction markMayApply(markType, nodeType) {\n let nodes = nodeType.schema.nodes;\n for (let name in nodes) {\n let parent = nodes[name];\n if (!parent.allowsMarkType(markType))\n continue;\n let seen = [], scan = (match) => {\n seen.push(match);\n for (let i = 0; i < match.edgeCount; i++) {\n let { type, next } = match.edge(i);\n if (type == nodeType)\n return true;\n if (seen.indexOf(next) < 0 && scan(next))\n return true;\n }\n };\n if (scan(parent.contentMatch))\n return true;\n }\n}\n\n/**\nA DOM serializer knows how to convert ProseMirror nodes and\nmarks of various types to DOM nodes.\n*/\nclass DOMSerializer {\n /**\n Create a serializer. `nodes` should map node names to functions\n that take a node and return a description of the corresponding\n DOM. `marks` does the same for mark names, but also gets an\n argument that tells it whether the mark's content is block or\n inline content (for typical use, it'll always be inline). A mark\n serializer may be `null` to indicate that marks of that type\n should not be serialized.\n */\n constructor(\n /**\n The node serialization functions.\n */\n nodes, \n /**\n The mark serialization functions.\n */\n marks) {\n this.nodes = nodes;\n this.marks = marks;\n }\n /**\n Serialize the content of this fragment to a DOM fragment. When\n not in the browser, the `document` option, containing a DOM\n document, should be passed so that the serializer can create\n nodes.\n */\n serializeFragment(fragment, options = {}, target) {\n if (!target)\n target = doc(options).createDocumentFragment();\n let top = target, active = [];\n fragment.forEach(node => {\n if (active.length || node.marks.length) {\n let keep = 0, rendered = 0;\n while (keep < active.length && rendered < node.marks.length) {\n let next = node.marks[rendered];\n if (!this.marks[next.type.name]) {\n rendered++;\n continue;\n }\n if (!next.eq(active[keep][0]) || next.type.spec.spanning === false)\n break;\n keep++;\n rendered++;\n }\n while (keep < active.length)\n top = active.pop()[1];\n while (rendered < node.marks.length) {\n let add = node.marks[rendered++];\n let markDOM = this.serializeMark(add, node.isInline, options);\n if (markDOM) {\n active.push([add, top]);\n top.appendChild(markDOM.dom);\n top = markDOM.contentDOM || markDOM.dom;\n }\n }\n }\n top.appendChild(this.serializeNodeInner(node, options));\n });\n return target;\n }\n /**\n @internal\n */\n serializeNodeInner(node, options) {\n let { dom, contentDOM } = renderSpec(doc(options), this.nodes[node.type.name](node), null, node.attrs);\n if (contentDOM) {\n if (node.isLeaf)\n throw new RangeError(\"Content hole not allowed in a leaf node spec\");\n this.serializeFragment(node.content, options, contentDOM);\n }\n return dom;\n }\n /**\n Serialize this node to a DOM node. This can be useful when you\n need to serialize a part of a document, as opposed to the whole\n document. To serialize a whole document, use\n [`serializeFragment`](https://prosemirror.net/docs/ref/#model.DOMSerializer.serializeFragment) on\n its [content](https://prosemirror.net/docs/ref/#model.Node.content).\n */\n serializeNode(node, options = {}) {\n let dom = this.serializeNodeInner(node, options);\n for (let i = node.marks.length - 1; i >= 0; i--) {\n let wrap = this.serializeMark(node.marks[i], node.isInline, options);\n if (wrap) {\n (wrap.contentDOM || wrap.dom).appendChild(dom);\n dom = wrap.dom;\n }\n }\n return dom;\n }\n /**\n @internal\n */\n serializeMark(mark, inline, options = {}) {\n let toDOM = this.marks[mark.type.name];\n return toDOM && renderSpec(doc(options), toDOM(mark, inline), null, mark.attrs);\n }\n static renderSpec(doc, structure, xmlNS = null, blockArraysIn) {\n return renderSpec(doc, structure, xmlNS, blockArraysIn);\n }\n /**\n Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM)\n properties in a schema's node and mark specs.\n */\n static fromSchema(schema) {\n return schema.cached.domSerializer ||\n (schema.cached.domSerializer = new DOMSerializer(this.nodesFromSchema(schema), this.marksFromSchema(schema)));\n }\n /**\n Gather the serializers in a schema's node specs into an object.\n This can be useful as a base to build a custom serializer from.\n */\n static nodesFromSchema(schema) {\n let result = gatherToDOM(schema.nodes);\n if (!result.text)\n result.text = node => node.text;\n return result;\n }\n /**\n Gather the serializers in a schema's mark specs into an object.\n */\n static marksFromSchema(schema) {\n return gatherToDOM(schema.marks);\n }\n}\nfunction gatherToDOM(obj) {\n let result = {};\n for (let name in obj) {\n let toDOM = obj[name].spec.toDOM;\n if (toDOM)\n result[name] = toDOM;\n }\n return result;\n}\nfunction doc(options) {\n return options.document || window.document;\n}\nconst suspiciousAttributeCache = new WeakMap();\nfunction suspiciousAttributes(attrs) {\n let value = suspiciousAttributeCache.get(attrs);\n if (value === undefined)\n suspiciousAttributeCache.set(attrs, value = suspiciousAttributesInner(attrs));\n return value;\n}\nfunction suspiciousAttributesInner(attrs) {\n let result = null;\n function scan(value) {\n if (value && typeof value == \"object\") {\n if (Array.isArray(value)) {\n if (typeof value[0] == \"string\") {\n if (!result)\n result = [];\n result.push(value);\n }\n else {\n for (let i = 0; i < value.length; i++)\n scan(value[i]);\n }\n }\n else {\n for (let prop in value)\n scan(value[prop]);\n }\n }\n }\n scan(attrs);\n return result;\n}\nfunction renderSpec(doc, structure, xmlNS, blockArraysIn) {\n if (typeof structure == \"string\")\n return { dom: doc.createTextNode(structure) };\n if (structure.nodeType != null)\n return { dom: structure };\n if (structure.dom && structure.dom.nodeType != null)\n return structure;\n let tagName = structure[0], suspicious;\n if (typeof tagName != \"string\")\n throw new RangeError(\"Invalid array passed to renderSpec\");\n if (blockArraysIn && (suspicious = suspiciousAttributes(blockArraysIn)) &&\n suspicious.indexOf(structure) > -1)\n throw new RangeError(\"Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.\");\n let space = tagName.indexOf(\" \");\n if (space > 0) {\n xmlNS = tagName.slice(0, space);\n tagName = tagName.slice(space + 1);\n }\n let contentDOM;\n let dom = (xmlNS ? doc.createElementNS(xmlNS, tagName) : doc.createElement(tagName));\n let attrs = structure[1], start = 1;\n if (attrs && typeof attrs == \"object\" && attrs.nodeType == null && !Array.isArray(attrs)) {\n start = 2;\n for (let name in attrs)\n if (attrs[name] != null) {\n let space = name.indexOf(\" \");\n if (space > 0)\n dom.setAttributeNS(name.slice(0, space), name.slice(space + 1), attrs[name]);\n else if (name == \"style\" && dom.style)\n dom.style.cssText = attrs[name];\n else\n dom.setAttribute(name, attrs[name]);\n }\n }\n for (let i = start; i < structure.length; i++) {\n let child = structure[i];\n if (child === 0) {\n if (i < structure.length - 1 || i > start)\n throw new RangeError(\"Content hole must be the only child of its parent node\");\n return { dom, contentDOM: dom };\n }\n else {\n let { dom: inner, contentDOM: innerContent } = renderSpec(doc, child, xmlNS, blockArraysIn);\n dom.appendChild(inner);\n if (innerContent) {\n if (contentDOM)\n throw new RangeError(\"Multiple content holes\");\n contentDOM = innerContent;\n }\n }\n }\n return { dom, contentDOM };\n}\n\nexport { ContentMatch, DOMParser, DOMSerializer, Fragment, Mark, MarkType, Node, NodeRange, NodeType, ReplaceError, ResolvedPos, Schema, Slice };\n","import { ReplaceError, Slice, Fragment, MarkType, Mark } from 'prosemirror-model';\n\n// Recovery values encode a range index and an offset. They are\n// represented as numbers, because tons of them will be created when\n// mapping, for example, a large number of decorations. The number's\n// lower 16 bits provide the index, the remaining bits the offset.\n//\n// Note: We intentionally don't use bit shift operators to en- and\n// decode these, since those clip to 32 bits, which we might in rare\n// cases want to overflow. A 64-bit float can represent 48-bit\n// integers precisely.\nconst lower16 = 0xffff;\nconst factor16 = Math.pow(2, 16);\nfunction makeRecover(index, offset) { return index + offset * factor16; }\nfunction recoverIndex(value) { return value & lower16; }\nfunction recoverOffset(value) { return (value - (value & lower16)) / factor16; }\nconst DEL_BEFORE = 1, DEL_AFTER = 2, DEL_ACROSS = 4, DEL_SIDE = 8;\n/**\nAn object representing a mapped position with extra\ninformation.\n*/\nclass MapResult {\n /**\n @internal\n */\n constructor(\n /**\n The mapped version of the position.\n */\n pos, \n /**\n @internal\n */\n delInfo, \n /**\n @internal\n */\n recover) {\n this.pos = pos;\n this.delInfo = delInfo;\n this.recover = recover;\n }\n /**\n Tells you whether the position was deleted, that is, whether the\n step removed the token on the side queried (via the `assoc`)\n argument from the document.\n */\n get deleted() { return (this.delInfo & DEL_SIDE) > 0; }\n /**\n Tells you whether the token before the mapped position was deleted.\n */\n get deletedBefore() { return (this.delInfo & (DEL_BEFORE | DEL_ACROSS)) > 0; }\n /**\n True when the token after the mapped position was deleted.\n */\n get deletedAfter() { return (this.delInfo & (DEL_AFTER | DEL_ACROSS)) > 0; }\n /**\n Tells whether any of the steps mapped through deletes across the\n position (including both the token before and after the\n position).\n */\n get deletedAcross() { return (this.delInfo & DEL_ACROSS) > 0; }\n}\n/**\nA map describing the deletions and insertions made by a step, which\ncan be used to find the correspondence between positions in the\npre-step version of a document and the same position in the\npost-step version.\n*/\nclass StepMap {\n /**\n Create a position map. The modifications to the document are\n represented as an array of numbers, in which each group of three\n represents a modified chunk as `[start, oldSize, newSize]`.\n */\n constructor(\n /**\n @internal\n */\n ranges, \n /**\n @internal\n */\n inverted = false) {\n this.ranges = ranges;\n this.inverted = inverted;\n if (!ranges.length && StepMap.empty)\n return StepMap.empty;\n }\n /**\n @internal\n */\n recover(value) {\n let diff = 0, index = recoverIndex(value);\n if (!this.inverted)\n for (let i = 0; i < index; i++)\n diff += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];\n return this.ranges[index * 3] + diff + recoverOffset(value);\n }\n mapResult(pos, assoc = 1) { return this._map(pos, assoc, false); }\n map(pos, assoc = 1) { return this._map(pos, assoc, true); }\n /**\n @internal\n */\n _map(pos, assoc, simple) {\n let diff = 0, oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;\n for (let i = 0; i < this.ranges.length; i += 3) {\n let start = this.ranges[i] - (this.inverted ? diff : 0);\n if (start > pos)\n break;\n let oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex], end = start + oldSize;\n if (pos <= end) {\n let side = !oldSize ? assoc : pos == start ? -1 : pos == end ? 1 : assoc;\n let result = start + diff + (side < 0 ? 0 : newSize);\n if (simple)\n return result;\n let recover = pos == (assoc < 0 ? start : end) ? null : makeRecover(i / 3, pos - start);\n let del = pos == start ? DEL_AFTER : pos == end ? DEL_BEFORE : DEL_ACROSS;\n if (assoc < 0 ? pos != start : pos != end)\n del |= DEL_SIDE;\n return new MapResult(result, del, recover);\n }\n diff += newSize - oldSize;\n }\n return simple ? pos + diff : new MapResult(pos + diff, 0, null);\n }\n /**\n @internal\n */\n touches(pos, recover) {\n let diff = 0, index = recoverIndex(recover);\n let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;\n for (let i = 0; i < this.ranges.length; i += 3) {\n let start = this.ranges[i] - (this.inverted ? diff : 0);\n if (start > pos)\n break;\n let oldSize = this.ranges[i + oldIndex], end = start + oldSize;\n if (pos <= end && i == index * 3)\n return true;\n diff += this.ranges[i + newIndex] - oldSize;\n }\n return false;\n }\n /**\n Calls the given function on each of the changed ranges included in\n this map.\n */\n forEach(f) {\n let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;\n for (let i = 0, diff = 0; i < this.ranges.length; i += 3) {\n let start = this.ranges[i], oldStart = start - (this.inverted ? diff : 0), newStart = start + (this.inverted ? 0 : diff);\n let oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex];\n f(oldStart, oldStart + oldSize, newStart, newStart + newSize);\n diff += newSize - oldSize;\n }\n }\n /**\n Create an inverted version of this map. The result can be used to\n map positions in the post-step document to the pre-step document.\n */\n invert() {\n return new StepMap(this.ranges, !this.inverted);\n }\n /**\n @internal\n */\n toString() {\n return (this.inverted ? \"-\" : \"\") + JSON.stringify(this.ranges);\n }\n /**\n Create a map that moves all positions by offset `n` (which may be\n negative). This can be useful when applying steps meant for a\n sub-document to a larger document, or vice-versa.\n */\n static offset(n) {\n return n == 0 ? StepMap.empty : new StepMap(n < 0 ? [0, -n, 0] : [0, 0, n]);\n }\n}\n/**\nA StepMap that contains no changed ranges.\n*/\nStepMap.empty = new StepMap([]);\n/**\nA mapping represents a pipeline of zero or more [step\nmaps](https://prosemirror.net/docs/ref/#transform.StepMap). It has special provisions for losslessly\nhandling mapping positions through a series of steps in which some\nsteps are inverted versions of earlier steps. (This comes up when\n‘[rebasing](https://prosemirror.net/docs/guide/#transform.rebasing)’ steps for\ncollaboration or history management.)\n*/\nclass Mapping {\n /**\n Create a new mapping with the given position maps.\n */\n constructor(maps, \n /**\n @internal\n */\n mirror, \n /**\n The starting position in the `maps` array, used when `map` or\n `mapResult` is called.\n */\n from = 0, \n /**\n The end position in the `maps` array.\n */\n to = maps ? maps.length : 0) {\n this.mirror = mirror;\n this.from = from;\n this.to = to;\n this._maps = maps || [];\n this.ownData = !(maps || mirror);\n }\n /**\n The step maps in this mapping.\n */\n get maps() { return this._maps; }\n /**\n Create a mapping that maps only through a part of this one.\n */\n slice(from = 0, to = this.maps.length) {\n return new Mapping(this._maps, this.mirror, from, to);\n }\n /**\n Add a step map to the end of this mapping. If `mirrors` is\n given, it should be the index of the step map that is the mirror\n image of this one.\n */\n appendMap(map, mirrors) {\n if (!this.ownData) {\n this._maps = this._maps.slice();\n this.mirror = this.mirror && this.mirror.slice();\n this.ownData = true;\n }\n this.to = this._maps.push(map);\n if (mirrors != null)\n this.setMirror(this._maps.length - 1, mirrors);\n }\n /**\n Add all the step maps in a given mapping to this one (preserving\n mirroring information).\n */\n appendMapping(mapping) {\n for (let i = 0, startSize = this._maps.length; i < mapping._maps.length; i++) {\n let mirr = mapping.getMirror(i);\n this.appendMap(mapping._maps[i], mirr != null && mirr < i ? startSize + mirr : undefined);\n }\n }\n /**\n Finds the offset of the step map that mirrors the map at the\n given offset, in this mapping (as per the second argument to\n `appendMap`).\n */\n getMirror(n) {\n if (this.mirror)\n for (let i = 0; i < this.mirror.length; i++)\n if (this.mirror[i] == n)\n return this.mirror[i + (i % 2 ? -1 : 1)];\n }\n /**\n @internal\n */\n setMirror(n, m) {\n if (!this.mirror)\n this.mirror = [];\n this.mirror.push(n, m);\n }\n /**\n Append the inverse of the given mapping to this one.\n */\n appendMappingInverted(mapping) {\n for (let i = mapping.maps.length - 1, totalSize = this._maps.length + mapping._maps.length; i >= 0; i--) {\n let mirr = mapping.getMirror(i);\n this.appendMap(mapping._maps[i].invert(), mirr != null && mirr > i ? totalSize - mirr - 1 : undefined);\n }\n }\n /**\n Create an inverted version of this mapping.\n */\n invert() {\n let inverse = new Mapping;\n inverse.appendMappingInverted(this);\n return inverse;\n }\n /**\n Map a position through this mapping.\n */\n map(pos, assoc = 1) {\n if (this.mirror)\n return this._map(pos, assoc, true);\n for (let i = this.from; i < this.to; i++)\n pos = this._maps[i].map(pos, assoc);\n return pos;\n }\n /**\n Map a position through this mapping, returning a mapping\n result.\n */\n mapResult(pos, assoc = 1) { return this._map(pos, assoc, false); }\n /**\n @internal\n */\n _map(pos, assoc, simple) {\n let delInfo = 0;\n for (let i = this.from; i < this.to; i++) {\n let map = this._maps[i], result = map.mapResult(pos, assoc);\n if (result.recover != null) {\n let corr = this.getMirror(i);\n if (corr != null && corr > i && corr < this.to) {\n i = corr;\n pos = this._maps[corr].recover(result.recover);\n continue;\n }\n }\n delInfo |= result.delInfo;\n pos = result.pos;\n }\n return simple ? pos : new MapResult(pos, delInfo, null);\n }\n}\n\nconst stepsByID = Object.create(null);\n/**\nA step object represents an atomic change. It generally applies\nonly to the document it was created for, since the positions\nstored in it will only make sense for that document.\n\nNew steps are defined by creating classes that extend `Step`,\noverriding the `apply`, `invert`, `map`, `getMap` and `fromJSON`\nmethods, and registering your class with a unique\nJSON-serialization identifier using\n[`Step.jsonID`](https://prosemirror.net/docs/ref/#transform.Step^jsonID).\n*/\nclass Step {\n /**\n Get the step map that represents the changes made by this step,\n and which can be used to transform between positions in the old\n and the new document.\n */\n getMap() { return StepMap.empty; }\n /**\n Try to merge this step with another one, to be applied directly\n after it. Returns the merged step when possible, null if the\n steps can't be merged.\n */\n merge(other) { return null; }\n /**\n Deserialize a step from its JSON representation. Will call\n through to the step class' own implementation of this method.\n */\n static fromJSON(schema, json) {\n if (!json || !json.stepType)\n throw new RangeError(\"Invalid input for Step.fromJSON\");\n let type = stepsByID[json.stepType];\n if (!type)\n throw new RangeError(`No step type ${json.stepType} defined`);\n return type.fromJSON(schema, json);\n }\n /**\n To be able to serialize steps to JSON, each step needs a string\n ID to attach to its JSON representation. Use this method to\n register an ID for your step classes. Try to pick something\n that's unlikely to clash with steps from other modules.\n */\n static jsonID(id, stepClass) {\n if (id in stepsByID)\n throw new RangeError(\"Duplicate use of step JSON ID \" + id);\n stepsByID[id] = stepClass;\n stepClass.prototype.jsonID = id;\n return stepClass;\n }\n}\n/**\nThe result of [applying](https://prosemirror.net/docs/ref/#transform.Step.apply) a step. Contains either a\nnew document or a failure value.\n*/\nclass StepResult {\n /**\n @internal\n */\n constructor(\n /**\n The transformed document, if successful.\n */\n doc, \n /**\n The failure message, if unsuccessful.\n */\n failed) {\n this.doc = doc;\n this.failed = failed;\n }\n /**\n Create a successful step result.\n */\n static ok(doc) { return new StepResult(doc, null); }\n /**\n Create a failed step result.\n */\n static fail(message) { return new StepResult(null, message); }\n /**\n Call [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) with the given\n arguments. Create a successful result if it succeeds, and a\n failed one if it throws a `ReplaceError`.\n */\n static fromReplace(doc, from, to, slice) {\n try {\n return StepResult.ok(doc.replace(from, to, slice));\n }\n catch (e) {\n if (e instanceof ReplaceError)\n return StepResult.fail(e.message);\n throw e;\n }\n }\n}\n\nfunction mapFragment(fragment, f, parent) {\n let mapped = [];\n for (let i = 0; i < fragment.childCount; i++) {\n let child = fragment.child(i);\n if (child.content.size)\n child = child.copy(mapFragment(child.content, f, child));\n if (child.isInline)\n child = f(child, parent, i);\n mapped.push(child);\n }\n return Fragment.fromArray(mapped);\n}\n/**\nAdd a mark to all inline content between two positions.\n*/\nclass AddMarkStep extends Step {\n /**\n Create a mark step.\n */\n constructor(\n /**\n The start of the marked range.\n */\n from, \n /**\n The end of the marked range.\n */\n to, \n /**\n The mark to add.\n */\n mark) {\n super();\n this.from = from;\n this.to = to;\n this.mark = mark;\n }\n apply(doc) {\n let oldSlice = doc.slice(this.from, this.to), $from = doc.resolve(this.from);\n let parent = $from.node($from.sharedDepth(this.to));\n let slice = new Slice(mapFragment(oldSlice.content, (node, parent) => {\n if (!node.isAtom || !parent.type.allowsMarkType(this.mark.type))\n return node;\n return node.mark(this.mark.addToSet(node.marks));\n }, parent), oldSlice.openStart, oldSlice.openEnd);\n return StepResult.fromReplace(doc, this.from, this.to, slice);\n }\n invert() {\n return new RemoveMarkStep(this.from, this.to, this.mark);\n }\n map(mapping) {\n let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);\n if (from.deleted && to.deleted || from.pos >= to.pos)\n return null;\n return new AddMarkStep(from.pos, to.pos, this.mark);\n }\n merge(other) {\n if (other instanceof AddMarkStep &&\n other.mark.eq(this.mark) &&\n this.from <= other.to && this.to >= other.from)\n return new AddMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);\n return null;\n }\n toJSON() {\n return { stepType: \"addMark\", mark: this.mark.toJSON(),\n from: this.from, to: this.to };\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\")\n throw new RangeError(\"Invalid input for AddMarkStep.fromJSON\");\n return new AddMarkStep(json.from, json.to, schema.markFromJSON(json.mark));\n }\n}\nStep.jsonID(\"addMark\", AddMarkStep);\n/**\nRemove a mark from all inline content between two positions.\n*/\nclass RemoveMarkStep extends Step {\n /**\n Create a mark-removing step.\n */\n constructor(\n /**\n The start of the unmarked range.\n */\n from, \n /**\n The end of the unmarked range.\n */\n to, \n /**\n The mark to remove.\n */\n mark) {\n super();\n this.from = from;\n this.to = to;\n this.mark = mark;\n }\n apply(doc) {\n let oldSlice = doc.slice(this.from, this.to);\n let slice = new Slice(mapFragment(oldSlice.content, node => {\n return node.mark(this.mark.removeFromSet(node.marks));\n }, doc), oldSlice.openStart, oldSlice.openEnd);\n return StepResult.fromReplace(doc, this.from, this.to, slice);\n }\n invert() {\n return new AddMarkStep(this.from, this.to, this.mark);\n }\n map(mapping) {\n let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);\n if (from.deleted && to.deleted || from.pos >= to.pos)\n return null;\n return new RemoveMarkStep(from.pos, to.pos, this.mark);\n }\n merge(other) {\n if (other instanceof RemoveMarkStep &&\n other.mark.eq(this.mark) &&\n this.from <= other.to && this.to >= other.from)\n return new RemoveMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);\n return null;\n }\n toJSON() {\n return { stepType: \"removeMark\", mark: this.mark.toJSON(),\n from: this.from, to: this.to };\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\")\n throw new RangeError(\"Invalid input for RemoveMarkStep.fromJSON\");\n return new RemoveMarkStep(json.from, json.to, schema.markFromJSON(json.mark));\n }\n}\nStep.jsonID(\"removeMark\", RemoveMarkStep);\n/**\nAdd a mark to a specific node.\n*/\nclass AddNodeMarkStep extends Step {\n /**\n Create a node mark step.\n */\n constructor(\n /**\n The position of the target node.\n */\n pos, \n /**\n The mark to add.\n */\n mark) {\n super();\n this.pos = pos;\n this.mark = mark;\n }\n apply(doc) {\n let node = doc.nodeAt(this.pos);\n if (!node)\n return StepResult.fail(\"No node at mark step's position\");\n let updated = node.type.create(node.attrs, null, this.mark.addToSet(node.marks));\n return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));\n }\n invert(doc) {\n let node = doc.nodeAt(this.pos);\n if (node) {\n let newSet = this.mark.addToSet(node.marks);\n if (newSet.length == node.marks.length) {\n for (let i = 0; i < node.marks.length; i++)\n if (!node.marks[i].isInSet(newSet))\n return new AddNodeMarkStep(this.pos, node.marks[i]);\n return new AddNodeMarkStep(this.pos, this.mark);\n }\n }\n return new RemoveNodeMarkStep(this.pos, this.mark);\n }\n map(mapping) {\n let pos = mapping.mapResult(this.pos, 1);\n return pos.deletedAfter ? null : new AddNodeMarkStep(pos.pos, this.mark);\n }\n toJSON() {\n return { stepType: \"addNodeMark\", pos: this.pos, mark: this.mark.toJSON() };\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.pos != \"number\")\n throw new RangeError(\"Invalid input for AddNodeMarkStep.fromJSON\");\n return new AddNodeMarkStep(json.pos, schema.markFromJSON(json.mark));\n }\n}\nStep.jsonID(\"addNodeMark\", AddNodeMarkStep);\n/**\nRemove a mark from a specific node.\n*/\nclass RemoveNodeMarkStep extends Step {\n /**\n Create a mark-removing step.\n */\n constructor(\n /**\n The position of the target node.\n */\n pos, \n /**\n The mark to remove.\n */\n mark) {\n super();\n this.pos = pos;\n this.mark = mark;\n }\n apply(doc) {\n let node = doc.nodeAt(this.pos);\n if (!node)\n return StepResult.fail(\"No node at mark step's position\");\n let updated = node.type.create(node.attrs, null, this.mark.removeFromSet(node.marks));\n return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));\n }\n invert(doc) {\n let node = doc.nodeAt(this.pos);\n if (!node || !this.mark.isInSet(node.marks))\n return this;\n return new AddNodeMarkStep(this.pos, this.mark);\n }\n map(mapping) {\n let pos = mapping.mapResult(this.pos, 1);\n return pos.deletedAfter ? null : new RemoveNodeMarkStep(pos.pos, this.mark);\n }\n toJSON() {\n return { stepType: \"removeNodeMark\", pos: this.pos, mark: this.mark.toJSON() };\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.pos != \"number\")\n throw new RangeError(\"Invalid input for RemoveNodeMarkStep.fromJSON\");\n return new RemoveNodeMarkStep(json.pos, schema.markFromJSON(json.mark));\n }\n}\nStep.jsonID(\"removeNodeMark\", RemoveNodeMarkStep);\n\n/**\nReplace a part of the document with a slice of new content.\n*/\nclass ReplaceStep extends Step {\n /**\n The given `slice` should fit the 'gap' between `from` and\n `to`—the depths must line up, and the surrounding nodes must be\n able to be joined with the open sides of the slice. When\n `structure` is true, the step will fail if the content between\n from and to is not just a sequence of closing and then opening\n tokens (this is to guard against rebased replace steps\n overwriting something they weren't supposed to).\n */\n constructor(\n /**\n The start position of the replaced range.\n */\n from, \n /**\n The end position of the replaced range.\n */\n to, \n /**\n The slice to insert.\n */\n slice, \n /**\n @internal\n */\n structure = false) {\n super();\n this.from = from;\n this.to = to;\n this.slice = slice;\n this.structure = structure;\n }\n apply(doc) {\n if (this.structure && contentBetween(doc, this.from, this.to))\n return StepResult.fail(\"Structure replace would overwrite content\");\n return StepResult.fromReplace(doc, this.from, this.to, this.slice);\n }\n getMap() {\n return new StepMap([this.from, this.to - this.from, this.slice.size]);\n }\n invert(doc) {\n return new ReplaceStep(this.from, this.from + this.slice.size, doc.slice(this.from, this.to));\n }\n map(mapping) {\n let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);\n if (from.deletedAcross && to.deletedAcross)\n return null;\n return new ReplaceStep(from.pos, Math.max(from.pos, to.pos), this.slice, this.structure);\n }\n merge(other) {\n if (!(other instanceof ReplaceStep) || other.structure || this.structure)\n return null;\n if (this.from + this.slice.size == other.from && !this.slice.openEnd && !other.slice.openStart) {\n let slice = this.slice.size + other.slice.size == 0 ? Slice.empty\n : new Slice(this.slice.content.append(other.slice.content), this.slice.openStart, other.slice.openEnd);\n return new ReplaceStep(this.from, this.to + (other.to - other.from), slice, this.structure);\n }\n else if (other.to == this.from && !this.slice.openStart && !other.slice.openEnd) {\n let slice = this.slice.size + other.slice.size == 0 ? Slice.empty\n : new Slice(other.slice.content.append(this.slice.content), other.slice.openStart, this.slice.openEnd);\n return new ReplaceStep(other.from, this.to, slice, this.structure);\n }\n else {\n return null;\n }\n }\n toJSON() {\n let json = { stepType: \"replace\", from: this.from, to: this.to };\n if (this.slice.size)\n json.slice = this.slice.toJSON();\n if (this.structure)\n json.structure = true;\n return json;\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\")\n throw new RangeError(\"Invalid input for ReplaceStep.fromJSON\");\n return new ReplaceStep(json.from, json.to, Slice.fromJSON(schema, json.slice), !!json.structure);\n }\n}\nStep.jsonID(\"replace\", ReplaceStep);\n/**\nReplace a part of the document with a slice of content, but\npreserve a range of the replaced content by moving it into the\nslice.\n*/\nclass ReplaceAroundStep extends Step {\n /**\n Create a replace-around step with the given range and gap.\n `insert` should be the point in the slice into which the content\n of the gap should be moved. `structure` has the same meaning as\n it has in the [`ReplaceStep`](https://prosemirror.net/docs/ref/#transform.ReplaceStep) class.\n */\n constructor(\n /**\n The start position of the replaced range.\n */\n from, \n /**\n The end position of the replaced range.\n */\n to, \n /**\n The start of preserved range.\n */\n gapFrom, \n /**\n The end of preserved range.\n */\n gapTo, \n /**\n The slice to insert.\n */\n slice, \n /**\n The position in the slice where the preserved range should be\n inserted.\n */\n insert, \n /**\n @internal\n */\n structure = false) {\n super();\n this.from = from;\n this.to = to;\n this.gapFrom = gapFrom;\n this.gapTo = gapTo;\n this.slice = slice;\n this.insert = insert;\n this.structure = structure;\n }\n apply(doc) {\n if (this.structure && (contentBetween(doc, this.from, this.gapFrom) ||\n contentBetween(doc, this.gapTo, this.to)))\n return StepResult.fail(\"Structure gap-replace would overwrite content\");\n let gap = doc.slice(this.gapFrom, this.gapTo);\n if (gap.openStart || gap.openEnd)\n return StepResult.fail(\"Gap is not a flat range\");\n let inserted = this.slice.insertAt(this.insert, gap.content);\n if (!inserted)\n return StepResult.fail(\"Content does not fit in gap\");\n return StepResult.fromReplace(doc, this.from, this.to, inserted);\n }\n getMap() {\n return new StepMap([this.from, this.gapFrom - this.from, this.insert,\n this.gapTo, this.to - this.gapTo, this.slice.size - this.insert]);\n }\n invert(doc) {\n let gap = this.gapTo - this.gapFrom;\n return new ReplaceAroundStep(this.from, this.from + this.slice.size + gap, this.from + this.insert, this.from + this.insert + gap, doc.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);\n }\n map(mapping) {\n let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);\n let gapFrom = this.from == this.gapFrom ? from.pos : mapping.map(this.gapFrom, -1);\n let gapTo = this.to == this.gapTo ? to.pos : mapping.map(this.gapTo, 1);\n if ((from.deletedAcross && to.deletedAcross) || gapFrom < from.pos || gapTo > to.pos)\n return null;\n return new ReplaceAroundStep(from.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);\n }\n toJSON() {\n let json = { stepType: \"replaceAround\", from: this.from, to: this.to,\n gapFrom: this.gapFrom, gapTo: this.gapTo, insert: this.insert };\n if (this.slice.size)\n json.slice = this.slice.toJSON();\n if (this.structure)\n json.structure = true;\n return json;\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\" ||\n typeof json.gapFrom != \"number\" || typeof json.gapTo != \"number\" || typeof json.insert != \"number\")\n throw new RangeError(\"Invalid input for ReplaceAroundStep.fromJSON\");\n return new ReplaceAroundStep(json.from, json.to, json.gapFrom, json.gapTo, Slice.fromJSON(schema, json.slice), json.insert, !!json.structure);\n }\n}\nStep.jsonID(\"replaceAround\", ReplaceAroundStep);\nfunction contentBetween(doc, from, to) {\n let $from = doc.resolve(from), dist = to - from, depth = $from.depth;\n while (dist > 0 && depth > 0 && $from.indexAfter(depth) == $from.node(depth).childCount) {\n depth--;\n dist--;\n }\n if (dist > 0) {\n let next = $from.node(depth).maybeChild($from.indexAfter(depth));\n while (dist > 0) {\n if (!next || next.isLeaf)\n return true;\n next = next.firstChild;\n dist--;\n }\n }\n return false;\n}\n\nfunction addMark(tr, from, to, mark) {\n let removed = [], added = [];\n let removing, adding;\n tr.doc.nodesBetween(from, to, (node, pos, parent) => {\n if (!node.isInline)\n return;\n let marks = node.marks;\n if (!mark.isInSet(marks) && parent.type.allowsMarkType(mark.type)) {\n let start = Math.max(pos, from), end = Math.min(pos + node.nodeSize, to);\n let newSet = mark.addToSet(marks);\n for (let i = 0; i < marks.length; i++) {\n if (!marks[i].isInSet(newSet)) {\n if (removing && removing.to == start && removing.mark.eq(marks[i]))\n removing.to = end;\n else\n removed.push(removing = new RemoveMarkStep(start, end, marks[i]));\n }\n }\n if (adding && adding.to == start)\n adding.to = end;\n else\n added.push(adding = new AddMarkStep(start, end, mark));\n }\n });\n removed.forEach(s => tr.step(s));\n added.forEach(s => tr.step(s));\n}\nfunction removeMark(tr, from, to, mark) {\n let matched = [], step = 0;\n tr.doc.nodesBetween(from, to, (node, pos) => {\n if (!node.isInline)\n return;\n step++;\n let toRemove = null;\n if (mark instanceof MarkType) {\n let set = node.marks, found;\n while (found = mark.isInSet(set)) {\n (toRemove || (toRemove = [])).push(found);\n set = found.removeFromSet(set);\n }\n }\n else if (mark) {\n if (mark.isInSet(node.marks))\n toRemove = [mark];\n }\n else {\n toRemove = node.marks;\n }\n if (toRemove && toRemove.length) {\n let end = Math.min(pos + node.nodeSize, to);\n for (let i = 0; i < toRemove.length; i++) {\n let style = toRemove[i], found;\n for (let j = 0; j < matched.length; j++) {\n let m = matched[j];\n if (m.step == step - 1 && style.eq(matched[j].style))\n found = m;\n }\n if (found) {\n found.to = end;\n found.step = step;\n }\n else {\n matched.push({ style, from: Math.max(pos, from), to: end, step });\n }\n }\n }\n });\n matched.forEach(m => tr.step(new RemoveMarkStep(m.from, m.to, m.style)));\n}\nfunction clearIncompatible(tr, pos, parentType, match = parentType.contentMatch, clearNewlines = true) {\n let node = tr.doc.nodeAt(pos);\n let replSteps = [], cur = pos + 1;\n for (let i = 0; i < node.childCount; i++) {\n let child = node.child(i), end = cur + child.nodeSize;\n let allowed = match.matchType(child.type);\n if (!allowed) {\n replSteps.push(new ReplaceStep(cur, end, Slice.empty));\n }\n else {\n match = allowed;\n for (let j = 0; j < child.marks.length; j++)\n if (!parentType.allowsMarkType(child.marks[j].type))\n tr.step(new RemoveMarkStep(cur, end, child.marks[j]));\n if (clearNewlines && child.isText && parentType.whitespace != \"pre\") {\n let m, newline = /\\r?\\n|\\r/g, slice;\n while (m = newline.exec(child.text)) {\n if (!slice)\n slice = new Slice(Fragment.from(parentType.schema.text(\" \", parentType.allowedMarks(child.marks))), 0, 0);\n replSteps.push(new ReplaceStep(cur + m.index, cur + m.index + m[0].length, slice));\n }\n }\n }\n cur = end;\n }\n if (!match.validEnd) {\n let fill = match.fillBefore(Fragment.empty, true);\n tr.replace(cur, cur, new Slice(fill, 0, 0));\n }\n for (let i = replSteps.length - 1; i >= 0; i--)\n tr.step(replSteps[i]);\n}\n\nfunction canCut(node, start, end) {\n return (start == 0 || node.canReplace(start, node.childCount)) &&\n (end == node.childCount || node.canReplace(0, end));\n}\n/**\nTry to find a target depth to which the content in the given range\ncan be lifted. Will not go across\n[isolating](https://prosemirror.net/docs/ref/#model.NodeSpec.isolating) parent nodes.\n*/\nfunction liftTarget(range) {\n let parent = range.parent;\n let content = parent.content.cutByIndex(range.startIndex, range.endIndex);\n for (let depth = range.depth, contentBefore = 0, contentAfter = 0;; --depth) {\n let node = range.$from.node(depth);\n let index = range.$from.index(depth) + contentBefore, endIndex = range.$to.indexAfter(depth) - contentAfter;\n if (depth < range.depth && node.canReplace(index, endIndex, content))\n return depth;\n if (depth == 0 || node.type.spec.isolating || !canCut(node, index, endIndex))\n break;\n if (index)\n contentBefore = 1;\n if (endIndex < node.childCount)\n contentAfter = 1;\n }\n return null;\n}\nfunction lift(tr, range, target) {\n let { $from, $to, depth } = range;\n let gapStart = $from.before(depth + 1), gapEnd = $to.after(depth + 1);\n let start = gapStart, end = gapEnd;\n let before = Fragment.empty, openStart = 0;\n for (let d = depth, splitting = false; d > target; d--)\n if (splitting || $from.index(d) > 0) {\n splitting = true;\n before = Fragment.from($from.node(d).copy(before));\n openStart++;\n }\n else {\n start--;\n }\n let after = Fragment.empty, openEnd = 0;\n for (let d = depth, splitting = false; d > target; d--)\n if (splitting || $to.after(d + 1) < $to.end(d)) {\n splitting = true;\n after = Fragment.from($to.node(d).copy(after));\n openEnd++;\n }\n else {\n end++;\n }\n tr.step(new ReplaceAroundStep(start, end, gapStart, gapEnd, new Slice(before.append(after), openStart, openEnd), before.size - openStart, true));\n}\n/**\nTry to find a valid way to wrap the content in the given range in a\nnode of the given type. May introduce extra nodes around and inside\nthe wrapper node, if necessary. Returns null if no valid wrapping\ncould be found. When `innerRange` is given, that range's content is\nused as the content to fit into the wrapping, instead of the\ncontent of `range`.\n*/\nfunction findWrapping(range, nodeType, attrs = null, innerRange = range) {\n let around = findWrappingOutside(range, nodeType);\n let inner = around && findWrappingInside(innerRange, nodeType);\n if (!inner)\n return null;\n return around.map(withAttrs)\n .concat({ type: nodeType, attrs }).concat(inner.map(withAttrs));\n}\nfunction withAttrs(type) { return { type, attrs: null }; }\nfunction findWrappingOutside(range, type) {\n let { parent, startIndex, endIndex } = range;\n let around = parent.contentMatchAt(startIndex).findWrapping(type);\n if (!around)\n return null;\n let outer = around.length ? around[0] : type;\n return parent.canReplaceWith(startIndex, endIndex, outer) ? around : null;\n}\nfunction findWrappingInside(range, type) {\n let { parent, startIndex, endIndex } = range;\n let inner = parent.child(startIndex);\n let inside = type.contentMatch.findWrapping(inner.type);\n if (!inside)\n return null;\n let lastType = inside.length ? inside[inside.length - 1] : type;\n let innerMatch = lastType.contentMatch;\n for (let i = startIndex; innerMatch && i < endIndex; i++)\n innerMatch = innerMatch.matchType(parent.child(i).type);\n if (!innerMatch || !innerMatch.validEnd)\n return null;\n return inside;\n}\nfunction wrap(tr, range, wrappers) {\n let content = Fragment.empty;\n for (let i = wrappers.length - 1; i >= 0; i--) {\n if (content.size) {\n let match = wrappers[i].type.contentMatch.matchFragment(content);\n if (!match || !match.validEnd)\n throw new RangeError(\"Wrapper type given to Transform.wrap does not form valid content of its parent wrapper\");\n }\n content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));\n }\n let start = range.start, end = range.end;\n tr.step(new ReplaceAroundStep(start, end, start, end, new Slice(content, 0, 0), wrappers.length, true));\n}\nfunction setBlockType(tr, from, to, type, attrs) {\n if (!type.isTextblock)\n throw new RangeError(\"Type given to setBlockType should be a textblock\");\n let mapFrom = tr.steps.length;\n tr.doc.nodesBetween(from, to, (node, pos) => {\n let attrsHere = typeof attrs == \"function\" ? attrs(node) : attrs;\n if (node.isTextblock && !node.hasMarkup(type, attrsHere) &&\n canChangeType(tr.doc, tr.mapping.slice(mapFrom).map(pos), type)) {\n let convertNewlines = null;\n if (type.schema.linebreakReplacement) {\n let pre = type.whitespace == \"pre\", supportLinebreak = !!type.contentMatch.matchType(type.schema.linebreakReplacement);\n if (pre && !supportLinebreak)\n convertNewlines = false;\n else if (!pre && supportLinebreak)\n convertNewlines = true;\n }\n // Ensure all markup that isn't allowed in the new node type is cleared\n if (convertNewlines === false)\n replaceLinebreaks(tr, node, pos, mapFrom);\n clearIncompatible(tr, tr.mapping.slice(mapFrom).map(pos, 1), type, undefined, convertNewlines === null);\n let mapping = tr.mapping.slice(mapFrom);\n let startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);\n tr.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type.create(attrsHere, null, node.marks)), 0, 0), 1, true));\n if (convertNewlines === true)\n replaceNewlines(tr, node, pos, mapFrom);\n return false;\n }\n });\n}\nfunction replaceNewlines(tr, node, pos, mapFrom) {\n node.forEach((child, offset) => {\n if (child.isText) {\n let m, newline = /\\r?\\n|\\r/g;\n while (m = newline.exec(child.text)) {\n let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset + m.index);\n tr.replaceWith(start, start + 1, node.type.schema.linebreakReplacement.create());\n }\n }\n });\n}\nfunction replaceLinebreaks(tr, node, pos, mapFrom) {\n node.forEach((child, offset) => {\n if (child.type == child.type.schema.linebreakReplacement) {\n let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset);\n tr.replaceWith(start, start + 1, node.type.schema.text(\"\\n\"));\n }\n });\n}\nfunction canChangeType(doc, pos, type) {\n let $pos = doc.resolve(pos), index = $pos.index();\n return $pos.parent.canReplaceWith(index, index + 1, type);\n}\n/**\nChange the type, attributes, and/or marks of the node at `pos`.\nWhen `type` isn't given, the existing node type is preserved,\n*/\nfunction setNodeMarkup(tr, pos, type, attrs, marks) {\n let node = tr.doc.nodeAt(pos);\n if (!node)\n throw new RangeError(\"No node at given position\");\n if (!type)\n type = node.type;\n let newNode = type.create(attrs, null, marks || node.marks);\n if (node.isLeaf)\n return tr.replaceWith(pos, pos + node.nodeSize, newNode);\n if (!type.validContent(node.content))\n throw new RangeError(\"Invalid content for node type \" + type.name);\n tr.step(new ReplaceAroundStep(pos, pos + node.nodeSize, pos + 1, pos + node.nodeSize - 1, new Slice(Fragment.from(newNode), 0, 0), 1, true));\n}\n/**\nCheck whether splitting at the given position is allowed.\n*/\nfunction canSplit(doc, pos, depth = 1, typesAfter) {\n let $pos = doc.resolve(pos), base = $pos.depth - depth;\n let innerType = (typesAfter && typesAfter[typesAfter.length - 1]) || $pos.parent;\n if (base < 0 || $pos.parent.type.spec.isolating ||\n !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) ||\n !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount)))\n return false;\n for (let d = $pos.depth - 1, i = depth - 2; d > base; d--, i--) {\n let node = $pos.node(d), index = $pos.index(d);\n if (node.type.spec.isolating)\n return false;\n let rest = node.content.cutByIndex(index, node.childCount);\n let overrideChild = typesAfter && typesAfter[i + 1];\n if (overrideChild)\n rest = rest.replaceChild(0, overrideChild.type.create(overrideChild.attrs));\n let after = (typesAfter && typesAfter[i]) || node;\n if (!node.canReplace(index + 1, node.childCount) || !after.type.validContent(rest))\n return false;\n }\n let index = $pos.indexAfter(base);\n let baseType = typesAfter && typesAfter[0];\n return $pos.node(base).canReplaceWith(index, index, baseType ? baseType.type : $pos.node(base + 1).type);\n}\nfunction split(tr, pos, depth = 1, typesAfter) {\n let $pos = tr.doc.resolve(pos), before = Fragment.empty, after = Fragment.empty;\n for (let d = $pos.depth, e = $pos.depth - depth, i = depth - 1; d > e; d--, i--) {\n before = Fragment.from($pos.node(d).copy(before));\n let typeAfter = typesAfter && typesAfter[i];\n after = Fragment.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d).copy(after));\n }\n tr.step(new ReplaceStep(pos, pos, new Slice(before.append(after), depth, depth), true));\n}\n/**\nTest whether the blocks before and after a given position can be\njoined.\n*/\nfunction canJoin(doc, pos) {\n let $pos = doc.resolve(pos), index = $pos.index();\n return joinable($pos.nodeBefore, $pos.nodeAfter) &&\n $pos.parent.canReplace(index, index + 1);\n}\nfunction canAppendWithSubstitutedLinebreaks(a, b) {\n if (!b.content.size)\n a.type.compatibleContent(b.type);\n let match = a.contentMatchAt(a.childCount);\n let { linebreakReplacement } = a.type.schema;\n for (let i = 0; i < b.childCount; i++) {\n let child = b.child(i);\n let type = child.type == linebreakReplacement ? a.type.schema.nodes.text : child.type;\n match = match.matchType(type);\n if (!match)\n return false;\n if (!a.type.allowsMarks(child.marks))\n return false;\n }\n return match.validEnd;\n}\nfunction joinable(a, b) {\n return !!(a && b && !a.isLeaf && canAppendWithSubstitutedLinebreaks(a, b));\n}\n/**\nFind an ancestor of the given position that can be joined to the\nblock before (or after if `dir` is positive). Returns the joinable\npoint, if any.\n*/\nfunction joinPoint(doc, pos, dir = -1) {\n let $pos = doc.resolve(pos);\n for (let d = $pos.depth;; d--) {\n let before, after, index = $pos.index(d);\n if (d == $pos.depth) {\n before = $pos.nodeBefore;\n after = $pos.nodeAfter;\n }\n else if (dir > 0) {\n before = $pos.node(d + 1);\n index++;\n after = $pos.node(d).maybeChild(index);\n }\n else {\n before = $pos.node(d).maybeChild(index - 1);\n after = $pos.node(d + 1);\n }\n if (before && !before.isTextblock && joinable(before, after) &&\n $pos.node(d).canReplace(index, index + 1))\n return pos;\n if (d == 0)\n break;\n pos = dir < 0 ? $pos.before(d) : $pos.after(d);\n }\n}\nfunction join(tr, pos, depth) {\n let convertNewlines = null;\n let { linebreakReplacement } = tr.doc.type.schema;\n let $before = tr.doc.resolve(pos - depth), beforeType = $before.node().type;\n if (linebreakReplacement && beforeType.inlineContent) {\n let pre = beforeType.whitespace == \"pre\";\n let supportLinebreak = !!beforeType.contentMatch.matchType(linebreakReplacement);\n if (pre && !supportLinebreak)\n convertNewlines = false;\n else if (!pre && supportLinebreak)\n convertNewlines = true;\n }\n let mapFrom = tr.steps.length;\n if (convertNewlines === false) {\n let $after = tr.doc.resolve(pos + depth);\n replaceLinebreaks(tr, $after.node(), $after.before(), mapFrom);\n }\n if (beforeType.inlineContent)\n clearIncompatible(tr, pos + depth - 1, beforeType, $before.node().contentMatchAt($before.index()), convertNewlines == null);\n let mapping = tr.mapping.slice(mapFrom), start = mapping.map(pos - depth);\n tr.step(new ReplaceStep(start, mapping.map(pos + depth, -1), Slice.empty, true));\n if (convertNewlines === true) {\n let $full = tr.doc.resolve(start);\n replaceNewlines(tr, $full.node(), $full.before(), tr.steps.length);\n }\n return tr;\n}\n/**\nTry to find a point where a node of the given type can be inserted\nnear `pos`, by searching up the node hierarchy when `pos` itself\nisn't a valid place but is at the start or end of a node. Return\nnull if no position was found.\n*/\nfunction insertPoint(doc, pos, nodeType) {\n let $pos = doc.resolve(pos);\n if ($pos.parent.canReplaceWith($pos.index(), $pos.index(), nodeType))\n return pos;\n if ($pos.parentOffset == 0)\n for (let d = $pos.depth - 1; d >= 0; d--) {\n let index = $pos.index(d);\n if ($pos.node(d).canReplaceWith(index, index, nodeType))\n return $pos.before(d + 1);\n if (index > 0)\n return null;\n }\n if ($pos.parentOffset == $pos.parent.content.size)\n for (let d = $pos.depth - 1; d >= 0; d--) {\n let index = $pos.indexAfter(d);\n if ($pos.node(d).canReplaceWith(index, index, nodeType))\n return $pos.after(d + 1);\n if (index < $pos.node(d).childCount)\n return null;\n }\n return null;\n}\n/**\nFinds a position at or around the given position where the given\nslice can be inserted. Will look at parent nodes' nearest boundary\nand try there, even if the original position wasn't directly at the\nstart or end of that node. Returns null when no position was found.\n*/\nfunction dropPoint(doc, pos, slice) {\n let $pos = doc.resolve(pos);\n if (!slice.content.size)\n return pos;\n let content = slice.content;\n for (let i = 0; i < slice.openStart; i++)\n content = content.firstChild.content;\n for (let pass = 1; pass <= (slice.openStart == 0 && slice.size ? 2 : 1); pass++) {\n for (let d = $pos.depth; d >= 0; d--) {\n let bias = d == $pos.depth ? 0 : $pos.pos <= ($pos.start(d + 1) + $pos.end(d + 1)) / 2 ? -1 : 1;\n let insertPos = $pos.index(d) + (bias > 0 ? 1 : 0);\n let parent = $pos.node(d), fits = false;\n if (pass == 1) {\n fits = parent.canReplace(insertPos, insertPos, content);\n }\n else {\n let wrapping = parent.contentMatchAt(insertPos).findWrapping(content.firstChild.type);\n fits = wrapping && parent.canReplaceWith(insertPos, insertPos, wrapping[0]);\n }\n if (fits)\n return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d + 1) : $pos.after(d + 1);\n }\n }\n return null;\n}\n\n/**\n‘Fit’ a slice into a given position in the document, producing a\n[step](https://prosemirror.net/docs/ref/#transform.Step) that inserts it. Will return null if\nthere's no meaningful way to insert the slice here, or inserting it\nwould be a no-op (an empty slice over an empty range).\n*/\nfunction replaceStep(doc, from, to = from, slice = Slice.empty) {\n if (from == to && !slice.size)\n return null;\n let $from = doc.resolve(from), $to = doc.resolve(to);\n // Optimization -- avoid work if it's obvious that it's not needed.\n if (fitsTrivially($from, $to, slice))\n return new ReplaceStep(from, to, slice);\n return new Fitter($from, $to, slice).fit();\n}\nfunction fitsTrivially($from, $to, slice) {\n return !slice.openStart && !slice.openEnd && $from.start() == $to.start() &&\n $from.parent.canReplace($from.index(), $to.index(), slice.content);\n}\n// Algorithm for 'placing' the elements of a slice into a gap:\n//\n// We consider the content of each node that is open to the left to be\n// independently placeable. I.e. in <p(\"foo\"), p(\"bar\")>, when the\n// paragraph on the left is open, \"foo\" can be placed (somewhere on\n// the left side of the replacement gap) independently from p(\"bar\").\n//\n// This class tracks the state of the placement progress in the\n// following properties:\n//\n// - `frontier` holds a stack of `{type, match}` objects that\n// represent the open side of the replacement. It starts at\n// `$from`, then moves forward as content is placed, and is finally\n// reconciled with `$to`.\n//\n// - `unplaced` is a slice that represents the content that hasn't\n// been placed yet.\n//\n// - `placed` is a fragment of placed content. Its open-start value\n// is implicit in `$from`, and its open-end value in `frontier`.\nclass Fitter {\n constructor($from, $to, unplaced) {\n this.$from = $from;\n this.$to = $to;\n this.unplaced = unplaced;\n this.frontier = [];\n this.placed = Fragment.empty;\n for (let i = 0; i <= $from.depth; i++) {\n let node = $from.node(i);\n this.frontier.push({\n type: node.type,\n match: node.contentMatchAt($from.indexAfter(i))\n });\n }\n for (let i = $from.depth; i > 0; i--)\n this.placed = Fragment.from($from.node(i).copy(this.placed));\n }\n get depth() { return this.frontier.length - 1; }\n fit() {\n // As long as there's unplaced content, try to place some of it.\n // If that fails, either increase the open score of the unplaced\n // slice, or drop nodes from it, and then try again.\n while (this.unplaced.size) {\n let fit = this.findFittable();\n if (fit)\n this.placeNodes(fit);\n else\n this.openMore() || this.dropNode();\n }\n // When there's inline content directly after the frontier _and_\n // directly after `this.$to`, we must generate a `ReplaceAround`\n // step that pulls that content into the node after the frontier.\n // That means the fitting must be done to the end of the textblock\n // node after `this.$to`, not `this.$to` itself.\n let moveInline = this.mustMoveInline(), placedSize = this.placed.size - this.depth - this.$from.depth;\n let $from = this.$from, $to = this.close(moveInline < 0 ? this.$to : $from.doc.resolve(moveInline));\n if (!$to)\n return null;\n // If closing to `$to` succeeded, create a step\n let content = this.placed, openStart = $from.depth, openEnd = $to.depth;\n while (openStart && openEnd && content.childCount == 1) { // Normalize by dropping open parent nodes\n content = content.firstChild.content;\n openStart--;\n openEnd--;\n }\n let slice = new Slice(content, openStart, openEnd);\n if (moveInline > -1)\n return new ReplaceAroundStep($from.pos, moveInline, this.$to.pos, this.$to.end(), slice, placedSize);\n if (slice.size || $from.pos != this.$to.pos) // Don't generate no-op steps\n return new ReplaceStep($from.pos, $to.pos, slice);\n return null;\n }\n // Find a position on the start spine of `this.unplaced` that has\n // content that can be moved somewhere on the frontier. Returns two\n // depths, one for the slice and one for the frontier.\n findFittable() {\n let startDepth = this.unplaced.openStart;\n for (let cur = this.unplaced.content, d = 0, openEnd = this.unplaced.openEnd; d < startDepth; d++) {\n let node = cur.firstChild;\n if (cur.childCount > 1)\n openEnd = 0;\n if (node.type.spec.isolating && openEnd <= d) {\n startDepth = d;\n break;\n }\n cur = node.content;\n }\n // Only try wrapping nodes (pass 2) after finding a place without\n // wrapping failed.\n for (let pass = 1; pass <= 2; pass++) {\n for (let sliceDepth = pass == 1 ? startDepth : this.unplaced.openStart; sliceDepth >= 0; sliceDepth--) {\n let fragment, parent = null;\n if (sliceDepth) {\n parent = contentAt(this.unplaced.content, sliceDepth - 1).firstChild;\n fragment = parent.content;\n }\n else {\n fragment = this.unplaced.content;\n }\n let first = fragment.firstChild;\n for (let frontierDepth = this.depth; frontierDepth >= 0; frontierDepth--) {\n let { type, match } = this.frontier[frontierDepth], wrap, inject = null;\n // In pass 1, if the next node matches, or there is no next\n // node but the parents look compatible, we've found a\n // place.\n if (pass == 1 && (first ? match.matchType(first.type) || (inject = match.fillBefore(Fragment.from(first), false))\n : parent && type.compatibleContent(parent.type)))\n return { sliceDepth, frontierDepth, parent, inject };\n // In pass 2, look for a set of wrapping nodes that make\n // `first` fit here.\n else if (pass == 2 && first && (wrap = match.findWrapping(first.type)))\n return { sliceDepth, frontierDepth, parent, wrap };\n // Don't continue looking further up if the parent node\n // would fit here.\n if (parent && match.matchType(parent.type))\n break;\n }\n }\n }\n }\n openMore() {\n let { content, openStart, openEnd } = this.unplaced;\n let inner = contentAt(content, openStart);\n if (!inner.childCount || inner.firstChild.isLeaf)\n return false;\n this.unplaced = new Slice(content, openStart + 1, Math.max(openEnd, inner.size + openStart >= content.size - openEnd ? openStart + 1 : 0));\n return true;\n }\n dropNode() {\n let { content, openStart, openEnd } = this.unplaced;\n let inner = contentAt(content, openStart);\n if (inner.childCount <= 1 && openStart > 0) {\n let openAtEnd = content.size - openStart <= openStart + inner.size;\n this.unplaced = new Slice(dropFromFragment(content, openStart - 1, 1), openStart - 1, openAtEnd ? openStart - 1 : openEnd);\n }\n else {\n this.unplaced = new Slice(dropFromFragment(content, openStart, 1), openStart, openEnd);\n }\n }\n // Move content from the unplaced slice at `sliceDepth` to the\n // frontier node at `frontierDepth`. Close that frontier node when\n // applicable.\n placeNodes({ sliceDepth, frontierDepth, parent, inject, wrap }) {\n while (this.depth > frontierDepth)\n this.closeFrontierNode();\n if (wrap)\n for (let i = 0; i < wrap.length; i++)\n this.openFrontierNode(wrap[i]);\n let slice = this.unplaced, fragment = parent ? parent.content : slice.content;\n let openStart = slice.openStart - sliceDepth;\n let taken = 0, add = [];\n let { match, type } = this.frontier[frontierDepth];\n if (inject) {\n for (let i = 0; i < inject.childCount; i++)\n add.push(inject.child(i));\n match = match.matchFragment(inject);\n }\n // Computes the amount of (end) open nodes at the end of the\n // fragment. When 0, the parent is open, but no more. When\n // negative, nothing is open.\n let openEndCount = (fragment.size + sliceDepth) - (slice.content.size - slice.openEnd);\n // Scan over the fragment, fitting as many child nodes as\n // possible.\n while (taken < fragment.childCount) {\n let next = fragment.child(taken), matches = match.matchType(next.type);\n if (!matches)\n break;\n taken++;\n if (taken > 1 || openStart == 0 || next.content.size) { // Drop empty open nodes\n match = matches;\n add.push(closeNodeStart(next.mark(type.allowedMarks(next.marks)), taken == 1 ? openStart : 0, taken == fragment.childCount ? openEndCount : -1));\n }\n }\n let toEnd = taken == fragment.childCount;\n if (!toEnd)\n openEndCount = -1;\n this.placed = addToFragment(this.placed, frontierDepth, Fragment.from(add));\n this.frontier[frontierDepth].match = match;\n // If the parent types match, and the entire node was moved, and\n // it's not open, close this frontier node right away.\n if (toEnd && openEndCount < 0 && parent && parent.type == this.frontier[this.depth].type && this.frontier.length > 1)\n this.closeFrontierNode();\n // Add new frontier nodes for any open nodes at the end.\n for (let i = 0, cur = fragment; i < openEndCount; i++) {\n let node = cur.lastChild;\n this.frontier.push({ type: node.type, match: node.contentMatchAt(node.childCount) });\n cur = node.content;\n }\n // Update `this.unplaced`. Drop the entire node from which we\n // placed it we got to its end, otherwise just drop the placed\n // nodes.\n this.unplaced = !toEnd ? new Slice(dropFromFragment(slice.content, sliceDepth, taken), slice.openStart, slice.openEnd)\n : sliceDepth == 0 ? Slice.empty\n : new Slice(dropFromFragment(slice.content, sliceDepth - 1, 1), sliceDepth - 1, openEndCount < 0 ? slice.openEnd : sliceDepth - 1);\n }\n mustMoveInline() {\n if (!this.$to.parent.isTextblock)\n return -1;\n let top = this.frontier[this.depth], level;\n if (!top.type.isTextblock || !contentAfterFits(this.$to, this.$to.depth, top.type, top.match, false) ||\n (this.$to.depth == this.depth && (level = this.findCloseLevel(this.$to)) && level.depth == this.depth))\n return -1;\n let { depth } = this.$to, after = this.$to.after(depth);\n while (depth > 1 && after == this.$to.end(--depth))\n ++after;\n return after;\n }\n findCloseLevel($to) {\n scan: for (let i = Math.min(this.depth, $to.depth); i >= 0; i--) {\n let { match, type } = this.frontier[i];\n let dropInner = i < $to.depth && $to.end(i + 1) == $to.pos + ($to.depth - (i + 1));\n let fit = contentAfterFits($to, i, type, match, dropInner);\n if (!fit)\n continue;\n for (let d = i - 1; d >= 0; d--) {\n let { match, type } = this.frontier[d];\n let matches = contentAfterFits($to, d, type, match, true);\n if (!matches || matches.childCount)\n continue scan;\n }\n return { depth: i, fit, move: dropInner ? $to.doc.resolve($to.after(i + 1)) : $to };\n }\n }\n close($to) {\n let close = this.findCloseLevel($to);\n if (!close)\n return null;\n while (this.depth > close.depth)\n this.closeFrontierNode();\n if (close.fit.childCount)\n this.placed = addToFragment(this.placed, close.depth, close.fit);\n $to = close.move;\n for (let d = close.depth + 1; d <= $to.depth; d++) {\n let node = $to.node(d), add = node.type.contentMatch.fillBefore(node.content, true, $to.index(d));\n this.openFrontierNode(node.type, node.attrs, add);\n }\n return $to;\n }\n openFrontierNode(type, attrs = null, content) {\n let top = this.frontier[this.depth];\n top.match = top.match.matchType(type);\n this.placed = addToFragment(this.placed, this.depth, Fragment.from(type.create(attrs, content)));\n this.frontier.push({ type, match: type.contentMatch });\n }\n closeFrontierNode() {\n let open = this.frontier.pop();\n let add = open.match.fillBefore(Fragment.empty, true);\n if (add.childCount)\n this.placed = addToFragment(this.placed, this.frontier.length, add);\n }\n}\nfunction dropFromFragment(fragment, depth, count) {\n if (depth == 0)\n return fragment.cutByIndex(count, fragment.childCount);\n return fragment.replaceChild(0, fragment.firstChild.copy(dropFromFragment(fragment.firstChild.content, depth - 1, count)));\n}\nfunction addToFragment(fragment, depth, content) {\n if (depth == 0)\n return fragment.append(content);\n return fragment.replaceChild(fragment.childCount - 1, fragment.lastChild.copy(addToFragment(fragment.lastChild.content, depth - 1, content)));\n}\nfunction contentAt(fragment, depth) {\n for (let i = 0; i < depth; i++)\n fragment = fragment.firstChild.content;\n return fragment;\n}\nfunction closeNodeStart(node, openStart, openEnd) {\n if (openStart <= 0)\n return node;\n let frag = node.content;\n if (openStart > 1)\n frag = frag.replaceChild(0, closeNodeStart(frag.firstChild, openStart - 1, frag.childCount == 1 ? openEnd - 1 : 0));\n if (openStart > 0) {\n frag = node.type.contentMatch.fillBefore(frag).append(frag);\n if (openEnd <= 0)\n frag = frag.append(node.type.contentMatch.matchFragment(frag).fillBefore(Fragment.empty, true));\n }\n return node.copy(frag);\n}\nfunction contentAfterFits($to, depth, type, match, open) {\n let node = $to.node(depth), index = open ? $to.indexAfter(depth) : $to.index(depth);\n if (index == node.childCount && !type.compatibleContent(node.type))\n return null;\n let fit = match.fillBefore(node.content, true, index);\n return fit && !invalidMarks(type, node.content, index) ? fit : null;\n}\nfunction invalidMarks(type, fragment, start) {\n for (let i = start; i < fragment.childCount; i++)\n if (!type.allowsMarks(fragment.child(i).marks))\n return true;\n return false;\n}\nfunction definesContent(type) {\n return type.spec.defining || type.spec.definingForContent;\n}\nfunction replaceRange(tr, from, to, slice) {\n if (!slice.size)\n return tr.deleteRange(from, to);\n let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to);\n if (fitsTrivially($from, $to, slice))\n return tr.step(new ReplaceStep(from, to, slice));\n let targetDepths = coveredDepths($from, $to);\n // Can't replace the whole document, so remove 0 if it's present\n if (targetDepths[targetDepths.length - 1] == 0)\n targetDepths.pop();\n // Negative numbers represent not expansion over the whole node at\n // that depth, but replacing from $from.before(-D) to $to.pos.\n let preferredTarget = -($from.depth + 1);\n targetDepths.unshift(preferredTarget);\n // This loop picks a preferred target depth, if one of the covering\n // depths is not outside of a defining node, and adds negative\n // depths for any depth that has $from at its start and does not\n // cross a defining node.\n for (let d = $from.depth, pos = $from.pos - 1; d > 0; d--, pos--) {\n let spec = $from.node(d).type.spec;\n if (spec.defining || spec.definingAsContext || spec.isolating)\n break;\n if (targetDepths.indexOf(d) > -1)\n preferredTarget = d;\n else if ($from.before(d) == pos)\n targetDepths.splice(1, 0, -d);\n }\n // Try to fit each possible depth of the slice into each possible\n // target depth, starting with the preferred depths.\n let preferredTargetIndex = targetDepths.indexOf(preferredTarget);\n let leftNodes = [], preferredDepth = slice.openStart;\n for (let content = slice.content, i = 0;; i++) {\n let node = content.firstChild;\n leftNodes.push(node);\n if (i == slice.openStart)\n break;\n content = node.content;\n }\n // Back up preferredDepth to cover defining textblocks directly\n // above it, possibly skipping a non-defining textblock.\n for (let d = preferredDepth - 1; d >= 0; d--) {\n let leftNode = leftNodes[d], def = definesContent(leftNode.type);\n if (def && !leftNode.sameMarkup($from.node(Math.abs(preferredTarget) - 1)))\n preferredDepth = d;\n else if (def || !leftNode.type.isTextblock)\n break;\n }\n for (let j = slice.openStart; j >= 0; j--) {\n let openDepth = (j + preferredDepth + 1) % (slice.openStart + 1);\n let insert = leftNodes[openDepth];\n if (!insert)\n continue;\n for (let i = 0; i < targetDepths.length; i++) {\n // Loop over possible expansion levels, starting with the\n // preferred one\n let targetDepth = targetDepths[(i + preferredTargetIndex) % targetDepths.length], expand = true;\n if (targetDepth < 0) {\n expand = false;\n targetDepth = -targetDepth;\n }\n let parent = $from.node(targetDepth - 1), index = $from.index(targetDepth - 1);\n if (parent.canReplaceWith(index, index, insert.type, insert.marks))\n return tr.replace($from.before(targetDepth), expand ? $to.after(targetDepth) : to, new Slice(closeFragment(slice.content, 0, slice.openStart, openDepth), openDepth, slice.openEnd));\n }\n }\n let startSteps = tr.steps.length;\n for (let i = targetDepths.length - 1; i >= 0; i--) {\n tr.replace(from, to, slice);\n if (tr.steps.length > startSteps)\n break;\n let depth = targetDepths[i];\n if (depth < 0)\n continue;\n from = $from.before(depth);\n to = $to.after(depth);\n }\n}\nfunction closeFragment(fragment, depth, oldOpen, newOpen, parent) {\n if (depth < oldOpen) {\n let first = fragment.firstChild;\n fragment = fragment.replaceChild(0, first.copy(closeFragment(first.content, depth + 1, oldOpen, newOpen, first)));\n }\n if (depth > newOpen) {\n let match = parent.contentMatchAt(0);\n let start = match.fillBefore(fragment).append(fragment);\n fragment = start.append(match.matchFragment(start).fillBefore(Fragment.empty, true));\n }\n return fragment;\n}\nfunction replaceRangeWith(tr, from, to, node) {\n if (!node.isInline && from == to && tr.doc.resolve(from).parent.content.size) {\n let point = insertPoint(tr.doc, from, node.type);\n if (point != null)\n from = to = point;\n }\n tr.replaceRange(from, to, new Slice(Fragment.from(node), 0, 0));\n}\nfunction deleteRange(tr, from, to) {\n let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to);\n let covered = coveredDepths($from, $to);\n for (let i = 0; i < covered.length; i++) {\n let depth = covered[i], last = i == covered.length - 1;\n if ((last && depth == 0) || $from.node(depth).type.contentMatch.validEnd)\n return tr.delete($from.start(depth), $to.end(depth));\n if (depth > 0 && (last || $from.node(depth - 1).canReplace($from.index(depth - 1), $to.indexAfter(depth - 1))))\n return tr.delete($from.before(depth), $to.after(depth));\n }\n for (let d = 1; d <= $from.depth && d <= $to.depth; d++) {\n if (from - $from.start(d) == $from.depth - d && to > $from.end(d) && $to.end(d) - to != $to.depth - d &&\n $from.start(d - 1) == $to.start(d - 1) && $from.node(d - 1).canReplace($from.index(d - 1), $to.index(d - 1)))\n return tr.delete($from.before(d), to);\n }\n tr.delete(from, to);\n}\n// Returns an array of all depths for which $from - $to spans the\n// whole content of the nodes at that depth.\nfunction coveredDepths($from, $to) {\n let result = [], minDepth = Math.min($from.depth, $to.depth);\n for (let d = minDepth; d >= 0; d--) {\n let start = $from.start(d);\n if (start < $from.pos - ($from.depth - d) ||\n $to.end(d) > $to.pos + ($to.depth - d) ||\n $from.node(d).type.spec.isolating ||\n $to.node(d).type.spec.isolating)\n break;\n if (start == $to.start(d) ||\n (d == $from.depth && d == $to.depth && $from.parent.inlineContent && $to.parent.inlineContent &&\n d && $to.start(d - 1) == start - 1))\n result.push(d);\n }\n return result;\n}\n\n/**\nUpdate an attribute in a specific node.\n*/\nclass AttrStep extends Step {\n /**\n Construct an attribute step.\n */\n constructor(\n /**\n The position of the target node.\n */\n pos, \n /**\n The attribute to set.\n */\n attr, \n // The attribute's new value.\n value) {\n super();\n this.pos = pos;\n this.attr = attr;\n this.value = value;\n }\n apply(doc) {\n let node = doc.nodeAt(this.pos);\n if (!node)\n return StepResult.fail(\"No node at attribute step's position\");\n let attrs = Object.create(null);\n for (let name in node.attrs)\n attrs[name] = node.attrs[name];\n attrs[this.attr] = this.value;\n let updated = node.type.create(attrs, null, node.marks);\n return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));\n }\n getMap() {\n return StepMap.empty;\n }\n invert(doc) {\n return new AttrStep(this.pos, this.attr, doc.nodeAt(this.pos).attrs[this.attr]);\n }\n map(mapping) {\n let pos = mapping.mapResult(this.pos, 1);\n return pos.deletedAfter ? null : new AttrStep(pos.pos, this.attr, this.value);\n }\n toJSON() {\n return { stepType: \"attr\", pos: this.pos, attr: this.attr, value: this.value };\n }\n static fromJSON(schema, json) {\n if (typeof json.pos != \"number\" || typeof json.attr != \"string\")\n throw new RangeError(\"Invalid input for AttrStep.fromJSON\");\n return new AttrStep(json.pos, json.attr, json.value);\n }\n}\nStep.jsonID(\"attr\", AttrStep);\n/**\nUpdate an attribute in the doc node.\n*/\nclass DocAttrStep extends Step {\n /**\n Construct an attribute step.\n */\n constructor(\n /**\n The attribute to set.\n */\n attr, \n // The attribute's new value.\n value) {\n super();\n this.attr = attr;\n this.value = value;\n }\n apply(doc) {\n let attrs = Object.create(null);\n for (let name in doc.attrs)\n attrs[name] = doc.attrs[name];\n attrs[this.attr] = this.value;\n let updated = doc.type.create(attrs, doc.content, doc.marks);\n return StepResult.ok(updated);\n }\n getMap() {\n return StepMap.empty;\n }\n invert(doc) {\n return new DocAttrStep(this.attr, doc.attrs[this.attr]);\n }\n map(mapping) {\n return this;\n }\n toJSON() {\n return { stepType: \"docAttr\", attr: this.attr, value: this.value };\n }\n static fromJSON(schema, json) {\n if (typeof json.attr != \"string\")\n throw new RangeError(\"Invalid input for DocAttrStep.fromJSON\");\n return new DocAttrStep(json.attr, json.value);\n }\n}\nStep.jsonID(\"docAttr\", DocAttrStep);\n\n/**\n@internal\n*/\nlet TransformError = class extends Error {\n};\nTransformError = function TransformError(message) {\n let err = Error.call(this, message);\n err.__proto__ = TransformError.prototype;\n return err;\n};\nTransformError.prototype = Object.create(Error.prototype);\nTransformError.prototype.constructor = TransformError;\nTransformError.prototype.name = \"TransformError\";\n/**\nAbstraction to build up and track an array of\n[steps](https://prosemirror.net/docs/ref/#transform.Step) representing a document transformation.\n\nMost transforming methods return the `Transform` object itself, so\nthat they can be chained.\n*/\nclass Transform {\n /**\n Create a transform that starts with the given document.\n */\n constructor(\n /**\n The current document (the result of applying the steps in the\n transform).\n */\n doc) {\n this.doc = doc;\n /**\n The steps in this transform.\n */\n this.steps = [];\n /**\n The documents before each of the steps.\n */\n this.docs = [];\n /**\n A mapping with the maps for each of the steps in this transform.\n */\n this.mapping = new Mapping;\n }\n /**\n The starting document.\n */\n get before() { return this.docs.length ? this.docs[0] : this.doc; }\n /**\n Apply a new step in this transform, saving the result. Throws an\n error when the step fails.\n */\n step(step) {\n let result = this.maybeStep(step);\n if (result.failed)\n throw new TransformError(result.failed);\n return this;\n }\n /**\n Try to apply a step in this transformation, ignoring it if it\n fails. Returns the step result.\n */\n maybeStep(step) {\n let result = step.apply(this.doc);\n if (!result.failed)\n this.addStep(step, result.doc);\n return result;\n }\n /**\n True when the document has been changed (when there are any\n steps).\n */\n get docChanged() {\n return this.steps.length > 0;\n }\n /**\n Return a single range, in post-transform document positions,\n that covers all content changed by this transform. Returns null\n if no replacements are made. Note that this will ignore changes\n that add/remove marks without replacing the underlying content.\n */\n changedRange() {\n let from = 1e9, to = -1e9;\n for (let i = 0; i < this.mapping.maps.length; i++) {\n let map = this.mapping.maps[i];\n if (i) {\n from = map.map(from, 1);\n to = map.map(to, -1);\n }\n map.forEach((_f, _t, fromB, toB) => {\n from = Math.min(from, fromB);\n to = Math.max(to, toB);\n });\n }\n return from == 1e9 ? null : { from, to };\n }\n /**\n @internal\n */\n addStep(step, doc) {\n this.docs.push(this.doc);\n this.steps.push(step);\n this.mapping.appendMap(step.getMap());\n this.doc = doc;\n }\n /**\n Replace the part of the document between `from` and `to` with the\n given `slice`.\n */\n replace(from, to = from, slice = Slice.empty) {\n let step = replaceStep(this.doc, from, to, slice);\n if (step)\n this.step(step);\n return this;\n }\n /**\n Replace the given range with the given content, which may be a\n fragment, node, or array of nodes.\n */\n replaceWith(from, to, content) {\n return this.replace(from, to, new Slice(Fragment.from(content), 0, 0));\n }\n /**\n Delete the content between the given positions.\n */\n delete(from, to) {\n return this.replace(from, to, Slice.empty);\n }\n /**\n Insert the given content at the given position.\n */\n insert(pos, content) {\n return this.replaceWith(pos, pos, content);\n }\n /**\n Replace a range of the document with a given slice, using\n `from`, `to`, and the slice's\n [`openStart`](https://prosemirror.net/docs/ref/#model.Slice.openStart) property as hints, rather\n than fixed start and end points. This method may grow the\n replaced area or close open nodes in the slice in order to get a\n fit that is more in line with WYSIWYG expectations, by dropping\n fully covered parent nodes of the replaced region when they are\n marked [non-defining as\n context](https://prosemirror.net/docs/ref/#model.NodeSpec.definingAsContext), or including an\n open parent node from the slice that _is_ marked as [defining\n its content](https://prosemirror.net/docs/ref/#model.NodeSpec.definingForContent).\n \n This is the method, for example, to handle paste. The similar\n [`replace`](https://prosemirror.net/docs/ref/#transform.Transform.replace) method is a more\n primitive tool which will _not_ move the start and end of its given\n range, and is useful in situations where you need more precise\n control over what happens.\n */\n replaceRange(from, to, slice) {\n replaceRange(this, from, to, slice);\n return this;\n }\n /**\n Replace the given range with a node, but use `from` and `to` as\n hints, rather than precise positions. When from and to are the same\n and are at the start or end of a parent node in which the given\n node doesn't fit, this method may _move_ them out towards a parent\n that does allow the given node to be placed. When the given range\n completely covers a parent node, this method may completely replace\n that parent node.\n */\n replaceRangeWith(from, to, node) {\n replaceRangeWith(this, from, to, node);\n return this;\n }\n /**\n Delete the given range, expanding it to cover fully covered\n parent nodes until a valid replace is found.\n */\n deleteRange(from, to) {\n deleteRange(this, from, to);\n return this;\n }\n /**\n Split the content in the given range off from its parent, if there\n is sibling content before or after it, and move it up the tree to\n the depth specified by `target`. You'll probably want to use\n [`liftTarget`](https://prosemirror.net/docs/ref/#transform.liftTarget) to compute `target`, to make\n sure the lift is valid.\n */\n lift(range, target) {\n lift(this, range, target);\n return this;\n }\n /**\n Join the blocks around the given position. If depth is 2, their\n last and first siblings are also joined, and so on.\n */\n join(pos, depth = 1) {\n join(this, pos, depth);\n return this;\n }\n /**\n Wrap the given [range](https://prosemirror.net/docs/ref/#model.NodeRange) in the given set of wrappers.\n The wrappers are assumed to be valid in this position, and should\n probably be computed with [`findWrapping`](https://prosemirror.net/docs/ref/#transform.findWrapping).\n */\n wrap(range, wrappers) {\n wrap(this, range, wrappers);\n return this;\n }\n /**\n Set the type of all textblocks (partly) between `from` and `to` to\n the given node type with the given attributes.\n */\n setBlockType(from, to = from, type, attrs = null) {\n setBlockType(this, from, to, type, attrs);\n return this;\n }\n /**\n Change the type, attributes, and/or marks of the node at `pos`.\n When `type` isn't given, the existing node type is preserved,\n */\n setNodeMarkup(pos, type, attrs = null, marks) {\n setNodeMarkup(this, pos, type, attrs, marks);\n return this;\n }\n /**\n Set a single attribute on a given node to a new value.\n The `pos` addresses the document content. Use `setDocAttribute`\n to set attributes on the document itself.\n */\n setNodeAttribute(pos, attr, value) {\n this.step(new AttrStep(pos, attr, value));\n return this;\n }\n /**\n Set a single attribute on the document to a new value.\n */\n setDocAttribute(attr, value) {\n this.step(new DocAttrStep(attr, value));\n return this;\n }\n /**\n Add a mark to the node at position `pos`.\n */\n addNodeMark(pos, mark) {\n this.step(new AddNodeMarkStep(pos, mark));\n return this;\n }\n /**\n Remove a mark (or all marks of the given type) from the node at\n position `pos`.\n */\n removeNodeMark(pos, mark) {\n let node = this.doc.nodeAt(pos);\n if (!node)\n throw new RangeError(\"No node at position \" + pos);\n if (mark instanceof Mark) {\n if (mark.isInSet(node.marks))\n this.step(new RemoveNodeMarkStep(pos, mark));\n }\n else {\n let set = node.marks, found, steps = [];\n while (found = mark.isInSet(set)) {\n steps.push(new RemoveNodeMarkStep(pos, found));\n set = found.removeFromSet(set);\n }\n for (let i = steps.length - 1; i >= 0; i--)\n this.step(steps[i]);\n }\n return this;\n }\n /**\n Split the node at the given position, and optionally, if `depth` is\n greater than one, any number of nodes above that. By default, the\n parts split off will inherit the node type of the original node.\n This can be changed by passing an array of types and attributes to\n use after the split (with the outermost nodes coming first).\n */\n split(pos, depth = 1, typesAfter) {\n split(this, pos, depth, typesAfter);\n return this;\n }\n /**\n Add the given mark to the inline content between `from` and `to`.\n */\n addMark(from, to, mark) {\n addMark(this, from, to, mark);\n return this;\n }\n /**\n Remove marks from inline nodes between `from` and `to`. When\n `mark` is a single mark, remove precisely that mark. When it is\n a mark type, remove all marks of that type. When it is null,\n remove all marks of any type.\n */\n removeMark(from, to, mark) {\n removeMark(this, from, to, mark);\n return this;\n }\n /**\n Removes all marks and nodes from the content of the node at\n `pos` that don't match the given new parent node type. Accepts\n an optional starting [content match](https://prosemirror.net/docs/ref/#model.ContentMatch) as\n third argument.\n */\n clearIncompatible(pos, parentType, match) {\n clearIncompatible(this, pos, parentType, match);\n return this;\n }\n}\n\nexport { AddMarkStep, AddNodeMarkStep, AttrStep, DocAttrStep, MapResult, Mapping, RemoveMarkStep, RemoveNodeMarkStep, ReplaceAroundStep, ReplaceStep, Step, StepMap, StepResult, Transform, TransformError, canJoin, canSplit, dropPoint, findWrapping, insertPoint, joinPoint, liftTarget, replaceStep };\n","import { Slice, Fragment, Mark, Node } from 'prosemirror-model';\nimport { ReplaceStep, ReplaceAroundStep, Transform } from 'prosemirror-transform';\n\nconst classesById = Object.create(null);\n/**\nSuperclass for editor selections. Every selection type should\nextend this. Should not be instantiated directly.\n*/\nclass Selection {\n /**\n Initialize a selection with the head and anchor and ranges. If no\n ranges are given, constructs a single range across `$anchor` and\n `$head`.\n */\n constructor(\n /**\n The resolved anchor of the selection (the side that stays in\n place when the selection is modified).\n */\n $anchor, \n /**\n The resolved head of the selection (the side that moves when\n the selection is modified).\n */\n $head, ranges) {\n this.$anchor = $anchor;\n this.$head = $head;\n this.ranges = ranges || [new SelectionRange($anchor.min($head), $anchor.max($head))];\n }\n /**\n The selection's anchor, as an unresolved position.\n */\n get anchor() { return this.$anchor.pos; }\n /**\n The selection's head.\n */\n get head() { return this.$head.pos; }\n /**\n The lower bound of the selection's main range.\n */\n get from() { return this.$from.pos; }\n /**\n The upper bound of the selection's main range.\n */\n get to() { return this.$to.pos; }\n /**\n The resolved lower bound of the selection's main range.\n */\n get $from() {\n return this.ranges[0].$from;\n }\n /**\n The resolved upper bound of the selection's main range.\n */\n get $to() {\n return this.ranges[0].$to;\n }\n /**\n Indicates whether the selection contains any content.\n */\n get empty() {\n let ranges = this.ranges;\n for (let i = 0; i < ranges.length; i++)\n if (ranges[i].$from.pos != ranges[i].$to.pos)\n return false;\n return true;\n }\n /**\n Get the content of this selection as a slice.\n */\n content() {\n return this.$from.doc.slice(this.from, this.to, true);\n }\n /**\n Replace the selection with a slice or, if no slice is given,\n delete the selection. Will append to the given transaction.\n */\n replace(tr, content = Slice.empty) {\n // Put the new selection at the position after the inserted\n // content. When that ended in an inline node, search backwards,\n // to get the position after that node. If not, search forward.\n let lastNode = content.content.lastChild, lastParent = null;\n for (let i = 0; i < content.openEnd; i++) {\n lastParent = lastNode;\n lastNode = lastNode.lastChild;\n }\n let mapFrom = tr.steps.length, ranges = this.ranges;\n for (let i = 0; i < ranges.length; i++) {\n let { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);\n tr.replaceRange(mapping.map($from.pos), mapping.map($to.pos), i ? Slice.empty : content);\n if (i == 0)\n selectionToInsertionEnd(tr, mapFrom, (lastNode ? lastNode.isInline : lastParent && lastParent.isTextblock) ? -1 : 1);\n }\n }\n /**\n Replace the selection with the given node, appending the changes\n to the given transaction.\n */\n replaceWith(tr, node) {\n let mapFrom = tr.steps.length, ranges = this.ranges;\n for (let i = 0; i < ranges.length; i++) {\n let { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);\n let from = mapping.map($from.pos), to = mapping.map($to.pos);\n if (i) {\n tr.deleteRange(from, to);\n }\n else {\n tr.replaceRangeWith(from, to, node);\n selectionToInsertionEnd(tr, mapFrom, node.isInline ? -1 : 1);\n }\n }\n }\n /**\n Find a valid cursor or leaf node selection starting at the given\n position and searching back if `dir` is negative, and forward if\n positive. When `textOnly` is true, only consider cursor\n selections. Will return null when no valid selection position is\n found.\n */\n static findFrom($pos, dir, textOnly = false) {\n let inner = $pos.parent.inlineContent ? new TextSelection($pos)\n : findSelectionIn($pos.node(0), $pos.parent, $pos.pos, $pos.index(), dir, textOnly);\n if (inner)\n return inner;\n for (let depth = $pos.depth - 1; depth >= 0; depth--) {\n let found = dir < 0\n ? findSelectionIn($pos.node(0), $pos.node(depth), $pos.before(depth + 1), $pos.index(depth), dir, textOnly)\n : findSelectionIn($pos.node(0), $pos.node(depth), $pos.after(depth + 1), $pos.index(depth) + 1, dir, textOnly);\n if (found)\n return found;\n }\n return null;\n }\n /**\n Find a valid cursor or leaf node selection near the given\n position. Searches forward first by default, but if `bias` is\n negative, it will search backwards first.\n */\n static near($pos, bias = 1) {\n return this.findFrom($pos, bias) || this.findFrom($pos, -bias) || new AllSelection($pos.node(0));\n }\n /**\n Find the cursor or leaf node selection closest to the start of\n the given document. Will return an\n [`AllSelection`](https://prosemirror.net/docs/ref/#state.AllSelection) if no valid position\n exists.\n */\n static atStart(doc) {\n return findSelectionIn(doc, doc, 0, 0, 1) || new AllSelection(doc);\n }\n /**\n Find the cursor or leaf node selection closest to the end of the\n given document.\n */\n static atEnd(doc) {\n return findSelectionIn(doc, doc, doc.content.size, doc.childCount, -1) || new AllSelection(doc);\n }\n /**\n Deserialize the JSON representation of a selection. Must be\n implemented for custom classes (as a static class method).\n */\n static fromJSON(doc, json) {\n if (!json || !json.type)\n throw new RangeError(\"Invalid input for Selection.fromJSON\");\n let cls = classesById[json.type];\n if (!cls)\n throw new RangeError(`No selection type ${json.type} defined`);\n return cls.fromJSON(doc, json);\n }\n /**\n To be able to deserialize selections from JSON, custom selection\n classes must register themselves with an ID string, so that they\n can be disambiguated. Try to pick something that's unlikely to\n clash with classes from other modules.\n */\n static jsonID(id, selectionClass) {\n if (id in classesById)\n throw new RangeError(\"Duplicate use of selection JSON ID \" + id);\n classesById[id] = selectionClass;\n selectionClass.prototype.jsonID = id;\n return selectionClass;\n }\n /**\n Get a [bookmark](https://prosemirror.net/docs/ref/#state.SelectionBookmark) for this selection,\n which is a value that can be mapped without having access to a\n current document, and later resolved to a real selection for a\n given document again. (This is used mostly by the history to\n track and restore old selections.) The default implementation of\n this method just converts the selection to a text selection and\n returns the bookmark for that.\n */\n getBookmark() {\n return TextSelection.between(this.$anchor, this.$head).getBookmark();\n }\n}\nSelection.prototype.visible = true;\n/**\nRepresents a selected range in a document.\n*/\nclass SelectionRange {\n /**\n Create a range.\n */\n constructor(\n /**\n The lower bound of the range.\n */\n $from, \n /**\n The upper bound of the range.\n */\n $to) {\n this.$from = $from;\n this.$to = $to;\n }\n}\nlet warnedAboutTextSelection = false;\nfunction checkTextSelection($pos) {\n if (!warnedAboutTextSelection && !$pos.parent.inlineContent) {\n warnedAboutTextSelection = true;\n console[\"warn\"](\"TextSelection endpoint not pointing into a node with inline content (\" + $pos.parent.type.name + \")\");\n }\n}\n/**\nA text selection represents a classical editor selection, with a\nhead (the moving side) and anchor (immobile side), both of which\npoint into textblock nodes. It can be empty (a regular cursor\nposition).\n*/\nclass TextSelection extends Selection {\n /**\n Construct a text selection between the given points.\n */\n constructor($anchor, $head = $anchor) {\n checkTextSelection($anchor);\n checkTextSelection($head);\n super($anchor, $head);\n }\n /**\n Returns a resolved position if this is a cursor selection (an\n empty text selection), and null otherwise.\n */\n get $cursor() { return this.$anchor.pos == this.$head.pos ? this.$head : null; }\n map(doc, mapping) {\n let $head = doc.resolve(mapping.map(this.head));\n if (!$head.parent.inlineContent)\n return Selection.near($head);\n let $anchor = doc.resolve(mapping.map(this.anchor));\n return new TextSelection($anchor.parent.inlineContent ? $anchor : $head, $head);\n }\n replace(tr, content = Slice.empty) {\n super.replace(tr, content);\n if (content == Slice.empty) {\n let marks = this.$from.marksAcross(this.$to);\n if (marks)\n tr.ensureMarks(marks);\n }\n }\n eq(other) {\n return other instanceof TextSelection && other.anchor == this.anchor && other.head == this.head;\n }\n getBookmark() {\n return new TextBookmark(this.anchor, this.head);\n }\n toJSON() {\n return { type: \"text\", anchor: this.anchor, head: this.head };\n }\n /**\n @internal\n */\n static fromJSON(doc, json) {\n if (typeof json.anchor != \"number\" || typeof json.head != \"number\")\n throw new RangeError(\"Invalid input for TextSelection.fromJSON\");\n return new TextSelection(doc.resolve(json.anchor), doc.resolve(json.head));\n }\n /**\n Create a text selection from non-resolved positions.\n */\n static create(doc, anchor, head = anchor) {\n let $anchor = doc.resolve(anchor);\n return new this($anchor, head == anchor ? $anchor : doc.resolve(head));\n }\n /**\n Return a text selection that spans the given positions or, if\n they aren't text positions, find a text selection near them.\n `bias` determines whether the method searches forward (default)\n or backwards (negative number) first. Will fall back to calling\n [`Selection.near`](https://prosemirror.net/docs/ref/#state.Selection^near) when the document\n doesn't contain a valid text position.\n */\n static between($anchor, $head, bias) {\n let dPos = $anchor.pos - $head.pos;\n if (!bias || dPos)\n bias = dPos >= 0 ? 1 : -1;\n if (!$head.parent.inlineContent) {\n let found = Selection.findFrom($head, bias, true) || Selection.findFrom($head, -bias, true);\n if (found)\n $head = found.$head;\n else\n return Selection.near($head, bias);\n }\n if (!$anchor.parent.inlineContent) {\n if (dPos == 0) {\n $anchor = $head;\n }\n else {\n $anchor = (Selection.findFrom($anchor, -bias, true) || Selection.findFrom($anchor, bias, true)).$anchor;\n if (($anchor.pos < $head.pos) != (dPos < 0))\n $anchor = $head;\n }\n }\n return new TextSelection($anchor, $head);\n }\n}\nSelection.jsonID(\"text\", TextSelection);\nclass TextBookmark {\n constructor(anchor, head) {\n this.anchor = anchor;\n this.head = head;\n }\n map(mapping) {\n return new TextBookmark(mapping.map(this.anchor), mapping.map(this.head));\n }\n resolve(doc) {\n return TextSelection.between(doc.resolve(this.anchor), doc.resolve(this.head));\n }\n}\n/**\nA node selection is a selection that points at a single node. All\nnodes marked [selectable](https://prosemirror.net/docs/ref/#model.NodeSpec.selectable) can be the\ntarget of a node selection. In such a selection, `from` and `to`\npoint directly before and after the selected node, `anchor` equals\n`from`, and `head` equals `to`..\n*/\nclass NodeSelection extends Selection {\n /**\n Create a node selection. Does not verify the validity of its\n argument.\n */\n constructor($pos) {\n let node = $pos.nodeAfter;\n let $end = $pos.node(0).resolve($pos.pos + node.nodeSize);\n super($pos, $end);\n this.node = node;\n }\n map(doc, mapping) {\n let { deleted, pos } = mapping.mapResult(this.anchor);\n let $pos = doc.resolve(pos);\n if (deleted)\n return Selection.near($pos);\n return new NodeSelection($pos);\n }\n content() {\n return new Slice(Fragment.from(this.node), 0, 0);\n }\n eq(other) {\n return other instanceof NodeSelection && other.anchor == this.anchor;\n }\n toJSON() {\n return { type: \"node\", anchor: this.anchor };\n }\n getBookmark() { return new NodeBookmark(this.anchor); }\n /**\n @internal\n */\n static fromJSON(doc, json) {\n if (typeof json.anchor != \"number\")\n throw new RangeError(\"Invalid input for NodeSelection.fromJSON\");\n return new NodeSelection(doc.resolve(json.anchor));\n }\n /**\n Create a node selection from non-resolved positions.\n */\n static create(doc, from) {\n return new NodeSelection(doc.resolve(from));\n }\n /**\n Determines whether the given node may be selected as a node\n selection.\n */\n static isSelectable(node) {\n return !node.isText && node.type.spec.selectable !== false;\n }\n}\nNodeSelection.prototype.visible = false;\nSelection.jsonID(\"node\", NodeSelection);\nclass NodeBookmark {\n constructor(anchor) {\n this.anchor = anchor;\n }\n map(mapping) {\n let { deleted, pos } = mapping.mapResult(this.anchor);\n return deleted ? new TextBookmark(pos, pos) : new NodeBookmark(pos);\n }\n resolve(doc) {\n let $pos = doc.resolve(this.anchor), node = $pos.nodeAfter;\n if (node && NodeSelection.isSelectable(node))\n return new NodeSelection($pos);\n return Selection.near($pos);\n }\n}\n/**\nA selection type that represents selecting the whole document\n(which can not necessarily be expressed with a text selection, when\nthere are for example leaf block nodes at the start or end of the\ndocument).\n*/\nclass AllSelection extends Selection {\n /**\n Create an all-selection over the given document.\n */\n constructor(doc) {\n super(doc.resolve(0), doc.resolve(doc.content.size));\n }\n replace(tr, content = Slice.empty) {\n if (content == Slice.empty) {\n tr.delete(0, tr.doc.content.size);\n let sel = Selection.atStart(tr.doc);\n if (!sel.eq(tr.selection))\n tr.setSelection(sel);\n }\n else {\n super.replace(tr, content);\n }\n }\n toJSON() { return { type: \"all\" }; }\n /**\n @internal\n */\n static fromJSON(doc) { return new AllSelection(doc); }\n map(doc) { return new AllSelection(doc); }\n eq(other) { return other instanceof AllSelection; }\n getBookmark() { return AllBookmark; }\n}\nSelection.jsonID(\"all\", AllSelection);\nconst AllBookmark = {\n map() { return this; },\n resolve(doc) { return new AllSelection(doc); }\n};\n// FIXME we'll need some awareness of text direction when scanning for selections\n// Try to find a selection inside the given node. `pos` points at the\n// position where the search starts. When `text` is true, only return\n// text selections.\nfunction findSelectionIn(doc, node, pos, index, dir, text = false) {\n if (node.inlineContent)\n return TextSelection.create(doc, pos);\n for (let i = index - (dir > 0 ? 0 : 1); dir > 0 ? i < node.childCount : i >= 0; i += dir) {\n let child = node.child(i);\n if (!child.isAtom) {\n let inner = findSelectionIn(doc, child, pos + dir, dir < 0 ? child.childCount : 0, dir, text);\n if (inner)\n return inner;\n }\n else if (!text && NodeSelection.isSelectable(child)) {\n return NodeSelection.create(doc, pos - (dir < 0 ? child.nodeSize : 0));\n }\n pos += child.nodeSize * dir;\n }\n return null;\n}\nfunction selectionToInsertionEnd(tr, startLen, bias) {\n let last = tr.steps.length - 1;\n if (last < startLen)\n return;\n let step = tr.steps[last];\n if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep))\n return;\n let map = tr.mapping.maps[last], end;\n map.forEach((_from, _to, _newFrom, newTo) => { if (end == null)\n end = newTo; });\n tr.setSelection(Selection.near(tr.doc.resolve(end), bias));\n}\n\nconst UPDATED_SEL = 1, UPDATED_MARKS = 2, UPDATED_SCROLL = 4;\n/**\nAn editor state transaction, which can be applied to a state to\ncreate an updated state. Use\n[`EditorState.tr`](https://prosemirror.net/docs/ref/#state.EditorState.tr) to create an instance.\n\nTransactions track changes to the document (they are a subclass of\n[`Transform`](https://prosemirror.net/docs/ref/#transform.Transform)), but also other state changes,\nlike selection updates and adjustments of the set of [stored\nmarks](https://prosemirror.net/docs/ref/#state.EditorState.storedMarks). In addition, you can store\nmetadata properties in a transaction, which are extra pieces of\ninformation that client code or plugins can use to describe what a\ntransaction represents, so that they can update their [own\nstate](https://prosemirror.net/docs/ref/#state.StateField) accordingly.\n\nThe [editor view](https://prosemirror.net/docs/ref/#view.EditorView) uses a few metadata\nproperties: it will attach a property `\"pointer\"` with the value\n`true` to selection transactions directly caused by mouse or touch\ninput, a `\"composition\"` property holding an ID identifying the\ncomposition that caused it to transactions caused by composed DOM\ninput, and a `\"uiEvent\"` property of that may be `\"paste\"`,\n`\"cut\"`, or `\"drop\"`.\n*/\nclass Transaction extends Transform {\n /**\n @internal\n */\n constructor(state) {\n super(state.doc);\n // The step count for which the current selection is valid.\n this.curSelectionFor = 0;\n // Bitfield to track which aspects of the state were updated by\n // this transaction.\n this.updated = 0;\n // Object used to store metadata properties for the transaction.\n this.meta = Object.create(null);\n this.time = Date.now();\n this.curSelection = state.selection;\n this.storedMarks = state.storedMarks;\n }\n /**\n The transaction's current selection. This defaults to the editor\n selection [mapped](https://prosemirror.net/docs/ref/#state.Selection.map) through the steps in the\n transaction, but can be overwritten with\n [`setSelection`](https://prosemirror.net/docs/ref/#state.Transaction.setSelection).\n */\n get selection() {\n if (this.curSelectionFor < this.steps.length) {\n this.curSelection = this.curSelection.map(this.doc, this.mapping.slice(this.curSelectionFor));\n this.curSelectionFor = this.steps.length;\n }\n return this.curSelection;\n }\n /**\n Update the transaction's current selection. Will determine the\n selection that the editor gets when the transaction is applied.\n */\n setSelection(selection) {\n if (selection.$from.doc != this.doc)\n throw new RangeError(\"Selection passed to setSelection must point at the current document\");\n this.curSelection = selection;\n this.curSelectionFor = this.steps.length;\n this.updated = (this.updated | UPDATED_SEL) & ~UPDATED_MARKS;\n this.storedMarks = null;\n return this;\n }\n /**\n Whether the selection was explicitly updated by this transaction.\n */\n get selectionSet() {\n return (this.updated & UPDATED_SEL) > 0;\n }\n /**\n Set the current stored marks.\n */\n setStoredMarks(marks) {\n this.storedMarks = marks;\n this.updated |= UPDATED_MARKS;\n return this;\n }\n /**\n Make sure the current stored marks or, if that is null, the marks\n at the selection, match the given set of marks. Does nothing if\n this is already the case.\n */\n ensureMarks(marks) {\n if (!Mark.sameSet(this.storedMarks || this.selection.$from.marks(), marks))\n this.setStoredMarks(marks);\n return this;\n }\n /**\n Add a mark to the set of stored marks.\n */\n addStoredMark(mark) {\n return this.ensureMarks(mark.addToSet(this.storedMarks || this.selection.$head.marks()));\n }\n /**\n Remove a mark or mark type from the set of stored marks.\n */\n removeStoredMark(mark) {\n return this.ensureMarks(mark.removeFromSet(this.storedMarks || this.selection.$head.marks()));\n }\n /**\n Whether the stored marks were explicitly set for this transaction.\n */\n get storedMarksSet() {\n return (this.updated & UPDATED_MARKS) > 0;\n }\n /**\n @internal\n */\n addStep(step, doc) {\n super.addStep(step, doc);\n this.updated = this.updated & ~UPDATED_MARKS;\n this.storedMarks = null;\n }\n /**\n Update the timestamp for the transaction.\n */\n setTime(time) {\n this.time = time;\n return this;\n }\n /**\n Replace the current selection with the given slice.\n */\n replaceSelection(slice) {\n this.selection.replace(this, slice);\n return this;\n }\n /**\n Replace the selection with the given node. When `inheritMarks` is\n true and the content is inline, it inherits the marks from the\n place where it is inserted.\n */\n replaceSelectionWith(node, inheritMarks = true) {\n let selection = this.selection;\n if (inheritMarks)\n node = node.mark(this.storedMarks || (selection.empty ? selection.$from.marks() : (selection.$from.marksAcross(selection.$to) || Mark.none)));\n selection.replaceWith(this, node);\n return this;\n }\n /**\n Delete the selection.\n */\n deleteSelection() {\n this.selection.replace(this);\n return this;\n }\n /**\n Replace the given range, or the selection if no range is given,\n with a text node containing the given string.\n */\n insertText(text, from, to) {\n let schema = this.doc.type.schema;\n if (from == null) {\n if (!text)\n return this.deleteSelection();\n return this.replaceSelectionWith(schema.text(text), true);\n }\n else {\n if (to == null)\n to = from;\n if (!text)\n return this.deleteRange(from, to);\n let marks = this.storedMarks;\n if (!marks) {\n let $from = this.doc.resolve(from);\n marks = to == from ? $from.marks() : $from.marksAcross(this.doc.resolve(to));\n }\n this.replaceRangeWith(from, to, schema.text(text, marks));\n if (!this.selection.empty && this.selection.to == from + text.length)\n this.setSelection(Selection.near(this.selection.$to));\n return this;\n }\n }\n /**\n Store a metadata property in this transaction, keyed either by\n name or by plugin.\n */\n setMeta(key, value) {\n this.meta[typeof key == \"string\" ? key : key.key] = value;\n return this;\n }\n /**\n Retrieve a metadata property for a given name or plugin.\n */\n getMeta(key) {\n return this.meta[typeof key == \"string\" ? key : key.key];\n }\n /**\n Returns true if this transaction doesn't contain any metadata,\n and can thus safely be extended.\n */\n get isGeneric() {\n for (let _ in this.meta)\n return false;\n return true;\n }\n /**\n Indicate that the editor should scroll the selection into view\n when updated to the state produced by this transaction.\n */\n scrollIntoView() {\n this.updated |= UPDATED_SCROLL;\n return this;\n }\n /**\n True when this transaction has had `scrollIntoView` called on it.\n */\n get scrolledIntoView() {\n return (this.updated & UPDATED_SCROLL) > 0;\n }\n}\n\nfunction bind(f, self) {\n return !self || !f ? f : f.bind(self);\n}\nclass FieldDesc {\n constructor(name, desc, self) {\n this.name = name;\n this.init = bind(desc.init, self);\n this.apply = bind(desc.apply, self);\n }\n}\nconst baseFields = [\n new FieldDesc(\"doc\", {\n init(config) { return config.doc || config.schema.topNodeType.createAndFill(); },\n apply(tr) { return tr.doc; }\n }),\n new FieldDesc(\"selection\", {\n init(config, instance) { return config.selection || Selection.atStart(instance.doc); },\n apply(tr) { return tr.selection; }\n }),\n new FieldDesc(\"storedMarks\", {\n init(config) { return config.storedMarks || null; },\n apply(tr, _marks, _old, state) { return state.selection.$cursor ? tr.storedMarks : null; }\n }),\n new FieldDesc(\"scrollToSelection\", {\n init() { return 0; },\n apply(tr, prev) { return tr.scrolledIntoView ? prev + 1 : prev; }\n })\n];\n// Object wrapping the part of a state object that stays the same\n// across transactions. Stored in the state's `config` property.\nclass Configuration {\n constructor(schema, plugins) {\n this.schema = schema;\n this.plugins = [];\n this.pluginsByKey = Object.create(null);\n this.fields = baseFields.slice();\n if (plugins)\n plugins.forEach(plugin => {\n if (this.pluginsByKey[plugin.key])\n throw new RangeError(\"Adding different instances of a keyed plugin (\" + plugin.key + \")\");\n this.plugins.push(plugin);\n this.pluginsByKey[plugin.key] = plugin;\n if (plugin.spec.state)\n this.fields.push(new FieldDesc(plugin.key, plugin.spec.state, plugin));\n });\n }\n}\n/**\nThe state of a ProseMirror editor is represented by an object of\nthis type. A state is a persistent data structure—it isn't\nupdated, but rather a new state value is computed from an old one\nusing the [`apply`](https://prosemirror.net/docs/ref/#state.EditorState.apply) method.\n\nA state holds a number of built-in fields, and plugins can\n[define](https://prosemirror.net/docs/ref/#state.PluginSpec.state) additional fields.\n*/\nclass EditorState {\n /**\n @internal\n */\n constructor(\n /**\n @internal\n */\n config) {\n this.config = config;\n }\n /**\n The schema of the state's document.\n */\n get schema() {\n return this.config.schema;\n }\n /**\n The plugins that are active in this state.\n */\n get plugins() {\n return this.config.plugins;\n }\n /**\n Apply the given transaction to produce a new state.\n */\n apply(tr) {\n return this.applyTransaction(tr).state;\n }\n /**\n @internal\n */\n filterTransaction(tr, ignore = -1) {\n for (let i = 0; i < this.config.plugins.length; i++)\n if (i != ignore) {\n let plugin = this.config.plugins[i];\n if (plugin.spec.filterTransaction && !plugin.spec.filterTransaction.call(plugin, tr, this))\n return false;\n }\n return true;\n }\n /**\n Verbose variant of [`apply`](https://prosemirror.net/docs/ref/#state.EditorState.apply) that\n returns the precise transactions that were applied (which might\n be influenced by the [transaction\n hooks](https://prosemirror.net/docs/ref/#state.PluginSpec.filterTransaction) of\n plugins) along with the new state.\n */\n applyTransaction(rootTr) {\n if (!this.filterTransaction(rootTr))\n return { state: this, transactions: [] };\n let trs = [rootTr], newState = this.applyInner(rootTr), seen = null;\n // This loop repeatedly gives plugins a chance to respond to\n // transactions as new transactions are added, making sure to only\n // pass the transactions the plugin did not see before.\n for (;;) {\n let haveNew = false;\n for (let i = 0; i < this.config.plugins.length; i++) {\n let plugin = this.config.plugins[i];\n if (plugin.spec.appendTransaction) {\n let n = seen ? seen[i].n : 0, oldState = seen ? seen[i].state : this;\n let tr = n < trs.length &&\n plugin.spec.appendTransaction.call(plugin, n ? trs.slice(n) : trs, oldState, newState);\n if (tr && newState.filterTransaction(tr, i)) {\n tr.setMeta(\"appendedTransaction\", rootTr);\n if (!seen) {\n seen = [];\n for (let j = 0; j < this.config.plugins.length; j++)\n seen.push(j < i ? { state: newState, n: trs.length } : { state: this, n: 0 });\n }\n trs.push(tr);\n newState = newState.applyInner(tr);\n haveNew = true;\n }\n if (seen)\n seen[i] = { state: newState, n: trs.length };\n }\n }\n if (!haveNew)\n return { state: newState, transactions: trs };\n }\n }\n /**\n @internal\n */\n applyInner(tr) {\n if (!tr.before.eq(this.doc))\n throw new RangeError(\"Applying a mismatched transaction\");\n let newInstance = new EditorState(this.config), fields = this.config.fields;\n for (let i = 0; i < fields.length; i++) {\n let field = fields[i];\n newInstance[field.name] = field.apply(tr, this[field.name], this, newInstance);\n }\n return newInstance;\n }\n /**\n Accessor that constructs and returns a new [transaction](https://prosemirror.net/docs/ref/#state.Transaction) from this state.\n */\n get tr() { return new Transaction(this); }\n /**\n Create a new state.\n */\n static create(config) {\n let $config = new Configuration(config.doc ? config.doc.type.schema : config.schema, config.plugins);\n let instance = new EditorState($config);\n for (let i = 0; i < $config.fields.length; i++)\n instance[$config.fields[i].name] = $config.fields[i].init(config, instance);\n return instance;\n }\n /**\n Create a new state based on this one, but with an adjusted set\n of active plugins. State fields that exist in both sets of\n plugins are kept unchanged. Those that no longer exist are\n dropped, and those that are new are initialized using their\n [`init`](https://prosemirror.net/docs/ref/#state.StateField.init) method, passing in the new\n configuration object..\n */\n reconfigure(config) {\n let $config = new Configuration(this.schema, config.plugins);\n let fields = $config.fields, instance = new EditorState($config);\n for (let i = 0; i < fields.length; i++) {\n let name = fields[i].name;\n instance[name] = this.hasOwnProperty(name) ? this[name] : fields[i].init(config, instance);\n }\n return instance;\n }\n /**\n Serialize this state to JSON. If you want to serialize the state\n of plugins, pass an object mapping property names to use in the\n resulting JSON object to plugin objects. The argument may also be\n a string or number, in which case it is ignored, to support the\n way `JSON.stringify` calls `toString` methods.\n */\n toJSON(pluginFields) {\n let result = { doc: this.doc.toJSON(), selection: this.selection.toJSON() };\n if (this.storedMarks)\n result.storedMarks = this.storedMarks.map(m => m.toJSON());\n if (pluginFields && typeof pluginFields == 'object')\n for (let prop in pluginFields) {\n if (prop == \"doc\" || prop == \"selection\")\n throw new RangeError(\"The JSON fields `doc` and `selection` are reserved\");\n let plugin = pluginFields[prop], state = plugin.spec.state;\n if (state && state.toJSON)\n result[prop] = state.toJSON.call(plugin, this[plugin.key]);\n }\n return result;\n }\n /**\n Deserialize a JSON representation of a state. `config` should\n have at least a `schema` field, and should contain array of\n plugins to initialize the state with. `pluginFields` can be used\n to deserialize the state of plugins, by associating plugin\n instances with the property names they use in the JSON object.\n */\n static fromJSON(config, json, pluginFields) {\n if (!json)\n throw new RangeError(\"Invalid input for EditorState.fromJSON\");\n if (!config.schema)\n throw new RangeError(\"Required config field 'schema' missing\");\n let $config = new Configuration(config.schema, config.plugins);\n let instance = new EditorState($config);\n $config.fields.forEach(field => {\n if (field.name == \"doc\") {\n instance.doc = Node.fromJSON(config.schema, json.doc);\n }\n else if (field.name == \"selection\") {\n instance.selection = Selection.fromJSON(instance.doc, json.selection);\n }\n else if (field.name == \"storedMarks\") {\n if (json.storedMarks)\n instance.storedMarks = json.storedMarks.map(config.schema.markFromJSON);\n }\n else {\n if (pluginFields)\n for (let prop in pluginFields) {\n let plugin = pluginFields[prop], state = plugin.spec.state;\n if (plugin.key == field.name && state && state.fromJSON &&\n Object.prototype.hasOwnProperty.call(json, prop)) {\n instance[field.name] = state.fromJSON.call(plugin, config, json[prop], instance);\n return;\n }\n }\n instance[field.name] = field.init(config, instance);\n }\n });\n return instance;\n }\n}\n\nfunction bindProps(obj, self, target) {\n for (let prop in obj) {\n let val = obj[prop];\n if (val instanceof Function)\n val = val.bind(self);\n else if (prop == \"handleDOMEvents\")\n val = bindProps(val, self, {});\n target[prop] = val;\n }\n return target;\n}\n/**\nPlugins bundle functionality that can be added to an editor.\nThey are part of the [editor state](https://prosemirror.net/docs/ref/#state.EditorState) and\nmay influence that state and the view that contains it.\n*/\nclass Plugin {\n /**\n Create a plugin.\n */\n constructor(\n /**\n The plugin's [spec object](https://prosemirror.net/docs/ref/#state.PluginSpec).\n */\n spec) {\n this.spec = spec;\n /**\n The [props](https://prosemirror.net/docs/ref/#view.EditorProps) exported by this plugin.\n */\n this.props = {};\n if (spec.props)\n bindProps(spec.props, this, this.props);\n this.key = spec.key ? spec.key.key : createKey(\"plugin\");\n }\n /**\n Extract the plugin's state field from an editor state.\n */\n getState(state) { return state[this.key]; }\n}\nconst keys = Object.create(null);\nfunction createKey(name) {\n if (name in keys)\n return name + \"$\" + ++keys[name];\n keys[name] = 0;\n return name + \"$\";\n}\n/**\nA key is used to [tag](https://prosemirror.net/docs/ref/#state.PluginSpec.key) plugins in a way\nthat makes it possible to find them, given an editor state.\nAssigning a key does mean only one plugin of that type can be\nactive in a state.\n*/\nclass PluginKey {\n /**\n Create a plugin key.\n */\n constructor(name = \"key\") { this.key = createKey(name); }\n /**\n Get the active plugin with this key, if any, from an editor\n state.\n */\n get(state) { return state.config.pluginsByKey[this.key]; }\n /**\n Get the plugin's state from an editor state.\n */\n getState(state) { return state[this.key]; }\n}\n\nexport { AllSelection, EditorState, NodeSelection, Plugin, PluginKey, Selection, SelectionRange, TextSelection, Transaction };\n","export var base = {\n 8: \"Backspace\",\n 9: \"Tab\",\n 10: \"Enter\",\n 12: \"NumLock\",\n 13: \"Enter\",\n 16: \"Shift\",\n 17: \"Control\",\n 18: \"Alt\",\n 20: \"CapsLock\",\n 27: \"Escape\",\n 32: \" \",\n 33: \"PageUp\",\n 34: \"PageDown\",\n 35: \"End\",\n 36: \"Home\",\n 37: \"ArrowLeft\",\n 38: \"ArrowUp\",\n 39: \"ArrowRight\",\n 40: \"ArrowDown\",\n 44: \"PrintScreen\",\n 45: \"Insert\",\n 46: \"Delete\",\n 59: \";\",\n 61: \"=\",\n 91: \"Meta\",\n 92: \"Meta\",\n 106: \"*\",\n 107: \"+\",\n 108: \",\",\n 109: \"-\",\n 110: \".\",\n 111: \"/\",\n 144: \"NumLock\",\n 145: \"ScrollLock\",\n 160: \"Shift\",\n 161: \"Shift\",\n 162: \"Control\",\n 163: \"Control\",\n 164: \"Alt\",\n 165: \"Alt\",\n 173: \"-\",\n 186: \";\",\n 187: \"=\",\n 188: \",\",\n 189: \"-\",\n 190: \".\",\n 191: \"/\",\n 192: \"`\",\n 219: \"[\",\n 220: \"\\\\\",\n 221: \"]\",\n 222: \"'\"\n}\n\nexport var shift = {\n 48: \")\",\n 49: \"!\",\n 50: \"@\",\n 51: \"#\",\n 52: \"$\",\n 53: \"%\",\n 54: \"^\",\n 55: \"&\",\n 56: \"*\",\n 57: \"(\",\n 59: \":\",\n 61: \"+\",\n 173: \"_\",\n 186: \":\",\n 187: \"+\",\n 188: \"<\",\n 189: \"_\",\n 190: \">\",\n 191: \"?\",\n 192: \"~\",\n 219: \"{\",\n 220: \"|\",\n 221: \"}\",\n 222: \"\\\"\"\n}\n\nvar mac = typeof navigator != \"undefined\" && /Mac/.test(navigator.platform)\nvar ie = typeof navigator != \"undefined\" && /MSIE \\d|Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(navigator.userAgent)\n\n// Fill in the digit keys\nfor (var i = 0; i < 10; i++) base[48 + i] = base[96 + i] = String(i)\n\n// The function keys\nfor (var i = 1; i <= 24; i++) base[i + 111] = \"F\" + i\n\n// And the alphabetic keys\nfor (var i = 65; i <= 90; i++) {\n base[i] = String.fromCharCode(i + 32)\n shift[i] = String.fromCharCode(i)\n}\n\n// For each code that doesn't have a shift-equivalent, copy the base name\nfor (var code in base) if (!shift.hasOwnProperty(code)) shift[code] = base[code]\n\nexport function keyName(event) {\n // On macOS, keys held with Shift and Cmd don't reflect the effect of Shift in `.key`.\n // On IE, shift effect is never included in `.key`.\n var ignoreKey = mac && event.metaKey && event.shiftKey && !event.ctrlKey && !event.altKey ||\n ie && event.shiftKey && event.key && event.key.length == 1 ||\n event.key == \"Unidentified\"\n var name = (!ignoreKey && event.key) ||\n (event.shiftKey ? shift : base)[event.keyCode] ||\n event.key || \"Unidentified\"\n // Edge sometimes produces wrong names (Issue #3)\n if (name == \"Esc\") name = \"Escape\"\n if (name == \"Del\") name = \"Delete\"\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8860571/\n if (name == \"Left\") name = \"ArrowLeft\"\n if (name == \"Up\") name = \"ArrowUp\"\n if (name == \"Right\") name = \"ArrowRight\"\n if (name == \"Down\") name = \"ArrowDown\"\n return name\n}\n","import { keyName, base } from 'w3c-keyname';\nimport { Plugin } from 'prosemirror-state';\n\nconst mac = typeof navigator != \"undefined\" && /Mac|iP(hone|[oa]d)/.test(navigator.platform);\nconst windows = typeof navigator != \"undefined\" && /Win/.test(navigator.platform);\nfunction normalizeKeyName(name) {\n let parts = name.split(/-(?!$)/), result = parts[parts.length - 1];\n if (result == \"Space\")\n result = \" \";\n let alt, ctrl, shift, meta;\n for (let i = 0; i < parts.length - 1; i++) {\n let mod = parts[i];\n if (/^(cmd|meta|m)$/i.test(mod))\n meta = true;\n else if (/^a(lt)?$/i.test(mod))\n alt = true;\n else if (/^(c|ctrl|control)$/i.test(mod))\n ctrl = true;\n else if (/^s(hift)?$/i.test(mod))\n shift = true;\n else if (/^mod$/i.test(mod)) {\n if (mac)\n meta = true;\n else\n ctrl = true;\n }\n else\n throw new Error(\"Unrecognized modifier name: \" + mod);\n }\n if (alt)\n result = \"Alt-\" + result;\n if (ctrl)\n result = \"Ctrl-\" + result;\n if (meta)\n result = \"Meta-\" + result;\n if (shift)\n result = \"Shift-\" + result;\n return result;\n}\nfunction normalize(map) {\n let copy = Object.create(null);\n for (let prop in map)\n copy[normalizeKeyName(prop)] = map[prop];\n return copy;\n}\nfunction modifiers(name, event, shift = true) {\n if (event.altKey)\n name = \"Alt-\" + name;\n if (event.ctrlKey)\n name = \"Ctrl-\" + name;\n if (event.metaKey)\n name = \"Meta-\" + name;\n if (shift && event.shiftKey)\n name = \"Shift-\" + name;\n return name;\n}\n/**\nCreate a keymap plugin for the given set of bindings.\n\nBindings should map key names to [command](https://prosemirror.net/docs/ref/#commands)-style\nfunctions, which will be called with `(EditorState, dispatch,\nEditorView)` arguments, and should return true when they've handled\nthe key. Note that the view argument isn't part of the command\nprotocol, but can be used as an escape hatch if a binding needs to\ndirectly interact with the UI.\n\nKey names may be strings like `\"Shift-Ctrl-Enter\"`—a key\nidentifier prefixed with zero or more modifiers. Key identifiers\nare based on the strings that can appear in\n[`KeyEvent.key`](https:developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key).\nUse lowercase letters to refer to letter keys (or uppercase letters\nif you want shift to be held). You may use `\"Space\"` as an alias\nfor the `\" \"` name.\n\nModifiers can be given in any order. `Shift-` (or `s-`), `Alt-` (or\n`a-`), `Ctrl-` (or `c-` or `Control-`) and `Cmd-` (or `m-` or\n`Meta-`) are recognized. For characters that are created by holding\nshift, the `Shift-` prefix is implied, and should not be added\nexplicitly.\n\nYou can use `Mod-` as a shorthand for `Cmd-` on Mac and `Ctrl-` on\nother platforms.\n\nYou can add multiple keymap plugins to an editor. The order in\nwhich they appear determines their precedence (the ones early in\nthe array get to dispatch first).\n*/\nfunction keymap(bindings) {\n return new Plugin({ props: { handleKeyDown: keydownHandler(bindings) } });\n}\n/**\nGiven a set of bindings (using the same format as\n[`keymap`](https://prosemirror.net/docs/ref/#keymap.keymap)), return a [keydown\nhandler](https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyDown) that handles them.\n*/\nfunction keydownHandler(bindings) {\n let map = normalize(bindings);\n return function (view, event) {\n let name = keyName(event), baseName, direct = map[modifiers(name, event)];\n if (direct && direct(view.state, view.dispatch, view))\n return true;\n // A character key\n if (name.length == 1 && name != \" \") {\n if (event.shiftKey) {\n // In case the name was already modified by shift, try looking\n // it up without its shift modifier\n let noShift = map[modifiers(name, event, false)];\n if (noShift && noShift(view.state, view.dispatch, view))\n return true;\n }\n if ((event.altKey || event.metaKey || event.ctrlKey) &&\n // Ctrl-Alt may be used for AltGr on Windows\n !(windows && event.ctrlKey && event.altKey) &&\n (baseName = base[event.keyCode]) && baseName != name) {\n // Try falling back to the keyCode when there's a modifier\n // active or the character produced isn't ASCII, and our table\n // produces a different name from the the keyCode. See #668,\n // #1060, #1529.\n let fromCode = map[modifiers(baseName, event)];\n if (fromCode && fromCode(view.state, view.dispatch, view))\n return true;\n }\n }\n return false;\n };\n}\n\nexport { keydownHandler, keymap };\n","import { NodeSelection, Plugin, PluginKey, Selection, SelectionRange, TextSelection } from \"prosemirror-state\";\nimport { Fragment, Slice } from \"prosemirror-model\";\nimport { Decoration, DecorationSet } from \"prosemirror-view\";\nimport { keydownHandler } from \"prosemirror-keymap\";\nimport { Transform } from \"prosemirror-transform\";\n\n//#region src/tablemap.ts\nlet readFromCache;\nlet addToCache;\nif (typeof WeakMap != \"undefined\") {\n\tlet cache = /* @__PURE__ */ new WeakMap();\n\treadFromCache = (key) => cache.get(key);\n\taddToCache = (key, value) => {\n\t\tcache.set(key, value);\n\t\treturn value;\n\t};\n} else {\n\tconst cache = [];\n\tconst cacheSize = 10;\n\tlet cachePos = 0;\n\treadFromCache = (key) => {\n\t\tfor (let i = 0; i < cache.length; i += 2) if (cache[i] == key) return cache[i + 1];\n\t};\n\taddToCache = (key, value) => {\n\t\tif (cachePos == cacheSize) cachePos = 0;\n\t\tcache[cachePos++] = key;\n\t\treturn cache[cachePos++] = value;\n\t};\n}\n/**\n* A table map describes the structure of a given table. To avoid\n* recomputing them all the time, they are cached per table node. To\n* be able to do that, positions saved in the map are relative to the\n* start of the table, rather than the start of the document.\n*\n* @public\n*/\nvar TableMap = class {\n\tconstructor(width, height, map, problems) {\n\t\tthis.width = width;\n\t\tthis.height = height;\n\t\tthis.map = map;\n\t\tthis.problems = problems;\n\t}\n\tfindCell(pos) {\n\t\tfor (let i = 0; i < this.map.length; i++) {\n\t\t\tconst curPos = this.map[i];\n\t\t\tif (curPos != pos) continue;\n\t\t\tconst left = i % this.width;\n\t\t\tconst top = i / this.width | 0;\n\t\t\tlet right = left + 1;\n\t\t\tlet bottom = top + 1;\n\t\t\tfor (let j = 1; right < this.width && this.map[i + j] == curPos; j++) right++;\n\t\t\tfor (let j = 1; bottom < this.height && this.map[i + this.width * j] == curPos; j++) bottom++;\n\t\t\treturn {\n\t\t\t\tleft,\n\t\t\t\ttop,\n\t\t\t\tright,\n\t\t\t\tbottom\n\t\t\t};\n\t\t}\n\t\tthrow new RangeError(`No cell with offset ${pos} found`);\n\t}\n\tcolCount(pos) {\n\t\tfor (let i = 0; i < this.map.length; i++) if (this.map[i] == pos) return i % this.width;\n\t\tthrow new RangeError(`No cell with offset ${pos} found`);\n\t}\n\tnextCell(pos, axis, dir) {\n\t\tconst { left, right, top, bottom } = this.findCell(pos);\n\t\tif (axis == \"horiz\") {\n\t\t\tif (dir < 0 ? left == 0 : right == this.width) return null;\n\t\t\treturn this.map[top * this.width + (dir < 0 ? left - 1 : right)];\n\t\t} else {\n\t\t\tif (dir < 0 ? top == 0 : bottom == this.height) return null;\n\t\t\treturn this.map[left + this.width * (dir < 0 ? top - 1 : bottom)];\n\t\t}\n\t}\n\trectBetween(a, b) {\n\t\tconst { left: leftA, right: rightA, top: topA, bottom: bottomA } = this.findCell(a);\n\t\tconst { left: leftB, right: rightB, top: topB, bottom: bottomB } = this.findCell(b);\n\t\treturn {\n\t\t\tleft: Math.min(leftA, leftB),\n\t\t\ttop: Math.min(topA, topB),\n\t\t\tright: Math.max(rightA, rightB),\n\t\t\tbottom: Math.max(bottomA, bottomB)\n\t\t};\n\t}\n\tcellsInRect(rect) {\n\t\tconst result = [];\n\t\tconst seen = {};\n\t\tfor (let row = rect.top; row < rect.bottom; row++) for (let col = rect.left; col < rect.right; col++) {\n\t\t\tconst index = row * this.width + col;\n\t\t\tconst pos = this.map[index];\n\t\t\tif (seen[pos]) continue;\n\t\t\tseen[pos] = true;\n\t\t\tif (col == rect.left && col && this.map[index - 1] == pos || row == rect.top && row && this.map[index - this.width] == pos) continue;\n\t\t\tresult.push(pos);\n\t\t}\n\t\treturn result;\n\t}\n\tpositionAt(row, col, table) {\n\t\tfor (let i = 0, rowStart = 0;; i++) {\n\t\t\tconst rowEnd = rowStart + table.child(i).nodeSize;\n\t\t\tif (i == row) {\n\t\t\t\tlet index = col + row * this.width;\n\t\t\t\tconst rowEndIndex = (row + 1) * this.width;\n\t\t\t\twhile (index < rowEndIndex && this.map[index] < rowStart) index++;\n\t\t\t\treturn index == rowEndIndex ? rowEnd - 1 : this.map[index];\n\t\t\t}\n\t\t\trowStart = rowEnd;\n\t\t}\n\t}\n\tstatic get(table) {\n\t\treturn readFromCache(table) || addToCache(table, computeMap(table));\n\t}\n};\nfunction computeMap(table) {\n\tif (table.type.spec.tableRole != \"table\") throw new RangeError(\"Not a table node: \" + table.type.name);\n\tconst width = findWidth(table), height = table.childCount;\n\tconst map = [];\n\tlet mapPos = 0;\n\tlet problems = null;\n\tconst colWidths = [];\n\tfor (let i = 0, e = width * height; i < e; i++) map[i] = 0;\n\tfor (let row = 0, pos = 0; row < height; row++) {\n\t\tconst rowNode = table.child(row);\n\t\tpos++;\n\t\tfor (let i = 0;; i++) {\n\t\t\twhile (mapPos < map.length && map[mapPos] != 0) mapPos++;\n\t\t\tif (i == rowNode.childCount) break;\n\t\t\tconst cellNode = rowNode.child(i);\n\t\t\tconst { colspan, rowspan, colwidth } = cellNode.attrs;\n\t\t\tfor (let h = 0; h < rowspan; h++) {\n\t\t\t\tif (h + row >= height) {\n\t\t\t\t\t(problems || (problems = [])).push({\n\t\t\t\t\t\ttype: \"overlong_rowspan\",\n\t\t\t\t\t\tpos,\n\t\t\t\t\t\tn: rowspan - h\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tconst start = mapPos + h * width;\n\t\t\t\tfor (let w = 0; w < colspan; w++) {\n\t\t\t\t\tif (map[start + w] == 0) map[start + w] = pos;\n\t\t\t\t\telse (problems || (problems = [])).push({\n\t\t\t\t\t\ttype: \"collision\",\n\t\t\t\t\t\trow,\n\t\t\t\t\t\tpos,\n\t\t\t\t\t\tn: colspan - w\n\t\t\t\t\t});\n\t\t\t\t\tconst colW = colwidth && colwidth[w];\n\t\t\t\t\tif (colW) {\n\t\t\t\t\t\tconst widthIndex = (start + w) % width * 2, prev = colWidths[widthIndex];\n\t\t\t\t\t\tif (prev == null || prev != colW && colWidths[widthIndex + 1] == 1) {\n\t\t\t\t\t\t\tcolWidths[widthIndex] = colW;\n\t\t\t\t\t\t\tcolWidths[widthIndex + 1] = 1;\n\t\t\t\t\t\t} else if (prev == colW) colWidths[widthIndex + 1]++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tmapPos += colspan;\n\t\t\tpos += cellNode.nodeSize;\n\t\t}\n\t\tconst expectedPos = (row + 1) * width;\n\t\tlet missing = 0;\n\t\twhile (mapPos < expectedPos) if (map[mapPos++] == 0) missing++;\n\t\tif (missing) (problems || (problems = [])).push({\n\t\t\ttype: \"missing\",\n\t\t\trow,\n\t\t\tn: missing\n\t\t});\n\t\tpos++;\n\t}\n\tif (width === 0 || height === 0) (problems || (problems = [])).push({ type: \"zero_sized\" });\n\tconst tableMap = new TableMap(width, height, map, problems);\n\tlet badWidths = false;\n\tfor (let i = 0; !badWidths && i < colWidths.length; i += 2) if (colWidths[i] != null && colWidths[i + 1] < height) badWidths = true;\n\tif (badWidths) findBadColWidths(tableMap, colWidths, table);\n\treturn tableMap;\n}\nfunction findWidth(table) {\n\tlet width = -1;\n\tlet hasRowSpan = false;\n\tfor (let row = 0; row < table.childCount; row++) {\n\t\tconst rowNode = table.child(row);\n\t\tlet rowWidth = 0;\n\t\tif (hasRowSpan) for (let j = 0; j < row; j++) {\n\t\t\tconst prevRow = table.child(j);\n\t\t\tfor (let i = 0; i < prevRow.childCount; i++) {\n\t\t\t\tconst cell = prevRow.child(i);\n\t\t\t\tif (j + cell.attrs.rowspan > row) rowWidth += cell.attrs.colspan;\n\t\t\t}\n\t\t}\n\t\tfor (let i = 0; i < rowNode.childCount; i++) {\n\t\t\tconst cell = rowNode.child(i);\n\t\t\trowWidth += cell.attrs.colspan;\n\t\t\tif (cell.attrs.rowspan > 1) hasRowSpan = true;\n\t\t}\n\t\tif (width == -1) width = rowWidth;\n\t\telse if (width != rowWidth) width = Math.max(width, rowWidth);\n\t}\n\treturn width;\n}\nfunction findBadColWidths(map, colWidths, table) {\n\tif (!map.problems) map.problems = [];\n\tconst seen = {};\n\tfor (let i = 0; i < map.map.length; i++) {\n\t\tconst pos = map.map[i];\n\t\tif (seen[pos]) continue;\n\t\tseen[pos] = true;\n\t\tconst node = table.nodeAt(pos);\n\t\tif (!node) throw new RangeError(`No cell with offset ${pos} found`);\n\t\tlet updated = null;\n\t\tconst attrs = node.attrs;\n\t\tfor (let j = 0; j < attrs.colspan; j++) {\n\t\t\tconst colWidth = colWidths[(i + j) % map.width * 2];\n\t\t\tif (colWidth != null && (!attrs.colwidth || attrs.colwidth[j] != colWidth)) (updated || (updated = freshColWidth(attrs)))[j] = colWidth;\n\t\t}\n\t\tif (updated) map.problems.unshift({\n\t\t\ttype: \"colwidth mismatch\",\n\t\t\tpos,\n\t\t\tcolwidth: updated\n\t\t});\n\t}\n}\nfunction freshColWidth(attrs) {\n\tif (attrs.colwidth) return attrs.colwidth.slice();\n\tconst result = [];\n\tfor (let i = 0; i < attrs.colspan; i++) result.push(0);\n\treturn result;\n}\n\n//#endregion\n//#region src/schema.ts\nfunction getCellAttrs(dom, extraAttrs) {\n\tif (typeof dom === \"string\") return {};\n\tconst widthAttr = dom.getAttribute(\"data-colwidth\");\n\tconst widths = widthAttr && /^\\d+(,\\d+)*$/.test(widthAttr) ? widthAttr.split(\",\").map((s) => Number(s)) : null;\n\tconst colspan = Number(dom.getAttribute(\"colspan\") || 1);\n\tconst result = {\n\t\tcolspan,\n\t\trowspan: Number(dom.getAttribute(\"rowspan\") || 1),\n\t\tcolwidth: widths && widths.length == colspan ? widths : null\n\t};\n\tfor (const prop in extraAttrs) {\n\t\tconst getter = extraAttrs[prop].getFromDOM;\n\t\tconst value = getter && getter(dom);\n\t\tif (value != null) result[prop] = value;\n\t}\n\treturn result;\n}\nfunction setCellAttrs(node, extraAttrs) {\n\tconst attrs = {};\n\tif (node.attrs.colspan != 1) attrs.colspan = node.attrs.colspan;\n\tif (node.attrs.rowspan != 1) attrs.rowspan = node.attrs.rowspan;\n\tif (node.attrs.colwidth) attrs[\"data-colwidth\"] = node.attrs.colwidth.join(\",\");\n\tfor (const prop in extraAttrs) {\n\t\tconst setter = extraAttrs[prop].setDOMAttr;\n\t\tif (setter) setter(node.attrs[prop], attrs);\n\t}\n\treturn attrs;\n}\nfunction validateColwidth(value) {\n\tif (value === null) return;\n\tif (!Array.isArray(value)) throw new TypeError(\"colwidth must be null or an array\");\n\tfor (const item of value) if (typeof item !== \"number\") throw new TypeError(\"colwidth must be null or an array of numbers\");\n}\n/**\n* This function creates a set of [node\n* specs](http://prosemirror.net/docs/ref/#model.SchemaSpec.nodes) for\n* `table`, `table_row`, and `table_cell` nodes types as used by this\n* module. The result can then be added to the set of nodes when\n* creating a schema.\n*\n* @public\n*/\nfunction tableNodes(options) {\n\tconst extraAttrs = options.cellAttributes || {};\n\tconst cellAttrs = {\n\t\tcolspan: {\n\t\t\tdefault: 1,\n\t\t\tvalidate: \"number\"\n\t\t},\n\t\trowspan: {\n\t\t\tdefault: 1,\n\t\t\tvalidate: \"number\"\n\t\t},\n\t\tcolwidth: {\n\t\t\tdefault: null,\n\t\t\tvalidate: validateColwidth\n\t\t}\n\t};\n\tfor (const prop in extraAttrs) cellAttrs[prop] = {\n\t\tdefault: extraAttrs[prop].default,\n\t\tvalidate: extraAttrs[prop].validate\n\t};\n\treturn {\n\t\ttable: {\n\t\t\tcontent: \"table_row+\",\n\t\t\ttableRole: \"table\",\n\t\t\tisolating: true,\n\t\t\tgroup: options.tableGroup,\n\t\t\tparseDOM: [{ tag: \"table\" }],\n\t\t\ttoDOM() {\n\t\t\t\treturn [\"table\", [\"tbody\", 0]];\n\t\t\t}\n\t\t},\n\t\ttable_row: {\n\t\t\tcontent: \"(table_cell | table_header)*\",\n\t\t\ttableRole: \"row\",\n\t\t\tparseDOM: [{ tag: \"tr\" }],\n\t\t\ttoDOM() {\n\t\t\t\treturn [\"tr\", 0];\n\t\t\t}\n\t\t},\n\t\ttable_cell: {\n\t\t\tcontent: options.cellContent,\n\t\t\tattrs: cellAttrs,\n\t\t\ttableRole: \"cell\",\n\t\t\tisolating: true,\n\t\t\tparseDOM: [{\n\t\t\t\ttag: \"td\",\n\t\t\t\tgetAttrs: (dom) => getCellAttrs(dom, extraAttrs)\n\t\t\t}],\n\t\t\ttoDOM(node) {\n\t\t\t\treturn [\n\t\t\t\t\t\"td\",\n\t\t\t\t\tsetCellAttrs(node, extraAttrs),\n\t\t\t\t\t0\n\t\t\t\t];\n\t\t\t}\n\t\t},\n\t\ttable_header: {\n\t\t\tcontent: options.cellContent,\n\t\t\tattrs: cellAttrs,\n\t\t\ttableRole: \"header_cell\",\n\t\t\tisolating: true,\n\t\t\tparseDOM: [{\n\t\t\t\ttag: \"th\",\n\t\t\t\tgetAttrs: (dom) => getCellAttrs(dom, extraAttrs)\n\t\t\t}],\n\t\t\ttoDOM(node) {\n\t\t\t\treturn [\n\t\t\t\t\t\"th\",\n\t\t\t\t\tsetCellAttrs(node, extraAttrs),\n\t\t\t\t\t0\n\t\t\t\t];\n\t\t\t}\n\t\t}\n\t};\n}\n/**\n* @public\n*/\nfunction tableNodeTypes(schema) {\n\tlet result = schema.cached.tableNodeTypes;\n\tif (!result) {\n\t\tresult = schema.cached.tableNodeTypes = {};\n\t\tfor (const name in schema.nodes) {\n\t\t\tconst type = schema.nodes[name], role = type.spec.tableRole;\n\t\t\tif (role) result[role] = type;\n\t\t}\n\t}\n\treturn result;\n}\n\n//#endregion\n//#region src/util.ts\n/**\n* @public\n*/\nconst tableEditingKey = new PluginKey(\"selectingCells\");\n/**\n* @public\n*/\nfunction cellAround($pos) {\n\tfor (let d = $pos.depth - 1; d > 0; d--) if ($pos.node(d).type.spec.tableRole == \"row\") return $pos.node(0).resolve($pos.before(d + 1));\n\treturn null;\n}\nfunction cellWrapping($pos) {\n\tfor (let d = $pos.depth; d > 0; d--) {\n\t\tconst role = $pos.node(d).type.spec.tableRole;\n\t\tif (role === \"cell\" || role === \"header_cell\") return $pos.node(d);\n\t}\n\treturn null;\n}\n/**\n* @public\n*/\nfunction isInTable(state) {\n\tconst $head = state.selection.$head;\n\tfor (let d = $head.depth; d > 0; d--) if ($head.node(d).type.spec.tableRole == \"row\") return true;\n\treturn false;\n}\n/**\n* @internal\n*/\nfunction selectionCell(state) {\n\tconst sel = state.selection;\n\tif (\"$anchorCell\" in sel && sel.$anchorCell) return sel.$anchorCell.pos > sel.$headCell.pos ? sel.$anchorCell : sel.$headCell;\n\telse if (\"node\" in sel && sel.node && sel.node.type.spec.tableRole == \"cell\") return sel.$anchor;\n\tconst $cell = cellAround(sel.$head) || cellNear(sel.$head);\n\tif ($cell) return $cell;\n\tthrow new RangeError(`No cell found around position ${sel.head}`);\n}\n/**\n* @public\n*/\nfunction cellNear($pos) {\n\tfor (let after = $pos.nodeAfter, pos = $pos.pos; after; after = after.firstChild, pos++) {\n\t\tconst role = after.type.spec.tableRole;\n\t\tif (role == \"cell\" || role == \"header_cell\") return $pos.doc.resolve(pos);\n\t}\n\tfor (let before = $pos.nodeBefore, pos = $pos.pos; before; before = before.lastChild, pos--) {\n\t\tconst role = before.type.spec.tableRole;\n\t\tif (role == \"cell\" || role == \"header_cell\") return $pos.doc.resolve(pos - before.nodeSize);\n\t}\n}\n/**\n* @public\n*/\nfunction pointsAtCell($pos) {\n\treturn $pos.parent.type.spec.tableRole == \"row\" && !!$pos.nodeAfter;\n}\n/**\n* @public\n*/\nfunction moveCellForward($pos) {\n\treturn $pos.node(0).resolve($pos.pos + $pos.nodeAfter.nodeSize);\n}\n/**\n* @internal\n*/\nfunction inSameTable($cellA, $cellB) {\n\treturn $cellA.depth == $cellB.depth && $cellA.pos >= $cellB.start(-1) && $cellA.pos <= $cellB.end(-1);\n}\n/**\n* @public\n*/\nfunction findCell($pos) {\n\treturn TableMap.get($pos.node(-1)).findCell($pos.pos - $pos.start(-1));\n}\n/**\n* @public\n*/\nfunction colCount($pos) {\n\treturn TableMap.get($pos.node(-1)).colCount($pos.pos - $pos.start(-1));\n}\n/**\n* @public\n*/\nfunction nextCell($pos, axis, dir) {\n\tconst table = $pos.node(-1);\n\tconst map = TableMap.get(table);\n\tconst tableStart = $pos.start(-1);\n\tconst moved = map.nextCell($pos.pos - tableStart, axis, dir);\n\treturn moved == null ? null : $pos.node(0).resolve(tableStart + moved);\n}\n/**\n* @public\n*/\nfunction removeColSpan(attrs, pos, n = 1) {\n\tconst result = {\n\t\t...attrs,\n\t\tcolspan: attrs.colspan - n\n\t};\n\tif (result.colwidth) {\n\t\tresult.colwidth = result.colwidth.slice();\n\t\tresult.colwidth.splice(pos, n);\n\t\tif (!result.colwidth.some((w) => w > 0)) result.colwidth = null;\n\t}\n\treturn result;\n}\n/**\n* @public\n*/\nfunction addColSpan(attrs, pos, n = 1) {\n\tconst result = {\n\t\t...attrs,\n\t\tcolspan: attrs.colspan + n\n\t};\n\tif (result.colwidth) {\n\t\tresult.colwidth = result.colwidth.slice();\n\t\tfor (let i = 0; i < n; i++) result.colwidth.splice(pos, 0, 0);\n\t}\n\treturn result;\n}\n/**\n* @public\n*/\nfunction columnIsHeader(map, table, col) {\n\tconst headerCell = tableNodeTypes(table.type.schema).header_cell;\n\tfor (let row = 0; row < map.height; row++) if (table.nodeAt(map.map[col + row * map.width]).type != headerCell) return false;\n\treturn true;\n}\n\n//#endregion\n//#region src/cellselection.ts\n/**\n* A [`Selection`](http://prosemirror.net/docs/ref/#state.Selection)\n* subclass that represents a cell selection spanning part of a table.\n* With the plugin enabled, these will be created when the user\n* selects across cells, and will be drawn by giving selected cells a\n* `selectedCell` CSS class.\n*\n* @public\n*/\nvar CellSelection = class CellSelection extends Selection {\n\tconstructor($anchorCell, $headCell = $anchorCell) {\n\t\tconst table = $anchorCell.node(-1);\n\t\tconst map = TableMap.get(table);\n\t\tconst tableStart = $anchorCell.start(-1);\n\t\tconst rect = map.rectBetween($anchorCell.pos - tableStart, $headCell.pos - tableStart);\n\t\tconst doc = $anchorCell.node(0);\n\t\tconst cells = map.cellsInRect(rect).filter((p) => p != $headCell.pos - tableStart);\n\t\tcells.unshift($headCell.pos - tableStart);\n\t\tconst ranges = cells.map((pos) => {\n\t\t\tconst cell = table.nodeAt(pos);\n\t\t\tif (!cell) throw new RangeError(`No cell with offset ${pos} found`);\n\t\t\tconst from = tableStart + pos + 1;\n\t\t\treturn new SelectionRange(doc.resolve(from), doc.resolve(from + cell.content.size));\n\t\t});\n\t\tsuper(ranges[0].$from, ranges[0].$to, ranges);\n\t\tthis.$anchorCell = $anchorCell;\n\t\tthis.$headCell = $headCell;\n\t}\n\tmap(doc, mapping) {\n\t\tconst $anchorCell = doc.resolve(mapping.map(this.$anchorCell.pos));\n\t\tconst $headCell = doc.resolve(mapping.map(this.$headCell.pos));\n\t\tif (pointsAtCell($anchorCell) && pointsAtCell($headCell) && inSameTable($anchorCell, $headCell)) {\n\t\t\tconst tableChanged = this.$anchorCell.node(-1) != $anchorCell.node(-1);\n\t\t\tif (tableChanged && this.isRowSelection()) return CellSelection.rowSelection($anchorCell, $headCell);\n\t\t\telse if (tableChanged && this.isColSelection()) return CellSelection.colSelection($anchorCell, $headCell);\n\t\t\telse return new CellSelection($anchorCell, $headCell);\n\t\t}\n\t\treturn TextSelection.between($anchorCell, $headCell);\n\t}\n\tcontent() {\n\t\tconst table = this.$anchorCell.node(-1);\n\t\tconst map = TableMap.get(table);\n\t\tconst tableStart = this.$anchorCell.start(-1);\n\t\tconst rect = map.rectBetween(this.$anchorCell.pos - tableStart, this.$headCell.pos - tableStart);\n\t\tconst seen = {};\n\t\tconst rows = [];\n\t\tfor (let row = rect.top; row < rect.bottom; row++) {\n\t\t\tconst rowContent = [];\n\t\t\tfor (let index = row * map.width + rect.left, col = rect.left; col < rect.right; col++, index++) {\n\t\t\t\tconst pos = map.map[index];\n\t\t\t\tif (seen[pos]) continue;\n\t\t\t\tseen[pos] = true;\n\t\t\t\tconst cellRect = map.findCell(pos);\n\t\t\t\tlet cell = table.nodeAt(pos);\n\t\t\t\tif (!cell) throw new RangeError(`No cell with offset ${pos} found`);\n\t\t\t\tconst extraLeft = rect.left - cellRect.left;\n\t\t\t\tconst extraRight = cellRect.right - rect.right;\n\t\t\t\tif (extraLeft > 0 || extraRight > 0) {\n\t\t\t\t\tlet attrs = cell.attrs;\n\t\t\t\t\tif (extraLeft > 0) attrs = removeColSpan(attrs, 0, extraLeft);\n\t\t\t\t\tif (extraRight > 0) attrs = removeColSpan(attrs, attrs.colspan - extraRight, extraRight);\n\t\t\t\t\tif (cellRect.left < rect.left) {\n\t\t\t\t\t\tcell = cell.type.createAndFill(attrs);\n\t\t\t\t\t\tif (!cell) throw new RangeError(`Could not create cell with attrs ${JSON.stringify(attrs)}`);\n\t\t\t\t\t} else cell = cell.type.create(attrs, cell.content);\n\t\t\t\t}\n\t\t\t\tif (cellRect.top < rect.top || cellRect.bottom > rect.bottom) {\n\t\t\t\t\tconst attrs = {\n\t\t\t\t\t\t...cell.attrs,\n\t\t\t\t\t\trowspan: Math.min(cellRect.bottom, rect.bottom) - Math.max(cellRect.top, rect.top)\n\t\t\t\t\t};\n\t\t\t\t\tif (cellRect.top < rect.top) cell = cell.type.createAndFill(attrs);\n\t\t\t\t\telse cell = cell.type.create(attrs, cell.content);\n\t\t\t\t}\n\t\t\t\trowContent.push(cell);\n\t\t\t}\n\t\t\trows.push(table.child(row).copy(Fragment.from(rowContent)));\n\t\t}\n\t\tconst fragment = this.isColSelection() && this.isRowSelection() ? table : rows;\n\t\treturn new Slice(Fragment.from(fragment), 1, 1);\n\t}\n\treplace(tr, content = Slice.empty) {\n\t\tconst mapFrom = tr.steps.length, ranges = this.ranges;\n\t\tfor (let i = 0; i < ranges.length; i++) {\n\t\t\tconst { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);\n\t\t\ttr.replace(mapping.map($from.pos), mapping.map($to.pos), i ? Slice.empty : content);\n\t\t}\n\t\tconst sel = Selection.findFrom(tr.doc.resolve(tr.mapping.slice(mapFrom).map(this.to)), -1);\n\t\tif (sel) tr.setSelection(sel);\n\t}\n\treplaceWith(tr, node) {\n\t\tthis.replace(tr, new Slice(Fragment.from(node), 0, 0));\n\t}\n\tforEachCell(f) {\n\t\tconst table = this.$anchorCell.node(-1);\n\t\tconst map = TableMap.get(table);\n\t\tconst tableStart = this.$anchorCell.start(-1);\n\t\tconst cells = map.cellsInRect(map.rectBetween(this.$anchorCell.pos - tableStart, this.$headCell.pos - tableStart));\n\t\tfor (let i = 0; i < cells.length; i++) f(table.nodeAt(cells[i]), tableStart + cells[i]);\n\t}\n\tisColSelection() {\n\t\tconst anchorTop = this.$anchorCell.index(-1);\n\t\tconst headTop = this.$headCell.index(-1);\n\t\tif (Math.min(anchorTop, headTop) > 0) return false;\n\t\tconst anchorBottom = anchorTop + this.$anchorCell.nodeAfter.attrs.rowspan;\n\t\tconst headBottom = headTop + this.$headCell.nodeAfter.attrs.rowspan;\n\t\treturn Math.max(anchorBottom, headBottom) == this.$headCell.node(-1).childCount;\n\t}\n\tstatic colSelection($anchorCell, $headCell = $anchorCell) {\n\t\tconst table = $anchorCell.node(-1);\n\t\tconst map = TableMap.get(table);\n\t\tconst tableStart = $anchorCell.start(-1);\n\t\tconst anchorRect = map.findCell($anchorCell.pos - tableStart);\n\t\tconst headRect = map.findCell($headCell.pos - tableStart);\n\t\tconst doc = $anchorCell.node(0);\n\t\tif (anchorRect.top <= headRect.top) {\n\t\t\tif (anchorRect.top > 0) $anchorCell = doc.resolve(tableStart + map.map[anchorRect.left]);\n\t\t\tif (headRect.bottom < map.height) $headCell = doc.resolve(tableStart + map.map[map.width * (map.height - 1) + headRect.right - 1]);\n\t\t} else {\n\t\t\tif (headRect.top > 0) $headCell = doc.resolve(tableStart + map.map[headRect.left]);\n\t\t\tif (anchorRect.bottom < map.height) $anchorCell = doc.resolve(tableStart + map.map[map.width * (map.height - 1) + anchorRect.right - 1]);\n\t\t}\n\t\treturn new CellSelection($anchorCell, $headCell);\n\t}\n\tisRowSelection() {\n\t\tconst table = this.$anchorCell.node(-1);\n\t\tconst map = TableMap.get(table);\n\t\tconst tableStart = this.$anchorCell.start(-1);\n\t\tconst anchorLeft = map.colCount(this.$anchorCell.pos - tableStart);\n\t\tconst headLeft = map.colCount(this.$headCell.pos - tableStart);\n\t\tif (Math.min(anchorLeft, headLeft) > 0) return false;\n\t\tconst anchorRight = anchorLeft + this.$anchorCell.nodeAfter.attrs.colspan;\n\t\tconst headRight = headLeft + this.$headCell.nodeAfter.attrs.colspan;\n\t\treturn Math.max(anchorRight, headRight) == map.width;\n\t}\n\teq(other) {\n\t\treturn other instanceof CellSelection && other.$anchorCell.pos == this.$anchorCell.pos && other.$headCell.pos == this.$headCell.pos;\n\t}\n\tstatic rowSelection($anchorCell, $headCell = $anchorCell) {\n\t\tconst table = $anchorCell.node(-1);\n\t\tconst map = TableMap.get(table);\n\t\tconst tableStart = $anchorCell.start(-1);\n\t\tconst anchorRect = map.findCell($anchorCell.pos - tableStart);\n\t\tconst headRect = map.findCell($headCell.pos - tableStart);\n\t\tconst doc = $anchorCell.node(0);\n\t\tif (anchorRect.left <= headRect.left) {\n\t\t\tif (anchorRect.left > 0) $anchorCell = doc.resolve(tableStart + map.map[anchorRect.top * map.width]);\n\t\t\tif (headRect.right < map.width) $headCell = doc.resolve(tableStart + map.map[map.width * (headRect.top + 1) - 1]);\n\t\t} else {\n\t\t\tif (headRect.left > 0) $headCell = doc.resolve(tableStart + map.map[headRect.top * map.width]);\n\t\t\tif (anchorRect.right < map.width) $anchorCell = doc.resolve(tableStart + map.map[map.width * (anchorRect.top + 1) - 1]);\n\t\t}\n\t\treturn new CellSelection($anchorCell, $headCell);\n\t}\n\ttoJSON() {\n\t\treturn {\n\t\t\ttype: \"cell\",\n\t\t\tanchor: this.$anchorCell.pos,\n\t\t\thead: this.$headCell.pos\n\t\t};\n\t}\n\tstatic fromJSON(doc, json) {\n\t\treturn new CellSelection(doc.resolve(json.anchor), doc.resolve(json.head));\n\t}\n\tstatic create(doc, anchorCell, headCell = anchorCell) {\n\t\treturn new CellSelection(doc.resolve(anchorCell), doc.resolve(headCell));\n\t}\n\tgetBookmark() {\n\t\treturn new CellBookmark(this.$anchorCell.pos, this.$headCell.pos);\n\t}\n};\nCellSelection.prototype.visible = false;\nSelection.jsonID(\"cell\", CellSelection);\n/**\n* @public\n*/\nvar CellBookmark = class CellBookmark {\n\tconstructor(anchor, head) {\n\t\tthis.anchor = anchor;\n\t\tthis.head = head;\n\t}\n\tmap(mapping) {\n\t\treturn new CellBookmark(mapping.map(this.anchor), mapping.map(this.head));\n\t}\n\tresolve(doc) {\n\t\tconst $anchorCell = doc.resolve(this.anchor), $headCell = doc.resolve(this.head);\n\t\tif ($anchorCell.parent.type.spec.tableRole == \"row\" && $headCell.parent.type.spec.tableRole == \"row\" && $anchorCell.index() < $anchorCell.parent.childCount && $headCell.index() < $headCell.parent.childCount && inSameTable($anchorCell, $headCell)) return new CellSelection($anchorCell, $headCell);\n\t\telse return Selection.near($headCell, 1);\n\t}\n};\nfunction drawCellSelection(state) {\n\tif (!(state.selection instanceof CellSelection)) return null;\n\tconst cells = [];\n\tstate.selection.forEachCell((node, pos) => {\n\t\tcells.push(Decoration.node(pos, pos + node.nodeSize, { class: \"selectedCell\" }));\n\t});\n\treturn DecorationSet.create(state.doc, cells);\n}\nfunction isCellBoundarySelection({ $from, $to }) {\n\tif ($from.pos == $to.pos || $from.pos < $to.pos - 6) return false;\n\tlet afterFrom = $from.pos;\n\tlet beforeTo = $to.pos;\n\tlet depth = $from.depth;\n\tfor (; depth >= 0; depth--, afterFrom++) if ($from.after(depth + 1) < $from.end(depth)) break;\n\tfor (let d = $to.depth; d >= 0; d--, beforeTo--) if ($to.before(d + 1) > $to.start(d)) break;\n\treturn afterFrom == beforeTo && /row|table/.test($from.node(depth).type.spec.tableRole);\n}\nfunction isTextSelectionAcrossCells({ $from, $to }) {\n\tlet fromCellBoundaryNode;\n\tlet toCellBoundaryNode;\n\tfor (let i = $from.depth; i > 0; i--) {\n\t\tconst node = $from.node(i);\n\t\tif (node.type.spec.tableRole === \"cell\" || node.type.spec.tableRole === \"header_cell\") {\n\t\t\tfromCellBoundaryNode = node;\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor (let i = $to.depth; i > 0; i--) {\n\t\tconst node = $to.node(i);\n\t\tif (node.type.spec.tableRole === \"cell\" || node.type.spec.tableRole === \"header_cell\") {\n\t\t\ttoCellBoundaryNode = node;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn fromCellBoundaryNode !== toCellBoundaryNode && $to.parentOffset === 0;\n}\nfunction normalizeSelection(state, tr, allowTableNodeSelection) {\n\tconst sel = (tr || state).selection;\n\tconst doc = (tr || state).doc;\n\tlet normalize;\n\tlet role;\n\tif (sel instanceof NodeSelection && (role = sel.node.type.spec.tableRole)) {\n\t\tif (role == \"cell\" || role == \"header_cell\") normalize = CellSelection.create(doc, sel.from);\n\t\telse if (role == \"row\") {\n\t\t\tconst $cell = doc.resolve(sel.from + 1);\n\t\t\tnormalize = CellSelection.rowSelection($cell, $cell);\n\t\t} else if (!allowTableNodeSelection) {\n\t\t\tconst map = TableMap.get(sel.node);\n\t\t\tconst start = sel.from + 1;\n\t\t\tconst lastCell = start + map.map[map.width * map.height - 1];\n\t\t\tnormalize = CellSelection.create(doc, start + 1, lastCell);\n\t\t}\n\t} else if (sel instanceof TextSelection && isCellBoundarySelection(sel)) normalize = TextSelection.create(doc, sel.from);\n\telse if (sel instanceof TextSelection && isTextSelectionAcrossCells(sel)) normalize = TextSelection.create(doc, sel.$from.start(), sel.$from.end());\n\tif (normalize) (tr || (tr = state.tr)).setSelection(normalize);\n\treturn tr;\n}\n\n//#endregion\n//#region src/fixtables.ts\n/**\n* @public\n*/\nconst fixTablesKey = new PluginKey(\"fix-tables\");\n/**\n* Helper for iterating through the nodes in a document that changed\n* compared to the given previous document. Useful for avoiding\n* duplicate work on each transaction.\n*\n* @public\n*/\nfunction changedDescendants(old, cur, offset, f) {\n\tconst oldSize = old.childCount, curSize = cur.childCount;\n\touter: for (let i = 0, j = 0; i < curSize; i++) {\n\t\tconst child = cur.child(i);\n\t\tfor (let scan = j, e = Math.min(oldSize, i + 3); scan < e; scan++) if (old.child(scan) == child) {\n\t\t\tj = scan + 1;\n\t\t\toffset += child.nodeSize;\n\t\t\tcontinue outer;\n\t\t}\n\t\tf(child, offset);\n\t\tif (j < oldSize && old.child(j).sameMarkup(child)) changedDescendants(old.child(j), child, offset + 1, f);\n\t\telse child.nodesBetween(0, child.content.size, f, offset + 1);\n\t\toffset += child.nodeSize;\n\t}\n}\n/**\n* Inspect all tables in the given state's document and return a\n* transaction that fixes them, if necessary. If `oldState` was\n* provided, that is assumed to hold a previous, known-good state,\n* which will be used to avoid re-scanning unchanged parts of the\n* document.\n*\n* @public\n*/\nfunction fixTables(state, oldState) {\n\tlet tr;\n\tconst check = (node, pos) => {\n\t\tif (node.type.spec.tableRole == \"table\") tr = fixTable(state, node, pos, tr);\n\t};\n\tif (!oldState) state.doc.descendants(check);\n\telse if (oldState.doc != state.doc) changedDescendants(oldState.doc, state.doc, 0, check);\n\treturn tr;\n}\nfunction fixTable(state, table, tablePos, tr) {\n\tconst map = TableMap.get(table);\n\tif (!map.problems) return tr;\n\tif (!tr) tr = state.tr;\n\tconst mustAdd = [];\n\tfor (let i = 0; i < map.height; i++) mustAdd.push(0);\n\tfor (let i = 0; i < map.problems.length; i++) {\n\t\tconst prob = map.problems[i];\n\t\tif (prob.type == \"collision\") {\n\t\t\tconst cell = table.nodeAt(prob.pos);\n\t\t\tif (!cell) continue;\n\t\t\tconst attrs = cell.attrs;\n\t\t\tfor (let j = 0; j < attrs.rowspan; j++) mustAdd[prob.row + j] += prob.n;\n\t\t\ttr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, removeColSpan(attrs, attrs.colspan - prob.n, prob.n));\n\t\t} else if (prob.type == \"missing\") mustAdd[prob.row] += prob.n;\n\t\telse if (prob.type == \"overlong_rowspan\") {\n\t\t\tconst cell = table.nodeAt(prob.pos);\n\t\t\tif (!cell) continue;\n\t\t\ttr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, {\n\t\t\t\t...cell.attrs,\n\t\t\t\trowspan: cell.attrs.rowspan - prob.n\n\t\t\t});\n\t\t} else if (prob.type == \"colwidth mismatch\") {\n\t\t\tconst cell = table.nodeAt(prob.pos);\n\t\t\tif (!cell) continue;\n\t\t\ttr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, {\n\t\t\t\t...cell.attrs,\n\t\t\t\tcolwidth: prob.colwidth\n\t\t\t});\n\t\t} else if (prob.type == \"zero_sized\") {\n\t\t\tconst pos = tr.mapping.map(tablePos);\n\t\t\ttr.delete(pos, pos + table.nodeSize);\n\t\t}\n\t}\n\tlet first, last;\n\tfor (let i = 0; i < mustAdd.length; i++) if (mustAdd[i]) {\n\t\tif (first == null) first = i;\n\t\tlast = i;\n\t}\n\tfor (let i = 0, pos = tablePos + 1; i < map.height; i++) {\n\t\tconst row = table.child(i);\n\t\tconst end = pos + row.nodeSize;\n\t\tconst add = mustAdd[i];\n\t\tif (add > 0) {\n\t\t\tlet role = \"cell\";\n\t\t\tif (row.firstChild) role = row.firstChild.type.spec.tableRole;\n\t\t\tconst nodes = [];\n\t\t\tfor (let j = 0; j < add; j++) {\n\t\t\t\tconst node = tableNodeTypes(state.schema)[role].createAndFill();\n\t\t\t\tif (node) nodes.push(node);\n\t\t\t}\n\t\t\tconst side = (i == 0 || first == i - 1) && last == i ? pos + 1 : end - 1;\n\t\t\ttr.insert(tr.mapping.map(side), nodes);\n\t\t}\n\t\tpos = end;\n\t}\n\treturn tr.setMeta(fixTablesKey, { fixTables: true });\n}\n\n//#endregion\n//#region src/utils/convert.ts\n/**\n* This function will transform the table node into a matrix of rows and columns\n* respecting merged cells, for example this table:\n*\n* ```\n* ┌──────┬──────┬─────────────┐\n* │ A1 │ B1 │ C1 │\n* ├──────┼──────┴──────┬──────┤\n* │ A2 │ B2 │ │\n* ├──────┼─────────────┤ D1 │\n* │ A3 │ B3 │ C3 │ │\n* └──────┴──────┴──────┴──────┘\n* ```\n*\n* will be converted to the below:\n*\n* ```javascript\n* [\n* [A1, B1, C1, null],\n* [A2, B2, null, D1],\n* [A3, B3, C3, null],\n* ]\n* ```\n* @internal\n*/\nfunction convertTableNodeToArrayOfRows(tableNode) {\n\tconst map = TableMap.get(tableNode);\n\tconst rows = [];\n\tconst rowCount = map.height;\n\tconst colCount$1 = map.width;\n\tfor (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n\t\tconst row = [];\n\t\tfor (let colIndex = 0; colIndex < colCount$1; colIndex++) {\n\t\t\tconst cellIndex = rowIndex * colCount$1 + colIndex;\n\t\t\tconst cellPos = map.map[cellIndex];\n\t\t\tif (rowIndex > 0) {\n\t\t\t\tconst topCellIndex = cellIndex - colCount$1;\n\t\t\t\tif (cellPos === map.map[topCellIndex]) {\n\t\t\t\t\trow.push(null);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (colIndex > 0) {\n\t\t\t\tconst leftCellIndex = cellIndex - 1;\n\t\t\t\tif (cellPos === map.map[leftCellIndex]) {\n\t\t\t\t\trow.push(null);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\trow.push(tableNode.nodeAt(cellPos));\n\t\t}\n\t\trows.push(row);\n\t}\n\treturn rows;\n}\n/**\n* Convert an array of rows to a table node.\n*\n* @internal\n*/\nfunction convertArrayOfRowsToTableNode(tableNode, arrayOfNodes) {\n\tconst newRows = [];\n\tconst map = TableMap.get(tableNode);\n\tconst rowCount = map.height;\n\tconst colCount$1 = map.width;\n\tfor (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n\t\tconst oldRow = tableNode.child(rowIndex);\n\t\tconst newCells = [];\n\t\tfor (let colIndex = 0; colIndex < colCount$1; colIndex++) {\n\t\t\tconst cell = arrayOfNodes[rowIndex][colIndex];\n\t\t\tif (!cell) continue;\n\t\t\tconst cellPos = map.map[rowIndex * map.width + colIndex];\n\t\t\tconst oldCell = tableNode.nodeAt(cellPos);\n\t\t\tif (!oldCell) continue;\n\t\t\tconst newCell = oldCell.type.createChecked(cell.attrs, cell.content, cell.marks);\n\t\t\tnewCells.push(newCell);\n\t\t}\n\t\tconst newRow = oldRow.type.createChecked(oldRow.attrs, newCells, oldRow.marks);\n\t\tnewRows.push(newRow);\n\t}\n\treturn tableNode.type.createChecked(tableNode.attrs, newRows, tableNode.marks);\n}\n\n//#endregion\n//#region src/utils/move-row-in-array-of-rows.ts\n/**\n* Move a row in an array of rows.\n*\n* @internal\n*/\nfunction moveRowInArrayOfRows(rows, indexesOrigin, indexesTarget, directionOverride) {\n\tconst direction = indexesOrigin[0] > indexesTarget[0] ? -1 : 1;\n\tconst rowsExtracted = rows.splice(indexesOrigin[0], indexesOrigin.length);\n\tconst positionOffset = rowsExtracted.length % 2 === 0 ? 1 : 0;\n\tlet target;\n\tif (directionOverride === -1 && direction === 1) target = indexesTarget[0] - 1;\n\telse if (directionOverride === 1 && direction === -1) target = indexesTarget[indexesTarget.length - 1] - positionOffset + 1;\n\telse target = direction === -1 ? indexesTarget[0] : indexesTarget[indexesTarget.length - 1] - positionOffset;\n\trows.splice(target, 0, ...rowsExtracted);\n\treturn rows;\n}\n\n//#endregion\n//#region src/utils/query.ts\n/**\n* Checks if the given object is a `CellSelection` instance.\n*\n* @internal\n*/\nfunction isCellSelection(value) {\n\treturn value instanceof CellSelection;\n}\n/**\n* Find the closest table node for a given position.\n*\n* @public\n*/\nfunction findTable($pos) {\n\treturn findParentNode((node) => node.type.spec.tableRole === \"table\", $pos);\n}\n/**\n* Try to find the anchor and head cell in the same table by using the given\n* anchor and head as hit points, or fallback to the selection's anchor and\n* head.\n*\n* @public\n*/\nfunction findCellRange(selection, anchorHit, headHit) {\n\tvar _ref, _ref2;\n\tif (anchorHit == null && headHit == null && isCellSelection(selection)) return [selection.$anchorCell, selection.$headCell];\n\tconst anchor = (_ref = anchorHit !== null && anchorHit !== void 0 ? anchorHit : headHit) !== null && _ref !== void 0 ? _ref : selection.anchor;\n\tconst head = (_ref2 = headHit !== null && headHit !== void 0 ? headHit : anchorHit) !== null && _ref2 !== void 0 ? _ref2 : selection.head;\n\tconst doc = selection.$head.doc;\n\tconst $anchorCell = findCellPos(doc, anchor);\n\tconst $headCell = findCellPos(doc, head);\n\tif ($anchorCell && $headCell && inSameTable($anchorCell, $headCell)) return [$anchorCell, $headCell];\n\treturn null;\n}\n/**\n* Try to find a resolved pos of a cell by using the given pos as a hit point.\n*\n* @public\n*/\nfunction findCellPos(doc, pos) {\n\tconst $pos = doc.resolve(pos);\n\treturn cellAround($pos) || cellNear($pos);\n}\n/**\n* Find the closest parent node that satisfies the predicate.\n*\n* @internal\n*/\nfunction findParentNode(predicate, $pos) {\n\tfor (let depth = $pos.depth; depth >= 0; depth -= 1) {\n\t\tconst node = $pos.node(depth);\n\t\tif (predicate(node)) return {\n\t\t\tnode,\n\t\t\tpos: depth === 0 ? 0 : $pos.before(depth),\n\t\t\tstart: $pos.start(depth),\n\t\t\tdepth\n\t\t};\n\t}\n\treturn null;\n}\n\n//#endregion\n//#region src/utils/get-cells.ts\n/**\n* Returns an array of cells in a column at the specified column index.\n*\n* @internal\n*/\nfunction getCellsInColumn(columnIndex, selection) {\n\tconst table = findTable(selection.$from);\n\tif (!table) return;\n\tconst map = TableMap.get(table.node);\n\tif (columnIndex < 0 || columnIndex > map.width - 1) return;\n\treturn map.cellsInRect({\n\t\tleft: columnIndex,\n\t\tright: columnIndex + 1,\n\t\ttop: 0,\n\t\tbottom: map.height\n\t}).map((nodePos) => {\n\t\tconst node = table.node.nodeAt(nodePos);\n\t\tconst pos = nodePos + table.start;\n\t\treturn {\n\t\t\tpos,\n\t\t\tstart: pos + 1,\n\t\t\tnode,\n\t\t\tdepth: table.depth + 2\n\t\t};\n\t});\n}\n/**\n* Returns an array of cells in a row at the specified row index.\n*\n* @internal\n*/\nfunction getCellsInRow(rowIndex, selection) {\n\tconst table = findTable(selection.$from);\n\tif (!table) return;\n\tconst map = TableMap.get(table.node);\n\tif (rowIndex < 0 || rowIndex > map.height - 1) return;\n\treturn map.cellsInRect({\n\t\tleft: 0,\n\t\tright: map.width,\n\t\ttop: rowIndex,\n\t\tbottom: rowIndex + 1\n\t}).map((nodePos) => {\n\t\tconst node = table.node.nodeAt(nodePos);\n\t\tconst pos = nodePos + table.start;\n\t\treturn {\n\t\t\tpos,\n\t\t\tstart: pos + 1,\n\t\t\tnode,\n\t\t\tdepth: table.depth + 2\n\t\t};\n\t});\n}\n\n//#endregion\n//#region src/utils/selection-range.ts\n/**\n* Returns a range of rectangular selection spanning all merged cells around a\n* column at index `columnIndex`.\n*\n* Original implementation from Atlassian (Apache License 2.0)\n*\n* https://bitbucket.org/atlassian/atlassian-frontend-mirror/src/5f91cb871e8248bc3bae5ddc30bb9fd9200fadbb/editor/editor-tables/src/utils/get-selection-range-in-column.ts#editor/editor-tables/src/utils/get-selection-range-in-column.ts\n*\n* @internal\n*/\nfunction getSelectionRangeInColumn(tr, startColIndex, endColIndex = startColIndex) {\n\tlet startIndex = startColIndex;\n\tlet endIndex = endColIndex;\n\tfor (let i = startColIndex; i >= 0; i--) {\n\t\tconst cells = getCellsInColumn(i, tr.selection);\n\t\tif (cells) cells.forEach((cell) => {\n\t\t\tconst maybeEndIndex = cell.node.attrs.colspan + i - 1;\n\t\t\tif (maybeEndIndex >= startIndex) startIndex = i;\n\t\t\tif (maybeEndIndex > endIndex) endIndex = maybeEndIndex;\n\t\t});\n\t}\n\tfor (let i = startColIndex; i <= endIndex; i++) {\n\t\tconst cells = getCellsInColumn(i, tr.selection);\n\t\tif (cells) cells.forEach((cell) => {\n\t\t\tconst maybeEndIndex = cell.node.attrs.colspan + i - 1;\n\t\t\tif (cell.node.attrs.colspan > 1 && maybeEndIndex > endIndex) endIndex = maybeEndIndex;\n\t\t});\n\t}\n\tconst indexes = [];\n\tfor (let i = startIndex; i <= endIndex; i++) {\n\t\tconst maybeCells = getCellsInColumn(i, tr.selection);\n\t\tif (maybeCells && maybeCells.length > 0) indexes.push(i);\n\t}\n\tstartIndex = indexes[0];\n\tendIndex = indexes[indexes.length - 1];\n\tconst firstSelectedColumnCells = getCellsInColumn(startIndex, tr.selection);\n\tconst firstRowCells = getCellsInRow(0, tr.selection);\n\tif (!firstSelectedColumnCells || !firstRowCells) return;\n\tconst $anchor = tr.doc.resolve(firstSelectedColumnCells[firstSelectedColumnCells.length - 1].pos);\n\tlet headCell;\n\tfor (let i = endIndex; i >= startIndex; i--) {\n\t\tconst columnCells = getCellsInColumn(i, tr.selection);\n\t\tif (columnCells && columnCells.length > 0) {\n\t\t\tfor (let j = firstRowCells.length - 1; j >= 0; j--) if (firstRowCells[j].pos === columnCells[0].pos) {\n\t\t\t\theadCell = columnCells[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (headCell) break;\n\t\t}\n\t}\n\tif (!headCell) return;\n\treturn {\n\t\t$anchor,\n\t\t$head: tr.doc.resolve(headCell.pos),\n\t\tindexes\n\t};\n}\n/**\n* Returns a range of rectangular selection spanning all merged cells around a\n* row at index `rowIndex`.\n*\n* Original implementation from Atlassian (Apache License 2.0)\n*\n* https://bitbucket.org/atlassian/atlassian-frontend-mirror/src/5f91cb871e8248bc3bae5ddc30bb9fd9200fadbb/editor/editor-tables/src/utils/get-selection-range-in-row.ts#editor/editor-tables/src/utils/get-selection-range-in-row.ts\n*\n* @internal\n*/\nfunction getSelectionRangeInRow(tr, startRowIndex, endRowIndex = startRowIndex) {\n\tlet startIndex = startRowIndex;\n\tlet endIndex = endRowIndex;\n\tfor (let i = startRowIndex; i >= 0; i--) {\n\t\tconst cells = getCellsInRow(i, tr.selection);\n\t\tif (cells) cells.forEach((cell) => {\n\t\t\tconst maybeEndIndex = cell.node.attrs.rowspan + i - 1;\n\t\t\tif (maybeEndIndex >= startIndex) startIndex = i;\n\t\t\tif (maybeEndIndex > endIndex) endIndex = maybeEndIndex;\n\t\t});\n\t}\n\tfor (let i = startRowIndex; i <= endIndex; i++) {\n\t\tconst cells = getCellsInRow(i, tr.selection);\n\t\tif (cells) cells.forEach((cell) => {\n\t\t\tconst maybeEndIndex = cell.node.attrs.rowspan + i - 1;\n\t\t\tif (cell.node.attrs.rowspan > 1 && maybeEndIndex > endIndex) endIndex = maybeEndIndex;\n\t\t});\n\t}\n\tconst indexes = [];\n\tfor (let i = startIndex; i <= endIndex; i++) {\n\t\tconst maybeCells = getCellsInRow(i, tr.selection);\n\t\tif (maybeCells && maybeCells.length > 0) indexes.push(i);\n\t}\n\tstartIndex = indexes[0];\n\tendIndex = indexes[indexes.length - 1];\n\tconst firstSelectedRowCells = getCellsInRow(startIndex, tr.selection);\n\tconst firstColumnCells = getCellsInColumn(0, tr.selection);\n\tif (!firstSelectedRowCells || !firstColumnCells) return;\n\tconst $anchor = tr.doc.resolve(firstSelectedRowCells[firstSelectedRowCells.length - 1].pos);\n\tlet headCell;\n\tfor (let i = endIndex; i >= startIndex; i--) {\n\t\tconst rowCells = getCellsInRow(i, tr.selection);\n\t\tif (rowCells && rowCells.length > 0) {\n\t\t\tfor (let j = firstColumnCells.length - 1; j >= 0; j--) if (firstColumnCells[j].pos === rowCells[0].pos) {\n\t\t\t\theadCell = rowCells[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (headCell) break;\n\t\t}\n\t}\n\tif (!headCell) return;\n\treturn {\n\t\t$anchor,\n\t\t$head: tr.doc.resolve(headCell.pos),\n\t\tindexes\n\t};\n}\n\n//#endregion\n//#region src/utils/transpose.ts\n/**\n* Transposes a 2D array by flipping columns to rows.\n*\n* Transposition is a familiar algebra concept where the matrix is flipped\n* along its diagonal. For more details, see:\n* https://en.wikipedia.org/wiki/Transpose\n*\n* @example\n* ```javascript\n* const arr = [\n* ['a1', 'a2', 'a3'],\n* ['b1', 'b2', 'b3'],\n* ['c1', 'c2', 'c3'],\n* ['d1', 'd2', 'd3'],\n* ];\n*\n* const result = transpose(arr);\n* result === [\n* ['a1', 'b1', 'c1', 'd1'],\n* ['a2', 'b2', 'c2', 'd2'],\n* ['a3', 'b3', 'c3', 'd3'],\n* ]\n* ```\n*/\nfunction transpose(array) {\n\treturn array[0].map((_, i) => {\n\t\treturn array.map((column) => column[i]);\n\t});\n}\n\n//#endregion\n//#region src/utils/move-column.ts\n/**\n* Move a column from index `origin` to index `target`.\n*\n* @internal\n*/\nfunction moveColumn(moveColParams) {\n\tvar _getSelectionRangeInC, _getSelectionRangeInC2;\n\tconst { tr, originIndex, targetIndex, select, pos } = moveColParams;\n\tconst table = findTable(tr.doc.resolve(pos));\n\tif (!table) return false;\n\tconst indexesOriginColumn = (_getSelectionRangeInC = getSelectionRangeInColumn(tr, originIndex)) === null || _getSelectionRangeInC === void 0 ? void 0 : _getSelectionRangeInC.indexes;\n\tconst indexesTargetColumn = (_getSelectionRangeInC2 = getSelectionRangeInColumn(tr, targetIndex)) === null || _getSelectionRangeInC2 === void 0 ? void 0 : _getSelectionRangeInC2.indexes;\n\tif (!indexesOriginColumn || !indexesTargetColumn) return false;\n\tif (indexesOriginColumn.includes(targetIndex)) return false;\n\tconst newTable = moveTableColumn$1(table.node, indexesOriginColumn, indexesTargetColumn, 0);\n\ttr.replaceWith(table.pos, table.pos + table.node.nodeSize, newTable);\n\tif (!select) return true;\n\tconst map = TableMap.get(newTable);\n\tconst start = table.start;\n\tconst index = targetIndex;\n\tconst lastCell = map.positionAt(map.height - 1, index, newTable);\n\tconst $lastCell = tr.doc.resolve(start + lastCell);\n\tconst firstCell = map.positionAt(0, index, newTable);\n\tconst $firstCell = tr.doc.resolve(start + firstCell);\n\ttr.setSelection(CellSelection.colSelection($lastCell, $firstCell));\n\treturn true;\n}\nfunction moveTableColumn$1(table, indexesOrigin, indexesTarget, direction) {\n\tlet rows = transpose(convertTableNodeToArrayOfRows(table));\n\trows = moveRowInArrayOfRows(rows, indexesOrigin, indexesTarget, direction);\n\trows = transpose(rows);\n\treturn convertArrayOfRowsToTableNode(table, rows);\n}\n\n//#endregion\n//#region src/utils/move-row.ts\n/**\n* Move a row from index `origin` to index `target`.\n*\n* @internal\n*/\nfunction moveRow(moveRowParams) {\n\tvar _getSelectionRangeInR, _getSelectionRangeInR2;\n\tconst { tr, originIndex, targetIndex, select, pos } = moveRowParams;\n\tconst table = findTable(tr.doc.resolve(pos));\n\tif (!table) return false;\n\tconst indexesOriginRow = (_getSelectionRangeInR = getSelectionRangeInRow(tr, originIndex)) === null || _getSelectionRangeInR === void 0 ? void 0 : _getSelectionRangeInR.indexes;\n\tconst indexesTargetRow = (_getSelectionRangeInR2 = getSelectionRangeInRow(tr, targetIndex)) === null || _getSelectionRangeInR2 === void 0 ? void 0 : _getSelectionRangeInR2.indexes;\n\tif (!indexesOriginRow || !indexesTargetRow) return false;\n\tif (indexesOriginRow.includes(targetIndex)) return false;\n\tconst newTable = moveTableRow$1(table.node, indexesOriginRow, indexesTargetRow, 0);\n\ttr.replaceWith(table.pos, table.pos + table.node.nodeSize, newTable);\n\tif (!select) return true;\n\tconst map = TableMap.get(newTable);\n\tconst start = table.start;\n\tconst index = targetIndex;\n\tconst lastCell = map.positionAt(index, map.width - 1, newTable);\n\tconst $lastCell = tr.doc.resolve(start + lastCell);\n\tconst firstCell = map.positionAt(index, 0, newTable);\n\tconst $firstCell = tr.doc.resolve(start + firstCell);\n\ttr.setSelection(CellSelection.rowSelection($lastCell, $firstCell));\n\treturn true;\n}\nfunction moveTableRow$1(table, indexesOrigin, indexesTarget, direction) {\n\tlet rows = convertTableNodeToArrayOfRows(table);\n\trows = moveRowInArrayOfRows(rows, indexesOrigin, indexesTarget, direction);\n\treturn convertArrayOfRowsToTableNode(table, rows);\n}\n\n//#endregion\n//#region src/commands.ts\n/**\n* Helper to get the selected rectangle in a table, if any. Adds table\n* map, table node, and table start offset to the object for\n* convenience.\n*\n* @public\n*/\nfunction selectedRect(state) {\n\tconst sel = state.selection;\n\tconst $pos = selectionCell(state);\n\tconst table = $pos.node(-1);\n\tconst tableStart = $pos.start(-1);\n\tconst map = TableMap.get(table);\n\treturn {\n\t\t...sel instanceof CellSelection ? map.rectBetween(sel.$anchorCell.pos - tableStart, sel.$headCell.pos - tableStart) : map.findCell($pos.pos - tableStart),\n\t\ttableStart,\n\t\tmap,\n\t\ttable\n\t};\n}\n/**\n* Add a column at the given position in a table.\n*\n* @public\n*/\nfunction addColumn(tr, { map, tableStart, table }, col) {\n\tlet refColumn = col > 0 ? -1 : 0;\n\tif (columnIsHeader(map, table, col + refColumn)) refColumn = col == 0 || col == map.width ? null : 0;\n\tfor (let row = 0; row < map.height; row++) {\n\t\tconst index = row * map.width + col;\n\t\tif (col > 0 && col < map.width && map.map[index - 1] == map.map[index]) {\n\t\t\tconst pos = map.map[index];\n\t\t\tconst cell = table.nodeAt(pos);\n\t\t\ttr.setNodeMarkup(tr.mapping.map(tableStart + pos), null, addColSpan(cell.attrs, col - map.colCount(pos)));\n\t\t\trow += cell.attrs.rowspan - 1;\n\t\t} else {\n\t\t\tconst type = refColumn == null ? tableNodeTypes(table.type.schema).cell : table.nodeAt(map.map[index + refColumn]).type;\n\t\t\tconst pos = map.positionAt(row, col, table);\n\t\t\ttr.insert(tr.mapping.map(tableStart + pos), type.createAndFill());\n\t\t}\n\t}\n\treturn tr;\n}\n/**\n* Command to add a column before the column with the selection.\n*\n* @public\n*/\nfunction addColumnBefore(state, dispatch) {\n\tif (!isInTable(state)) return false;\n\tif (dispatch) {\n\t\tconst rect = selectedRect(state);\n\t\tdispatch(addColumn(state.tr, rect, rect.left));\n\t}\n\treturn true;\n}\n/**\n* Command to add a column after the column with the selection.\n*\n* @public\n*/\nfunction addColumnAfter(state, dispatch) {\n\tif (!isInTable(state)) return false;\n\tif (dispatch) {\n\t\tconst rect = selectedRect(state);\n\t\tdispatch(addColumn(state.tr, rect, rect.right));\n\t}\n\treturn true;\n}\n/**\n* @public\n*/\nfunction removeColumn(tr, { map, table, tableStart }, col) {\n\tconst mapStart = tr.mapping.maps.length;\n\tfor (let row = 0; row < map.height;) {\n\t\tconst index = row * map.width + col;\n\t\tconst pos = map.map[index];\n\t\tconst cell = table.nodeAt(pos);\n\t\tconst attrs = cell.attrs;\n\t\tif (col > 0 && map.map[index - 1] == pos || col < map.width - 1 && map.map[index + 1] == pos) tr.setNodeMarkup(tr.mapping.slice(mapStart).map(tableStart + pos), null, removeColSpan(attrs, col - map.colCount(pos)));\n\t\telse {\n\t\t\tconst start = tr.mapping.slice(mapStart).map(tableStart + pos);\n\t\t\ttr.delete(start, start + cell.nodeSize);\n\t\t}\n\t\trow += attrs.rowspan;\n\t}\n}\n/**\n* Command function that removes the selected columns from a table.\n*\n* @public\n*/\nfunction deleteColumn(state, dispatch) {\n\tif (!isInTable(state)) return false;\n\tif (dispatch) {\n\t\tconst rect = selectedRect(state);\n\t\tconst tr = state.tr;\n\t\tif (rect.left == 0 && rect.right == rect.map.width) return false;\n\t\tfor (let i = rect.right - 1;; i--) {\n\t\t\tremoveColumn(tr, rect, i);\n\t\t\tif (i == rect.left) break;\n\t\t\tconst table = rect.tableStart ? tr.doc.nodeAt(rect.tableStart - 1) : tr.doc;\n\t\t\tif (!table) throw new RangeError(\"No table found\");\n\t\t\trect.table = table;\n\t\t\trect.map = TableMap.get(table);\n\t\t}\n\t\tdispatch(tr);\n\t}\n\treturn true;\n}\n/**\n* @public\n*/\nfunction rowIsHeader(map, table, row) {\n\tvar _table$nodeAt;\n\tconst headerCell = tableNodeTypes(table.type.schema).header_cell;\n\tfor (let col = 0; col < map.width; col++) if (((_table$nodeAt = table.nodeAt(map.map[col + row * map.width])) === null || _table$nodeAt === void 0 ? void 0 : _table$nodeAt.type) != headerCell) return false;\n\treturn true;\n}\n/**\n* @public\n*/\nfunction addRow(tr, { map, tableStart, table }, row) {\n\tlet rowPos = tableStart;\n\tfor (let i = 0; i < row; i++) rowPos += table.child(i).nodeSize;\n\tconst cells = [];\n\tlet refRow = row > 0 ? -1 : 0;\n\tif (rowIsHeader(map, table, row + refRow)) refRow = row == 0 || row == map.height ? null : 0;\n\tfor (let col = 0, index = map.width * row; col < map.width; col++, index++) if (row > 0 && row < map.height && map.map[index] == map.map[index - map.width]) {\n\t\tconst pos = map.map[index];\n\t\tconst attrs = table.nodeAt(pos).attrs;\n\t\ttr.setNodeMarkup(tableStart + pos, null, {\n\t\t\t...attrs,\n\t\t\trowspan: attrs.rowspan + 1\n\t\t});\n\t\tcol += attrs.colspan - 1;\n\t} else {\n\t\tvar _table$nodeAt2;\n\t\tconst type = refRow == null ? tableNodeTypes(table.type.schema).cell : (_table$nodeAt2 = table.nodeAt(map.map[index + refRow * map.width])) === null || _table$nodeAt2 === void 0 ? void 0 : _table$nodeAt2.type;\n\t\tconst node = type === null || type === void 0 ? void 0 : type.createAndFill();\n\t\tif (node) cells.push(node);\n\t}\n\ttr.insert(rowPos, tableNodeTypes(table.type.schema).row.create(null, cells));\n\treturn tr;\n}\n/**\n* Add a table row before the selection.\n*\n* @public\n*/\nfunction addRowBefore(state, dispatch) {\n\tif (!isInTable(state)) return false;\n\tif (dispatch) {\n\t\tconst rect = selectedRect(state);\n\t\tdispatch(addRow(state.tr, rect, rect.top));\n\t}\n\treturn true;\n}\n/**\n* Add a table row after the selection.\n*\n* @public\n*/\nfunction addRowAfter(state, dispatch) {\n\tif (!isInTable(state)) return false;\n\tif (dispatch) {\n\t\tconst rect = selectedRect(state);\n\t\tdispatch(addRow(state.tr, rect, rect.bottom));\n\t}\n\treturn true;\n}\n/**\n* @public\n*/\nfunction removeRow(tr, { map, table, tableStart }, row) {\n\tlet rowPos = 0;\n\tfor (let i = 0; i < row; i++) rowPos += table.child(i).nodeSize;\n\tconst nextRow = rowPos + table.child(row).nodeSize;\n\tconst mapFrom = tr.mapping.maps.length;\n\ttr.delete(rowPos + tableStart, nextRow + tableStart);\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (let col = 0, index = row * map.width; col < map.width; col++, index++) {\n\t\tconst pos = map.map[index];\n\t\tif (seen.has(pos)) continue;\n\t\tseen.add(pos);\n\t\tif (row > 0 && pos == map.map[index - map.width]) {\n\t\t\tconst attrs = table.nodeAt(pos).attrs;\n\t\t\ttr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos + tableStart), null, {\n\t\t\t\t...attrs,\n\t\t\t\trowspan: attrs.rowspan - 1\n\t\t\t});\n\t\t\tcol += attrs.colspan - 1;\n\t\t} else if (row < map.height && pos == map.map[index + map.width]) {\n\t\t\tconst cell = table.nodeAt(pos);\n\t\t\tconst attrs = cell.attrs;\n\t\t\tconst copy = cell.type.create({\n\t\t\t\t...attrs,\n\t\t\t\trowspan: cell.attrs.rowspan - 1\n\t\t\t}, cell.content);\n\t\t\tconst newPos = map.positionAt(row + 1, col, table);\n\t\t\ttr.insert(tr.mapping.slice(mapFrom).map(tableStart + newPos), copy);\n\t\t\tcol += attrs.colspan - 1;\n\t\t}\n\t}\n}\n/**\n* Remove the selected rows from a table.\n*\n* @public\n*/\nfunction deleteRow(state, dispatch) {\n\tif (!isInTable(state)) return false;\n\tif (dispatch) {\n\t\tconst rect = selectedRect(state), tr = state.tr;\n\t\tif (rect.top == 0 && rect.bottom == rect.map.height) return false;\n\t\tfor (let i = rect.bottom - 1;; i--) {\n\t\t\tremoveRow(tr, rect, i);\n\t\t\tif (i == rect.top) break;\n\t\t\tconst table = rect.tableStart ? tr.doc.nodeAt(rect.tableStart - 1) : tr.doc;\n\t\t\tif (!table) throw new RangeError(\"No table found\");\n\t\t\trect.table = table;\n\t\t\trect.map = TableMap.get(rect.table);\n\t\t}\n\t\tdispatch(tr);\n\t}\n\treturn true;\n}\nfunction isEmpty(cell) {\n\tconst c = cell.content;\n\treturn c.childCount == 1 && c.child(0).isTextblock && c.child(0).childCount == 0;\n}\nfunction cellsOverlapRectangle({ width, height, map }, rect) {\n\tlet indexTop = rect.top * width + rect.left, indexLeft = indexTop;\n\tlet indexBottom = (rect.bottom - 1) * width + rect.left, indexRight = indexTop + (rect.right - rect.left - 1);\n\tfor (let i = rect.top; i < rect.bottom; i++) {\n\t\tif (rect.left > 0 && map[indexLeft] == map[indexLeft - 1] || rect.right < width && map[indexRight] == map[indexRight + 1]) return true;\n\t\tindexLeft += width;\n\t\tindexRight += width;\n\t}\n\tfor (let i = rect.left; i < rect.right; i++) {\n\t\tif (rect.top > 0 && map[indexTop] == map[indexTop - width] || rect.bottom < height && map[indexBottom] == map[indexBottom + width]) return true;\n\t\tindexTop++;\n\t\tindexBottom++;\n\t}\n\treturn false;\n}\n/**\n* Merge the selected cells into a single cell. Only available when\n* the selected cells' outline forms a rectangle.\n*\n* @public\n*/\nfunction mergeCells(state, dispatch) {\n\tconst sel = state.selection;\n\tif (!(sel instanceof CellSelection) || sel.$anchorCell.pos == sel.$headCell.pos) return false;\n\tconst rect = selectedRect(state), { map } = rect;\n\tif (cellsOverlapRectangle(map, rect)) return false;\n\tif (dispatch) {\n\t\tconst tr = state.tr;\n\t\tconst seen = {};\n\t\tlet content = Fragment.empty;\n\t\tlet mergedPos;\n\t\tlet mergedCell;\n\t\tfor (let row = rect.top; row < rect.bottom; row++) for (let col = rect.left; col < rect.right; col++) {\n\t\t\tconst cellPos = map.map[row * map.width + col];\n\t\t\tconst cell = rect.table.nodeAt(cellPos);\n\t\t\tif (seen[cellPos] || !cell) continue;\n\t\t\tseen[cellPos] = true;\n\t\t\tif (mergedPos == null) {\n\t\t\t\tmergedPos = cellPos;\n\t\t\t\tmergedCell = cell;\n\t\t\t} else {\n\t\t\t\tif (!isEmpty(cell)) content = content.append(cell.content);\n\t\t\t\tconst mapped = tr.mapping.map(cellPos + rect.tableStart);\n\t\t\t\ttr.delete(mapped, mapped + cell.nodeSize);\n\t\t\t}\n\t\t}\n\t\tif (mergedPos == null || mergedCell == null) return true;\n\t\ttr.setNodeMarkup(mergedPos + rect.tableStart, null, {\n\t\t\t...addColSpan(mergedCell.attrs, mergedCell.attrs.colspan, rect.right - rect.left - mergedCell.attrs.colspan),\n\t\t\trowspan: rect.bottom - rect.top\n\t\t});\n\t\tif (content.size > 0) {\n\t\t\tconst end = mergedPos + 1 + mergedCell.content.size;\n\t\t\tconst start = isEmpty(mergedCell) ? mergedPos + 1 : end;\n\t\t\ttr.replaceWith(start + rect.tableStart, end + rect.tableStart, content);\n\t\t}\n\t\ttr.setSelection(new CellSelection(tr.doc.resolve(mergedPos + rect.tableStart)));\n\t\tdispatch(tr);\n\t}\n\treturn true;\n}\n/**\n* Split a selected cell, whose rowpan or colspan is greater than one,\n* into smaller cells. Use the first cell type for the new cells.\n*\n* @public\n*/\nfunction splitCell(state, dispatch) {\n\tconst nodeTypes = tableNodeTypes(state.schema);\n\treturn splitCellWithType(({ node }) => {\n\t\treturn nodeTypes[node.type.spec.tableRole];\n\t})(state, dispatch);\n}\n/**\n* Split a selected cell, whose rowpan or colspan is greater than one,\n* into smaller cells with the cell type (th, td) returned by getType function.\n*\n* @public\n*/\nfunction splitCellWithType(getCellType) {\n\treturn (state, dispatch) => {\n\t\tconst sel = state.selection;\n\t\tlet cellNode;\n\t\tlet cellPos;\n\t\tif (!(sel instanceof CellSelection)) {\n\t\t\tvar _cellAround;\n\t\t\tcellNode = cellWrapping(sel.$from);\n\t\t\tif (!cellNode) return false;\n\t\t\tcellPos = (_cellAround = cellAround(sel.$from)) === null || _cellAround === void 0 ? void 0 : _cellAround.pos;\n\t\t} else {\n\t\t\tif (sel.$anchorCell.pos != sel.$headCell.pos) return false;\n\t\t\tcellNode = sel.$anchorCell.nodeAfter;\n\t\t\tcellPos = sel.$anchorCell.pos;\n\t\t}\n\t\tif (cellNode == null || cellPos == null) return false;\n\t\tif (cellNode.attrs.colspan == 1 && cellNode.attrs.rowspan == 1) return false;\n\t\tif (dispatch) {\n\t\t\tlet baseAttrs = cellNode.attrs;\n\t\t\tconst attrs = [];\n\t\t\tconst colwidth = baseAttrs.colwidth;\n\t\t\tif (baseAttrs.rowspan > 1) baseAttrs = {\n\t\t\t\t...baseAttrs,\n\t\t\t\trowspan: 1\n\t\t\t};\n\t\t\tif (baseAttrs.colspan > 1) baseAttrs = {\n\t\t\t\t...baseAttrs,\n\t\t\t\tcolspan: 1\n\t\t\t};\n\t\t\tconst rect = selectedRect(state), tr = state.tr;\n\t\t\tfor (let i = 0; i < rect.right - rect.left; i++) attrs.push(colwidth ? {\n\t\t\t\t...baseAttrs,\n\t\t\t\tcolwidth: colwidth && colwidth[i] ? [colwidth[i]] : null\n\t\t\t} : baseAttrs);\n\t\t\tlet lastCell;\n\t\t\tfor (let row = rect.top; row < rect.bottom; row++) {\n\t\t\t\tlet pos = rect.map.positionAt(row, rect.left, rect.table);\n\t\t\t\tif (row == rect.top) pos += cellNode.nodeSize;\n\t\t\t\tfor (let col = rect.left, i = 0; col < rect.right; col++, i++) {\n\t\t\t\t\tif (col == rect.left && row == rect.top) continue;\n\t\t\t\t\ttr.insert(lastCell = tr.mapping.map(pos + rect.tableStart, 1), getCellType({\n\t\t\t\t\t\tnode: cellNode,\n\t\t\t\t\t\trow,\n\t\t\t\t\t\tcol\n\t\t\t\t\t}).createAndFill(attrs[i]));\n\t\t\t\t}\n\t\t\t}\n\t\t\ttr.setNodeMarkup(cellPos, getCellType({\n\t\t\t\tnode: cellNode,\n\t\t\t\trow: rect.top,\n\t\t\t\tcol: rect.left\n\t\t\t}), attrs[0]);\n\t\t\tif (sel instanceof CellSelection) tr.setSelection(new CellSelection(tr.doc.resolve(sel.$anchorCell.pos), lastCell ? tr.doc.resolve(lastCell) : void 0));\n\t\t\tdispatch(tr);\n\t\t}\n\t\treturn true;\n\t};\n}\n/**\n* Returns a command that sets the given attribute to the given value,\n* and is only available when the currently selected cell doesn't\n* already have that attribute set to that value.\n*\n* @public\n*/\nfunction setCellAttr(name, value) {\n\treturn function(state, dispatch) {\n\t\tif (!isInTable(state)) return false;\n\t\tconst $cell = selectionCell(state);\n\t\tif ($cell.nodeAfter.attrs[name] === value) return false;\n\t\tif (dispatch) {\n\t\t\tconst tr = state.tr;\n\t\t\tif (state.selection instanceof CellSelection) state.selection.forEachCell((node, pos) => {\n\t\t\t\tif (node.attrs[name] !== value) tr.setNodeMarkup(pos, null, {\n\t\t\t\t\t...node.attrs,\n\t\t\t\t\t[name]: value\n\t\t\t\t});\n\t\t\t});\n\t\t\telse tr.setNodeMarkup($cell.pos, null, {\n\t\t\t\t...$cell.nodeAfter.attrs,\n\t\t\t\t[name]: value\n\t\t\t});\n\t\t\tdispatch(tr);\n\t\t}\n\t\treturn true;\n\t};\n}\nfunction deprecated_toggleHeader(type) {\n\treturn function(state, dispatch) {\n\t\tif (!isInTable(state)) return false;\n\t\tif (dispatch) {\n\t\t\tconst types = tableNodeTypes(state.schema);\n\t\t\tconst rect = selectedRect(state), tr = state.tr;\n\t\t\tconst cells = rect.map.cellsInRect(type == \"column\" ? {\n\t\t\t\tleft: rect.left,\n\t\t\t\ttop: 0,\n\t\t\t\tright: rect.right,\n\t\t\t\tbottom: rect.map.height\n\t\t\t} : type == \"row\" ? {\n\t\t\t\tleft: 0,\n\t\t\t\ttop: rect.top,\n\t\t\t\tright: rect.map.width,\n\t\t\t\tbottom: rect.bottom\n\t\t\t} : rect);\n\t\t\tconst nodes = cells.map((pos) => rect.table.nodeAt(pos));\n\t\t\tfor (let i = 0; i < cells.length; i++) if (nodes[i].type == types.header_cell) tr.setNodeMarkup(rect.tableStart + cells[i], types.cell, nodes[i].attrs);\n\t\t\tif (tr.steps.length === 0) for (let i = 0; i < cells.length; i++) tr.setNodeMarkup(rect.tableStart + cells[i], types.header_cell, nodes[i].attrs);\n\t\t\tdispatch(tr);\n\t\t}\n\t\treturn true;\n\t};\n}\nfunction isHeaderEnabledByType(type, rect, types) {\n\tconst cellPositions = rect.map.cellsInRect({\n\t\tleft: 0,\n\t\ttop: 0,\n\t\tright: type == \"row\" ? rect.map.width : 1,\n\t\tbottom: type == \"column\" ? rect.map.height : 1\n\t});\n\tfor (let i = 0; i < cellPositions.length; i++) {\n\t\tconst cell = rect.table.nodeAt(cellPositions[i]);\n\t\tif (cell && cell.type !== types.header_cell) return false;\n\t}\n\treturn true;\n}\n/**\n* Toggles between row/column header and normal cells (Only applies to first row/column).\n* For deprecated behavior pass `useDeprecatedLogic` in options with true.\n*\n* @public\n*/\nfunction toggleHeader(type, options) {\n\toptions = options || { useDeprecatedLogic: false };\n\tif (options.useDeprecatedLogic) return deprecated_toggleHeader(type);\n\treturn function(state, dispatch) {\n\t\tif (!isInTable(state)) return false;\n\t\tif (dispatch) {\n\t\t\tconst types = tableNodeTypes(state.schema);\n\t\t\tconst rect = selectedRect(state), tr = state.tr;\n\t\t\tconst isHeaderRowEnabled = isHeaderEnabledByType(\"row\", rect, types);\n\t\t\tconst isHeaderColumnEnabled = isHeaderEnabledByType(\"column\", rect, types);\n\t\t\tconst selectionStartsAt = (type === \"column\" ? isHeaderRowEnabled : type === \"row\" ? isHeaderColumnEnabled : false) ? 1 : 0;\n\t\t\tconst cellsRect = type == \"column\" ? {\n\t\t\t\tleft: 0,\n\t\t\t\ttop: selectionStartsAt,\n\t\t\t\tright: 1,\n\t\t\t\tbottom: rect.map.height\n\t\t\t} : type == \"row\" ? {\n\t\t\t\tleft: selectionStartsAt,\n\t\t\t\ttop: 0,\n\t\t\t\tright: rect.map.width,\n\t\t\t\tbottom: 1\n\t\t\t} : rect;\n\t\t\tconst newType = type == \"column\" ? isHeaderColumnEnabled ? types.cell : types.header_cell : type == \"row\" ? isHeaderRowEnabled ? types.cell : types.header_cell : types.cell;\n\t\t\trect.map.cellsInRect(cellsRect).forEach((relativeCellPos) => {\n\t\t\t\tconst cellPos = relativeCellPos + rect.tableStart;\n\t\t\t\tconst cell = tr.doc.nodeAt(cellPos);\n\t\t\t\tif (cell) tr.setNodeMarkup(cellPos, newType, cell.attrs);\n\t\t\t});\n\t\t\tdispatch(tr);\n\t\t}\n\t\treturn true;\n\t};\n}\n/**\n* Toggles whether the selected row contains header cells.\n*\n* @public\n*/\nconst toggleHeaderRow = toggleHeader(\"row\", { useDeprecatedLogic: true });\n/**\n* Toggles whether the selected column contains header cells.\n*\n* @public\n*/\nconst toggleHeaderColumn = toggleHeader(\"column\", { useDeprecatedLogic: true });\n/**\n* Toggles whether the selected cells are header cells.\n*\n* @public\n*/\nconst toggleHeaderCell = toggleHeader(\"cell\", { useDeprecatedLogic: true });\nfunction findNextCell($cell, dir) {\n\tif (dir < 0) {\n\t\tconst before = $cell.nodeBefore;\n\t\tif (before) return $cell.pos - before.nodeSize;\n\t\tfor (let row = $cell.index(-1) - 1, rowEnd = $cell.before(); row >= 0; row--) {\n\t\t\tconst rowNode = $cell.node(-1).child(row);\n\t\t\tconst lastChild = rowNode.lastChild;\n\t\t\tif (lastChild) return rowEnd - 1 - lastChild.nodeSize;\n\t\t\trowEnd -= rowNode.nodeSize;\n\t\t}\n\t} else {\n\t\tif ($cell.index() < $cell.parent.childCount - 1) return $cell.pos + $cell.nodeAfter.nodeSize;\n\t\tconst table = $cell.node(-1);\n\t\tfor (let row = $cell.indexAfter(-1), rowStart = $cell.after(); row < table.childCount; row++) {\n\t\t\tconst rowNode = table.child(row);\n\t\t\tif (rowNode.childCount) return rowStart + 1;\n\t\t\trowStart += rowNode.nodeSize;\n\t\t}\n\t}\n\treturn null;\n}\n/**\n* Returns a command for selecting the next (direction=1) or previous\n* (direction=-1) cell in a table.\n*\n* @public\n*/\nfunction goToNextCell(direction) {\n\treturn function(state, dispatch) {\n\t\tif (!isInTable(state)) return false;\n\t\tconst cell = findNextCell(selectionCell(state), direction);\n\t\tif (cell == null) return false;\n\t\tif (dispatch) {\n\t\t\tconst $cell = state.doc.resolve(cell);\n\t\t\tdispatch(state.tr.setSelection(TextSelection.between($cell, moveCellForward($cell))).scrollIntoView());\n\t\t}\n\t\treturn true;\n\t};\n}\n/**\n* Deletes the table around the selection, if any.\n*\n* @public\n*/\nfunction deleteTable(state, dispatch) {\n\tconst $pos = state.selection.$anchor;\n\tfor (let d = $pos.depth; d > 0; d--) if ($pos.node(d).type.spec.tableRole == \"table\") {\n\t\tif (dispatch) dispatch(state.tr.delete($pos.before(d), $pos.after(d)).scrollIntoView());\n\t\treturn true;\n\t}\n\treturn false;\n}\n/**\n* Deletes the content of the selected cells, if they are not empty.\n*\n* @public\n*/\nfunction deleteCellSelection(state, dispatch) {\n\tconst sel = state.selection;\n\tif (!(sel instanceof CellSelection)) return false;\n\tif (dispatch) {\n\t\tconst tr = state.tr;\n\t\tconst baseContent = tableNodeTypes(state.schema).cell.createAndFill().content;\n\t\tsel.forEachCell((cell, pos) => {\n\t\t\tif (!cell.content.eq(baseContent)) tr.replace(tr.mapping.map(pos + 1), tr.mapping.map(pos + cell.nodeSize - 1), new Slice(baseContent, 0, 0));\n\t\t});\n\t\tif (tr.docChanged) dispatch(tr);\n\t}\n\treturn true;\n}\n/**\n* Move a table row from index `from` to index `to`.\n*\n* @public\n*/\nfunction moveTableRow(options) {\n\treturn (state, dispatch) => {\n\t\tconst { from: originIndex, to: targetIndex, select = true, pos = state.selection.from } = options;\n\t\tconst tr = state.tr;\n\t\tif (moveRow({\n\t\t\ttr,\n\t\t\toriginIndex,\n\t\t\ttargetIndex,\n\t\t\tselect,\n\t\t\tpos\n\t\t})) {\n\t\t\tdispatch === null || dispatch === void 0 || dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t};\n}\n/**\n* Move a table column from index `from` to index `to`.\n*\n* @public\n*/\nfunction moveTableColumn(options) {\n\treturn (state, dispatch) => {\n\t\tconst { from: originIndex, to: targetIndex, select = true, pos = state.selection.from } = options;\n\t\tconst tr = state.tr;\n\t\tif (moveColumn({\n\t\t\ttr,\n\t\t\toriginIndex,\n\t\t\ttargetIndex,\n\t\t\tselect,\n\t\t\tpos\n\t\t})) {\n\t\t\tdispatch === null || dispatch === void 0 || dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t};\n}\n\n//#endregion\n//#region src/copypaste.ts\n/**\n* Get a rectangular area of cells from a slice, or null if the outer\n* nodes of the slice aren't table cells or rows.\n*\n* @internal\n*/\nfunction pastedCells(slice) {\n\tif (slice.size === 0) return null;\n\tlet { content, openStart, openEnd } = slice;\n\twhile (content.childCount == 1 && (openStart > 0 && openEnd > 0 || content.child(0).type.spec.tableRole == \"table\")) {\n\t\topenStart--;\n\t\topenEnd--;\n\t\tcontent = content.child(0).content;\n\t}\n\tconst first = content.child(0);\n\tconst role = first.type.spec.tableRole;\n\tconst schema = first.type.schema, rows = [];\n\tif (role == \"row\") for (let i = 0; i < content.childCount; i++) {\n\t\tlet cells = content.child(i).content;\n\t\tconst left = i ? 0 : Math.max(0, openStart - 1);\n\t\tconst right = i < content.childCount - 1 ? 0 : Math.max(0, openEnd - 1);\n\t\tif (left || right) cells = fitSlice(tableNodeTypes(schema).row, new Slice(cells, left, right)).content;\n\t\trows.push(cells);\n\t}\n\telse if (role == \"cell\" || role == \"header_cell\") rows.push(openStart || openEnd ? fitSlice(tableNodeTypes(schema).row, new Slice(content, openStart, openEnd)).content : content);\n\telse return null;\n\treturn ensureRectangular(schema, rows);\n}\nfunction ensureRectangular(schema, rows) {\n\tconst widths = [];\n\tfor (let i = 0; i < rows.length; i++) {\n\t\tconst row = rows[i];\n\t\tfor (let j = row.childCount - 1; j >= 0; j--) {\n\t\t\tconst { rowspan, colspan } = row.child(j).attrs;\n\t\t\tfor (let r = i; r < i + rowspan; r++) widths[r] = (widths[r] || 0) + colspan;\n\t\t}\n\t}\n\tlet width = 0;\n\tfor (let r = 0; r < widths.length; r++) width = Math.max(width, widths[r]);\n\tfor (let r = 0; r < widths.length; r++) {\n\t\tif (r >= rows.length) rows.push(Fragment.empty);\n\t\tif (widths[r] < width) {\n\t\t\tconst empty = tableNodeTypes(schema).cell.createAndFill();\n\t\t\tconst cells = [];\n\t\t\tfor (let i = widths[r]; i < width; i++) cells.push(empty);\n\t\t\trows[r] = rows[r].append(Fragment.from(cells));\n\t\t}\n\t}\n\treturn {\n\t\theight: rows.length,\n\t\twidth,\n\t\trows\n\t};\n}\nfunction fitSlice(nodeType, slice) {\n\tconst node = nodeType.createAndFill();\n\treturn new Transform(node).replace(0, node.content.size, slice).doc;\n}\n/**\n* Clip or extend (repeat) the given set of cells to cover the given\n* width and height. Will clip rowspan/colspan cells at the edges when\n* they stick out.\n*\n* @internal\n*/\nfunction clipCells({ width, height, rows }, newWidth, newHeight) {\n\tif (width != newWidth) {\n\t\tconst added = [];\n\t\tconst newRows = [];\n\t\tfor (let row = 0; row < rows.length; row++) {\n\t\t\tconst frag = rows[row], cells = [];\n\t\t\tfor (let col = added[row] || 0, i = 0; col < newWidth; i++) {\n\t\t\t\tlet cell = frag.child(i % frag.childCount);\n\t\t\t\tif (col + cell.attrs.colspan > newWidth) cell = cell.type.createChecked(removeColSpan(cell.attrs, cell.attrs.colspan, col + cell.attrs.colspan - newWidth), cell.content);\n\t\t\t\tcells.push(cell);\n\t\t\t\tcol += cell.attrs.colspan;\n\t\t\t\tfor (let j = 1; j < cell.attrs.rowspan; j++) added[row + j] = (added[row + j] || 0) + cell.attrs.colspan;\n\t\t\t}\n\t\t\tnewRows.push(Fragment.from(cells));\n\t\t}\n\t\trows = newRows;\n\t\twidth = newWidth;\n\t}\n\tif (height != newHeight) {\n\t\tconst newRows = [];\n\t\tfor (let row = 0, i = 0; row < newHeight; row++, i++) {\n\t\t\tconst cells = [], source = rows[i % height];\n\t\t\tfor (let j = 0; j < source.childCount; j++) {\n\t\t\t\tlet cell = source.child(j);\n\t\t\t\tif (row + cell.attrs.rowspan > newHeight) cell = cell.type.create({\n\t\t\t\t\t...cell.attrs,\n\t\t\t\t\trowspan: Math.max(1, newHeight - cell.attrs.rowspan)\n\t\t\t\t}, cell.content);\n\t\t\t\tcells.push(cell);\n\t\t\t}\n\t\t\tnewRows.push(Fragment.from(cells));\n\t\t}\n\t\trows = newRows;\n\t\theight = newHeight;\n\t}\n\treturn {\n\t\twidth,\n\t\theight,\n\t\trows\n\t};\n}\nfunction growTable(tr, map, table, start, width, height, mapFrom) {\n\tconst schema = tr.doc.type.schema;\n\tconst types = tableNodeTypes(schema);\n\tlet empty;\n\tlet emptyHead;\n\tif (width > map.width) for (let row = 0, rowEnd = 0; row < map.height; row++) {\n\t\tconst rowNode = table.child(row);\n\t\trowEnd += rowNode.nodeSize;\n\t\tconst cells = [];\n\t\tlet add;\n\t\tif (rowNode.lastChild == null || rowNode.lastChild.type == types.cell) add = empty || (empty = types.cell.createAndFill());\n\t\telse add = emptyHead || (emptyHead = types.header_cell.createAndFill());\n\t\tfor (let i = map.width; i < width; i++) cells.push(add);\n\t\ttr.insert(tr.mapping.slice(mapFrom).map(rowEnd - 1 + start), cells);\n\t}\n\tif (height > map.height) {\n\t\tconst cells = [];\n\t\tfor (let i = 0, start$1 = (map.height - 1) * map.width; i < Math.max(map.width, width); i++) {\n\t\t\tconst header = i >= map.width ? false : table.nodeAt(map.map[start$1 + i]).type == types.header_cell;\n\t\t\tcells.push(header ? emptyHead || (emptyHead = types.header_cell.createAndFill()) : empty || (empty = types.cell.createAndFill()));\n\t\t}\n\t\tconst emptyRow = types.row.create(null, Fragment.from(cells)), rows = [];\n\t\tfor (let i = map.height; i < height; i++) rows.push(emptyRow);\n\t\ttr.insert(tr.mapping.slice(mapFrom).map(start + table.nodeSize - 2), rows);\n\t}\n\treturn !!(empty || emptyHead);\n}\nfunction isolateHorizontal(tr, map, table, start, left, right, top, mapFrom) {\n\tif (top == 0 || top == map.height) return false;\n\tlet found = false;\n\tfor (let col = left; col < right; col++) {\n\t\tconst index = top * map.width + col, pos = map.map[index];\n\t\tif (map.map[index - map.width] == pos) {\n\t\t\tfound = true;\n\t\t\tconst cell = table.nodeAt(pos);\n\t\t\tconst { top: cellTop, left: cellLeft } = map.findCell(pos);\n\t\t\ttr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos + start), null, {\n\t\t\t\t...cell.attrs,\n\t\t\t\trowspan: top - cellTop\n\t\t\t});\n\t\t\ttr.insert(tr.mapping.slice(mapFrom).map(map.positionAt(top, cellLeft, table)), cell.type.createAndFill({\n\t\t\t\t...cell.attrs,\n\t\t\t\trowspan: cellTop + cell.attrs.rowspan - top\n\t\t\t}));\n\t\t\tcol += cell.attrs.colspan - 1;\n\t\t}\n\t}\n\treturn found;\n}\nfunction isolateVertical(tr, map, table, start, top, bottom, left, mapFrom) {\n\tif (left == 0 || left == map.width) return false;\n\tlet found = false;\n\tfor (let row = top; row < bottom; row++) {\n\t\tconst index = row * map.width + left, pos = map.map[index];\n\t\tif (map.map[index - 1] == pos) {\n\t\t\tfound = true;\n\t\t\tconst cell = table.nodeAt(pos);\n\t\t\tconst cellLeft = map.colCount(pos);\n\t\t\tconst updatePos = tr.mapping.slice(mapFrom).map(pos + start);\n\t\t\ttr.setNodeMarkup(updatePos, null, removeColSpan(cell.attrs, left - cellLeft, cell.attrs.colspan - (left - cellLeft)));\n\t\t\ttr.insert(updatePos + cell.nodeSize, cell.type.createAndFill(removeColSpan(cell.attrs, 0, left - cellLeft)));\n\t\t\trow += cell.attrs.rowspan - 1;\n\t\t}\n\t}\n\treturn found;\n}\n/**\n* Insert the given set of cells (as returned by `pastedCells`) into a\n* table, at the position pointed at by rect.\n*\n* @internal\n*/\nfunction insertCells(state, dispatch, tableStart, rect, cells) {\n\tlet table = tableStart ? state.doc.nodeAt(tableStart - 1) : state.doc;\n\tif (!table) throw new Error(\"No table found\");\n\tlet map = TableMap.get(table);\n\tconst { top, left } = rect;\n\tconst right = left + cells.width, bottom = top + cells.height;\n\tconst tr = state.tr;\n\tlet mapFrom = 0;\n\tfunction recomp() {\n\t\ttable = tableStart ? tr.doc.nodeAt(tableStart - 1) : tr.doc;\n\t\tif (!table) throw new Error(\"No table found\");\n\t\tmap = TableMap.get(table);\n\t\tmapFrom = tr.mapping.maps.length;\n\t}\n\tif (growTable(tr, map, table, tableStart, right, bottom, mapFrom)) recomp();\n\tif (isolateHorizontal(tr, map, table, tableStart, left, right, top, mapFrom)) recomp();\n\tif (isolateHorizontal(tr, map, table, tableStart, left, right, bottom, mapFrom)) recomp();\n\tif (isolateVertical(tr, map, table, tableStart, top, bottom, left, mapFrom)) recomp();\n\tif (isolateVertical(tr, map, table, tableStart, top, bottom, right, mapFrom)) recomp();\n\tfor (let row = top; row < bottom; row++) {\n\t\tconst from = map.positionAt(row, left, table), to = map.positionAt(row, right, table);\n\t\ttr.replace(tr.mapping.slice(mapFrom).map(from + tableStart), tr.mapping.slice(mapFrom).map(to + tableStart), new Slice(cells.rows[row - top], 0, 0));\n\t}\n\trecomp();\n\ttr.setSelection(new CellSelection(tr.doc.resolve(tableStart + map.positionAt(top, left, table)), tr.doc.resolve(tableStart + map.positionAt(bottom - 1, right - 1, table))));\n\tdispatch(tr);\n}\n\n//#endregion\n//#region src/input.ts\nconst handleKeyDown = keydownHandler({\n\tArrowLeft: arrow(\"horiz\", -1),\n\tArrowRight: arrow(\"horiz\", 1),\n\tArrowUp: arrow(\"vert\", -1),\n\tArrowDown: arrow(\"vert\", 1),\n\t\"Shift-ArrowLeft\": shiftArrow(\"horiz\", -1),\n\t\"Shift-ArrowRight\": shiftArrow(\"horiz\", 1),\n\t\"Shift-ArrowUp\": shiftArrow(\"vert\", -1),\n\t\"Shift-ArrowDown\": shiftArrow(\"vert\", 1),\n\tBackspace: deleteCellSelection,\n\t\"Mod-Backspace\": deleteCellSelection,\n\tDelete: deleteCellSelection,\n\t\"Mod-Delete\": deleteCellSelection\n});\nfunction maybeSetSelection(state, dispatch, selection) {\n\tif (selection.eq(state.selection)) return false;\n\tif (dispatch) dispatch(state.tr.setSelection(selection).scrollIntoView());\n\treturn true;\n}\n/**\n* @internal\n*/\nfunction arrow(axis, dir) {\n\treturn (state, dispatch, view) => {\n\t\tif (!view) return false;\n\t\tconst sel = state.selection;\n\t\tif (sel instanceof CellSelection) return maybeSetSelection(state, dispatch, Selection.near(sel.$headCell, dir));\n\t\tif (axis != \"horiz\" && !sel.empty) return false;\n\t\tconst end = atEndOfCell(view, axis, dir);\n\t\tif (end == null) return false;\n\t\tif (axis == \"horiz\") return maybeSetSelection(state, dispatch, Selection.near(state.doc.resolve(sel.head + dir), dir));\n\t\telse {\n\t\t\tconst $cell = state.doc.resolve(end);\n\t\t\tconst $next = nextCell($cell, axis, dir);\n\t\t\tlet newSel;\n\t\t\tif ($next) newSel = Selection.near($next, 1);\n\t\t\telse if (dir < 0) newSel = Selection.near(state.doc.resolve($cell.before(-1)), -1);\n\t\t\telse newSel = Selection.near(state.doc.resolve($cell.after(-1)), 1);\n\t\t\treturn maybeSetSelection(state, dispatch, newSel);\n\t\t}\n\t};\n}\nfunction shiftArrow(axis, dir) {\n\treturn (state, dispatch, view) => {\n\t\tif (!view) return false;\n\t\tconst sel = state.selection;\n\t\tlet cellSel;\n\t\tif (sel instanceof CellSelection) cellSel = sel;\n\t\telse {\n\t\t\tconst end = atEndOfCell(view, axis, dir);\n\t\t\tif (end == null) return false;\n\t\t\tcellSel = new CellSelection(state.doc.resolve(end));\n\t\t}\n\t\tconst $head = nextCell(cellSel.$headCell, axis, dir);\n\t\tif (!$head) return false;\n\t\treturn maybeSetSelection(state, dispatch, new CellSelection(cellSel.$anchorCell, $head));\n\t};\n}\nfunction handleTripleClick(view, pos) {\n\tconst doc = view.state.doc, $cell = cellAround(doc.resolve(pos));\n\tif (!$cell) return false;\n\tview.dispatch(view.state.tr.setSelection(new CellSelection($cell)));\n\treturn true;\n}\n/**\n* @public\n*/\nfunction handlePaste(view, _, slice) {\n\tif (!isInTable(view.state)) return false;\n\tlet cells = pastedCells(slice);\n\tconst sel = view.state.selection;\n\tif (sel instanceof CellSelection) {\n\t\tif (!cells) cells = {\n\t\t\twidth: 1,\n\t\t\theight: 1,\n\t\t\trows: [Fragment.from(fitSlice(tableNodeTypes(view.state.schema).cell, slice))]\n\t\t};\n\t\tconst table = sel.$anchorCell.node(-1);\n\t\tconst start = sel.$anchorCell.start(-1);\n\t\tconst rect = TableMap.get(table).rectBetween(sel.$anchorCell.pos - start, sel.$headCell.pos - start);\n\t\tcells = clipCells(cells, rect.right - rect.left, rect.bottom - rect.top);\n\t\tinsertCells(view.state, view.dispatch, start, rect, cells);\n\t\treturn true;\n\t} else if (cells) {\n\t\tconst $cell = selectionCell(view.state);\n\t\tconst start = $cell.start(-1);\n\t\tinsertCells(view.state, view.dispatch, start, TableMap.get($cell.node(-1)).findCell($cell.pos - start), cells);\n\t\treturn true;\n\t} else return false;\n}\nfunction handleMouseDown$1(view, startEvent) {\n\tvar _cellUnderMouse;\n\tif (startEvent.button != 0) return;\n\tif (startEvent.ctrlKey || startEvent.metaKey) return;\n\tconst startDOMCell = domInCell(view, startEvent.target);\n\tlet $anchor;\n\tif (startEvent.shiftKey && view.state.selection instanceof CellSelection) {\n\t\tsetCellSelection(view.state.selection.$anchorCell, startEvent);\n\t\tstartEvent.preventDefault();\n\t} else if (startEvent.shiftKey && startDOMCell && ($anchor = cellAround(view.state.selection.$anchor)) != null && ((_cellUnderMouse = cellUnderMouse(view, startEvent)) === null || _cellUnderMouse === void 0 ? void 0 : _cellUnderMouse.pos) != $anchor.pos) {\n\t\tsetCellSelection($anchor, startEvent);\n\t\tstartEvent.preventDefault();\n\t} else if (!startDOMCell) return;\n\tfunction setCellSelection($anchor$1, event) {\n\t\tlet $head = cellUnderMouse(view, event);\n\t\tconst starting = tableEditingKey.getState(view.state) == null;\n\t\tif (!$head || !inSameTable($anchor$1, $head)) if (starting) $head = $anchor$1;\n\t\telse return;\n\t\tconst selection = new CellSelection($anchor$1, $head);\n\t\tif (starting || !view.state.selection.eq(selection)) {\n\t\t\tconst tr = view.state.tr.setSelection(selection);\n\t\t\tif (starting) tr.setMeta(tableEditingKey, $anchor$1.pos);\n\t\t\tview.dispatch(tr);\n\t\t}\n\t}\n\tfunction stop() {\n\t\tview.root.removeEventListener(\"mouseup\", stop);\n\t\tview.root.removeEventListener(\"dragstart\", stop);\n\t\tview.root.removeEventListener(\"mousemove\", move);\n\t\tif (tableEditingKey.getState(view.state) != null) view.dispatch(view.state.tr.setMeta(tableEditingKey, -1));\n\t}\n\tfunction move(_event) {\n\t\tconst event = _event;\n\t\tconst anchor = tableEditingKey.getState(view.state);\n\t\tlet $anchor$1;\n\t\tif (anchor != null) $anchor$1 = view.state.doc.resolve(anchor);\n\t\telse if (domInCell(view, event.target) != startDOMCell) {\n\t\t\t$anchor$1 = cellUnderMouse(view, startEvent);\n\t\t\tif (!$anchor$1) return stop();\n\t\t}\n\t\tif ($anchor$1) setCellSelection($anchor$1, event);\n\t}\n\tview.root.addEventListener(\"mouseup\", stop);\n\tview.root.addEventListener(\"dragstart\", stop);\n\tview.root.addEventListener(\"mousemove\", move);\n}\nfunction atEndOfCell(view, axis, dir) {\n\tif (!(view.state.selection instanceof TextSelection)) return null;\n\tconst { $head } = view.state.selection;\n\tfor (let d = $head.depth - 1; d >= 0; d--) {\n\t\tconst parent = $head.node(d);\n\t\tif ((dir < 0 ? $head.index(d) : $head.indexAfter(d)) != (dir < 0 ? 0 : parent.childCount)) return null;\n\t\tif (parent.type.spec.tableRole == \"cell\" || parent.type.spec.tableRole == \"header_cell\") {\n\t\t\tconst cellPos = $head.before(d);\n\t\t\tconst dirStr = axis == \"vert\" ? dir > 0 ? \"down\" : \"up\" : dir > 0 ? \"right\" : \"left\";\n\t\t\treturn view.endOfTextblock(dirStr) ? cellPos : null;\n\t\t}\n\t}\n\treturn null;\n}\nfunction domInCell(view, dom) {\n\tfor (; dom && dom != view.dom; dom = dom.parentNode) if (dom.nodeName == \"TD\" || dom.nodeName == \"TH\") return dom;\n\treturn null;\n}\nfunction cellUnderMouse(view, event) {\n\tconst mousePos = view.posAtCoords({\n\t\tleft: event.clientX,\n\t\ttop: event.clientY\n\t});\n\tif (!mousePos) return null;\n\tlet { inside, pos } = mousePos;\n\treturn inside >= 0 && cellAround(view.state.doc.resolve(inside)) || cellAround(view.state.doc.resolve(pos));\n}\n\n//#endregion\n//#region src/tableview.ts\n/**\n* @public\n*/\nvar TableView = class {\n\tconstructor(node, defaultCellMinWidth) {\n\t\tthis.node = node;\n\t\tthis.defaultCellMinWidth = defaultCellMinWidth;\n\t\tthis.dom = document.createElement(\"div\");\n\t\tthis.dom.className = \"tableWrapper\";\n\t\tthis.table = this.dom.appendChild(document.createElement(\"table\"));\n\t\tthis.table.style.setProperty(\"--default-cell-min-width\", `${defaultCellMinWidth}px`);\n\t\tthis.colgroup = this.table.appendChild(document.createElement(\"colgroup\"));\n\t\tupdateColumnsOnResize(node, this.colgroup, this.table, defaultCellMinWidth);\n\t\tthis.contentDOM = this.table.appendChild(document.createElement(\"tbody\"));\n\t}\n\tupdate(node) {\n\t\tif (node.type != this.node.type) return false;\n\t\tthis.node = node;\n\t\tupdateColumnsOnResize(node, this.colgroup, this.table, this.defaultCellMinWidth);\n\t\treturn true;\n\t}\n\tignoreMutation(record) {\n\t\treturn record.type == \"attributes\" && (record.target == this.table || this.colgroup.contains(record.target));\n\t}\n};\n/**\n* @public\n*/\nfunction updateColumnsOnResize(node, colgroup, table, defaultCellMinWidth, overrideCol, overrideValue) {\n\tlet totalWidth = 0;\n\tlet fixedWidth = true;\n\tlet nextDOM = colgroup.firstChild;\n\tconst row = node.firstChild;\n\tif (!row) return;\n\tfor (let i = 0, col = 0; i < row.childCount; i++) {\n\t\tconst { colspan, colwidth } = row.child(i).attrs;\n\t\tfor (let j = 0; j < colspan; j++, col++) {\n\t\t\tconst hasWidth = overrideCol == col ? overrideValue : colwidth && colwidth[j];\n\t\t\tconst cssWidth = hasWidth ? hasWidth + \"px\" : \"\";\n\t\t\ttotalWidth += hasWidth || defaultCellMinWidth;\n\t\t\tif (!hasWidth) fixedWidth = false;\n\t\t\tif (!nextDOM) {\n\t\t\t\tconst col$1 = document.createElement(\"col\");\n\t\t\t\tcol$1.style.width = cssWidth;\n\t\t\t\tcolgroup.appendChild(col$1);\n\t\t\t} else {\n\t\t\t\tif (nextDOM.style.width != cssWidth) nextDOM.style.width = cssWidth;\n\t\t\t\tnextDOM = nextDOM.nextSibling;\n\t\t\t}\n\t\t}\n\t}\n\twhile (nextDOM) {\n\t\tvar _nextDOM$parentNode;\n\t\tconst after = nextDOM.nextSibling;\n\t\t(_nextDOM$parentNode = nextDOM.parentNode) === null || _nextDOM$parentNode === void 0 || _nextDOM$parentNode.removeChild(nextDOM);\n\t\tnextDOM = after;\n\t}\n\tif (fixedWidth) {\n\t\ttable.style.width = totalWidth + \"px\";\n\t\ttable.style.minWidth = \"\";\n\t} else {\n\t\ttable.style.width = \"\";\n\t\ttable.style.minWidth = totalWidth + \"px\";\n\t}\n}\n\n//#endregion\n//#region src/columnresizing.ts\n/**\n* @public\n*/\nconst columnResizingPluginKey = new PluginKey(\"tableColumnResizing\");\n/**\n* @public\n*/\nfunction columnResizing({ handleWidth = 5, cellMinWidth = 25, defaultCellMinWidth = 100, View = TableView, lastColumnResizable = true } = {}) {\n\tconst plugin = new Plugin({\n\t\tkey: columnResizingPluginKey,\n\t\tstate: {\n\t\t\tinit(_, state) {\n\t\t\t\tvar _plugin$spec;\n\t\t\t\tconst nodeViews = (_plugin$spec = plugin.spec) === null || _plugin$spec === void 0 || (_plugin$spec = _plugin$spec.props) === null || _plugin$spec === void 0 ? void 0 : _plugin$spec.nodeViews;\n\t\t\t\tconst tableName = tableNodeTypes(state.schema).table.name;\n\t\t\t\tif (View && nodeViews) nodeViews[tableName] = (node, view) => {\n\t\t\t\t\treturn new View(node, defaultCellMinWidth, view);\n\t\t\t\t};\n\t\t\t\treturn new ResizeState(-1, false);\n\t\t\t},\n\t\t\tapply(tr, prev) {\n\t\t\t\treturn prev.apply(tr);\n\t\t\t}\n\t\t},\n\t\tprops: {\n\t\t\tattributes: (state) => {\n\t\t\t\tconst pluginState = columnResizingPluginKey.getState(state);\n\t\t\t\treturn pluginState && pluginState.activeHandle > -1 ? { class: \"resize-cursor\" } : {};\n\t\t\t},\n\t\t\thandleDOMEvents: {\n\t\t\t\tmousemove: (view, event) => {\n\t\t\t\t\thandleMouseMove(view, event, handleWidth, lastColumnResizable);\n\t\t\t\t},\n\t\t\t\tmouseleave: (view) => {\n\t\t\t\t\thandleMouseLeave(view);\n\t\t\t\t},\n\t\t\t\tmousedown: (view, event) => {\n\t\t\t\t\thandleMouseDown(view, event, cellMinWidth, defaultCellMinWidth);\n\t\t\t\t}\n\t\t\t},\n\t\t\tdecorations: (state) => {\n\t\t\t\tconst pluginState = columnResizingPluginKey.getState(state);\n\t\t\t\tif (pluginState && pluginState.activeHandle > -1) return handleDecorations(state, pluginState.activeHandle);\n\t\t\t},\n\t\t\tnodeViews: {}\n\t\t}\n\t});\n\treturn plugin;\n}\n/**\n* @public\n*/\nvar ResizeState = class ResizeState {\n\tconstructor(activeHandle, dragging) {\n\t\tthis.activeHandle = activeHandle;\n\t\tthis.dragging = dragging;\n\t}\n\tapply(tr) {\n\t\tconst state = this;\n\t\tconst action = tr.getMeta(columnResizingPluginKey);\n\t\tif (action && action.setHandle != null) return new ResizeState(action.setHandle, false);\n\t\tif (action && action.setDragging !== void 0) return new ResizeState(state.activeHandle, action.setDragging);\n\t\tif (state.activeHandle > -1 && tr.docChanged) {\n\t\t\tlet handle = tr.mapping.map(state.activeHandle, -1);\n\t\t\tif (!pointsAtCell(tr.doc.resolve(handle))) handle = -1;\n\t\t\treturn new ResizeState(handle, state.dragging);\n\t\t}\n\t\treturn state;\n\t}\n};\nfunction handleMouseMove(view, event, handleWidth, lastColumnResizable) {\n\tif (!view.editable) return;\n\tconst pluginState = columnResizingPluginKey.getState(view.state);\n\tif (!pluginState) return;\n\tif (!pluginState.dragging) {\n\t\tconst target = domCellAround(event.target);\n\t\tlet cell = -1;\n\t\tif (target) {\n\t\t\tconst { left, right } = target.getBoundingClientRect();\n\t\t\tif (event.clientX - left <= handleWidth) cell = edgeCell(view, event, \"left\", handleWidth);\n\t\t\telse if (right - event.clientX <= handleWidth) cell = edgeCell(view, event, \"right\", handleWidth);\n\t\t}\n\t\tif (cell != pluginState.activeHandle) {\n\t\t\tif (!lastColumnResizable && cell !== -1) {\n\t\t\t\tconst $cell = view.state.doc.resolve(cell);\n\t\t\t\tconst table = $cell.node(-1);\n\t\t\t\tconst map = TableMap.get(table);\n\t\t\t\tconst tableStart = $cell.start(-1);\n\t\t\t\tif (map.colCount($cell.pos - tableStart) + $cell.nodeAfter.attrs.colspan - 1 == map.width - 1) return;\n\t\t\t}\n\t\t\tupdateHandle(view, cell);\n\t\t}\n\t}\n}\nfunction handleMouseLeave(view) {\n\tif (!view.editable) return;\n\tconst pluginState = columnResizingPluginKey.getState(view.state);\n\tif (pluginState && pluginState.activeHandle > -1 && !pluginState.dragging) updateHandle(view, -1);\n}\nfunction handleMouseDown(view, event, cellMinWidth, defaultCellMinWidth) {\n\tvar _view$dom$ownerDocume;\n\tif (!view.editable) return false;\n\tconst win = (_view$dom$ownerDocume = view.dom.ownerDocument.defaultView) !== null && _view$dom$ownerDocume !== void 0 ? _view$dom$ownerDocume : window;\n\tconst pluginState = columnResizingPluginKey.getState(view.state);\n\tif (!pluginState || pluginState.activeHandle == -1 || pluginState.dragging) return false;\n\tconst cell = view.state.doc.nodeAt(pluginState.activeHandle);\n\tconst width = currentColWidth(view, pluginState.activeHandle, cell.attrs);\n\tview.dispatch(view.state.tr.setMeta(columnResizingPluginKey, { setDragging: {\n\t\tstartX: event.clientX,\n\t\tstartWidth: width\n\t} }));\n\tfunction finish(event$1) {\n\t\twin.removeEventListener(\"mouseup\", finish);\n\t\twin.removeEventListener(\"mousemove\", move);\n\t\tconst pluginState$1 = columnResizingPluginKey.getState(view.state);\n\t\tif (pluginState$1 === null || pluginState$1 === void 0 ? void 0 : pluginState$1.dragging) {\n\t\t\tupdateColumnWidth(view, pluginState$1.activeHandle, draggedWidth(pluginState$1.dragging, event$1, cellMinWidth));\n\t\t\tview.dispatch(view.state.tr.setMeta(columnResizingPluginKey, { setDragging: null }));\n\t\t}\n\t}\n\tfunction move(event$1) {\n\t\tif (!event$1.which) return finish(event$1);\n\t\tconst pluginState$1 = columnResizingPluginKey.getState(view.state);\n\t\tif (!pluginState$1) return;\n\t\tif (pluginState$1.dragging) {\n\t\t\tconst dragged = draggedWidth(pluginState$1.dragging, event$1, cellMinWidth);\n\t\t\tdisplayColumnWidth(view, pluginState$1.activeHandle, dragged, defaultCellMinWidth);\n\t\t}\n\t}\n\tdisplayColumnWidth(view, pluginState.activeHandle, width, defaultCellMinWidth);\n\twin.addEventListener(\"mouseup\", finish);\n\twin.addEventListener(\"mousemove\", move);\n\tevent.preventDefault();\n\treturn true;\n}\nfunction currentColWidth(view, cellPos, { colspan, colwidth }) {\n\tconst width = colwidth && colwidth[colwidth.length - 1];\n\tif (width) return width;\n\tconst dom = view.domAtPos(cellPos);\n\tlet domWidth = dom.node.childNodes[dom.offset].offsetWidth, parts = colspan;\n\tif (colwidth) {\n\t\tfor (let i = 0; i < colspan; i++) if (colwidth[i]) {\n\t\t\tdomWidth -= colwidth[i];\n\t\t\tparts--;\n\t\t}\n\t}\n\treturn domWidth / parts;\n}\nfunction domCellAround(target) {\n\twhile (target && target.nodeName != \"TD\" && target.nodeName != \"TH\") target = target.classList && target.classList.contains(\"ProseMirror\") ? null : target.parentNode;\n\treturn target;\n}\nfunction edgeCell(view, event, side, handleWidth) {\n\tconst offset = side == \"right\" ? -handleWidth : handleWidth;\n\tconst found = view.posAtCoords({\n\t\tleft: event.clientX + offset,\n\t\ttop: event.clientY\n\t});\n\tif (!found) return -1;\n\tconst { pos } = found;\n\tconst $cell = cellAround(view.state.doc.resolve(pos));\n\tif (!$cell) return -1;\n\tif (side == \"right\") return $cell.pos;\n\tconst map = TableMap.get($cell.node(-1)), start = $cell.start(-1);\n\tconst index = map.map.indexOf($cell.pos - start);\n\treturn index % map.width == 0 ? -1 : start + map.map[index - 1];\n}\nfunction draggedWidth(dragging, event, resizeMinWidth) {\n\tconst offset = event.clientX - dragging.startX;\n\treturn Math.max(resizeMinWidth, dragging.startWidth + offset);\n}\nfunction updateHandle(view, value) {\n\tview.dispatch(view.state.tr.setMeta(columnResizingPluginKey, { setHandle: value }));\n}\nfunction updateColumnWidth(view, cell, width) {\n\tconst $cell = view.state.doc.resolve(cell);\n\tconst table = $cell.node(-1), map = TableMap.get(table), start = $cell.start(-1);\n\tconst col = map.colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;\n\tconst tr = view.state.tr;\n\tfor (let row = 0; row < map.height; row++) {\n\t\tconst mapIndex = row * map.width + col;\n\t\tif (row && map.map[mapIndex] == map.map[mapIndex - map.width]) continue;\n\t\tconst pos = map.map[mapIndex];\n\t\tconst attrs = table.nodeAt(pos).attrs;\n\t\tconst index = attrs.colspan == 1 ? 0 : col - map.colCount(pos);\n\t\tif (attrs.colwidth && attrs.colwidth[index] == width) continue;\n\t\tconst colwidth = attrs.colwidth ? attrs.colwidth.slice() : zeroes(attrs.colspan);\n\t\tcolwidth[index] = width;\n\t\ttr.setNodeMarkup(start + pos, null, {\n\t\t\t...attrs,\n\t\t\tcolwidth\n\t\t});\n\t}\n\tif (tr.docChanged) view.dispatch(tr);\n}\nfunction displayColumnWidth(view, cell, width, defaultCellMinWidth) {\n\tconst $cell = view.state.doc.resolve(cell);\n\tconst table = $cell.node(-1), start = $cell.start(-1);\n\tconst col = TableMap.get(table).colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;\n\tlet dom = view.domAtPos($cell.start(-1)).node;\n\twhile (dom && dom.nodeName != \"TABLE\") dom = dom.parentNode;\n\tif (!dom) return;\n\tupdateColumnsOnResize(table, dom.firstChild, dom, defaultCellMinWidth, col, width);\n}\nfunction zeroes(n) {\n\treturn Array(n).fill(0);\n}\nfunction handleDecorations(state, cell) {\n\tconst decorations = [];\n\tconst $cell = state.doc.resolve(cell);\n\tconst table = $cell.node(-1);\n\tif (!table) return DecorationSet.empty;\n\tconst map = TableMap.get(table);\n\tconst start = $cell.start(-1);\n\tconst col = map.colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;\n\tfor (let row = 0; row < map.height; row++) {\n\t\tconst index = col + row * map.width;\n\t\tif ((col == map.width - 1 || map.map[index] != map.map[index + 1]) && (row == 0 || map.map[index] != map.map[index - map.width])) {\n\t\t\tvar _columnResizingPlugin;\n\t\t\tconst cellPos = map.map[index];\n\t\t\tconst pos = start + cellPos + table.nodeAt(cellPos).nodeSize - 1;\n\t\t\tconst dom = document.createElement(\"div\");\n\t\t\tdom.className = \"column-resize-handle\";\n\t\t\tif ((_columnResizingPlugin = columnResizingPluginKey.getState(state)) === null || _columnResizingPlugin === void 0 ? void 0 : _columnResizingPlugin.dragging) decorations.push(Decoration.node(start + cellPos, start + cellPos + table.nodeAt(cellPos).nodeSize, { class: \"column-resize-dragging\" }));\n\t\t\tdecorations.push(Decoration.widget(pos, dom));\n\t\t}\n\t}\n\treturn DecorationSet.create(state.doc, decorations);\n}\n\n//#endregion\n//#region src/index.ts\n/**\n* Creates a [plugin](http://prosemirror.net/docs/ref/#state.Plugin)\n* that, when added to an editor, enables cell-selection, handles\n* cell-based copy/paste, and makes sure tables stay well-formed (each\n* row has the same width, and cells don't overlap).\n*\n* You should probably put this plugin near the end of your array of\n* plugins, since it handles mouse and arrow key events in tables\n* rather broadly, and other plugins, like the gap cursor or the\n* column-width dragging plugin, might want to get a turn first to\n* perform more specific behavior.\n*\n* @public\n*/\nfunction tableEditing({ allowTableNodeSelection = false } = {}) {\n\treturn new Plugin({\n\t\tkey: tableEditingKey,\n\t\tstate: {\n\t\t\tinit() {\n\t\t\t\treturn null;\n\t\t\t},\n\t\t\tapply(tr, cur) {\n\t\t\t\tconst set = tr.getMeta(tableEditingKey);\n\t\t\t\tif (set != null) return set == -1 ? null : set;\n\t\t\t\tif (cur == null || !tr.docChanged) return cur;\n\t\t\t\tconst { deleted, pos } = tr.mapping.mapResult(cur);\n\t\t\t\treturn deleted ? null : pos;\n\t\t\t}\n\t\t},\n\t\tprops: {\n\t\t\tdecorations: drawCellSelection,\n\t\t\thandleDOMEvents: { mousedown: handleMouseDown$1 },\n\t\t\tcreateSelectionBetween(view) {\n\t\t\t\treturn tableEditingKey.getState(view.state) != null ? view.state.selection : null;\n\t\t\t},\n\t\t\thandleTripleClick,\n\t\t\thandleKeyDown,\n\t\t\thandlePaste\n\t\t},\n\t\tappendTransaction(_, oldState, state) {\n\t\t\treturn normalizeSelection(state, fixTables(state, oldState), allowTableNodeSelection);\n\t\t}\n\t});\n}\n\n//#endregion\nexport { CellBookmark, CellSelection, ResizeState, TableMap, TableView, clipCells as __clipCells, insertCells as __insertCells, pastedCells as __pastedCells, addColSpan, addColumn, addColumnAfter, addColumnBefore, addRow, addRowAfter, addRowBefore, cellAround, cellNear, colCount, columnIsHeader, columnResizing, columnResizingPluginKey, deleteCellSelection, deleteColumn, deleteRow, deleteTable, findCell, findCellPos, findCellRange, findTable, fixTables, fixTablesKey, goToNextCell, handlePaste, inSameTable, isInTable, mergeCells, moveCellForward, moveTableColumn, moveTableRow, nextCell, pointsAtCell, removeColSpan, removeColumn, removeRow, rowIsHeader, selectedRect, selectionCell, setCellAttr, splitCell, splitCellWithType, tableEditing, tableEditingKey, tableNodeTypes, tableNodes, toggleHeader, toggleHeaderCell, toggleHeaderColumn, toggleHeaderRow, updateColumnsOnResize };\n//# sourceMappingURL=index.js.map","// Prevent tree-shaking from removing Vue's `h` and `Fragment`,\n// which are required at runtime for TSX to work.\nexport function keepAlive(..._args: unknown[]) {}\n","import clsx from 'clsx'\nimport DOMPurify from 'dompurify'\nimport { h } from 'vue'\n\nimport { keepAlive } from '../keep-alive'\n\nkeepAlive(h)\n\ntype IconProps = {\n icon?: string | null\n class?: string\n onClick?: (event: PointerEvent) => void\n}\n\nexport function Icon({ icon, class: className, onClick }: IconProps) {\n return (\n <span\n class={clsx('milkdown-icon', className)}\n onPointerdown={onClick}\n innerHTML={icon ? DOMPurify.sanitize(icon.trim()) : undefined}\n />\n )\n}\n\nIcon.props = {\n icon: {\n type: String,\n required: false,\n },\n class: {\n type: String,\n required: false,\n },\n onClick: {\n type: Function,\n required: false,\n },\n}\n","import type { DragContext, Refs } from '../view/types'\n\nexport function prepareDndContext(refs: Refs): DragContext | undefined {\n const {\n dragPreviewRef,\n tableWrapperRef,\n contentWrapperRef,\n yLineHandleRef,\n xLineHandleRef,\n } = refs\n\n const preview = dragPreviewRef.value\n if (!preview) return\n const wrapper = tableWrapperRef.value\n if (!wrapper) return\n const content = contentWrapperRef.value\n if (!content) return\n const contentRoot = content.querySelector('tbody')\n if (!contentRoot) return\n const previewRoot = preview.querySelector('tbody')\n if (!previewRoot) return\n const yHandle = yLineHandleRef.value\n if (!yHandle) return\n const xHandle = xLineHandleRef.value\n if (!xHandle) return\n\n const context = {\n preview,\n wrapper,\n content,\n contentRoot,\n previewRoot,\n yHandle,\n xHandle,\n }\n\n return context\n}\n","export function clearPreview(previewRoot: HTMLElement) {\n while (previewRoot.firstChild) previewRoot.removeChild(previewRoot.firstChild)\n}\n\nexport function renderPreview(\n axis: 'x' | 'y',\n preview: HTMLElement,\n previewRoot: HTMLElement,\n tableContent: HTMLElement,\n index: number\n) {\n const { width: tableWidth, height: tableHeight } = tableContent\n .querySelector('tbody')!\n .getBoundingClientRect()\n if (axis === 'y') {\n const rows = tableContent.querySelectorAll('tr')\n const row = rows[index]\n if (!row) return\n\n previewRoot.appendChild(row.cloneNode(true))\n const height = row.getBoundingClientRect().height\n\n Object.assign(preview.style, {\n width: `${tableWidth}px`,\n height: `${height}px`,\n })\n\n preview.dataset.show = 'true'\n\n return\n }\n\n if (axis === 'x') {\n const rows = tableContent.querySelectorAll('tr')\n let width: number | undefined\n\n Array.from(rows).forEach((row) => {\n const col = row.children[index]\n if (!col) return\n\n if (width === undefined) width = col.getBoundingClientRect().width\n\n const tr = col.parentElement!.cloneNode(false)\n const clone = col.cloneNode(true)\n tr.appendChild(clone)\n previewRoot.appendChild(tr)\n })\n\n Object.assign(preview.style, {\n width: `${width}px`,\n height: `${tableHeight}px`,\n })\n\n preview.dataset.show = 'true'\n\n return\n }\n}\n","import type { Ctx } from '@jvs-milkdown/ctx'\n\nimport { editorViewCtx } from '@jvs-milkdown/core'\n\nimport type { DragContext, Refs } from '../view/types'\n\nimport { prepareDndContext } from './prepare-dnd-context'\nimport { clearPreview, renderPreview } from './preview'\n\nexport function createDragRowHandler(refs: Refs, ctx?: Ctx) {\n return (event: DragEvent) => {\n handleDrag(refs, event, ctx, (context) => {\n updateDragInfo('y', event, context, refs)\n\n const { preview, content, previewRoot } = context\n\n clearPreview(previewRoot)\n\n const { hoverIndex } = refs\n const [rowIndex] = hoverIndex.value\n renderPreview('y', preview, previewRoot, content, rowIndex)\n })\n }\n}\n\nexport function createDragColHandler(refs: Refs, ctx?: Ctx) {\n return (event: DragEvent) => {\n handleDrag(refs, event, ctx, (context) => {\n updateDragInfo('x', event, context, refs)\n\n const { preview, content, previewRoot } = context\n\n const { hoverIndex } = refs\n const [_, colIndex] = hoverIndex.value\n\n clearPreview(previewRoot)\n\n renderPreview('x', preview, previewRoot, content, colIndex)\n })\n }\n}\n\nfunction updateDragInfo(\n axis: 'x' | 'y',\n event: DragEvent,\n context: DragContext,\n refs: Refs\n) {\n const { xHandle, yHandle, preview } = context\n xHandle.dataset.displayType = axis === 'y' ? 'indicator' : 'none'\n yHandle.dataset.displayType = axis === 'x' ? 'indicator' : 'none'\n\n const { hoverIndex, dragInfo } = refs\n const [rowIndex, colIndex] = hoverIndex.value\n\n dragInfo.value = {\n startCoords: [event.clientX, event.clientY],\n startIndex: axis === 'y' ? rowIndex : colIndex,\n endIndex: axis === 'y' ? rowIndex : colIndex,\n type: axis === 'y' ? 'row' : 'col',\n }\n\n preview.dataset.direction = axis === 'y' ? 'vertical' : 'horizontal'\n}\n\nfunction handleDrag(\n refs: Refs,\n event: DragEvent,\n ctx: Ctx | undefined,\n fn: (context: DragContext) => void\n) {\n const view = ctx?.get(editorViewCtx)\n if (!view?.editable) return\n\n event.stopPropagation()\n if (event.dataTransfer) event.dataTransfer.effectAllowed = 'move'\n\n const context = prepareDndContext(refs)\n\n if (!context) return\n\n // This is to avoid a chrome bug:\n // https://stackoverflow.com/questions/14203734/dragend-dragenter-and-dragleave-firing-off-immediately-when-i-drag\n requestAnimationFrame(() => {\n fn(context)\n })\n}\n","import type { Node } from '@jvs-milkdown/prose/model'\nimport type { EditorView } from '@jvs-milkdown/prose/view'\nimport type { Ref } from 'vue'\n\nimport { findParent } from '@jvs-milkdown/prose'\nimport { CellSelection, findTable } from '@jvs-milkdown/prose/tables'\n\nimport type { CellIndex, Refs } from './types'\n\nfunction findNodeIndex(parent: Node, child: Node) {\n for (let i = 0; i < parent.childCount; i++) {\n if (parent.child(i) === child) return i\n }\n return -1\n}\n\nexport function findPointerIndex(\n event: PointerEvent,\n view?: EditorView\n): CellIndex | undefined {\n if (!view) return\n\n try {\n const posAtCoords = view.posAtCoords({\n left: event.clientX,\n top: event.clientY,\n })\n if (!posAtCoords) return\n const pos = posAtCoords?.inside\n if (pos == null || pos < 0) return\n\n const $pos = view.state.doc.resolve(pos)\n const node = view.state.doc.nodeAt(pos)\n if (!node) return\n\n const cellType = ['table_cell', 'table_header']\n const rowType = ['table_row', 'table_header_row']\n\n const cell = cellType.includes(node.type.name)\n ? node\n : findParent((node) => cellType.includes(node.type.name))($pos)?.node\n const row = findParent((node) => rowType.includes(node.type.name))(\n $pos\n )?.node\n const table = findParent((node) => node.type.name === 'table')($pos)?.node\n if (!cell || !row || !table) return\n\n const columnIndex = findNodeIndex(row, cell)\n const rowIndex = findNodeIndex(table, row)\n\n return [rowIndex, columnIndex]\n } catch {\n return undefined\n }\n}\n\nexport function getRelatedDOM(\n contentWrapperRef: Ref<HTMLElement | undefined>,\n [rowIndex, columnIndex]: CellIndex\n) {\n const content = contentWrapperRef.value\n if (!content) return\n const rows = content.querySelectorAll('tr')\n const row = rows[rowIndex]\n if (!row) return\n\n const firstRow = rows[0]\n if (!firstRow) return\n\n const headerCol = firstRow.children[columnIndex]\n if (!headerCol) return\n\n const col = row.children[columnIndex]\n if (!col) return\n\n return {\n row,\n col,\n headerCol,\n }\n}\n\nexport function recoveryStateBetweenUpdate(\n refs: Refs,\n view?: EditorView,\n node?: Node\n) {\n if (!node) return\n if (!view) return\n const { selection } = view.state\n if (!(selection instanceof CellSelection)) return\n\n const { $from } = selection\n const table = findTable($from)\n if (!table || table.node !== node) return\n\n if (selection.isColSelection()) {\n const { $head } = selection\n const colIndex = $head.index($head.depth - 1)\n refs.hoverIndex.value = [0, colIndex]\n return\n }\n if (selection.isRowSelection()) {\n const { $head } = selection\n const rowNode = findParent(\n (node) =>\n node.type.name === 'table_row' || node.type.name === 'table_header_row'\n )($head)\n if (!rowNode) return\n const rowIndex = findNodeIndex(table.node, rowNode.node)\n refs.hoverIndex.value = [rowIndex, 0]\n }\n}\n","function findDragOverElement(\n elements: Element[],\n pointer: number,\n axis: 'x' | 'y'\n): [Element, number] | undefined {\n const startProp = axis === 'x' ? 'left' : 'top'\n const endProp = axis === 'x' ? 'right' : 'bottom'\n const lastIndex = elements.length - 1\n\n const index = elements.findIndex((el, index) => {\n const rect = el.getBoundingClientRect()\n const boundaryStart = rect[startProp]\n const boundaryEnd = rect[endProp]\n\n // The pointer is within the boundary of the current element.\n if (boundaryStart <= pointer && pointer <= boundaryEnd) return true\n // The pointer is beyond the last element.\n if (index === lastIndex && pointer > boundaryEnd) return true\n // The pointer is before the first element.\n if (index === 0 && pointer < boundaryStart) return true\n\n return false\n })\n\n const element = elements[index]\n\n return element ? [element, index] : undefined\n}\n\nexport function getDragOverColumn(\n table: Element,\n pointerX: number\n): [element: Element, index: number] | undefined {\n const firstRow = table.querySelector('tr')\n if (!firstRow) return\n const cells = Array.from(firstRow.children)\n return findDragOverElement(cells, pointerX, 'x')\n}\n\nexport function getDragOverRow(\n table: Element,\n pointerY: number\n): [element: Element, index: number] | undefined {\n const rows = Array.from(table.querySelectorAll('tr'))\n return findDragOverElement(rows, pointerY, 'y')\n}\n","import { computePosition, offset } from '@floating-ui/dom'\nimport { throttle } from 'lodash-es'\n\nimport type { Refs } from '../view/types'\n\nimport { getRelatedDOM } from '../view/utils'\nimport { getDragOverColumn, getDragOverRow } from './calc-drag-over'\nimport { prepareDndContext } from './prepare-dnd-context'\n\nexport function createDragOverHandler(refs: Refs): (e: DragEvent) => void {\n return throttle((e: DragEvent) => {\n const context = prepareDndContext(refs)\n if (!context) return\n const { preview, content, contentRoot, xHandle, yHandle } = context\n const { dragInfo, hoverIndex } = refs\n\n if (preview.dataset.show === 'false') return\n const dom = getRelatedDOM(refs.contentWrapperRef, hoverIndex.value!)\n if (!dom) return\n const firstRow = contentRoot.querySelector('tr')\n if (!firstRow) return\n const info = dragInfo.value\n if (!info) return\n\n if (!contentRoot.offsetParent) return\n\n const wrapperOffsetTop = (contentRoot.offsetParent as HTMLElement).offsetTop\n const wrapperOffsetLeft = (contentRoot.offsetParent as HTMLElement)\n .offsetLeft\n\n if (info.type === 'col') {\n const width = dom.col.getBoundingClientRect().width\n const { left, width: fullWidth } = contentRoot.getBoundingClientRect()\n const leftGap = wrapperOffsetLeft - left\n const previewLeft = e.clientX + leftGap - width / 2\n\n const [startX] = info.startCoords\n const direction = startX < e.clientX ? 'right' : 'left'\n\n preview.style.top = `${wrapperOffsetTop}px`\n const previewLeftOffset =\n previewLeft < left + leftGap - 20\n ? left + leftGap - 20\n : previewLeft > left + fullWidth + leftGap - width + 20\n ? left + fullWidth + leftGap - width + 20\n : previewLeft\n\n preview.style.left = `${previewLeftOffset}px`\n\n const dragOverColumn = getDragOverColumn(contentRoot, e.clientX)\n if (dragOverColumn) {\n const [col, index] = dragOverColumn\n const yHandleWidth = yHandle.getBoundingClientRect().width\n const contentBoundary = content.getBoundingClientRect()\n info.endIndex = index\n\n computePosition(col, yHandle, {\n placement: direction === 'left' ? 'left' : 'right',\n middleware: [offset(direction === 'left' ? -1 * yHandleWidth : 0)],\n })\n .then(({ x }) => {\n yHandle.dataset.show = 'true'\n Object.assign(yHandle.style, {\n height: `${contentBoundary.height}px`,\n left: `${x}px`,\n top: `${wrapperOffsetTop}px`,\n })\n })\n .catch(console.error)\n }\n } else if (info.type === 'row') {\n const height = dom.row.getBoundingClientRect().height\n const { top, height: fullHeight } = contentRoot.getBoundingClientRect()\n\n const topGap = wrapperOffsetTop - top\n const previewTop = e.clientY + topGap - height / 2\n\n const [_, startY] = info.startCoords\n const direction = startY < e.clientY ? 'down' : 'up'\n\n const previewTopOffset =\n previewTop < top + topGap - 20\n ? top + topGap - 20\n : previewTop > top + fullHeight + topGap - height + 20\n ? top + fullHeight + topGap - height + 20\n : previewTop\n\n preview.style.top = `${previewTopOffset}px`\n preview.style.left = `${wrapperOffsetLeft}px`\n\n const dragOverRow = getDragOverRow(contentRoot, e.clientY)\n if (dragOverRow) {\n const [row, index] = dragOverRow\n const xHandleHeight = xHandle.getBoundingClientRect().height\n const contentBoundary = content.getBoundingClientRect()\n info.endIndex = index\n\n computePosition(row, xHandle, {\n placement: direction === 'up' ? 'top' : 'bottom',\n middleware: [offset(direction === 'up' ? -1 * xHandleHeight : 0)],\n })\n .then(({ y }) => {\n xHandle.dataset.show = 'true'\n Object.assign(xHandle.style, {\n width: `${contentBoundary.width}px`,\n top: `${y}px`,\n })\n })\n .catch(console.error)\n }\n }\n }, 20)\n}\n","import type { Ctx } from '@jvs-milkdown/ctx'\n\nimport { commandsCtx, editorViewCtx } from '@jvs-milkdown/core'\nimport {\n moveColCommand,\n moveRowCommand,\n selectColCommand,\n selectRowCommand,\n} from '@jvs-milkdown/preset-gfm'\nimport { onMounted, onUnmounted } from 'vue'\n\nimport type { CellIndex, Refs } from './types'\n\nimport {\n createDragColHandler,\n createDragRowHandler,\n} from '../dnd/create-drag-handler'\nimport { createDragOverHandler } from '../dnd/drag-over-handler'\n\nexport function useDragHandlers(\n refs: Refs,\n ctx?: Ctx,\n getPos?: () => number | undefined\n) {\n const { dragPreviewRef, yLineHandleRef, xLineHandleRef, dragInfo } = refs\n\n const dragRow = createDragRowHandler(refs, ctx)\n const dragCol = createDragColHandler(refs, ctx)\n\n const onDragEnd = () => {\n const preview = dragPreviewRef.value\n if (!preview) return\n\n if (preview.dataset.show === 'false') return\n\n const previewRoot = preview?.querySelector('tbody')\n\n while (previewRoot?.firstChild)\n previewRoot?.removeChild(previewRoot.firstChild)\n\n if (preview) preview.dataset.show = 'false'\n }\n\n const onDrop = () => {\n const preview = dragPreviewRef.value\n if (!preview) return\n const yHandle = yLineHandleRef.value\n if (!yHandle) return\n const xHandle = xLineHandleRef.value\n if (!xHandle) return\n const info = dragInfo.value\n if (!info) return\n if (!ctx) return\n if (preview.dataset.show === 'false') return\n\n yHandle.dataset.show = 'false'\n xHandle.dataset.show = 'false'\n\n if (info.startIndex === info.endIndex) return\n\n const commands = ctx.get(commandsCtx)\n const payload = {\n from: info.startIndex,\n to: info.endIndex,\n pos: (getPos?.() ?? 0) + 1,\n }\n if (info.type === 'col') {\n commands.call(selectColCommand.key, {\n pos: payload.pos,\n index: info.startIndex,\n })\n commands.call(moveColCommand.key, payload)\n const index: CellIndex = [0, info.endIndex]\n refs.hoverIndex.value = index\n } else {\n commands.call(selectRowCommand.key, {\n pos: payload.pos,\n index: info.startIndex,\n })\n commands.call(moveRowCommand.key, payload)\n const index: CellIndex = [info.endIndex, 0]\n refs.hoverIndex.value = index\n }\n\n requestAnimationFrame(() => {\n ctx.get(editorViewCtx).focus()\n })\n }\n const onDragOver = createDragOverHandler(refs)\n\n onMounted(() => {\n window.addEventListener('dragover', onDragOver)\n window.addEventListener('dragend', onDragEnd)\n window.addEventListener('drop', onDrop)\n })\n\n onUnmounted(() => {\n window.removeEventListener('dragover', onDragOver)\n window.removeEventListener('dragend', onDragEnd)\n window.removeEventListener('drop', onDrop)\n })\n\n return {\n dragRow,\n dragCol,\n }\n}\n","import type { Ctx } from '@jvs-milkdown/ctx'\n\nimport { commandsCtx, editorViewCtx } from '@jvs-milkdown/core'\nimport {\n addColAfterCommand,\n addColBeforeCommand,\n addRowAfterCommand,\n addRowBeforeCommand,\n deleteSelectedCellsCommand,\n mergeCellsCommand,\n selectColCommand,\n selectRowCommand,\n setAlignCommand,\n} from '@jvs-milkdown/preset-gfm'\nimport { TextSelection } from '@jvs-milkdown/prose/state'\nimport {\n CellSelection,\n selectedRect,\n splitCellWithType,\n} from '@jvs-milkdown/prose/tables'\n\nimport type { Refs } from './types'\n\nexport function useOperation(\n refs: Refs,\n ctx?: Ctx,\n getPos?: () => number | undefined\n) {\n const { contentWrapperRef, hoverIndex } = refs\n\n const addRowByIndex = (index: number) => {\n if (!ctx || !ctx.get(editorViewCtx).editable) return\n\n const rows = Array.from(\n contentWrapperRef.value?.querySelectorAll('tr') ?? []\n )\n const commands = ctx.get(commandsCtx)\n const pos = (getPos?.() ?? 0) + 1\n if (rows.length === index) {\n commands.call(selectRowCommand.key, { pos, index: index - 1 })\n commands.call(addRowAfterCommand.key)\n } else {\n commands.call(selectRowCommand.key, { pos, index })\n commands.call(addRowBeforeCommand.key)\n }\n\n commands.call(selectRowCommand.key, { pos, index })\n }\n\n const addColByIndex = (index: number) => {\n if (!ctx || !ctx.get(editorViewCtx).editable) return\n const cols = Array.from(\n contentWrapperRef.value?.querySelector('tr')?.children ?? []\n )\n const commands = ctx.get(commandsCtx)\n\n const pos = (getPos?.() ?? 0) + 1\n if (cols.length === index) {\n commands.call(selectColCommand.key, { pos, index: index - 1 })\n commands.call(addColAfterCommand.key)\n } else {\n commands.call(selectColCommand.key, { pos, index })\n commands.call(addColBeforeCommand.key)\n }\n commands.call(selectColCommand.key, { pos, index })\n }\n\n const selectCol = () => {\n if (!ctx) return\n const [_, colIndex] = hoverIndex.value!\n const commands = ctx.get(commandsCtx)\n const pos = (getPos?.() ?? 0) + 1\n commands.call(selectColCommand.key, { pos, index: colIndex })\n }\n\n const selectRow = () => {\n if (!ctx) return\n const [rowIndex, _] = hoverIndex.value!\n const commands = ctx.get(commandsCtx)\n const pos = (getPos?.() ?? 0) + 1\n commands.call(selectRowCommand.key, { pos, index: rowIndex })\n }\n\n const deleteSelected = (e: PointerEvent) => {\n if (!ctx) return\n\n if (!ctx.get(editorViewCtx).editable) return\n\n e.preventDefault()\n e.stopPropagation()\n const commands = ctx.get(commandsCtx)\n commands.call(deleteSelectedCellsCommand.key)\n requestAnimationFrame(() => {\n ctx.get(editorViewCtx).focus()\n })\n }\n\n const onAlign =\n (direction: 'left' | 'center' | 'right') => (e: PointerEvent) => {\n if (!ctx) return\n\n if (!ctx.get(editorViewCtx).editable) return\n\n e.preventDefault()\n e.stopPropagation()\n const commands = ctx.get(commandsCtx)\n commands.call(setAlignCommand.key, direction)\n requestAnimationFrame(() => {\n ctx.get(editorViewCtx).focus()\n })\n }\n\n const onMergeCells = (e: PointerEvent) => {\n if (!ctx) return\n if (!ctx.get(editorViewCtx).editable) return\n e.preventDefault()\n e.stopPropagation()\n const commands = ctx.get(commandsCtx)\n commands.call(mergeCellsCommand.key)\n requestAnimationFrame(() => {\n ctx.get(editorViewCtx).focus()\n })\n }\n\n const onSplitCell = (e: PointerEvent) => {\n if (!ctx) return\n if (!ctx.get(editorViewCtx).editable) return\n e.preventDefault()\n e.stopPropagation()\n const view = ctx.get(editorViewCtx)\n const { state } = view\n const { selection } = state\n\n // Find the merged cell\n let cellNode: ReturnType<typeof selection.$from.node> | null = null\n let cellPos: number | null = null\n\n if (selection instanceof CellSelection) {\n selection.forEachCell((cell, pos) => {\n if (\n !cellNode &&\n ((cell.attrs.rowspan ?? 1) > 1 || (cell.attrs.colspan ?? 1) > 1)\n ) {\n cellNode = cell\n cellPos = pos\n }\n })\n } else {\n const { $from } = selection\n for (let d = $from.depth; d > 0; d--) {\n const n = $from.node(d)\n if (n.type.name === 'table_cell' || n.type.name === 'table_header') {\n cellNode = n\n cellPos = $from.before(d)\n break\n }\n }\n }\n\n if (!cellNode || cellPos == null) return\n if (\n (cellNode.attrs.colspan ?? 1) == 1 &&\n (cellNode.attrs.rowspan ?? 1) == 1\n )\n return\n\n // Set selection to TextSelection inside the merged cell.\n // This avoids the prosemirror-tables bug where splitCell creates\n // a CellSelection using unmapped positions after the split.\n const $cellPos = state.doc.resolve(cellPos + 2)\n view.dispatch(state.tr.setSelection(TextSelection.near($cellPos)))\n\n // Use splitCellWithType to produce correct cell types per row.\n // prosemirror-tables' splitCell always uses the merged cell's type\n // (e.g. table_header) for ALL new cells, but milkdown's schema\n // requires table_header in table_header_row and table_cell in\n // table_row. Without this, inserts into body rows fail due to\n // schema mismatch, corrupting the table.\n const newState = view.state\n const { table } = selectedRect(newState)\n const { schema } = newState\n\n splitCellWithType(({ row }) => {\n const rowNode = table.child(row)\n return rowNode.type.name === 'table_header_row'\n ? schema.nodes.table_header!\n : schema.nodes.table_cell!\n })(newState, (tr) => {\n view.dispatch(tr)\n })\n\n requestAnimationFrame(() => {\n view.focus()\n })\n }\n\n return {\n addRowByIndex,\n addColByIndex,\n selectCol,\n selectRow,\n deleteSelected,\n onAlign,\n onMergeCells,\n onSplitCell,\n }\n}\n","import type { EditorView } from '@jvs-milkdown/prose/view'\n\nimport type { Refs } from './types'\n\nexport function usePointerHandlers(_refs: Refs, _view?: EditorView) {\n const pointerMove = (_e: PointerEvent) => {}\n const pointerLeave = () => {}\n\n return {\n pointerMove,\n pointerLeave,\n }\n}\n","import type { Ctx } from '@jvs-milkdown/ctx'\nimport type { Node } from '@jvs-milkdown/prose/model'\nimport type { EditorView } from '@jvs-milkdown/prose/view'\n\nimport { computePosition } from '@floating-ui/dom'\nimport { CellSelection } from '@jvs-milkdown/prose/tables'\nimport {\n defineComponent,\n ref,\n type VNodeRef,\n h,\n onMounted,\n onBeforeUnmount,\n type Ref,\n} from 'vue'\n\nimport type { TableBlockConfig } from '../config'\nimport type { CellIndex, DragInfo, Refs } from './types'\n\nimport { Icon } from '../../__internal__/components/icon'\nimport { keepAlive } from '../../__internal__/keep-alive'\nimport { useDragHandlers } from './drag'\nimport { useOperation } from './operation'\nimport { usePointerHandlers } from './pointer'\nimport { recoveryStateBetweenUpdate } from './utils'\n\nkeepAlive(h)\n\ntype TableBlockProps = {\n view: EditorView\n ctx: Ctx\n getPos: () => number | undefined\n config: TableBlockConfig\n onMount: (div: Element) => void\n node: Ref<Node>\n}\n\nexport const TableBlock = defineComponent<TableBlockProps>({\n props: {\n view: {\n type: Object,\n required: true,\n },\n ctx: {\n type: Object,\n required: true,\n },\n getPos: {\n type: Function,\n required: true,\n },\n config: {\n type: Object,\n required: true,\n },\n onMount: {\n type: Function,\n required: true,\n },\n node: {\n type: Object,\n required: true,\n },\n },\n setup({ view, node, ctx, getPos, config, onMount }) {\n const contentWrapperRef = ref<HTMLElement>()\n let contentMounted = false\n const contentWrapperFunctionRef: VNodeRef = (div) => {\n if (div == null) return\n if (div instanceof HTMLElement) {\n contentWrapperRef.value = div\n if (!contentMounted) {\n onMount(div)\n contentMounted = true\n }\n } else {\n contentWrapperRef.value = undefined\n }\n }\n const tableWrapperRef = ref<HTMLDivElement>()\n const dragPreviewRef = ref<HTMLDivElement>()\n const hoverIndex = ref<CellIndex>([0, 0])\n const lineHoverIndex = ref<CellIndex>([-1, -1])\n const dragInfo = ref<DragInfo>()\n\n // --- Column resize state ---\n const resizingCol = ref(-1)\n const colWidths = ref<number[]>([])\n\n const syncColWidths = () => {\n if (resizingCol.value >= 0) return\n const firstRow = node.value.firstChild\n if (!firstRow) return\n const colCount = firstRow.content.childCount\n const widths: number[] = []\n const hasBounds = colBounds.value.length === colCount\n for (let i = 0; i < colCount; i++) {\n const cell = firstRow.content.child(i)\n const w = cell.attrs.colwidth\n if (Array.isArray(w) && w[0]) {\n widths.push(w[0])\n } else if (hasBounds) {\n widths.push(Math.round(colBounds.value[i]!.width))\n } else {\n widths.push(0)\n }\n }\n colWidths.value = widths\n }\n\n const refs: Refs = {\n dragPreviewRef,\n tableWrapperRef,\n contentWrapperRef,\n hoverIndex,\n lineHoverIndex,\n dragInfo,\n }\n\n const { pointerLeave, pointerMove } = usePointerHandlers(refs, view)\n const { dragRow, dragCol } = useDragHandlers(refs, ctx, getPos)\n const {\n onAddRow,\n onAddCol,\n addRowByIndex,\n addColByIndex,\n selectCol,\n selectRow,\n deleteSelected,\n onAlign,\n onMergeCells,\n onSplitCell,\n } = useOperation(refs, ctx, getPos)\n\n // --- Floating cell toolbar state ---\n const cellToolbarRef = ref<HTMLDivElement>()\n const showCellToolbar = ref(false)\n const canMerge = ref(false)\n const canSplit = ref(false)\n\n const updateCellToolbar = () => {\n const { selection } = view.state\n const tablePos = getPos()\n if (tablePos == null) {\n showCellToolbar.value = false\n return\n }\n const tableEnd = tablePos + node.value.nodeSize\n if (selection.from < tablePos || selection.from > tableEnd) {\n showCellToolbar.value = false\n return\n }\n\n if (selection instanceof CellSelection) {\n // Compute merge/split availability\n let _cellCount = 0\n let hasMerged = false\n selection.forEachCell((cell) => {\n _cellCount++\n if ((cell.attrs.rowspan ?? 1) > 1 || (cell.attrs.colspan ?? 1) > 1) {\n hasMerged = true\n }\n })\n canMerge.value = _cellCount > 1\n canSplit.value = hasMerged\n } else {\n // TextSelection: only show toolbar for CellSelection-based actions\n showCellToolbar.value = false\n return\n }\n\n if (!canMerge.value && !canSplit.value) {\n showCellToolbar.value = false\n return\n }\n\n showCellToolbar.value = true\n\n // Position toolbar above the first selected cell using floating-ui\n requestAnimationFrame(() => {\n const toolbar = cellToolbarRef.value\n const content = contentWrapperRef.value\n if (!toolbar || !content) return\n\n const selectedCells = content.querySelectorAll('.selectedCell')\n let refEl: Element | null =\n selectedCells.length > 0 ? selectedCells[0]! : null\n\n if (!refEl && !(view.state.selection instanceof CellSelection)) {\n const { $from } = view.state.selection\n for (let d = $from.depth; d > 0; d--) {\n const node = $from.node(d)\n if (\n node.type.name === 'table_cell' ||\n node.type.name === 'table_header'\n ) {\n const cellPos = $from.before(d)\n const dom = view.nodeDOM(cellPos)\n if (dom instanceof HTMLElement) refEl = dom\n break\n }\n }\n }\n\n if (!refEl) return\n\n computePosition(refEl, toolbar, { placement: 'top' })\n .then(({ x, y }) => {\n toolbar.style.left = `${x}px`\n toolbar.style.top = `${y}px`\n toolbar.dataset.show = 'true'\n })\n .catch(console.error)\n })\n }\n\n const colBounds = ref<{ left: number; width: number }[]>([])\n const rowBounds = ref<{ top: number; height: number }[]>([])\n\n let ro: ResizeObserver | null = null\n let mo: MutationObserver | null = null\n\n const updateBounds = () => {\n const content = contentWrapperRef.value\n if (!content) return\n\n const firstRow = content.querySelector('tr')\n const tableRect = content.getBoundingClientRect()\n\n if (firstRow) {\n colBounds.value = Array.from(firstRow.children).map((c) => {\n const rect = c.getBoundingClientRect()\n return { left: rect.left - tableRect.left, width: rect.width }\n })\n }\n\n const rows = content.querySelectorAll('tr')\n rowBounds.value = Array.from(rows).map((c) => {\n const rect = c.getBoundingClientRect()\n return { top: rect.top - tableRect.top, height: rect.height }\n })\n syncColWidths()\n }\n\n const startResize = (e: PointerEvent, colIndex: number) => {\n if (!view.editable) return\n e.preventDefault()\n e.stopPropagation()\n const startX = e.clientX\n const startWidth = colBounds.value[colIndex]?.width ?? 100\n resizingCol.value = colIndex\n\n const onMove = (ev: PointerEvent) => {\n const delta = ev.clientX - startX\n const newWidth = Math.max(50, startWidth + delta)\n colWidths.value = colWidths.value.map((w, i) =>\n i === colIndex ? newWidth : w\n )\n }\n\n const onUp = (ev: PointerEvent) => {\n document.removeEventListener('pointermove', onMove)\n document.removeEventListener('pointerup', onUp)\n\n const delta = ev.clientX - startX\n const newWidth = Math.max(50, startWidth + delta)\n\n // Commit via ProseMirror transaction\n const tablePos = getPos()\n if (tablePos == null) {\n resizingCol.value = -1\n return\n }\n const tableNode = node.value\n let tr = view.state.tr\n let pos = tablePos + 1\n\n tableNode.forEach((row) => {\n let cellIdx = 0\n row.forEach((cell, _offset, cellNodePos) => {\n if (cellIdx === colIndex) {\n const absPos = tablePos + 1 + cellNodePos\n const colwidth = [Math.round(newWidth)]\n tr = tr.setNodeMarkup(absPos, undefined, {\n ...cell.attrs,\n colwidth,\n })\n }\n cellIdx++\n })\n pos += row.nodeSize\n })\n\n resizingCol.value = -1\n if (tr.docChanged) view.dispatch(tr)\n }\n\n document.addEventListener('pointermove', onMove)\n document.addEventListener('pointerup', onUp)\n }\n\n const activeColIndex = ref(-1)\n const activeRowIndex = ref(-1)\n\n // Listen for ProseMirror state updates\n const dispatchListener = () => {\n updateCellToolbar()\n\n // Update active handler button groups based on selection\n const { selection } = view.state\n if (selection instanceof CellSelection) {\n if (selection.isColSelection()) {\n const { $head } = selection\n activeColIndex.value = $head.index($head.depth - 1)\n activeRowIndex.value = -1\n } else if (selection.isRowSelection()) {\n activeColIndex.value = -1\n // Simple approach for row index: derive from hoverIndex which is updated by pointer? Or compute.\n // recoveryStateBetweenUpdate updates hoverIndex.\n } else {\n activeColIndex.value = -1\n activeRowIndex.value = -1\n }\n } else {\n activeColIndex.value = -1\n activeRowIndex.value = -1\n }\n }\n\n onMounted(() => {\n requestAnimationFrame(() => {\n if (view.editable) recoveryStateBetweenUpdate(refs, view, node.value)\n syncColWidths()\n })\n view.dom.addEventListener('keyup', dispatchListener)\n view.dom.addEventListener('pointerup', dispatchListener)\n updateCellToolbar()\n\n ro = new ResizeObserver(() => {\n requestAnimationFrame(updateBounds)\n })\n mo = new MutationObserver((mutations) => {\n let shouldUpdate = false\n for (const mut of mutations) {\n if (mut.type === 'childList') {\n for (const node of mut.addedNodes) {\n if (\n node instanceof HTMLElement &&\n ['TR', 'TD', 'TH', 'TBODY'].includes(node.nodeName)\n )\n shouldUpdate = true\n }\n for (const node of mut.removedNodes) {\n if (\n node instanceof HTMLElement &&\n ['TR', 'TD', 'TH', 'TBODY'].includes(node.nodeName)\n )\n shouldUpdate = true\n }\n } else if (mut.type === 'attributes') {\n shouldUpdate = true\n }\n }\n if (shouldUpdate) {\n requestAnimationFrame(updateBounds)\n }\n })\n\n if (contentWrapperRef.value) {\n ro.observe(contentWrapperRef.value)\n mo.observe(contentWrapperRef.value, {\n childList: true,\n subtree: true,\n attributes: true,\n })\n }\n })\n\n onBeforeUnmount(() => {\n view.dom.removeEventListener('keyup', dispatchListener)\n view.dom.removeEventListener('pointerup', dispatchListener)\n if (ro) ro.disconnect()\n if (mo) mo.disconnect()\n })\n\n return () => {\n updateCellToolbar()\n\n return (\n <div\n onDragstart={(e) => e.preventDefault()}\n onDragover={(e) => e.preventDefault()}\n onDragleave={(e) => e.preventDefault()}\n onPointermove={pointerMove}\n onPointerleave={pointerLeave}\n class=\"milkdown-table-wrapper-outer\"\n >\n {/* Floating cell toolbar (merge/split) */}\n <div\n ref={cellToolbarRef}\n data-show={showCellToolbar.value ? 'true' : 'false'}\n class=\"cell-toolbar\"\n contenteditable=\"false\"\n onPointerdown={(e: PointerEvent) => e.stopPropagation()}\n >\n {canMerge.value && (\n <button\n type=\"button\"\n class=\"cell-toolbar-btn\"\n onPointerdown={onMergeCells}\n >\n <Icon icon={config.renderButton('merge_cells')} />\n </button>\n )}\n {canSplit.value && (\n <button\n type=\"button\"\n class=\"cell-toolbar-btn\"\n onPointerdown={onSplitCell}\n >\n <Icon icon={config.renderButton('split_cell')} />\n </button>\n )}\n </div>\n\n <div class=\"table-wrapper\" ref={tableWrapperRef}>\n {/* Fixed Col Drag Handles */}\n <div contenteditable=\"false\" class=\"fixed-handles-col\">\n {colBounds.value.map((bound, i) => (\n <div\n key={`col-${i}`}\n class=\"handle cell-handle fixed\"\n data-role=\"col-drag-handle\"\n draggable=\"true\"\n style={{ left: `${bound.left}px`, width: `${bound.width}px` }}\n onDragstart={(e) => {\n hoverIndex.value = [0, i]\n dragCol(e)\n }}\n onClick={(e) => {\n hoverIndex.value = [0, i]\n selectCol(e)\n activeColIndex.value = i\n activeRowIndex.value = -1\n }}\n onPointerdown={(e: PointerEvent) => e.stopPropagation()}\n onPointermove={(e: PointerEvent) => e.stopPropagation()}\n >\n <div\n class=\"button-group\"\n data-show={activeColIndex.value === i ? 'true' : 'false'}\n onPointermove={(e: PointerEvent) => e.stopPropagation()}\n >\n <button\n type=\"button\"\n onPointerdown={(e) => {\n hoverIndex.value = [0, i]\n onAlign('left')(e)\n }}\n >\n <Icon icon={config.renderButton('align_col_left')} />\n </button>\n <button\n type=\"button\"\n onPointerdown={(e) => {\n hoverIndex.value = [0, i]\n onAlign('center')(e)\n }}\n >\n <Icon icon={config.renderButton('align_col_center')} />\n </button>\n <button\n type=\"button\"\n onPointerdown={(e) => {\n hoverIndex.value = [0, i]\n onAlign('right')(e)\n }}\n >\n <Icon icon={config.renderButton('align_col_right')} />\n </button>\n <button\n type=\"button\"\n onPointerdown={(e) => {\n hoverIndex.value = [0, i]\n deleteSelected(e)\n }}\n >\n <Icon icon={config.renderButton('delete_col')} />\n </button>\n </div>\n </div>\n ))}\n </div>\n\n {/* Add Col Dots */}\n <div contenteditable=\"false\" class=\"add-dots-col\">\n {[\n ...colBounds.value.map((b) => b.left),\n colBounds.value.length\n ? colBounds.value[colBounds.value.length - 1].left +\n colBounds.value[colBounds.value.length - 1].width\n : 0,\n ].map((left, i) => (\n <div\n key={`add-col-${i}`}\n class=\"add-dot\"\n style={{ left: `${left}px` }}\n onClick={() => addColByIndex(i)}\n onPointerdown={(e: PointerEvent) => e.stopPropagation()}\n >\n <Icon icon={config.renderButton('add_col')} />\n </div>\n ))}\n </div>\n\n {/* Column Resize Handles */}\n <div contenteditable=\"false\" class=\"resize-handles-col\">\n {colBounds.value.map((bound, i) => (\n <div\n key={`resize-${i}`}\n class={[\n 'col-resize-handle',\n resizingCol.value === i ? 'active' : '',\n ].join(' ')}\n style={{\n left: `${bound.left + bound.width - 3}px`,\n }}\n onPointerdown={(e: PointerEvent) => startResize(e, i)}\n />\n ))}\n </div>\n\n {/* Fixed Row Drag Handles */}\n <div contenteditable=\"false\" class=\"fixed-handles-row\">\n {rowBounds.value.map((bound, i) => (\n <div\n key={`row-${i}`}\n class=\"handle cell-handle fixed\"\n data-role=\"row-drag-handle\"\n draggable=\"true\"\n style={{ top: `${bound.top}px`, height: `${bound.height}px` }}\n onDragstart={(e) => {\n hoverIndex.value = [i, 0]\n dragRow(e)\n }}\n onClick={(e) => {\n hoverIndex.value = [i, 0]\n selectRow(e)\n activeRowIndex.value = i\n activeColIndex.value = -1\n }}\n onPointerdown={(e: PointerEvent) => e.stopPropagation()}\n >\n <div\n class=\"button-group\"\n data-show={activeRowIndex.value === i ? 'true' : 'false'}\n onPointermove={(e: PointerEvent) => e.stopPropagation()}\n >\n <button\n type=\"button\"\n onPointerdown={(e) => {\n hoverIndex.value = [i, 0]\n deleteSelected(e)\n }}\n >\n <Icon icon={config.renderButton('delete_row')} />\n </button>\n </div>\n </div>\n ))}\n </div>\n\n {/* Add Row Dots */}\n <div contenteditable=\"false\" class=\"add-dots-row\">\n {[\n ...rowBounds.value.map((b) => b.top),\n rowBounds.value.length\n ? rowBounds.value[rowBounds.value.length - 1].top +\n rowBounds.value[rowBounds.value.length - 1].height\n : 0,\n ].map((top, i) => (\n <div\n key={`add-row-${i}`}\n class=\"add-dot\"\n style={{ top: `${top}px` }}\n onClick={() => addRowByIndex(i)}\n onPointerdown={(e: PointerEvent) => e.stopPropagation()}\n >\n <Icon icon={config.renderButton('add_row')} />\n </div>\n ))}\n </div>\n\n <div\n data-show=\"false\"\n class=\"drag-preview\"\n data-direction=\"vertical\"\n ref={dragPreviewRef}\n >\n <table>\n <tbody></tbody>\n </table>\n </div>\n\n <table ref={contentWrapperFunctionRef} class=\"children\">\n <colgroup>\n {colWidths.value.map((w, i) => (\n <col\n key={i}\n style={w > 0 ? { width: `${w}px` } : undefined}\n />\n ))}\n </colgroup>\n </table>\n </div>\n </div>\n )\n }\n },\n})\n","import type { Ctx } from '@jvs-milkdown/ctx'\nimport type { Node } from '@jvs-milkdown/prose/model'\nimport type {\n EditorView,\n NodeView,\n NodeViewConstructor,\n ViewMutationRecord,\n} from '@jvs-milkdown/prose/view'\n\nimport { tableSchema } from '@jvs-milkdown/preset-gfm'\nimport { $view } from '@jvs-milkdown/utils'\nimport {\n createApp,\n shallowRef,\n triggerRef,\n type App,\n type ShallowRef,\n} from 'vue'\n\nimport { withMeta } from '../../__internal__/meta'\nimport { tableBlockConfig } from '../config'\nimport { TableBlock } from './component'\n\nexport class TableNodeView implements NodeView {\n dom: HTMLElement\n contentDOM: HTMLElement\n app: App\n\n nodeRef: ShallowRef<Node>\n #selectionUpdateScheduled = false\n\n constructor(\n public ctx: Ctx,\n public node: Node,\n public view: EditorView,\n public getPos: () => number | undefined\n ) {\n const dom = document.createElement('div')\n dom.className = 'milkdown-table-block'\n\n const contentDOM = document.createElement('tbody')\n this.contentDOM = contentDOM\n contentDOM.setAttribute('data-content-dom', 'true')\n contentDOM.classList.add('content-dom')\n this.nodeRef = shallowRef(node)\n\n const app = createApp(TableBlock, {\n view,\n ctx,\n getPos,\n config: ctx.get(tableBlockConfig.key),\n onMount: (div: Element) => {\n div.appendChild(contentDOM)\n },\n node: this.nodeRef,\n })\n app.mount(dom)\n this.app = app\n\n this.dom = dom\n }\n\n update(node: Node) {\n if (node.type !== this.node.type) return false\n\n if (node.sameMarkup(this.node) && node.content.eq(this.node.content)) {\n // Content unchanged — still trigger a reactive tick for selection-based UI (cell toolbar)\n if (!this.#selectionUpdateScheduled) {\n this.#selectionUpdateScheduled = true\n queueMicrotask(() => {\n triggerRef(this.nodeRef)\n this.#selectionUpdateScheduled = false\n })\n }\n return true\n }\n\n this.node = node\n this.nodeRef.value = node\n\n return true\n }\n\n stopEvent(e: Event) {\n if (e.type === 'drop' || e.type.startsWith('drag')) return true\n\n if (e.type === 'mousedown' || e.type === 'pointerdown') {\n if (e.target instanceof Element && e.target.closest('button')) return true\n }\n\n return false\n }\n\n ignoreMutation(mutation: ViewMutationRecord) {\n if (!this.dom || !this.contentDOM) return true\n\n if ((mutation.type as unknown) === 'selection') return false\n\n if (this.contentDOM === mutation.target && mutation.type === 'attributes')\n return true\n\n if (this.contentDOM.contains(mutation.target)) return false\n\n return true\n }\n\n destroy() {\n this.app.unmount()\n this.dom.remove()\n this.contentDOM.remove()\n }\n}\n\nexport const tableBlockView = $view(\n tableSchema.node,\n (ctx): NodeViewConstructor => {\n return (initialNode, view, getPos) => {\n return new TableNodeView(ctx, initialNode, view, getPos)\n }\n }\n)\n\nwithMeta(tableBlockView, {\n displayName: 'NodeView<table-block>',\n group: 'TableBlock',\n})\n","import type { MilkdownPlugin } from '@jvs-milkdown/ctx'\n\nimport { tableBlockConfig } from './config'\nimport { tableBlockView } from './view'\n\nexport * from './view'\nexport * from './config'\n\nexport const tableBlock: MilkdownPlugin[] = [tableBlockConfig, tableBlockView]\n"],"names":["__spreadValues","mac","node","index","_a","_b"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,SAAS,QAAA,CACd,QACA,IAAA,EACG;AACH,EAAA,MAAA,CAAO,OAAO,MAAA,EAAQ;AAAA,IACpB,IAAA,EAAMA,gBAAA,CAAA;AAAA,MACJ,OAAA,EAAS;AAAA,KAAA,EACN,IAAA;AAAA,GAEN,CAAA;AAED,EAAA,OAAO,MAAA;AACT;;;;;;;;;;;;;;;;;;ACOA,MAAM,uBAAA,GAA4C;AAAA,EAChD,YAAA,EAAc,CAAC,UAAA,KAAe;AAC5B,IAAA,QAAQ,UAAA;AAAY,MAClB,KAAK,SAAA;AACH,QAAA,OAAO,GAAA;AAAA,MAC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AC5B,WAAA,CAAY,IAAA;AAAA,EACZ,CAAC,GAAA,KAA6B;AAC5B,IAAA,OAAO,CAAC,WAAA,EAAa,IAAA,EAAM,MAAA,KAAW;AACpC,MAAA,OAAO,IAAI,aAAA,CAAc,GAAA,EAAK,WAAA,EAAa,MAAM,MAAM,CAAA;AAAA,IACzD,CAAA;AAAA,EACF;AACF;AAEA,QAAA,CAAS,cAAA,EAAgB;AAAA,EACvB,WAAA,EAAa,uBAAA;AAAA,EACb,KAAA,EAAO;AACT,CAAC,CAAA;;ACrHM,MAAM,UAAA,GAA+B,CAAC,gBAAA,EAAkB,cAAc;;;;","x_google_ignoreList":[2,3,4,5,6,7]}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/__internal__/meta.ts","../../src/table-block/config.ts","../../../../node_modules/.pnpm/prosemirror-model@1.25.4/node_modules/prosemirror-model/dist/index.js","../../../../node_modules/.pnpm/prosemirror-transform@1.11.0/node_modules/prosemirror-transform/dist/index.js","../../../../node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.js","../../../../node_modules/.pnpm/w3c-keyname@2.2.8/node_modules/w3c-keyname/index.js","../../../../node_modules/.pnpm/prosemirror-keymap@1.2.3/node_modules/prosemirror-keymap/dist/index.js","../../../../node_modules/.pnpm/prosemirror-tables@1.8.5/node_modules/prosemirror-tables/dist/index.js","../../src/__internal__/keep-alive.ts","../../src/__internal__/components/icon.tsx","../../src/table-block/dnd/prepare-dnd-context.ts","../../src/table-block/dnd/preview.ts","../../src/table-block/dnd/create-drag-handler.ts","../../src/table-block/view/utils.ts","../../src/table-block/dnd/calc-drag-over.ts","../../src/table-block/dnd/drag-over-handler.ts","../../src/table-block/view/drag.ts","../../src/table-block/view/operation.ts","../../src/table-block/view/pointer.ts","../../src/table-block/view/component.tsx","../../src/table-block/view/view.ts","../../src/table-block/index.ts"],"sourcesContent":["import type { Meta, MilkdownPlugin } from '@jvs-milkdown/ctx'\n\nexport function withMeta<T extends MilkdownPlugin>(\n plugin: T,\n meta: Partial<Meta> & Pick<Meta, 'displayName'>\n): T {\n Object.assign(plugin, {\n meta: {\n package: '@jvs-milkdown/components',\n ...meta,\n },\n })\n\n return plugin\n}\n","import { $ctx } from '@jvs-milkdown/utils'\n\nimport { withMeta } from '../__internal__/meta'\n\nexport type RenderType =\n | 'add_row'\n | 'add_col'\n | 'delete_row'\n | 'delete_col'\n | 'align_col_left'\n | 'align_col_center'\n | 'align_col_right'\n | 'col_drag_handle'\n | 'row_drag_handle'\n | 'merge_cells'\n | 'split_cell'\n\nexport interface TableBlockConfig {\n renderButton: (renderType: RenderType) => string\n}\n\nconst defaultTableBlockConfig: TableBlockConfig = {\n renderButton: (renderType) => {\n switch (renderType) {\n case 'add_row':\n return '+'\n case 'add_col':\n return '+'\n case 'delete_row':\n return '-'\n case 'delete_col':\n return '-'\n case 'align_col_left':\n return 'left'\n case 'align_col_center':\n return 'center'\n case 'align_col_right':\n return 'right'\n case 'col_drag_handle':\n return '='\n case 'row_drag_handle':\n return '='\n case 'merge_cells':\n return '⊞'\n case 'split_cell':\n return '⊟'\n }\n },\n}\n\nexport const tableBlockConfig = $ctx(\n { ...defaultTableBlockConfig },\n 'tableBlockConfigCtx'\n)\n\nwithMeta(tableBlockConfig, {\n displayName: 'Config<table-block>',\n group: 'TableBlock',\n})\n","import OrderedMap from 'orderedmap';\n\nfunction findDiffStart(a, b, pos) {\n for (let i = 0;; i++) {\n if (i == a.childCount || i == b.childCount)\n return a.childCount == b.childCount ? null : pos;\n let childA = a.child(i), childB = b.child(i);\n if (childA == childB) {\n pos += childA.nodeSize;\n continue;\n }\n if (!childA.sameMarkup(childB))\n return pos;\n if (childA.isText && childA.text != childB.text) {\n for (let j = 0; childA.text[j] == childB.text[j]; j++)\n pos++;\n return pos;\n }\n if (childA.content.size || childB.content.size) {\n let inner = findDiffStart(childA.content, childB.content, pos + 1);\n if (inner != null)\n return inner;\n }\n pos += childA.nodeSize;\n }\n}\nfunction findDiffEnd(a, b, posA, posB) {\n for (let iA = a.childCount, iB = b.childCount;;) {\n if (iA == 0 || iB == 0)\n return iA == iB ? null : { a: posA, b: posB };\n let childA = a.child(--iA), childB = b.child(--iB), size = childA.nodeSize;\n if (childA == childB) {\n posA -= size;\n posB -= size;\n continue;\n }\n if (!childA.sameMarkup(childB))\n return { a: posA, b: posB };\n if (childA.isText && childA.text != childB.text) {\n let same = 0, minSize = Math.min(childA.text.length, childB.text.length);\n while (same < minSize && childA.text[childA.text.length - same - 1] == childB.text[childB.text.length - same - 1]) {\n same++;\n posA--;\n posB--;\n }\n return { a: posA, b: posB };\n }\n if (childA.content.size || childB.content.size) {\n let inner = findDiffEnd(childA.content, childB.content, posA - 1, posB - 1);\n if (inner)\n return inner;\n }\n posA -= size;\n posB -= size;\n }\n}\n\n/**\nA fragment represents a node's collection of child nodes.\n\nLike nodes, fragments are persistent data structures, and you\nshould not mutate them or their content. Rather, you create new\ninstances whenever needed. The API tries to make this easy.\n*/\nclass Fragment {\n /**\n @internal\n */\n constructor(\n /**\n The child nodes in this fragment.\n */\n content, size) {\n this.content = content;\n this.size = size || 0;\n if (size == null)\n for (let i = 0; i < content.length; i++)\n this.size += content[i].nodeSize;\n }\n /**\n Invoke a callback for all descendant nodes between the given two\n positions (relative to start of this fragment). Doesn't descend\n into a node when the callback returns `false`.\n */\n nodesBetween(from, to, f, nodeStart = 0, parent) {\n for (let i = 0, pos = 0; pos < to; i++) {\n let child = this.content[i], end = pos + child.nodeSize;\n if (end > from && f(child, nodeStart + pos, parent || null, i) !== false && child.content.size) {\n let start = pos + 1;\n child.nodesBetween(Math.max(0, from - start), Math.min(child.content.size, to - start), f, nodeStart + start);\n }\n pos = end;\n }\n }\n /**\n Call the given callback for every descendant node. `pos` will be\n relative to the start of the fragment. The callback may return\n `false` to prevent traversal of a given node's children.\n */\n descendants(f) {\n this.nodesBetween(0, this.size, f);\n }\n /**\n Extract the text between `from` and `to`. See the same method on\n [`Node`](https://prosemirror.net/docs/ref/#model.Node.textBetween).\n */\n textBetween(from, to, blockSeparator, leafText) {\n let text = \"\", first = true;\n this.nodesBetween(from, to, (node, pos) => {\n let nodeText = node.isText ? node.text.slice(Math.max(from, pos) - pos, to - pos)\n : !node.isLeaf ? \"\"\n : leafText ? (typeof leafText === \"function\" ? leafText(node) : leafText)\n : node.type.spec.leafText ? node.type.spec.leafText(node)\n : \"\";\n if (node.isBlock && (node.isLeaf && nodeText || node.isTextblock) && blockSeparator) {\n if (first)\n first = false;\n else\n text += blockSeparator;\n }\n text += nodeText;\n }, 0);\n return text;\n }\n /**\n Create a new fragment containing the combined content of this\n fragment and the other.\n */\n append(other) {\n if (!other.size)\n return this;\n if (!this.size)\n return other;\n let last = this.lastChild, first = other.firstChild, content = this.content.slice(), i = 0;\n if (last.isText && last.sameMarkup(first)) {\n content[content.length - 1] = last.withText(last.text + first.text);\n i = 1;\n }\n for (; i < other.content.length; i++)\n content.push(other.content[i]);\n return new Fragment(content, this.size + other.size);\n }\n /**\n Cut out the sub-fragment between the two given positions.\n */\n cut(from, to = this.size) {\n if (from == 0 && to == this.size)\n return this;\n let result = [], size = 0;\n if (to > from)\n for (let i = 0, pos = 0; pos < to; i++) {\n let child = this.content[i], end = pos + child.nodeSize;\n if (end > from) {\n if (pos < from || end > to) {\n if (child.isText)\n child = child.cut(Math.max(0, from - pos), Math.min(child.text.length, to - pos));\n else\n child = child.cut(Math.max(0, from - pos - 1), Math.min(child.content.size, to - pos - 1));\n }\n result.push(child);\n size += child.nodeSize;\n }\n pos = end;\n }\n return new Fragment(result, size);\n }\n /**\n @internal\n */\n cutByIndex(from, to) {\n if (from == to)\n return Fragment.empty;\n if (from == 0 && to == this.content.length)\n return this;\n return new Fragment(this.content.slice(from, to));\n }\n /**\n Create a new fragment in which the node at the given index is\n replaced by the given node.\n */\n replaceChild(index, node) {\n let current = this.content[index];\n if (current == node)\n return this;\n let copy = this.content.slice();\n let size = this.size + node.nodeSize - current.nodeSize;\n copy[index] = node;\n return new Fragment(copy, size);\n }\n /**\n Create a new fragment by prepending the given node to this\n fragment.\n */\n addToStart(node) {\n return new Fragment([node].concat(this.content), this.size + node.nodeSize);\n }\n /**\n Create a new fragment by appending the given node to this\n fragment.\n */\n addToEnd(node) {\n return new Fragment(this.content.concat(node), this.size + node.nodeSize);\n }\n /**\n Compare this fragment to another one.\n */\n eq(other) {\n if (this.content.length != other.content.length)\n return false;\n for (let i = 0; i < this.content.length; i++)\n if (!this.content[i].eq(other.content[i]))\n return false;\n return true;\n }\n /**\n The first child of the fragment, or `null` if it is empty.\n */\n get firstChild() { return this.content.length ? this.content[0] : null; }\n /**\n The last child of the fragment, or `null` if it is empty.\n */\n get lastChild() { return this.content.length ? this.content[this.content.length - 1] : null; }\n /**\n The number of child nodes in this fragment.\n */\n get childCount() { return this.content.length; }\n /**\n Get the child node at the given index. Raise an error when the\n index is out of range.\n */\n child(index) {\n let found = this.content[index];\n if (!found)\n throw new RangeError(\"Index \" + index + \" out of range for \" + this);\n return found;\n }\n /**\n Get the child node at the given index, if it exists.\n */\n maybeChild(index) {\n return this.content[index] || null;\n }\n /**\n Call `f` for every child node, passing the node, its offset\n into this parent node, and its index.\n */\n forEach(f) {\n for (let i = 0, p = 0; i < this.content.length; i++) {\n let child = this.content[i];\n f(child, p, i);\n p += child.nodeSize;\n }\n }\n /**\n Find the first position at which this fragment and another\n fragment differ, or `null` if they are the same.\n */\n findDiffStart(other, pos = 0) {\n return findDiffStart(this, other, pos);\n }\n /**\n Find the first position, searching from the end, at which this\n fragment and the given fragment differ, or `null` if they are\n the same. Since this position will not be the same in both\n nodes, an object with two separate positions is returned.\n */\n findDiffEnd(other, pos = this.size, otherPos = other.size) {\n return findDiffEnd(this, other, pos, otherPos);\n }\n /**\n Find the index and inner offset corresponding to a given relative\n position in this fragment. The result object will be reused\n (overwritten) the next time the function is called. @internal\n */\n findIndex(pos) {\n if (pos == 0)\n return retIndex(0, pos);\n if (pos == this.size)\n return retIndex(this.content.length, pos);\n if (pos > this.size || pos < 0)\n throw new RangeError(`Position ${pos} outside of fragment (${this})`);\n for (let i = 0, curPos = 0;; i++) {\n let cur = this.child(i), end = curPos + cur.nodeSize;\n if (end >= pos) {\n if (end == pos)\n return retIndex(i + 1, end);\n return retIndex(i, curPos);\n }\n curPos = end;\n }\n }\n /**\n Return a debugging string that describes this fragment.\n */\n toString() { return \"<\" + this.toStringInner() + \">\"; }\n /**\n @internal\n */\n toStringInner() { return this.content.join(\", \"); }\n /**\n Create a JSON-serializeable representation of this fragment.\n */\n toJSON() {\n return this.content.length ? this.content.map(n => n.toJSON()) : null;\n }\n /**\n Deserialize a fragment from its JSON representation.\n */\n static fromJSON(schema, value) {\n if (!value)\n return Fragment.empty;\n if (!Array.isArray(value))\n throw new RangeError(\"Invalid input for Fragment.fromJSON\");\n return new Fragment(value.map(schema.nodeFromJSON));\n }\n /**\n Build a fragment from an array of nodes. Ensures that adjacent\n text nodes with the same marks are joined together.\n */\n static fromArray(array) {\n if (!array.length)\n return Fragment.empty;\n let joined, size = 0;\n for (let i = 0; i < array.length; i++) {\n let node = array[i];\n size += node.nodeSize;\n if (i && node.isText && array[i - 1].sameMarkup(node)) {\n if (!joined)\n joined = array.slice(0, i);\n joined[joined.length - 1] = node\n .withText(joined[joined.length - 1].text + node.text);\n }\n else if (joined) {\n joined.push(node);\n }\n }\n return new Fragment(joined || array, size);\n }\n /**\n Create a fragment from something that can be interpreted as a\n set of nodes. For `null`, it returns the empty fragment. For a\n fragment, the fragment itself. For a node or array of nodes, a\n fragment containing those nodes.\n */\n static from(nodes) {\n if (!nodes)\n return Fragment.empty;\n if (nodes instanceof Fragment)\n return nodes;\n if (Array.isArray(nodes))\n return this.fromArray(nodes);\n if (nodes.attrs)\n return new Fragment([nodes], nodes.nodeSize);\n throw new RangeError(\"Can not convert \" + nodes + \" to a Fragment\" +\n (nodes.nodesBetween ? \" (looks like multiple versions of prosemirror-model were loaded)\" : \"\"));\n }\n}\n/**\nAn empty fragment. Intended to be reused whenever a node doesn't\ncontain anything (rather than allocating a new empty fragment for\neach leaf node).\n*/\nFragment.empty = new Fragment([], 0);\nconst found = { index: 0, offset: 0 };\nfunction retIndex(index, offset) {\n found.index = index;\n found.offset = offset;\n return found;\n}\n\nfunction compareDeep(a, b) {\n if (a === b)\n return true;\n if (!(a && typeof a == \"object\") ||\n !(b && typeof b == \"object\"))\n return false;\n let array = Array.isArray(a);\n if (Array.isArray(b) != array)\n return false;\n if (array) {\n if (a.length != b.length)\n return false;\n for (let i = 0; i < a.length; i++)\n if (!compareDeep(a[i], b[i]))\n return false;\n }\n else {\n for (let p in a)\n if (!(p in b) || !compareDeep(a[p], b[p]))\n return false;\n for (let p in b)\n if (!(p in a))\n return false;\n }\n return true;\n}\n\n/**\nA mark is a piece of information that can be attached to a node,\nsuch as it being emphasized, in code font, or a link. It has a\ntype and optionally a set of attributes that provide further\ninformation (such as the target of the link). Marks are created\nthrough a `Schema`, which controls which types exist and which\nattributes they have.\n*/\nclass Mark {\n /**\n @internal\n */\n constructor(\n /**\n The type of this mark.\n */\n type, \n /**\n The attributes associated with this mark.\n */\n attrs) {\n this.type = type;\n this.attrs = attrs;\n }\n /**\n Given a set of marks, create a new set which contains this one as\n well, in the right position. If this mark is already in the set,\n the set itself is returned. If any marks that are set to be\n [exclusive](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) with this mark are present,\n those are replaced by this one.\n */\n addToSet(set) {\n let copy, placed = false;\n for (let i = 0; i < set.length; i++) {\n let other = set[i];\n if (this.eq(other))\n return set;\n if (this.type.excludes(other.type)) {\n if (!copy)\n copy = set.slice(0, i);\n }\n else if (other.type.excludes(this.type)) {\n return set;\n }\n else {\n if (!placed && other.type.rank > this.type.rank) {\n if (!copy)\n copy = set.slice(0, i);\n copy.push(this);\n placed = true;\n }\n if (copy)\n copy.push(other);\n }\n }\n if (!copy)\n copy = set.slice();\n if (!placed)\n copy.push(this);\n return copy;\n }\n /**\n Remove this mark from the given set, returning a new set. If this\n mark is not in the set, the set itself is returned.\n */\n removeFromSet(set) {\n for (let i = 0; i < set.length; i++)\n if (this.eq(set[i]))\n return set.slice(0, i).concat(set.slice(i + 1));\n return set;\n }\n /**\n Test whether this mark is in the given set of marks.\n */\n isInSet(set) {\n for (let i = 0; i < set.length; i++)\n if (this.eq(set[i]))\n return true;\n return false;\n }\n /**\n Test whether this mark has the same type and attributes as\n another mark.\n */\n eq(other) {\n return this == other ||\n (this.type == other.type && compareDeep(this.attrs, other.attrs));\n }\n /**\n Convert this mark to a JSON-serializeable representation.\n */\n toJSON() {\n let obj = { type: this.type.name };\n for (let _ in this.attrs) {\n obj.attrs = this.attrs;\n break;\n }\n return obj;\n }\n /**\n Deserialize a mark from JSON.\n */\n static fromJSON(schema, json) {\n if (!json)\n throw new RangeError(\"Invalid input for Mark.fromJSON\");\n let type = schema.marks[json.type];\n if (!type)\n throw new RangeError(`There is no mark type ${json.type} in this schema`);\n let mark = type.create(json.attrs);\n type.checkAttrs(mark.attrs);\n return mark;\n }\n /**\n Test whether two sets of marks are identical.\n */\n static sameSet(a, b) {\n if (a == b)\n return true;\n if (a.length != b.length)\n return false;\n for (let i = 0; i < a.length; i++)\n if (!a[i].eq(b[i]))\n return false;\n return true;\n }\n /**\n Create a properly sorted mark set from null, a single mark, or an\n unsorted array of marks.\n */\n static setFrom(marks) {\n if (!marks || Array.isArray(marks) && marks.length == 0)\n return Mark.none;\n if (marks instanceof Mark)\n return [marks];\n let copy = marks.slice();\n copy.sort((a, b) => a.type.rank - b.type.rank);\n return copy;\n }\n}\n/**\nThe empty set of marks.\n*/\nMark.none = [];\n\n/**\nError type raised by [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) when\ngiven an invalid replacement.\n*/\nclass ReplaceError extends Error {\n}\n/*\nReplaceError = function(this: any, message: string) {\n let err = Error.call(this, message)\n ;(err as any).__proto__ = ReplaceError.prototype\n return err\n} as any\n\nReplaceError.prototype = Object.create(Error.prototype)\nReplaceError.prototype.constructor = ReplaceError\nReplaceError.prototype.name = \"ReplaceError\"\n*/\n/**\nA slice represents a piece cut out of a larger document. It\nstores not only a fragment, but also the depth up to which nodes on\nboth side are ‘open’ (cut through).\n*/\nclass Slice {\n /**\n Create a slice. When specifying a non-zero open depth, you must\n make sure that there are nodes of at least that depth at the\n appropriate side of the fragment—i.e. if the fragment is an\n empty paragraph node, `openStart` and `openEnd` can't be greater\n than 1.\n \n It is not necessary for the content of open nodes to conform to\n the schema's content constraints, though it should be a valid\n start/end/middle for such a node, depending on which sides are\n open.\n */\n constructor(\n /**\n The slice's content.\n */\n content, \n /**\n The open depth at the start of the fragment.\n */\n openStart, \n /**\n The open depth at the end.\n */\n openEnd) {\n this.content = content;\n this.openStart = openStart;\n this.openEnd = openEnd;\n }\n /**\n The size this slice would add when inserted into a document.\n */\n get size() {\n return this.content.size - this.openStart - this.openEnd;\n }\n /**\n @internal\n */\n insertAt(pos, fragment) {\n let content = insertInto(this.content, pos + this.openStart, fragment);\n return content && new Slice(content, this.openStart, this.openEnd);\n }\n /**\n @internal\n */\n removeBetween(from, to) {\n return new Slice(removeRange(this.content, from + this.openStart, to + this.openStart), this.openStart, this.openEnd);\n }\n /**\n Tests whether this slice is equal to another slice.\n */\n eq(other) {\n return this.content.eq(other.content) && this.openStart == other.openStart && this.openEnd == other.openEnd;\n }\n /**\n @internal\n */\n toString() {\n return this.content + \"(\" + this.openStart + \",\" + this.openEnd + \")\";\n }\n /**\n Convert a slice to a JSON-serializable representation.\n */\n toJSON() {\n if (!this.content.size)\n return null;\n let json = { content: this.content.toJSON() };\n if (this.openStart > 0)\n json.openStart = this.openStart;\n if (this.openEnd > 0)\n json.openEnd = this.openEnd;\n return json;\n }\n /**\n Deserialize a slice from its JSON representation.\n */\n static fromJSON(schema, json) {\n if (!json)\n return Slice.empty;\n let openStart = json.openStart || 0, openEnd = json.openEnd || 0;\n if (typeof openStart != \"number\" || typeof openEnd != \"number\")\n throw new RangeError(\"Invalid input for Slice.fromJSON\");\n return new Slice(Fragment.fromJSON(schema, json.content), openStart, openEnd);\n }\n /**\n Create a slice from a fragment by taking the maximum possible\n open value on both side of the fragment.\n */\n static maxOpen(fragment, openIsolating = true) {\n let openStart = 0, openEnd = 0;\n for (let n = fragment.firstChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.firstChild)\n openStart++;\n for (let n = fragment.lastChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.lastChild)\n openEnd++;\n return new Slice(fragment, openStart, openEnd);\n }\n}\n/**\nThe empty slice.\n*/\nSlice.empty = new Slice(Fragment.empty, 0, 0);\nfunction removeRange(content, from, to) {\n let { index, offset } = content.findIndex(from), child = content.maybeChild(index);\n let { index: indexTo, offset: offsetTo } = content.findIndex(to);\n if (offset == from || child.isText) {\n if (offsetTo != to && !content.child(indexTo).isText)\n throw new RangeError(\"Removing non-flat range\");\n return content.cut(0, from).append(content.cut(to));\n }\n if (index != indexTo)\n throw new RangeError(\"Removing non-flat range\");\n return content.replaceChild(index, child.copy(removeRange(child.content, from - offset - 1, to - offset - 1)));\n}\nfunction insertInto(content, dist, insert, parent) {\n let { index, offset } = content.findIndex(dist), child = content.maybeChild(index);\n if (offset == dist || child.isText) {\n if (parent && !parent.canReplace(index, index, insert))\n return null;\n return content.cut(0, dist).append(insert).append(content.cut(dist));\n }\n let inner = insertInto(child.content, dist - offset - 1, insert, child);\n return inner && content.replaceChild(index, child.copy(inner));\n}\nfunction replace($from, $to, slice) {\n if (slice.openStart > $from.depth)\n throw new ReplaceError(\"Inserted content deeper than insertion position\");\n if ($from.depth - slice.openStart != $to.depth - slice.openEnd)\n throw new ReplaceError(\"Inconsistent open depths\");\n return replaceOuter($from, $to, slice, 0);\n}\nfunction replaceOuter($from, $to, slice, depth) {\n let index = $from.index(depth), node = $from.node(depth);\n if (index == $to.index(depth) && depth < $from.depth - slice.openStart) {\n let inner = replaceOuter($from, $to, slice, depth + 1);\n return node.copy(node.content.replaceChild(index, inner));\n }\n else if (!slice.content.size) {\n return close(node, replaceTwoWay($from, $to, depth));\n }\n else if (!slice.openStart && !slice.openEnd && $from.depth == depth && $to.depth == depth) { // Simple, flat case\n let parent = $from.parent, content = parent.content;\n return close(parent, content.cut(0, $from.parentOffset).append(slice.content).append(content.cut($to.parentOffset)));\n }\n else {\n let { start, end } = prepareSliceForReplace(slice, $from);\n return close(node, replaceThreeWay($from, start, end, $to, depth));\n }\n}\nfunction checkJoin(main, sub) {\n if (!sub.type.compatibleContent(main.type))\n throw new ReplaceError(\"Cannot join \" + sub.type.name + \" onto \" + main.type.name);\n}\nfunction joinable($before, $after, depth) {\n let node = $before.node(depth);\n checkJoin(node, $after.node(depth));\n return node;\n}\nfunction addNode(child, target) {\n let last = target.length - 1;\n if (last >= 0 && child.isText && child.sameMarkup(target[last]))\n target[last] = child.withText(target[last].text + child.text);\n else\n target.push(child);\n}\nfunction addRange($start, $end, depth, target) {\n let node = ($end || $start).node(depth);\n let startIndex = 0, endIndex = $end ? $end.index(depth) : node.childCount;\n if ($start) {\n startIndex = $start.index(depth);\n if ($start.depth > depth) {\n startIndex++;\n }\n else if ($start.textOffset) {\n addNode($start.nodeAfter, target);\n startIndex++;\n }\n }\n for (let i = startIndex; i < endIndex; i++)\n addNode(node.child(i), target);\n if ($end && $end.depth == depth && $end.textOffset)\n addNode($end.nodeBefore, target);\n}\nfunction close(node, content) {\n node.type.checkContent(content);\n return node.copy(content);\n}\nfunction replaceThreeWay($from, $start, $end, $to, depth) {\n let openStart = $from.depth > depth && joinable($from, $start, depth + 1);\n let openEnd = $to.depth > depth && joinable($end, $to, depth + 1);\n let content = [];\n addRange(null, $from, depth, content);\n if (openStart && openEnd && $start.index(depth) == $end.index(depth)) {\n checkJoin(openStart, openEnd);\n addNode(close(openStart, replaceThreeWay($from, $start, $end, $to, depth + 1)), content);\n }\n else {\n if (openStart)\n addNode(close(openStart, replaceTwoWay($from, $start, depth + 1)), content);\n addRange($start, $end, depth, content);\n if (openEnd)\n addNode(close(openEnd, replaceTwoWay($end, $to, depth + 1)), content);\n }\n addRange($to, null, depth, content);\n return new Fragment(content);\n}\nfunction replaceTwoWay($from, $to, depth) {\n let content = [];\n addRange(null, $from, depth, content);\n if ($from.depth > depth) {\n let type = joinable($from, $to, depth + 1);\n addNode(close(type, replaceTwoWay($from, $to, depth + 1)), content);\n }\n addRange($to, null, depth, content);\n return new Fragment(content);\n}\nfunction prepareSliceForReplace(slice, $along) {\n let extra = $along.depth - slice.openStart, parent = $along.node(extra);\n let node = parent.copy(slice.content);\n for (let i = extra - 1; i >= 0; i--)\n node = $along.node(i).copy(Fragment.from(node));\n return { start: node.resolveNoCache(slice.openStart + extra),\n end: node.resolveNoCache(node.content.size - slice.openEnd - extra) };\n}\n\n/**\nYou can [_resolve_](https://prosemirror.net/docs/ref/#model.Node.resolve) a position to get more\ninformation about it. Objects of this class represent such a\nresolved position, providing various pieces of context\ninformation, and some helper methods.\n\nThroughout this interface, methods that take an optional `depth`\nparameter will interpret undefined as `this.depth` and negative\nnumbers as `this.depth + value`.\n*/\nclass ResolvedPos {\n /**\n @internal\n */\n constructor(\n /**\n The position that was resolved.\n */\n pos, \n /**\n @internal\n */\n path, \n /**\n The offset this position has into its parent node.\n */\n parentOffset) {\n this.pos = pos;\n this.path = path;\n this.parentOffset = parentOffset;\n this.depth = path.length / 3 - 1;\n }\n /**\n @internal\n */\n resolveDepth(val) {\n if (val == null)\n return this.depth;\n if (val < 0)\n return this.depth + val;\n return val;\n }\n /**\n The parent node that the position points into. Note that even if\n a position points into a text node, that node is not considered\n the parent—text nodes are ‘flat’ in this model, and have no content.\n */\n get parent() { return this.node(this.depth); }\n /**\n The root node in which the position was resolved.\n */\n get doc() { return this.node(0); }\n /**\n The ancestor node at the given level. `p.node(p.depth)` is the\n same as `p.parent`.\n */\n node(depth) { return this.path[this.resolveDepth(depth) * 3]; }\n /**\n The index into the ancestor at the given level. If this points\n at the 3rd node in the 2nd paragraph on the top level, for\n example, `p.index(0)` is 1 and `p.index(1)` is 2.\n */\n index(depth) { return this.path[this.resolveDepth(depth) * 3 + 1]; }\n /**\n The index pointing after this position into the ancestor at the\n given level.\n */\n indexAfter(depth) {\n depth = this.resolveDepth(depth);\n return this.index(depth) + (depth == this.depth && !this.textOffset ? 0 : 1);\n }\n /**\n The (absolute) position at the start of the node at the given\n level.\n */\n start(depth) {\n depth = this.resolveDepth(depth);\n return depth == 0 ? 0 : this.path[depth * 3 - 1] + 1;\n }\n /**\n The (absolute) position at the end of the node at the given\n level.\n */\n end(depth) {\n depth = this.resolveDepth(depth);\n return this.start(depth) + this.node(depth).content.size;\n }\n /**\n The (absolute) position directly before the wrapping node at the\n given level, or, when `depth` is `this.depth + 1`, the original\n position.\n */\n before(depth) {\n depth = this.resolveDepth(depth);\n if (!depth)\n throw new RangeError(\"There is no position before the top-level node\");\n return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1];\n }\n /**\n The (absolute) position directly after the wrapping node at the\n given level, or the original position when `depth` is `this.depth + 1`.\n */\n after(depth) {\n depth = this.resolveDepth(depth);\n if (!depth)\n throw new RangeError(\"There is no position after the top-level node\");\n return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1] + this.path[depth * 3].nodeSize;\n }\n /**\n When this position points into a text node, this returns the\n distance between the position and the start of the text node.\n Will be zero for positions that point between nodes.\n */\n get textOffset() { return this.pos - this.path[this.path.length - 1]; }\n /**\n Get the node directly after the position, if any. If the position\n points into a text node, only the part of that node after the\n position is returned.\n */\n get nodeAfter() {\n let parent = this.parent, index = this.index(this.depth);\n if (index == parent.childCount)\n return null;\n let dOff = this.pos - this.path[this.path.length - 1], child = parent.child(index);\n return dOff ? parent.child(index).cut(dOff) : child;\n }\n /**\n Get the node directly before the position, if any. If the\n position points into a text node, only the part of that node\n before the position is returned.\n */\n get nodeBefore() {\n let index = this.index(this.depth);\n let dOff = this.pos - this.path[this.path.length - 1];\n if (dOff)\n return this.parent.child(index).cut(0, dOff);\n return index == 0 ? null : this.parent.child(index - 1);\n }\n /**\n Get the position at the given index in the parent node at the\n given depth (which defaults to `this.depth`).\n */\n posAtIndex(index, depth) {\n depth = this.resolveDepth(depth);\n let node = this.path[depth * 3], pos = depth == 0 ? 0 : this.path[depth * 3 - 1] + 1;\n for (let i = 0; i < index; i++)\n pos += node.child(i).nodeSize;\n return pos;\n }\n /**\n Get the marks at this position, factoring in the surrounding\n marks' [`inclusive`](https://prosemirror.net/docs/ref/#model.MarkSpec.inclusive) property. If the\n position is at the start of a non-empty node, the marks of the\n node after it (if any) are returned.\n */\n marks() {\n let parent = this.parent, index = this.index();\n // In an empty parent, return the empty array\n if (parent.content.size == 0)\n return Mark.none;\n // When inside a text node, just return the text node's marks\n if (this.textOffset)\n return parent.child(index).marks;\n let main = parent.maybeChild(index - 1), other = parent.maybeChild(index);\n // If the `after` flag is true of there is no node before, make\n // the node after this position the main reference.\n if (!main) {\n let tmp = main;\n main = other;\n other = tmp;\n }\n // Use all marks in the main node, except those that have\n // `inclusive` set to false and are not present in the other node.\n let marks = main.marks;\n for (var i = 0; i < marks.length; i++)\n if (marks[i].type.spec.inclusive === false && (!other || !marks[i].isInSet(other.marks)))\n marks = marks[i--].removeFromSet(marks);\n return marks;\n }\n /**\n Get the marks after the current position, if any, except those\n that are non-inclusive and not present at position `$end`. This\n is mostly useful for getting the set of marks to preserve after a\n deletion. Will return `null` if this position is at the end of\n its parent node or its parent node isn't a textblock (in which\n case no marks should be preserved).\n */\n marksAcross($end) {\n let after = this.parent.maybeChild(this.index());\n if (!after || !after.isInline)\n return null;\n let marks = after.marks, next = $end.parent.maybeChild($end.index());\n for (var i = 0; i < marks.length; i++)\n if (marks[i].type.spec.inclusive === false && (!next || !marks[i].isInSet(next.marks)))\n marks = marks[i--].removeFromSet(marks);\n return marks;\n }\n /**\n The depth up to which this position and the given (non-resolved)\n position share the same parent nodes.\n */\n sharedDepth(pos) {\n for (let depth = this.depth; depth > 0; depth--)\n if (this.start(depth) <= pos && this.end(depth) >= pos)\n return depth;\n return 0;\n }\n /**\n Returns a range based on the place where this position and the\n given position diverge around block content. If both point into\n the same textblock, for example, a range around that textblock\n will be returned. If they point into different blocks, the range\n around those blocks in their shared ancestor is returned. You can\n pass in an optional predicate that will be called with a parent\n node to see if a range into that parent is acceptable.\n */\n blockRange(other = this, pred) {\n if (other.pos < this.pos)\n return other.blockRange(this);\n for (let d = this.depth - (this.parent.inlineContent || this.pos == other.pos ? 1 : 0); d >= 0; d--)\n if (other.pos <= this.end(d) && (!pred || pred(this.node(d))))\n return new NodeRange(this, other, d);\n return null;\n }\n /**\n Query whether the given position shares the same parent node.\n */\n sameParent(other) {\n return this.pos - this.parentOffset == other.pos - other.parentOffset;\n }\n /**\n Return the greater of this and the given position.\n */\n max(other) {\n return other.pos > this.pos ? other : this;\n }\n /**\n Return the smaller of this and the given position.\n */\n min(other) {\n return other.pos < this.pos ? other : this;\n }\n /**\n @internal\n */\n toString() {\n let str = \"\";\n for (let i = 1; i <= this.depth; i++)\n str += (str ? \"/\" : \"\") + this.node(i).type.name + \"_\" + this.index(i - 1);\n return str + \":\" + this.parentOffset;\n }\n /**\n @internal\n */\n static resolve(doc, pos) {\n if (!(pos >= 0 && pos <= doc.content.size))\n throw new RangeError(\"Position \" + pos + \" out of range\");\n let path = [];\n let start = 0, parentOffset = pos;\n for (let node = doc;;) {\n let { index, offset } = node.content.findIndex(parentOffset);\n let rem = parentOffset - offset;\n path.push(node, index, start + offset);\n if (!rem)\n break;\n node = node.child(index);\n if (node.isText)\n break;\n parentOffset = rem - 1;\n start += offset + 1;\n }\n return new ResolvedPos(pos, path, parentOffset);\n }\n /**\n @internal\n */\n static resolveCached(doc, pos) {\n let cache = resolveCache.get(doc);\n if (cache) {\n for (let i = 0; i < cache.elts.length; i++) {\n let elt = cache.elts[i];\n if (elt.pos == pos)\n return elt;\n }\n }\n else {\n resolveCache.set(doc, cache = new ResolveCache);\n }\n let result = cache.elts[cache.i] = ResolvedPos.resolve(doc, pos);\n cache.i = (cache.i + 1) % resolveCacheSize;\n return result;\n }\n}\nclass ResolveCache {\n constructor() {\n this.elts = [];\n this.i = 0;\n }\n}\nconst resolveCacheSize = 12, resolveCache = new WeakMap();\n/**\nRepresents a flat range of content, i.e. one that starts and\nends in the same node.\n*/\nclass NodeRange {\n /**\n Construct a node range. `$from` and `$to` should point into the\n same node until at least the given `depth`, since a node range\n denotes an adjacent set of nodes in a single parent node.\n */\n constructor(\n /**\n A resolved position along the start of the content. May have a\n `depth` greater than this object's `depth` property, since\n these are the positions that were used to compute the range,\n not re-resolved positions directly at its boundaries.\n */\n $from, \n /**\n A position along the end of the content. See\n caveat for [`$from`](https://prosemirror.net/docs/ref/#model.NodeRange.$from).\n */\n $to, \n /**\n The depth of the node that this range points into.\n */\n depth) {\n this.$from = $from;\n this.$to = $to;\n this.depth = depth;\n }\n /**\n The position at the start of the range.\n */\n get start() { return this.$from.before(this.depth + 1); }\n /**\n The position at the end of the range.\n */\n get end() { return this.$to.after(this.depth + 1); }\n /**\n The parent node that the range points into.\n */\n get parent() { return this.$from.node(this.depth); }\n /**\n The start index of the range in the parent node.\n */\n get startIndex() { return this.$from.index(this.depth); }\n /**\n The end index of the range in the parent node.\n */\n get endIndex() { return this.$to.indexAfter(this.depth); }\n}\n\nconst emptyAttrs = Object.create(null);\n/**\nThis class represents a node in the tree that makes up a\nProseMirror document. So a document is an instance of `Node`, with\nchildren that are also instances of `Node`.\n\nNodes are persistent data structures. Instead of changing them, you\ncreate new ones with the content you want. Old ones keep pointing\nat the old document shape. This is made cheaper by sharing\nstructure between the old and new data as much as possible, which a\ntree shape like this (without back pointers) makes easy.\n\n**Do not** directly mutate the properties of a `Node` object. See\n[the guide](https://prosemirror.net/docs/guide/#doc) for more information.\n*/\nclass Node {\n /**\n @internal\n */\n constructor(\n /**\n The type of node that this is.\n */\n type, \n /**\n An object mapping attribute names to values. The kind of\n attributes allowed and required are\n [determined](https://prosemirror.net/docs/ref/#model.NodeSpec.attrs) by the node type.\n */\n attrs, \n // A fragment holding the node's children.\n content, \n /**\n The marks (things like whether it is emphasized or part of a\n link) applied to this node.\n */\n marks = Mark.none) {\n this.type = type;\n this.attrs = attrs;\n this.marks = marks;\n this.content = content || Fragment.empty;\n }\n /**\n The array of this node's child nodes.\n */\n get children() { return this.content.content; }\n /**\n The size of this node, as defined by the integer-based [indexing\n scheme](https://prosemirror.net/docs/guide/#doc.indexing). For text nodes, this is the\n amount of characters. For other leaf nodes, it is one. For\n non-leaf nodes, it is the size of the content plus two (the\n start and end token).\n */\n get nodeSize() { return this.isLeaf ? 1 : 2 + this.content.size; }\n /**\n The number of children that the node has.\n */\n get childCount() { return this.content.childCount; }\n /**\n Get the child node at the given index. Raises an error when the\n index is out of range.\n */\n child(index) { return this.content.child(index); }\n /**\n Get the child node at the given index, if it exists.\n */\n maybeChild(index) { return this.content.maybeChild(index); }\n /**\n Call `f` for every child node, passing the node, its offset\n into this parent node, and its index.\n */\n forEach(f) { this.content.forEach(f); }\n /**\n Invoke a callback for all descendant nodes recursively between\n the given two positions that are relative to start of this\n node's content. The callback is invoked with the node, its\n position relative to the original node (method receiver),\n its parent node, and its child index. When the callback returns\n false for a given node, that node's children will not be\n recursed over. The last parameter can be used to specify a\n starting position to count from.\n */\n nodesBetween(from, to, f, startPos = 0) {\n this.content.nodesBetween(from, to, f, startPos, this);\n }\n /**\n Call the given callback for every descendant node. Doesn't\n descend into a node when the callback returns `false`.\n */\n descendants(f) {\n this.nodesBetween(0, this.content.size, f);\n }\n /**\n Concatenates all the text nodes found in this fragment and its\n children.\n */\n get textContent() {\n return (this.isLeaf && this.type.spec.leafText)\n ? this.type.spec.leafText(this)\n : this.textBetween(0, this.content.size, \"\");\n }\n /**\n Get all text between positions `from` and `to`. When\n `blockSeparator` is given, it will be inserted to separate text\n from different block nodes. If `leafText` is given, it'll be\n inserted for every non-text leaf node encountered, otherwise\n [`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec.leafText) will be used.\n */\n textBetween(from, to, blockSeparator, leafText) {\n return this.content.textBetween(from, to, blockSeparator, leafText);\n }\n /**\n Returns this node's first child, or `null` if there are no\n children.\n */\n get firstChild() { return this.content.firstChild; }\n /**\n Returns this node's last child, or `null` if there are no\n children.\n */\n get lastChild() { return this.content.lastChild; }\n /**\n Test whether two nodes represent the same piece of document.\n */\n eq(other) {\n return this == other || (this.sameMarkup(other) && this.content.eq(other.content));\n }\n /**\n Compare the markup (type, attributes, and marks) of this node to\n those of another. Returns `true` if both have the same markup.\n */\n sameMarkup(other) {\n return this.hasMarkup(other.type, other.attrs, other.marks);\n }\n /**\n Check whether this node's markup correspond to the given type,\n attributes, and marks.\n */\n hasMarkup(type, attrs, marks) {\n return this.type == type &&\n compareDeep(this.attrs, attrs || type.defaultAttrs || emptyAttrs) &&\n Mark.sameSet(this.marks, marks || Mark.none);\n }\n /**\n Create a new node with the same markup as this node, containing\n the given content (or empty, if no content is given).\n */\n copy(content = null) {\n if (content == this.content)\n return this;\n return new Node(this.type, this.attrs, content, this.marks);\n }\n /**\n Create a copy of this node, with the given set of marks instead\n of the node's own marks.\n */\n mark(marks) {\n return marks == this.marks ? this : new Node(this.type, this.attrs, this.content, marks);\n }\n /**\n Create a copy of this node with only the content between the\n given positions. If `to` is not given, it defaults to the end of\n the node.\n */\n cut(from, to = this.content.size) {\n if (from == 0 && to == this.content.size)\n return this;\n return this.copy(this.content.cut(from, to));\n }\n /**\n Cut out the part of the document between the given positions, and\n return it as a `Slice` object.\n */\n slice(from, to = this.content.size, includeParents = false) {\n if (from == to)\n return Slice.empty;\n let $from = this.resolve(from), $to = this.resolve(to);\n let depth = includeParents ? 0 : $from.sharedDepth(to);\n let start = $from.start(depth), node = $from.node(depth);\n let content = node.content.cut($from.pos - start, $to.pos - start);\n return new Slice(content, $from.depth - depth, $to.depth - depth);\n }\n /**\n Replace the part of the document between the given positions with\n the given slice. The slice must 'fit', meaning its open sides\n must be able to connect to the surrounding content, and its\n content nodes must be valid children for the node they are placed\n into. If any of this is violated, an error of type\n [`ReplaceError`](https://prosemirror.net/docs/ref/#model.ReplaceError) is thrown.\n */\n replace(from, to, slice) {\n return replace(this.resolve(from), this.resolve(to), slice);\n }\n /**\n Find the node directly after the given position.\n */\n nodeAt(pos) {\n for (let node = this;;) {\n let { index, offset } = node.content.findIndex(pos);\n node = node.maybeChild(index);\n if (!node)\n return null;\n if (offset == pos || node.isText)\n return node;\n pos -= offset + 1;\n }\n }\n /**\n Find the (direct) child node after the given offset, if any,\n and return it along with its index and offset relative to this\n node.\n */\n childAfter(pos) {\n let { index, offset } = this.content.findIndex(pos);\n return { node: this.content.maybeChild(index), index, offset };\n }\n /**\n Find the (direct) child node before the given offset, if any,\n and return it along with its index and offset relative to this\n node.\n */\n childBefore(pos) {\n if (pos == 0)\n return { node: null, index: 0, offset: 0 };\n let { index, offset } = this.content.findIndex(pos);\n if (offset < pos)\n return { node: this.content.child(index), index, offset };\n let node = this.content.child(index - 1);\n return { node, index: index - 1, offset: offset - node.nodeSize };\n }\n /**\n Resolve the given position in the document, returning an\n [object](https://prosemirror.net/docs/ref/#model.ResolvedPos) with information about its context.\n */\n resolve(pos) { return ResolvedPos.resolveCached(this, pos); }\n /**\n @internal\n */\n resolveNoCache(pos) { return ResolvedPos.resolve(this, pos); }\n /**\n Test whether a given mark or mark type occurs in this document\n between the two given positions.\n */\n rangeHasMark(from, to, type) {\n let found = false;\n if (to > from)\n this.nodesBetween(from, to, node => {\n if (type.isInSet(node.marks))\n found = true;\n return !found;\n });\n return found;\n }\n /**\n True when this is a block (non-inline node)\n */\n get isBlock() { return this.type.isBlock; }\n /**\n True when this is a textblock node, a block node with inline\n content.\n */\n get isTextblock() { return this.type.isTextblock; }\n /**\n True when this node allows inline content.\n */\n get inlineContent() { return this.type.inlineContent; }\n /**\n True when this is an inline node (a text node or a node that can\n appear among text).\n */\n get isInline() { return this.type.isInline; }\n /**\n True when this is a text node.\n */\n get isText() { return this.type.isText; }\n /**\n True when this is a leaf node.\n */\n get isLeaf() { return this.type.isLeaf; }\n /**\n True when this is an atom, i.e. when it does not have directly\n editable content. This is usually the same as `isLeaf`, but can\n be configured with the [`atom` property](https://prosemirror.net/docs/ref/#model.NodeSpec.atom)\n on a node's spec (typically used when the node is displayed as\n an uneditable [node view](https://prosemirror.net/docs/ref/#view.NodeView)).\n */\n get isAtom() { return this.type.isAtom; }\n /**\n Return a string representation of this node for debugging\n purposes.\n */\n toString() {\n if (this.type.spec.toDebugString)\n return this.type.spec.toDebugString(this);\n let name = this.type.name;\n if (this.content.size)\n name += \"(\" + this.content.toStringInner() + \")\";\n return wrapMarks(this.marks, name);\n }\n /**\n Get the content match in this node at the given index.\n */\n contentMatchAt(index) {\n let match = this.type.contentMatch.matchFragment(this.content, 0, index);\n if (!match)\n throw new Error(\"Called contentMatchAt on a node with invalid content\");\n return match;\n }\n /**\n Test whether replacing the range between `from` and `to` (by\n child index) with the given replacement fragment (which defaults\n to the empty fragment) would leave the node's content valid. You\n can optionally pass `start` and `end` indices into the\n replacement fragment.\n */\n canReplace(from, to, replacement = Fragment.empty, start = 0, end = replacement.childCount) {\n let one = this.contentMatchAt(from).matchFragment(replacement, start, end);\n let two = one && one.matchFragment(this.content, to);\n if (!two || !two.validEnd)\n return false;\n for (let i = start; i < end; i++)\n if (!this.type.allowsMarks(replacement.child(i).marks))\n return false;\n return true;\n }\n /**\n Test whether replacing the range `from` to `to` (by index) with\n a node of the given type would leave the node's content valid.\n */\n canReplaceWith(from, to, type, marks) {\n if (marks && !this.type.allowsMarks(marks))\n return false;\n let start = this.contentMatchAt(from).matchType(type);\n let end = start && start.matchFragment(this.content, to);\n return end ? end.validEnd : false;\n }\n /**\n Test whether the given node's content could be appended to this\n node. If that node is empty, this will only return true if there\n is at least one node type that can appear in both nodes (to avoid\n merging completely incompatible nodes).\n */\n canAppend(other) {\n if (other.content.size)\n return this.canReplace(this.childCount, this.childCount, other.content);\n else\n return this.type.compatibleContent(other.type);\n }\n /**\n Check whether this node and its descendants conform to the\n schema, and raise an exception when they do not.\n */\n check() {\n this.type.checkContent(this.content);\n this.type.checkAttrs(this.attrs);\n let copy = Mark.none;\n for (let i = 0; i < this.marks.length; i++) {\n let mark = this.marks[i];\n mark.type.checkAttrs(mark.attrs);\n copy = mark.addToSet(copy);\n }\n if (!Mark.sameSet(copy, this.marks))\n throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(m => m.type.name)}`);\n this.content.forEach(node => node.check());\n }\n /**\n Return a JSON-serializeable representation of this node.\n */\n toJSON() {\n let obj = { type: this.type.name };\n for (let _ in this.attrs) {\n obj.attrs = this.attrs;\n break;\n }\n if (this.content.size)\n obj.content = this.content.toJSON();\n if (this.marks.length)\n obj.marks = this.marks.map(n => n.toJSON());\n return obj;\n }\n /**\n Deserialize a node from its JSON representation.\n */\n static fromJSON(schema, json) {\n if (!json)\n throw new RangeError(\"Invalid input for Node.fromJSON\");\n let marks = undefined;\n if (json.marks) {\n if (!Array.isArray(json.marks))\n throw new RangeError(\"Invalid mark data for Node.fromJSON\");\n marks = json.marks.map(schema.markFromJSON);\n }\n if (json.type == \"text\") {\n if (typeof json.text != \"string\")\n throw new RangeError(\"Invalid text node in JSON\");\n return schema.text(json.text, marks);\n }\n let content = Fragment.fromJSON(schema, json.content);\n let node = schema.nodeType(json.type).create(json.attrs, content, marks);\n node.type.checkAttrs(node.attrs);\n return node;\n }\n}\nNode.prototype.text = undefined;\nclass TextNode extends Node {\n /**\n @internal\n */\n constructor(type, attrs, content, marks) {\n super(type, attrs, null, marks);\n if (!content)\n throw new RangeError(\"Empty text nodes are not allowed\");\n this.text = content;\n }\n toString() {\n if (this.type.spec.toDebugString)\n return this.type.spec.toDebugString(this);\n return wrapMarks(this.marks, JSON.stringify(this.text));\n }\n get textContent() { return this.text; }\n textBetween(from, to) { return this.text.slice(from, to); }\n get nodeSize() { return this.text.length; }\n mark(marks) {\n return marks == this.marks ? this : new TextNode(this.type, this.attrs, this.text, marks);\n }\n withText(text) {\n if (text == this.text)\n return this;\n return new TextNode(this.type, this.attrs, text, this.marks);\n }\n cut(from = 0, to = this.text.length) {\n if (from == 0 && to == this.text.length)\n return this;\n return this.withText(this.text.slice(from, to));\n }\n eq(other) {\n return this.sameMarkup(other) && this.text == other.text;\n }\n toJSON() {\n let base = super.toJSON();\n base.text = this.text;\n return base;\n }\n}\nfunction wrapMarks(marks, str) {\n for (let i = marks.length - 1; i >= 0; i--)\n str = marks[i].type.name + \"(\" + str + \")\";\n return str;\n}\n\n/**\nInstances of this class represent a match state of a node type's\n[content expression](https://prosemirror.net/docs/ref/#model.NodeSpec.content), and can be used to\nfind out whether further content matches here, and whether a given\nposition is a valid end of the node.\n*/\nclass ContentMatch {\n /**\n @internal\n */\n constructor(\n /**\n True when this match state represents a valid end of the node.\n */\n validEnd) {\n this.validEnd = validEnd;\n /**\n @internal\n */\n this.next = [];\n /**\n @internal\n */\n this.wrapCache = [];\n }\n /**\n @internal\n */\n static parse(string, nodeTypes) {\n let stream = new TokenStream(string, nodeTypes);\n if (stream.next == null)\n return ContentMatch.empty;\n let expr = parseExpr(stream);\n if (stream.next)\n stream.err(\"Unexpected trailing text\");\n let match = dfa(nfa(expr));\n checkForDeadEnds(match, stream);\n return match;\n }\n /**\n Match a node type, returning a match after that node if\n successful.\n */\n matchType(type) {\n for (let i = 0; i < this.next.length; i++)\n if (this.next[i].type == type)\n return this.next[i].next;\n return null;\n }\n /**\n Try to match a fragment. Returns the resulting match when\n successful.\n */\n matchFragment(frag, start = 0, end = frag.childCount) {\n let cur = this;\n for (let i = start; cur && i < end; i++)\n cur = cur.matchType(frag.child(i).type);\n return cur;\n }\n /**\n @internal\n */\n get inlineContent() {\n return this.next.length != 0 && this.next[0].type.isInline;\n }\n /**\n Get the first matching node type at this match position that can\n be generated.\n */\n get defaultType() {\n for (let i = 0; i < this.next.length; i++) {\n let { type } = this.next[i];\n if (!(type.isText || type.hasRequiredAttrs()))\n return type;\n }\n return null;\n }\n /**\n @internal\n */\n compatible(other) {\n for (let i = 0; i < this.next.length; i++)\n for (let j = 0; j < other.next.length; j++)\n if (this.next[i].type == other.next[j].type)\n return true;\n return false;\n }\n /**\n Try to match the given fragment, and if that fails, see if it can\n be made to match by inserting nodes in front of it. When\n successful, return a fragment of inserted nodes (which may be\n empty if nothing had to be inserted). When `toEnd` is true, only\n return a fragment if the resulting match goes to the end of the\n content expression.\n */\n fillBefore(after, toEnd = false, startIndex = 0) {\n let seen = [this];\n function search(match, types) {\n let finished = match.matchFragment(after, startIndex);\n if (finished && (!toEnd || finished.validEnd))\n return Fragment.from(types.map(tp => tp.createAndFill()));\n for (let i = 0; i < match.next.length; i++) {\n let { type, next } = match.next[i];\n if (!(type.isText || type.hasRequiredAttrs()) && seen.indexOf(next) == -1) {\n seen.push(next);\n let found = search(next, types.concat(type));\n if (found)\n return found;\n }\n }\n return null;\n }\n return search(this, []);\n }\n /**\n Find a set of wrapping node types that would allow a node of the\n given type to appear at this position. The result may be empty\n (when it fits directly) and will be null when no such wrapping\n exists.\n */\n findWrapping(target) {\n for (let i = 0; i < this.wrapCache.length; i += 2)\n if (this.wrapCache[i] == target)\n return this.wrapCache[i + 1];\n let computed = this.computeWrapping(target);\n this.wrapCache.push(target, computed);\n return computed;\n }\n /**\n @internal\n */\n computeWrapping(target) {\n let seen = Object.create(null), active = [{ match: this, type: null, via: null }];\n while (active.length) {\n let current = active.shift(), match = current.match;\n if (match.matchType(target)) {\n let result = [];\n for (let obj = current; obj.type; obj = obj.via)\n result.push(obj.type);\n return result.reverse();\n }\n for (let i = 0; i < match.next.length; i++) {\n let { type, next } = match.next[i];\n if (!type.isLeaf && !type.hasRequiredAttrs() && !(type.name in seen) && (!current.type || next.validEnd)) {\n active.push({ match: type.contentMatch, type, via: current });\n seen[type.name] = true;\n }\n }\n }\n return null;\n }\n /**\n The number of outgoing edges this node has in the finite\n automaton that describes the content expression.\n */\n get edgeCount() {\n return this.next.length;\n }\n /**\n Get the _n_th outgoing edge from this node in the finite\n automaton that describes the content expression.\n */\n edge(n) {\n if (n >= this.next.length)\n throw new RangeError(`There's no ${n}th edge in this content match`);\n return this.next[n];\n }\n /**\n @internal\n */\n toString() {\n let seen = [];\n function scan(m) {\n seen.push(m);\n for (let i = 0; i < m.next.length; i++)\n if (seen.indexOf(m.next[i].next) == -1)\n scan(m.next[i].next);\n }\n scan(this);\n return seen.map((m, i) => {\n let out = i + (m.validEnd ? \"*\" : \" \") + \" \";\n for (let i = 0; i < m.next.length; i++)\n out += (i ? \", \" : \"\") + m.next[i].type.name + \"->\" + seen.indexOf(m.next[i].next);\n return out;\n }).join(\"\\n\");\n }\n}\n/**\n@internal\n*/\nContentMatch.empty = new ContentMatch(true);\nclass TokenStream {\n constructor(string, nodeTypes) {\n this.string = string;\n this.nodeTypes = nodeTypes;\n this.inline = null;\n this.pos = 0;\n this.tokens = string.split(/\\s*(?=\\b|\\W|$)/);\n if (this.tokens[this.tokens.length - 1] == \"\")\n this.tokens.pop();\n if (this.tokens[0] == \"\")\n this.tokens.shift();\n }\n get next() { return this.tokens[this.pos]; }\n eat(tok) { return this.next == tok && (this.pos++ || true); }\n err(str) { throw new SyntaxError(str + \" (in content expression '\" + this.string + \"')\"); }\n}\nfunction parseExpr(stream) {\n let exprs = [];\n do {\n exprs.push(parseExprSeq(stream));\n } while (stream.eat(\"|\"));\n return exprs.length == 1 ? exprs[0] : { type: \"choice\", exprs };\n}\nfunction parseExprSeq(stream) {\n let exprs = [];\n do {\n exprs.push(parseExprSubscript(stream));\n } while (stream.next && stream.next != \")\" && stream.next != \"|\");\n return exprs.length == 1 ? exprs[0] : { type: \"seq\", exprs };\n}\nfunction parseExprSubscript(stream) {\n let expr = parseExprAtom(stream);\n for (;;) {\n if (stream.eat(\"+\"))\n expr = { type: \"plus\", expr };\n else if (stream.eat(\"*\"))\n expr = { type: \"star\", expr };\n else if (stream.eat(\"?\"))\n expr = { type: \"opt\", expr };\n else if (stream.eat(\"{\"))\n expr = parseExprRange(stream, expr);\n else\n break;\n }\n return expr;\n}\nfunction parseNum(stream) {\n if (/\\D/.test(stream.next))\n stream.err(\"Expected number, got '\" + stream.next + \"'\");\n let result = Number(stream.next);\n stream.pos++;\n return result;\n}\nfunction parseExprRange(stream, expr) {\n let min = parseNum(stream), max = min;\n if (stream.eat(\",\")) {\n if (stream.next != \"}\")\n max = parseNum(stream);\n else\n max = -1;\n }\n if (!stream.eat(\"}\"))\n stream.err(\"Unclosed braced range\");\n return { type: \"range\", min, max, expr };\n}\nfunction resolveName(stream, name) {\n let types = stream.nodeTypes, type = types[name];\n if (type)\n return [type];\n let result = [];\n for (let typeName in types) {\n let type = types[typeName];\n if (type.isInGroup(name))\n result.push(type);\n }\n if (result.length == 0)\n stream.err(\"No node type or group '\" + name + \"' found\");\n return result;\n}\nfunction parseExprAtom(stream) {\n if (stream.eat(\"(\")) {\n let expr = parseExpr(stream);\n if (!stream.eat(\")\"))\n stream.err(\"Missing closing paren\");\n return expr;\n }\n else if (!/\\W/.test(stream.next)) {\n let exprs = resolveName(stream, stream.next).map(type => {\n if (stream.inline == null)\n stream.inline = type.isInline;\n else if (stream.inline != type.isInline)\n stream.err(\"Mixing inline and block content\");\n return { type: \"name\", value: type };\n });\n stream.pos++;\n return exprs.length == 1 ? exprs[0] : { type: \"choice\", exprs };\n }\n else {\n stream.err(\"Unexpected token '\" + stream.next + \"'\");\n }\n}\n// Construct an NFA from an expression as returned by the parser. The\n// NFA is represented as an array of states, which are themselves\n// arrays of edges, which are `{term, to}` objects. The first state is\n// the entry state and the last node is the success state.\n//\n// Note that unlike typical NFAs, the edge ordering in this one is\n// significant, in that it is used to contruct filler content when\n// necessary.\nfunction nfa(expr) {\n let nfa = [[]];\n connect(compile(expr, 0), node());\n return nfa;\n function node() { return nfa.push([]) - 1; }\n function edge(from, to, term) {\n let edge = { term, to };\n nfa[from].push(edge);\n return edge;\n }\n function connect(edges, to) {\n edges.forEach(edge => edge.to = to);\n }\n function compile(expr, from) {\n if (expr.type == \"choice\") {\n return expr.exprs.reduce((out, expr) => out.concat(compile(expr, from)), []);\n }\n else if (expr.type == \"seq\") {\n for (let i = 0;; i++) {\n let next = compile(expr.exprs[i], from);\n if (i == expr.exprs.length - 1)\n return next;\n connect(next, from = node());\n }\n }\n else if (expr.type == \"star\") {\n let loop = node();\n edge(from, loop);\n connect(compile(expr.expr, loop), loop);\n return [edge(loop)];\n }\n else if (expr.type == \"plus\") {\n let loop = node();\n connect(compile(expr.expr, from), loop);\n connect(compile(expr.expr, loop), loop);\n return [edge(loop)];\n }\n else if (expr.type == \"opt\") {\n return [edge(from)].concat(compile(expr.expr, from));\n }\n else if (expr.type == \"range\") {\n let cur = from;\n for (let i = 0; i < expr.min; i++) {\n let next = node();\n connect(compile(expr.expr, cur), next);\n cur = next;\n }\n if (expr.max == -1) {\n connect(compile(expr.expr, cur), cur);\n }\n else {\n for (let i = expr.min; i < expr.max; i++) {\n let next = node();\n edge(cur, next);\n connect(compile(expr.expr, cur), next);\n cur = next;\n }\n }\n return [edge(cur)];\n }\n else if (expr.type == \"name\") {\n return [edge(from, undefined, expr.value)];\n }\n else {\n throw new Error(\"Unknown expr type\");\n }\n }\n}\nfunction cmp(a, b) { return b - a; }\n// Get the set of nodes reachable by null edges from `node`. Omit\n// nodes with only a single null-out-edge, since they may lead to\n// needless duplicated nodes.\nfunction nullFrom(nfa, node) {\n let result = [];\n scan(node);\n return result.sort(cmp);\n function scan(node) {\n let edges = nfa[node];\n if (edges.length == 1 && !edges[0].term)\n return scan(edges[0].to);\n result.push(node);\n for (let i = 0; i < edges.length; i++) {\n let { term, to } = edges[i];\n if (!term && result.indexOf(to) == -1)\n scan(to);\n }\n }\n}\n// Compiles an NFA as produced by `nfa` into a DFA, modeled as a set\n// of state objects (`ContentMatch` instances) with transitions\n// between them.\nfunction dfa(nfa) {\n let labeled = Object.create(null);\n return explore(nullFrom(nfa, 0));\n function explore(states) {\n let out = [];\n states.forEach(node => {\n nfa[node].forEach(({ term, to }) => {\n if (!term)\n return;\n let set;\n for (let i = 0; i < out.length; i++)\n if (out[i][0] == term)\n set = out[i][1];\n nullFrom(nfa, to).forEach(node => {\n if (!set)\n out.push([term, set = []]);\n if (set.indexOf(node) == -1)\n set.push(node);\n });\n });\n });\n let state = labeled[states.join(\",\")] = new ContentMatch(states.indexOf(nfa.length - 1) > -1);\n for (let i = 0; i < out.length; i++) {\n let states = out[i][1].sort(cmp);\n state.next.push({ type: out[i][0], next: labeled[states.join(\",\")] || explore(states) });\n }\n return state;\n }\n}\nfunction checkForDeadEnds(match, stream) {\n for (let i = 0, work = [match]; i < work.length; i++) {\n let state = work[i], dead = !state.validEnd, nodes = [];\n for (let j = 0; j < state.next.length; j++) {\n let { type, next } = state.next[j];\n nodes.push(type.name);\n if (dead && !(type.isText || type.hasRequiredAttrs()))\n dead = false;\n if (work.indexOf(next) == -1)\n work.push(next);\n }\n if (dead)\n stream.err(\"Only non-generatable nodes (\" + nodes.join(\", \") + \") in a required position (see https://prosemirror.net/docs/guide/#generatable)\");\n }\n}\n\n// For node types where all attrs have a default value (or which don't\n// have any attributes), build up a single reusable default attribute\n// object, and use it for all nodes that don't specify specific\n// attributes.\nfunction defaultAttrs(attrs) {\n let defaults = Object.create(null);\n for (let attrName in attrs) {\n let attr = attrs[attrName];\n if (!attr.hasDefault)\n return null;\n defaults[attrName] = attr.default;\n }\n return defaults;\n}\nfunction computeAttrs(attrs, value) {\n let built = Object.create(null);\n for (let name in attrs) {\n let given = value && value[name];\n if (given === undefined) {\n let attr = attrs[name];\n if (attr.hasDefault)\n given = attr.default;\n else\n throw new RangeError(\"No value supplied for attribute \" + name);\n }\n built[name] = given;\n }\n return built;\n}\nfunction checkAttrs(attrs, values, type, name) {\n for (let name in values)\n if (!(name in attrs))\n throw new RangeError(`Unsupported attribute ${name} for ${type} of type ${name}`);\n for (let name in attrs) {\n let attr = attrs[name];\n if (attr.validate)\n attr.validate(values[name]);\n }\n}\nfunction initAttrs(typeName, attrs) {\n let result = Object.create(null);\n if (attrs)\n for (let name in attrs)\n result[name] = new Attribute(typeName, name, attrs[name]);\n return result;\n}\n/**\nNode types are objects allocated once per `Schema` and used to\n[tag](https://prosemirror.net/docs/ref/#model.Node.type) `Node` instances. They contain information\nabout the node type, such as its name and what kind of node it\nrepresents.\n*/\nclass NodeType {\n /**\n @internal\n */\n constructor(\n /**\n The name the node type has in this schema.\n */\n name, \n /**\n A link back to the `Schema` the node type belongs to.\n */\n schema, \n /**\n The spec that this type is based on\n */\n spec) {\n this.name = name;\n this.schema = schema;\n this.spec = spec;\n /**\n The set of marks allowed in this node. `null` means all marks\n are allowed.\n */\n this.markSet = null;\n this.groups = spec.group ? spec.group.split(\" \") : [];\n this.attrs = initAttrs(name, spec.attrs);\n this.defaultAttrs = defaultAttrs(this.attrs);\n this.contentMatch = null;\n this.inlineContent = null;\n this.isBlock = !(spec.inline || name == \"text\");\n this.isText = name == \"text\";\n }\n /**\n True if this is an inline type.\n */\n get isInline() { return !this.isBlock; }\n /**\n True if this is a textblock type, a block that contains inline\n content.\n */\n get isTextblock() { return this.isBlock && this.inlineContent; }\n /**\n True for node types that allow no content.\n */\n get isLeaf() { return this.contentMatch == ContentMatch.empty; }\n /**\n True when this node is an atom, i.e. when it does not have\n directly editable content.\n */\n get isAtom() { return this.isLeaf || !!this.spec.atom; }\n /**\n Return true when this node type is part of the given\n [group](https://prosemirror.net/docs/ref/#model.NodeSpec.group).\n */\n isInGroup(group) {\n return this.groups.indexOf(group) > -1;\n }\n /**\n The node type's [whitespace](https://prosemirror.net/docs/ref/#model.NodeSpec.whitespace) option.\n */\n get whitespace() {\n return this.spec.whitespace || (this.spec.code ? \"pre\" : \"normal\");\n }\n /**\n Tells you whether this node type has any required attributes.\n */\n hasRequiredAttrs() {\n for (let n in this.attrs)\n if (this.attrs[n].isRequired)\n return true;\n return false;\n }\n /**\n Indicates whether this node allows some of the same content as\n the given node type.\n */\n compatibleContent(other) {\n return this == other || this.contentMatch.compatible(other.contentMatch);\n }\n /**\n @internal\n */\n computeAttrs(attrs) {\n if (!attrs && this.defaultAttrs)\n return this.defaultAttrs;\n else\n return computeAttrs(this.attrs, attrs);\n }\n /**\n Create a `Node` of this type. The given attributes are\n checked and defaulted (you can pass `null` to use the type's\n defaults entirely, if no required attributes exist). `content`\n may be a `Fragment`, a node, an array of nodes, or\n `null`. Similarly `marks` may be `null` to default to the empty\n set of marks.\n */\n create(attrs = null, content, marks) {\n if (this.isText)\n throw new Error(\"NodeType.create can't construct text nodes\");\n return new Node(this, this.computeAttrs(attrs), Fragment.from(content), Mark.setFrom(marks));\n }\n /**\n Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content\n against the node type's content restrictions, and throw an error\n if it doesn't match.\n */\n createChecked(attrs = null, content, marks) {\n content = Fragment.from(content);\n this.checkContent(content);\n return new Node(this, this.computeAttrs(attrs), content, Mark.setFrom(marks));\n }\n /**\n Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but see if it is\n necessary to add nodes to the start or end of the given fragment\n to make it fit the node. If no fitting wrapping can be found,\n return null. Note that, due to the fact that required nodes can\n always be created, this will always succeed if you pass null or\n `Fragment.empty` as content.\n */\n createAndFill(attrs = null, content, marks) {\n attrs = this.computeAttrs(attrs);\n content = Fragment.from(content);\n if (content.size) {\n let before = this.contentMatch.fillBefore(content);\n if (!before)\n return null;\n content = before.append(content);\n }\n let matched = this.contentMatch.matchFragment(content);\n let after = matched && matched.fillBefore(Fragment.empty, true);\n if (!after)\n return null;\n return new Node(this, attrs, content.append(after), Mark.setFrom(marks));\n }\n /**\n Returns true if the given fragment is valid content for this node\n type.\n */\n validContent(content) {\n let result = this.contentMatch.matchFragment(content);\n if (!result || !result.validEnd)\n return false;\n for (let i = 0; i < content.childCount; i++)\n if (!this.allowsMarks(content.child(i).marks))\n return false;\n return true;\n }\n /**\n Throws a RangeError if the given fragment is not valid content for this\n node type.\n @internal\n */\n checkContent(content) {\n if (!this.validContent(content))\n throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0, 50)}`);\n }\n /**\n @internal\n */\n checkAttrs(attrs) {\n checkAttrs(this.attrs, attrs, \"node\", this.name);\n }\n /**\n Check whether the given mark type is allowed in this node.\n */\n allowsMarkType(markType) {\n return this.markSet == null || this.markSet.indexOf(markType) > -1;\n }\n /**\n Test whether the given set of marks are allowed in this node.\n */\n allowsMarks(marks) {\n if (this.markSet == null)\n return true;\n for (let i = 0; i < marks.length; i++)\n if (!this.allowsMarkType(marks[i].type))\n return false;\n return true;\n }\n /**\n Removes the marks that are not allowed in this node from the given set.\n */\n allowedMarks(marks) {\n if (this.markSet == null)\n return marks;\n let copy;\n for (let i = 0; i < marks.length; i++) {\n if (!this.allowsMarkType(marks[i].type)) {\n if (!copy)\n copy = marks.slice(0, i);\n }\n else if (copy) {\n copy.push(marks[i]);\n }\n }\n return !copy ? marks : copy.length ? copy : Mark.none;\n }\n /**\n @internal\n */\n static compile(nodes, schema) {\n let result = Object.create(null);\n nodes.forEach((name, spec) => result[name] = new NodeType(name, schema, spec));\n let topType = schema.spec.topNode || \"doc\";\n if (!result[topType])\n throw new RangeError(\"Schema is missing its top node type ('\" + topType + \"')\");\n if (!result.text)\n throw new RangeError(\"Every schema needs a 'text' type\");\n for (let _ in result.text.attrs)\n throw new RangeError(\"The text node type should not have attributes\");\n return result;\n }\n}\nfunction validateType(typeName, attrName, type) {\n let types = type.split(\"|\");\n return (value) => {\n let name = value === null ? \"null\" : typeof value;\n if (types.indexOf(name) < 0)\n throw new RangeError(`Expected value of type ${types} for attribute ${attrName} on type ${typeName}, got ${name}`);\n };\n}\n// Attribute descriptors\nclass Attribute {\n constructor(typeName, attrName, options) {\n this.hasDefault = Object.prototype.hasOwnProperty.call(options, \"default\");\n this.default = options.default;\n this.validate = typeof options.validate == \"string\" ? validateType(typeName, attrName, options.validate) : options.validate;\n }\n get isRequired() {\n return !this.hasDefault;\n }\n}\n// Marks\n/**\nLike nodes, marks (which are associated with nodes to signify\nthings like emphasis or being part of a link) are\n[tagged](https://prosemirror.net/docs/ref/#model.Mark.type) with type objects, which are\ninstantiated once per `Schema`.\n*/\nclass MarkType {\n /**\n @internal\n */\n constructor(\n /**\n The name of the mark type.\n */\n name, \n /**\n @internal\n */\n rank, \n /**\n The schema that this mark type instance is part of.\n */\n schema, \n /**\n The spec on which the type is based.\n */\n spec) {\n this.name = name;\n this.rank = rank;\n this.schema = schema;\n this.spec = spec;\n this.attrs = initAttrs(name, spec.attrs);\n this.excluded = null;\n let defaults = defaultAttrs(this.attrs);\n this.instance = defaults ? new Mark(this, defaults) : null;\n }\n /**\n Create a mark of this type. `attrs` may be `null` or an object\n containing only some of the mark's attributes. The others, if\n they have defaults, will be added.\n */\n create(attrs = null) {\n if (!attrs && this.instance)\n return this.instance;\n return new Mark(this, computeAttrs(this.attrs, attrs));\n }\n /**\n @internal\n */\n static compile(marks, schema) {\n let result = Object.create(null), rank = 0;\n marks.forEach((name, spec) => result[name] = new MarkType(name, rank++, schema, spec));\n return result;\n }\n /**\n When there is a mark of this type in the given set, a new set\n without it is returned. Otherwise, the input set is returned.\n */\n removeFromSet(set) {\n for (var i = 0; i < set.length; i++)\n if (set[i].type == this) {\n set = set.slice(0, i).concat(set.slice(i + 1));\n i--;\n }\n return set;\n }\n /**\n Tests whether there is a mark of this type in the given set.\n */\n isInSet(set) {\n for (let i = 0; i < set.length; i++)\n if (set[i].type == this)\n return set[i];\n }\n /**\n @internal\n */\n checkAttrs(attrs) {\n checkAttrs(this.attrs, attrs, \"mark\", this.name);\n }\n /**\n Queries whether a given mark type is\n [excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.\n */\n excludes(other) {\n return this.excluded.indexOf(other) > -1;\n }\n}\n/**\nA document schema. Holds [node](https://prosemirror.net/docs/ref/#model.NodeType) and [mark\ntype](https://prosemirror.net/docs/ref/#model.MarkType) objects for the nodes and marks that may\noccur in conforming documents, and provides functionality for\ncreating and deserializing such documents.\n\nWhen given, the type parameters provide the names of the nodes and\nmarks in this schema.\n*/\nclass Schema {\n /**\n Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).\n */\n constructor(spec) {\n /**\n The [linebreak\n replacement](https://prosemirror.net/docs/ref/#model.NodeSpec.linebreakReplacement) node defined\n in this schema, if any.\n */\n this.linebreakReplacement = null;\n /**\n An object for storing whatever values modules may want to\n compute and cache per schema. (If you want to store something\n in it, try to use property names unlikely to clash.)\n */\n this.cached = Object.create(null);\n let instanceSpec = this.spec = {};\n for (let prop in spec)\n instanceSpec[prop] = spec[prop];\n instanceSpec.nodes = OrderedMap.from(spec.nodes),\n instanceSpec.marks = OrderedMap.from(spec.marks || {}),\n this.nodes = NodeType.compile(this.spec.nodes, this);\n this.marks = MarkType.compile(this.spec.marks, this);\n let contentExprCache = Object.create(null);\n for (let prop in this.nodes) {\n if (prop in this.marks)\n throw new RangeError(prop + \" can not be both a node and a mark\");\n let type = this.nodes[prop], contentExpr = type.spec.content || \"\", markExpr = type.spec.marks;\n type.contentMatch = contentExprCache[contentExpr] ||\n (contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes));\n type.inlineContent = type.contentMatch.inlineContent;\n if (type.spec.linebreakReplacement) {\n if (this.linebreakReplacement)\n throw new RangeError(\"Multiple linebreak nodes defined\");\n if (!type.isInline || !type.isLeaf)\n throw new RangeError(\"Linebreak replacement nodes must be inline leaf nodes\");\n this.linebreakReplacement = type;\n }\n type.markSet = markExpr == \"_\" ? null :\n markExpr ? gatherMarks(this, markExpr.split(\" \")) :\n markExpr == \"\" || !type.inlineContent ? [] : null;\n }\n for (let prop in this.marks) {\n let type = this.marks[prop], excl = type.spec.excludes;\n type.excluded = excl == null ? [type] : excl == \"\" ? [] : gatherMarks(this, excl.split(\" \"));\n }\n this.nodeFromJSON = json => Node.fromJSON(this, json);\n this.markFromJSON = json => Mark.fromJSON(this, json);\n this.topNodeType = this.nodes[this.spec.topNode || \"doc\"];\n this.cached.wrappings = Object.create(null);\n }\n /**\n Create a node in this schema. The `type` may be a string or a\n `NodeType` instance. Attributes will be extended with defaults,\n `content` may be a `Fragment`, `null`, a `Node`, or an array of\n nodes.\n */\n node(type, attrs = null, content, marks) {\n if (typeof type == \"string\")\n type = this.nodeType(type);\n else if (!(type instanceof NodeType))\n throw new RangeError(\"Invalid node type: \" + type);\n else if (type.schema != this)\n throw new RangeError(\"Node type from different schema used (\" + type.name + \")\");\n return type.createChecked(attrs, content, marks);\n }\n /**\n Create a text node in the schema. Empty text nodes are not\n allowed.\n */\n text(text, marks) {\n let type = this.nodes.text;\n return new TextNode(type, type.defaultAttrs, text, Mark.setFrom(marks));\n }\n /**\n Create a mark with the given type and attributes.\n */\n mark(type, attrs) {\n if (typeof type == \"string\")\n type = this.marks[type];\n return type.create(attrs);\n }\n /**\n @internal\n */\n nodeType(name) {\n let found = this.nodes[name];\n if (!found)\n throw new RangeError(\"Unknown node type: \" + name);\n return found;\n }\n}\nfunction gatherMarks(schema, marks) {\n let found = [];\n for (let i = 0; i < marks.length; i++) {\n let name = marks[i], mark = schema.marks[name], ok = mark;\n if (mark) {\n found.push(mark);\n }\n else {\n for (let prop in schema.marks) {\n let mark = schema.marks[prop];\n if (name == \"_\" || (mark.spec.group && mark.spec.group.split(\" \").indexOf(name) > -1))\n found.push(ok = mark);\n }\n }\n if (!ok)\n throw new SyntaxError(\"Unknown mark type: '\" + marks[i] + \"'\");\n }\n return found;\n}\n\nfunction isTagRule(rule) { return rule.tag != null; }\nfunction isStyleRule(rule) { return rule.style != null; }\n/**\nA DOM parser represents a strategy for parsing DOM content into a\nProseMirror document conforming to a given schema. Its behavior is\ndefined by an array of [rules](https://prosemirror.net/docs/ref/#model.ParseRule).\n*/\nclass DOMParser {\n /**\n Create a parser that targets the given schema, using the given\n parsing rules.\n */\n constructor(\n /**\n The schema into which the parser parses.\n */\n schema, \n /**\n The set of [parse rules](https://prosemirror.net/docs/ref/#model.ParseRule) that the parser\n uses, in order of precedence.\n */\n rules) {\n this.schema = schema;\n this.rules = rules;\n /**\n @internal\n */\n this.tags = [];\n /**\n @internal\n */\n this.styles = [];\n let matchedStyles = this.matchedStyles = [];\n rules.forEach(rule => {\n if (isTagRule(rule)) {\n this.tags.push(rule);\n }\n else if (isStyleRule(rule)) {\n let prop = /[^=]*/.exec(rule.style)[0];\n if (matchedStyles.indexOf(prop) < 0)\n matchedStyles.push(prop);\n this.styles.push(rule);\n }\n });\n // Only normalize list elements when lists in the schema can't directly contain themselves\n this.normalizeLists = !this.tags.some(r => {\n if (!/^(ul|ol)\\b/.test(r.tag) || !r.node)\n return false;\n let node = schema.nodes[r.node];\n return node.contentMatch.matchType(node);\n });\n }\n /**\n Parse a document from the content of a DOM node.\n */\n parse(dom, options = {}) {\n let context = new ParseContext(this, options, false);\n context.addAll(dom, Mark.none, options.from, options.to);\n return context.finish();\n }\n /**\n Parses the content of the given DOM node, like\n [`parse`](https://prosemirror.net/docs/ref/#model.DOMParser.parse), and takes the same set of\n options. But unlike that method, which produces a whole node,\n this one returns a slice that is open at the sides, meaning that\n the schema constraints aren't applied to the start of nodes to\n the left of the input and the end of nodes at the end.\n */\n parseSlice(dom, options = {}) {\n let context = new ParseContext(this, options, true);\n context.addAll(dom, Mark.none, options.from, options.to);\n return Slice.maxOpen(context.finish());\n }\n /**\n @internal\n */\n matchTag(dom, context, after) {\n for (let i = after ? this.tags.indexOf(after) + 1 : 0; i < this.tags.length; i++) {\n let rule = this.tags[i];\n if (matches(dom, rule.tag) &&\n (rule.namespace === undefined || dom.namespaceURI == rule.namespace) &&\n (!rule.context || context.matchesContext(rule.context))) {\n if (rule.getAttrs) {\n let result = rule.getAttrs(dom);\n if (result === false)\n continue;\n rule.attrs = result || undefined;\n }\n return rule;\n }\n }\n }\n /**\n @internal\n */\n matchStyle(prop, value, context, after) {\n for (let i = after ? this.styles.indexOf(after) + 1 : 0; i < this.styles.length; i++) {\n let rule = this.styles[i], style = rule.style;\n if (style.indexOf(prop) != 0 ||\n rule.context && !context.matchesContext(rule.context) ||\n // Test that the style string either precisely matches the prop,\n // or has an '=' sign after the prop, followed by the given\n // value.\n style.length > prop.length &&\n (style.charCodeAt(prop.length) != 61 || style.slice(prop.length + 1) != value))\n continue;\n if (rule.getAttrs) {\n let result = rule.getAttrs(value);\n if (result === false)\n continue;\n rule.attrs = result || undefined;\n }\n return rule;\n }\n }\n /**\n @internal\n */\n static schemaRules(schema) {\n let result = [];\n function insert(rule) {\n let priority = rule.priority == null ? 50 : rule.priority, i = 0;\n for (; i < result.length; i++) {\n let next = result[i], nextPriority = next.priority == null ? 50 : next.priority;\n if (nextPriority < priority)\n break;\n }\n result.splice(i, 0, rule);\n }\n for (let name in schema.marks) {\n let rules = schema.marks[name].spec.parseDOM;\n if (rules)\n rules.forEach(rule => {\n insert(rule = copy(rule));\n if (!(rule.mark || rule.ignore || rule.clearMark))\n rule.mark = name;\n });\n }\n for (let name in schema.nodes) {\n let rules = schema.nodes[name].spec.parseDOM;\n if (rules)\n rules.forEach(rule => {\n insert(rule = copy(rule));\n if (!(rule.node || rule.ignore || rule.mark))\n rule.node = name;\n });\n }\n return result;\n }\n /**\n Construct a DOM parser using the parsing rules listed in a\n schema's [node specs](https://prosemirror.net/docs/ref/#model.NodeSpec.parseDOM), reordered by\n [priority](https://prosemirror.net/docs/ref/#model.GenericParseRule.priority).\n */\n static fromSchema(schema) {\n return schema.cached.domParser ||\n (schema.cached.domParser = new DOMParser(schema, DOMParser.schemaRules(schema)));\n }\n}\nconst blockTags = {\n address: true, article: true, aside: true, blockquote: true, canvas: true,\n dd: true, div: true, dl: true, fieldset: true, figcaption: true, figure: true,\n footer: true, form: true, h1: true, h2: true, h3: true, h4: true, h5: true,\n h6: true, header: true, hgroup: true, hr: true, li: true, noscript: true, ol: true,\n output: true, p: true, pre: true, section: true, table: true, tfoot: true, ul: true\n};\nconst ignoreTags = {\n head: true, noscript: true, object: true, script: true, style: true, title: true\n};\nconst listTags = { ol: true, ul: true };\n// Using a bitfield for node context options\nconst OPT_PRESERVE_WS = 1, OPT_PRESERVE_WS_FULL = 2, OPT_OPEN_LEFT = 4;\nfunction wsOptionsFor(type, preserveWhitespace, base) {\n if (preserveWhitespace != null)\n return (preserveWhitespace ? OPT_PRESERVE_WS : 0) |\n (preserveWhitespace === \"full\" ? OPT_PRESERVE_WS_FULL : 0);\n return type && type.whitespace == \"pre\" ? OPT_PRESERVE_WS | OPT_PRESERVE_WS_FULL : base & ~OPT_OPEN_LEFT;\n}\nclass NodeContext {\n constructor(type, attrs, marks, solid, match, options) {\n this.type = type;\n this.attrs = attrs;\n this.marks = marks;\n this.solid = solid;\n this.options = options;\n this.content = [];\n // Marks applied to the node's children\n this.activeMarks = Mark.none;\n this.match = match || (options & OPT_OPEN_LEFT ? null : type.contentMatch);\n }\n findWrapping(node) {\n if (!this.match) {\n if (!this.type)\n return [];\n let fill = this.type.contentMatch.fillBefore(Fragment.from(node));\n if (fill) {\n this.match = this.type.contentMatch.matchFragment(fill);\n }\n else {\n let start = this.type.contentMatch, wrap;\n if (wrap = start.findWrapping(node.type)) {\n this.match = start;\n return wrap;\n }\n else {\n return null;\n }\n }\n }\n return this.match.findWrapping(node.type);\n }\n finish(openEnd) {\n if (!(this.options & OPT_PRESERVE_WS)) { // Strip trailing whitespace\n let last = this.content[this.content.length - 1], m;\n if (last && last.isText && (m = /[ \\t\\r\\n\\u000c]+$/.exec(last.text))) {\n let text = last;\n if (last.text.length == m[0].length)\n this.content.pop();\n else\n this.content[this.content.length - 1] = text.withText(text.text.slice(0, text.text.length - m[0].length));\n }\n }\n let content = Fragment.from(this.content);\n if (!openEnd && this.match)\n content = content.append(this.match.fillBefore(Fragment.empty, true));\n return this.type ? this.type.create(this.attrs, content, this.marks) : content;\n }\n inlineContext(node) {\n if (this.type)\n return this.type.inlineContent;\n if (this.content.length)\n return this.content[0].isInline;\n return node.parentNode && !blockTags.hasOwnProperty(node.parentNode.nodeName.toLowerCase());\n }\n}\nclass ParseContext {\n constructor(\n // The parser we are using.\n parser, \n // The options passed to this parse.\n options, isOpen) {\n this.parser = parser;\n this.options = options;\n this.isOpen = isOpen;\n this.open = 0;\n this.localPreserveWS = false;\n let topNode = options.topNode, topContext;\n let topOptions = wsOptionsFor(null, options.preserveWhitespace, 0) | (isOpen ? OPT_OPEN_LEFT : 0);\n if (topNode)\n topContext = new NodeContext(topNode.type, topNode.attrs, Mark.none, true, options.topMatch || topNode.type.contentMatch, topOptions);\n else if (isOpen)\n topContext = new NodeContext(null, null, Mark.none, true, null, topOptions);\n else\n topContext = new NodeContext(parser.schema.topNodeType, null, Mark.none, true, null, topOptions);\n this.nodes = [topContext];\n this.find = options.findPositions;\n this.needsBlock = false;\n }\n get top() {\n return this.nodes[this.open];\n }\n // Add a DOM node to the content. Text is inserted as text node,\n // otherwise, the node is passed to `addElement` or, if it has a\n // `style` attribute, `addElementWithStyles`.\n addDOM(dom, marks) {\n if (dom.nodeType == 3)\n this.addTextNode(dom, marks);\n else if (dom.nodeType == 1)\n this.addElement(dom, marks);\n }\n addTextNode(dom, marks) {\n let value = dom.nodeValue;\n let top = this.top, preserveWS = (top.options & OPT_PRESERVE_WS_FULL) ? \"full\"\n : this.localPreserveWS || (top.options & OPT_PRESERVE_WS) > 0;\n let { schema } = this.parser;\n if (preserveWS === \"full\" ||\n top.inlineContext(dom) ||\n /[^ \\t\\r\\n\\u000c]/.test(value)) {\n if (!preserveWS) {\n value = value.replace(/[ \\t\\r\\n\\u000c]+/g, \" \");\n // If this starts with whitespace, and there is no node before it, or\n // a hard break, or a text node that ends with whitespace, strip the\n // leading space.\n if (/^[ \\t\\r\\n\\u000c]/.test(value) && this.open == this.nodes.length - 1) {\n let nodeBefore = top.content[top.content.length - 1];\n let domNodeBefore = dom.previousSibling;\n if (!nodeBefore ||\n (domNodeBefore && domNodeBefore.nodeName == 'BR') ||\n (nodeBefore.isText && /[ \\t\\r\\n\\u000c]$/.test(nodeBefore.text)))\n value = value.slice(1);\n }\n }\n else if (preserveWS === \"full\") {\n value = value.replace(/\\r\\n?/g, \"\\n\");\n }\n else if (schema.linebreakReplacement && /[\\r\\n]/.test(value) && this.top.findWrapping(schema.linebreakReplacement.create())) {\n let lines = value.split(/\\r?\\n|\\r/);\n for (let i = 0; i < lines.length; i++) {\n if (i)\n this.insertNode(schema.linebreakReplacement.create(), marks, true);\n if (lines[i])\n this.insertNode(schema.text(lines[i]), marks, !/\\S/.test(lines[i]));\n }\n value = \"\";\n }\n else {\n value = value.replace(/\\r?\\n|\\r/g, \" \");\n }\n if (value)\n this.insertNode(schema.text(value), marks, !/\\S/.test(value));\n this.findInText(dom);\n }\n else {\n this.findInside(dom);\n }\n }\n // Try to find a handler for the given tag and use that to parse. If\n // none is found, the element's content nodes are added directly.\n addElement(dom, marks, matchAfter) {\n let outerWS = this.localPreserveWS, top = this.top;\n if (dom.tagName == \"PRE\" || /pre/.test(dom.style && dom.style.whiteSpace))\n this.localPreserveWS = true;\n let name = dom.nodeName.toLowerCase(), ruleID;\n if (listTags.hasOwnProperty(name) && this.parser.normalizeLists)\n normalizeList(dom);\n let rule = (this.options.ruleFromNode && this.options.ruleFromNode(dom)) ||\n (ruleID = this.parser.matchTag(dom, this, matchAfter));\n out: if (rule ? rule.ignore : ignoreTags.hasOwnProperty(name)) {\n this.findInside(dom);\n this.ignoreFallback(dom, marks);\n }\n else if (!rule || rule.skip || rule.closeParent) {\n if (rule && rule.closeParent)\n this.open = Math.max(0, this.open - 1);\n else if (rule && rule.skip.nodeType)\n dom = rule.skip;\n let sync, oldNeedsBlock = this.needsBlock;\n if (blockTags.hasOwnProperty(name)) {\n if (top.content.length && top.content[0].isInline && this.open) {\n this.open--;\n top = this.top;\n }\n sync = true;\n if (!top.type)\n this.needsBlock = true;\n }\n else if (!dom.firstChild) {\n this.leafFallback(dom, marks);\n break out;\n }\n let innerMarks = rule && rule.skip ? marks : this.readStyles(dom, marks);\n if (innerMarks)\n this.addAll(dom, innerMarks);\n if (sync)\n this.sync(top);\n this.needsBlock = oldNeedsBlock;\n }\n else {\n let innerMarks = this.readStyles(dom, marks);\n if (innerMarks)\n this.addElementByRule(dom, rule, innerMarks, rule.consuming === false ? ruleID : undefined);\n }\n this.localPreserveWS = outerWS;\n }\n // Called for leaf DOM nodes that would otherwise be ignored\n leafFallback(dom, marks) {\n if (dom.nodeName == \"BR\" && this.top.type && this.top.type.inlineContent)\n this.addTextNode(dom.ownerDocument.createTextNode(\"\\n\"), marks);\n }\n // Called for ignored nodes\n ignoreFallback(dom, marks) {\n // Ignored BR nodes should at least create an inline context\n if (dom.nodeName == \"BR\" && (!this.top.type || !this.top.type.inlineContent))\n this.findPlace(this.parser.schema.text(\"-\"), marks, true);\n }\n // Run any style parser associated with the node's styles. Either\n // return an updated array of marks, or null to indicate some of the\n // styles had a rule with `ignore` set.\n readStyles(dom, marks) {\n let styles = dom.style;\n // Because many properties will only show up in 'normalized' form\n // in `style.item` (i.e. text-decoration becomes\n // text-decoration-line, text-decoration-color, etc), we directly\n // query the styles mentioned in our rules instead of iterating\n // over the items.\n if (styles && styles.length)\n for (let i = 0; i < this.parser.matchedStyles.length; i++) {\n let name = this.parser.matchedStyles[i], value = styles.getPropertyValue(name);\n if (value)\n for (let after = undefined;;) {\n let rule = this.parser.matchStyle(name, value, this, after);\n if (!rule)\n break;\n if (rule.ignore)\n return null;\n if (rule.clearMark)\n marks = marks.filter(m => !rule.clearMark(m));\n else\n marks = marks.concat(this.parser.schema.marks[rule.mark].create(rule.attrs));\n if (rule.consuming === false)\n after = rule;\n else\n break;\n }\n }\n return marks;\n }\n // Look up a handler for the given node. If none are found, return\n // false. Otherwise, apply it, use its return value to drive the way\n // the node's content is wrapped, and return true.\n addElementByRule(dom, rule, marks, continueAfter) {\n let sync, nodeType;\n if (rule.node) {\n nodeType = this.parser.schema.nodes[rule.node];\n if (!nodeType.isLeaf) {\n let inner = this.enter(nodeType, rule.attrs || null, marks, rule.preserveWhitespace);\n if (inner) {\n sync = true;\n marks = inner;\n }\n }\n else if (!this.insertNode(nodeType.create(rule.attrs), marks, dom.nodeName == \"BR\")) {\n this.leafFallback(dom, marks);\n }\n }\n else {\n let markType = this.parser.schema.marks[rule.mark];\n marks = marks.concat(markType.create(rule.attrs));\n }\n let startIn = this.top;\n if (nodeType && nodeType.isLeaf) {\n this.findInside(dom);\n }\n else if (continueAfter) {\n this.addElement(dom, marks, continueAfter);\n }\n else if (rule.getContent) {\n this.findInside(dom);\n rule.getContent(dom, this.parser.schema).forEach(node => this.insertNode(node, marks, false));\n }\n else {\n let contentDOM = dom;\n if (typeof rule.contentElement == \"string\")\n contentDOM = dom.querySelector(rule.contentElement);\n else if (typeof rule.contentElement == \"function\")\n contentDOM = rule.contentElement(dom);\n else if (rule.contentElement)\n contentDOM = rule.contentElement;\n this.findAround(dom, contentDOM, true);\n this.addAll(contentDOM, marks);\n this.findAround(dom, contentDOM, false);\n }\n if (sync && this.sync(startIn))\n this.open--;\n }\n // Add all child nodes between `startIndex` and `endIndex` (or the\n // whole node, if not given). If `sync` is passed, use it to\n // synchronize after every block element.\n addAll(parent, marks, startIndex, endIndex) {\n let index = startIndex || 0;\n for (let dom = startIndex ? parent.childNodes[startIndex] : parent.firstChild, end = endIndex == null ? null : parent.childNodes[endIndex]; dom != end; dom = dom.nextSibling, ++index) {\n this.findAtPoint(parent, index);\n this.addDOM(dom, marks);\n }\n this.findAtPoint(parent, index);\n }\n // Try to find a way to fit the given node type into the current\n // context. May add intermediate wrappers and/or leave non-solid\n // nodes that we're in.\n findPlace(node, marks, cautious) {\n let route, sync;\n for (let depth = this.open, penalty = 0; depth >= 0; depth--) {\n let cx = this.nodes[depth];\n let found = cx.findWrapping(node);\n if (found && (!route || route.length > found.length + penalty)) {\n route = found;\n sync = cx;\n if (!found.length)\n break;\n }\n if (cx.solid) {\n if (cautious)\n break;\n penalty += 2;\n }\n }\n if (!route)\n return null;\n this.sync(sync);\n for (let i = 0; i < route.length; i++)\n marks = this.enterInner(route[i], null, marks, false);\n return marks;\n }\n // Try to insert the given node, adjusting the context when needed.\n insertNode(node, marks, cautious) {\n if (node.isInline && this.needsBlock && !this.top.type) {\n let block = this.textblockFromContext();\n if (block)\n marks = this.enterInner(block, null, marks);\n }\n let innerMarks = this.findPlace(node, marks, cautious);\n if (innerMarks) {\n this.closeExtra();\n let top = this.top;\n if (top.match)\n top.match = top.match.matchType(node.type);\n let nodeMarks = Mark.none;\n for (let m of innerMarks.concat(node.marks))\n if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, node.type))\n nodeMarks = m.addToSet(nodeMarks);\n top.content.push(node.mark(nodeMarks));\n return true;\n }\n return false;\n }\n // Try to start a node of the given type, adjusting the context when\n // necessary.\n enter(type, attrs, marks, preserveWS) {\n let innerMarks = this.findPlace(type.create(attrs), marks, false);\n if (innerMarks)\n innerMarks = this.enterInner(type, attrs, marks, true, preserveWS);\n return innerMarks;\n }\n // Open a node of the given type\n enterInner(type, attrs, marks, solid = false, preserveWS) {\n this.closeExtra();\n let top = this.top;\n top.match = top.match && top.match.matchType(type);\n let options = wsOptionsFor(type, preserveWS, top.options);\n if ((top.options & OPT_OPEN_LEFT) && top.content.length == 0)\n options |= OPT_OPEN_LEFT;\n let applyMarks = Mark.none;\n marks = marks.filter(m => {\n if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, type)) {\n applyMarks = m.addToSet(applyMarks);\n return false;\n }\n return true;\n });\n this.nodes.push(new NodeContext(type, attrs, applyMarks, solid, null, options));\n this.open++;\n return marks;\n }\n // Make sure all nodes above this.open are finished and added to\n // their parents\n closeExtra(openEnd = false) {\n let i = this.nodes.length - 1;\n if (i > this.open) {\n for (; i > this.open; i--)\n this.nodes[i - 1].content.push(this.nodes[i].finish(openEnd));\n this.nodes.length = this.open + 1;\n }\n }\n finish() {\n this.open = 0;\n this.closeExtra(this.isOpen);\n return this.nodes[0].finish(!!(this.isOpen || this.options.topOpen));\n }\n sync(to) {\n for (let i = this.open; i >= 0; i--) {\n if (this.nodes[i] == to) {\n this.open = i;\n return true;\n }\n else if (this.localPreserveWS) {\n this.nodes[i].options |= OPT_PRESERVE_WS;\n }\n }\n return false;\n }\n get currentPos() {\n this.closeExtra();\n let pos = 0;\n for (let i = this.open; i >= 0; i--) {\n let content = this.nodes[i].content;\n for (let j = content.length - 1; j >= 0; j--)\n pos += content[j].nodeSize;\n if (i)\n pos++;\n }\n return pos;\n }\n findAtPoint(parent, offset) {\n if (this.find)\n for (let i = 0; i < this.find.length; i++) {\n if (this.find[i].node == parent && this.find[i].offset == offset)\n this.find[i].pos = this.currentPos;\n }\n }\n findInside(parent) {\n if (this.find)\n for (let i = 0; i < this.find.length; i++) {\n if (this.find[i].pos == null && parent.nodeType == 1 && parent.contains(this.find[i].node))\n this.find[i].pos = this.currentPos;\n }\n }\n findAround(parent, content, before) {\n if (parent != content && this.find)\n for (let i = 0; i < this.find.length; i++) {\n if (this.find[i].pos == null && parent.nodeType == 1 && parent.contains(this.find[i].node)) {\n let pos = content.compareDocumentPosition(this.find[i].node);\n if (pos & (before ? 2 : 4))\n this.find[i].pos = this.currentPos;\n }\n }\n }\n findInText(textNode) {\n if (this.find)\n for (let i = 0; i < this.find.length; i++) {\n if (this.find[i].node == textNode)\n this.find[i].pos = this.currentPos - (textNode.nodeValue.length - this.find[i].offset);\n }\n }\n // Determines whether the given context string matches this context.\n matchesContext(context) {\n if (context.indexOf(\"|\") > -1)\n return context.split(/\\s*\\|\\s*/).some(this.matchesContext, this);\n let parts = context.split(\"/\");\n let option = this.options.context;\n let useRoot = !this.isOpen && (!option || option.parent.type == this.nodes[0].type);\n let minDepth = -(option ? option.depth + 1 : 0) + (useRoot ? 0 : 1);\n let match = (i, depth) => {\n for (; i >= 0; i--) {\n let part = parts[i];\n if (part == \"\") {\n if (i == parts.length - 1 || i == 0)\n continue;\n for (; depth >= minDepth; depth--)\n if (match(i - 1, depth))\n return true;\n return false;\n }\n else {\n let next = depth > 0 || (depth == 0 && useRoot) ? this.nodes[depth].type\n : option && depth >= minDepth ? option.node(depth - minDepth).type\n : null;\n if (!next || (next.name != part && !next.isInGroup(part)))\n return false;\n depth--;\n }\n }\n return true;\n };\n return match(parts.length - 1, this.open);\n }\n textblockFromContext() {\n let $context = this.options.context;\n if ($context)\n for (let d = $context.depth; d >= 0; d--) {\n let deflt = $context.node(d).contentMatchAt($context.indexAfter(d)).defaultType;\n if (deflt && deflt.isTextblock && deflt.defaultAttrs)\n return deflt;\n }\n for (let name in this.parser.schema.nodes) {\n let type = this.parser.schema.nodes[name];\n if (type.isTextblock && type.defaultAttrs)\n return type;\n }\n }\n}\n// Kludge to work around directly nested list nodes produced by some\n// tools and allowed by browsers to mean that the nested list is\n// actually part of the list item above it.\nfunction normalizeList(dom) {\n for (let child = dom.firstChild, prevItem = null; child; child = child.nextSibling) {\n let name = child.nodeType == 1 ? child.nodeName.toLowerCase() : null;\n if (name && listTags.hasOwnProperty(name) && prevItem) {\n prevItem.appendChild(child);\n child = prevItem;\n }\n else if (name == \"li\") {\n prevItem = child;\n }\n else if (name) {\n prevItem = null;\n }\n }\n}\n// Apply a CSS selector.\nfunction matches(dom, selector) {\n return (dom.matches || dom.msMatchesSelector || dom.webkitMatchesSelector || dom.mozMatchesSelector).call(dom, selector);\n}\nfunction copy(obj) {\n let copy = {};\n for (let prop in obj)\n copy[prop] = obj[prop];\n return copy;\n}\n// Used when finding a mark at the top level of a fragment parse.\n// Checks whether it would be reasonable to apply a given mark type to\n// a given node, by looking at the way the mark occurs in the schema.\nfunction markMayApply(markType, nodeType) {\n let nodes = nodeType.schema.nodes;\n for (let name in nodes) {\n let parent = nodes[name];\n if (!parent.allowsMarkType(markType))\n continue;\n let seen = [], scan = (match) => {\n seen.push(match);\n for (let i = 0; i < match.edgeCount; i++) {\n let { type, next } = match.edge(i);\n if (type == nodeType)\n return true;\n if (seen.indexOf(next) < 0 && scan(next))\n return true;\n }\n };\n if (scan(parent.contentMatch))\n return true;\n }\n}\n\n/**\nA DOM serializer knows how to convert ProseMirror nodes and\nmarks of various types to DOM nodes.\n*/\nclass DOMSerializer {\n /**\n Create a serializer. `nodes` should map node names to functions\n that take a node and return a description of the corresponding\n DOM. `marks` does the same for mark names, but also gets an\n argument that tells it whether the mark's content is block or\n inline content (for typical use, it'll always be inline). A mark\n serializer may be `null` to indicate that marks of that type\n should not be serialized.\n */\n constructor(\n /**\n The node serialization functions.\n */\n nodes, \n /**\n The mark serialization functions.\n */\n marks) {\n this.nodes = nodes;\n this.marks = marks;\n }\n /**\n Serialize the content of this fragment to a DOM fragment. When\n not in the browser, the `document` option, containing a DOM\n document, should be passed so that the serializer can create\n nodes.\n */\n serializeFragment(fragment, options = {}, target) {\n if (!target)\n target = doc(options).createDocumentFragment();\n let top = target, active = [];\n fragment.forEach(node => {\n if (active.length || node.marks.length) {\n let keep = 0, rendered = 0;\n while (keep < active.length && rendered < node.marks.length) {\n let next = node.marks[rendered];\n if (!this.marks[next.type.name]) {\n rendered++;\n continue;\n }\n if (!next.eq(active[keep][0]) || next.type.spec.spanning === false)\n break;\n keep++;\n rendered++;\n }\n while (keep < active.length)\n top = active.pop()[1];\n while (rendered < node.marks.length) {\n let add = node.marks[rendered++];\n let markDOM = this.serializeMark(add, node.isInline, options);\n if (markDOM) {\n active.push([add, top]);\n top.appendChild(markDOM.dom);\n top = markDOM.contentDOM || markDOM.dom;\n }\n }\n }\n top.appendChild(this.serializeNodeInner(node, options));\n });\n return target;\n }\n /**\n @internal\n */\n serializeNodeInner(node, options) {\n let { dom, contentDOM } = renderSpec(doc(options), this.nodes[node.type.name](node), null, node.attrs);\n if (contentDOM) {\n if (node.isLeaf)\n throw new RangeError(\"Content hole not allowed in a leaf node spec\");\n this.serializeFragment(node.content, options, contentDOM);\n }\n return dom;\n }\n /**\n Serialize this node to a DOM node. This can be useful when you\n need to serialize a part of a document, as opposed to the whole\n document. To serialize a whole document, use\n [`serializeFragment`](https://prosemirror.net/docs/ref/#model.DOMSerializer.serializeFragment) on\n its [content](https://prosemirror.net/docs/ref/#model.Node.content).\n */\n serializeNode(node, options = {}) {\n let dom = this.serializeNodeInner(node, options);\n for (let i = node.marks.length - 1; i >= 0; i--) {\n let wrap = this.serializeMark(node.marks[i], node.isInline, options);\n if (wrap) {\n (wrap.contentDOM || wrap.dom).appendChild(dom);\n dom = wrap.dom;\n }\n }\n return dom;\n }\n /**\n @internal\n */\n serializeMark(mark, inline, options = {}) {\n let toDOM = this.marks[mark.type.name];\n return toDOM && renderSpec(doc(options), toDOM(mark, inline), null, mark.attrs);\n }\n static renderSpec(doc, structure, xmlNS = null, blockArraysIn) {\n return renderSpec(doc, structure, xmlNS, blockArraysIn);\n }\n /**\n Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM)\n properties in a schema's node and mark specs.\n */\n static fromSchema(schema) {\n return schema.cached.domSerializer ||\n (schema.cached.domSerializer = new DOMSerializer(this.nodesFromSchema(schema), this.marksFromSchema(schema)));\n }\n /**\n Gather the serializers in a schema's node specs into an object.\n This can be useful as a base to build a custom serializer from.\n */\n static nodesFromSchema(schema) {\n let result = gatherToDOM(schema.nodes);\n if (!result.text)\n result.text = node => node.text;\n return result;\n }\n /**\n Gather the serializers in a schema's mark specs into an object.\n */\n static marksFromSchema(schema) {\n return gatherToDOM(schema.marks);\n }\n}\nfunction gatherToDOM(obj) {\n let result = {};\n for (let name in obj) {\n let toDOM = obj[name].spec.toDOM;\n if (toDOM)\n result[name] = toDOM;\n }\n return result;\n}\nfunction doc(options) {\n return options.document || window.document;\n}\nconst suspiciousAttributeCache = new WeakMap();\nfunction suspiciousAttributes(attrs) {\n let value = suspiciousAttributeCache.get(attrs);\n if (value === undefined)\n suspiciousAttributeCache.set(attrs, value = suspiciousAttributesInner(attrs));\n return value;\n}\nfunction suspiciousAttributesInner(attrs) {\n let result = null;\n function scan(value) {\n if (value && typeof value == \"object\") {\n if (Array.isArray(value)) {\n if (typeof value[0] == \"string\") {\n if (!result)\n result = [];\n result.push(value);\n }\n else {\n for (let i = 0; i < value.length; i++)\n scan(value[i]);\n }\n }\n else {\n for (let prop in value)\n scan(value[prop]);\n }\n }\n }\n scan(attrs);\n return result;\n}\nfunction renderSpec(doc, structure, xmlNS, blockArraysIn) {\n if (typeof structure == \"string\")\n return { dom: doc.createTextNode(structure) };\n if (structure.nodeType != null)\n return { dom: structure };\n if (structure.dom && structure.dom.nodeType != null)\n return structure;\n let tagName = structure[0], suspicious;\n if (typeof tagName != \"string\")\n throw new RangeError(\"Invalid array passed to renderSpec\");\n if (blockArraysIn && (suspicious = suspiciousAttributes(blockArraysIn)) &&\n suspicious.indexOf(structure) > -1)\n throw new RangeError(\"Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.\");\n let space = tagName.indexOf(\" \");\n if (space > 0) {\n xmlNS = tagName.slice(0, space);\n tagName = tagName.slice(space + 1);\n }\n let contentDOM;\n let dom = (xmlNS ? doc.createElementNS(xmlNS, tagName) : doc.createElement(tagName));\n let attrs = structure[1], start = 1;\n if (attrs && typeof attrs == \"object\" && attrs.nodeType == null && !Array.isArray(attrs)) {\n start = 2;\n for (let name in attrs)\n if (attrs[name] != null) {\n let space = name.indexOf(\" \");\n if (space > 0)\n dom.setAttributeNS(name.slice(0, space), name.slice(space + 1), attrs[name]);\n else if (name == \"style\" && dom.style)\n dom.style.cssText = attrs[name];\n else\n dom.setAttribute(name, attrs[name]);\n }\n }\n for (let i = start; i < structure.length; i++) {\n let child = structure[i];\n if (child === 0) {\n if (i < structure.length - 1 || i > start)\n throw new RangeError(\"Content hole must be the only child of its parent node\");\n return { dom, contentDOM: dom };\n }\n else {\n let { dom: inner, contentDOM: innerContent } = renderSpec(doc, child, xmlNS, blockArraysIn);\n dom.appendChild(inner);\n if (innerContent) {\n if (contentDOM)\n throw new RangeError(\"Multiple content holes\");\n contentDOM = innerContent;\n }\n }\n }\n return { dom, contentDOM };\n}\n\nexport { ContentMatch, DOMParser, DOMSerializer, Fragment, Mark, MarkType, Node, NodeRange, NodeType, ReplaceError, ResolvedPos, Schema, Slice };\n","import { ReplaceError, Slice, Fragment, MarkType, Mark } from 'prosemirror-model';\n\n// Recovery values encode a range index and an offset. They are\n// represented as numbers, because tons of them will be created when\n// mapping, for example, a large number of decorations. The number's\n// lower 16 bits provide the index, the remaining bits the offset.\n//\n// Note: We intentionally don't use bit shift operators to en- and\n// decode these, since those clip to 32 bits, which we might in rare\n// cases want to overflow. A 64-bit float can represent 48-bit\n// integers precisely.\nconst lower16 = 0xffff;\nconst factor16 = Math.pow(2, 16);\nfunction makeRecover(index, offset) { return index + offset * factor16; }\nfunction recoverIndex(value) { return value & lower16; }\nfunction recoverOffset(value) { return (value - (value & lower16)) / factor16; }\nconst DEL_BEFORE = 1, DEL_AFTER = 2, DEL_ACROSS = 4, DEL_SIDE = 8;\n/**\nAn object representing a mapped position with extra\ninformation.\n*/\nclass MapResult {\n /**\n @internal\n */\n constructor(\n /**\n The mapped version of the position.\n */\n pos, \n /**\n @internal\n */\n delInfo, \n /**\n @internal\n */\n recover) {\n this.pos = pos;\n this.delInfo = delInfo;\n this.recover = recover;\n }\n /**\n Tells you whether the position was deleted, that is, whether the\n step removed the token on the side queried (via the `assoc`)\n argument from the document.\n */\n get deleted() { return (this.delInfo & DEL_SIDE) > 0; }\n /**\n Tells you whether the token before the mapped position was deleted.\n */\n get deletedBefore() { return (this.delInfo & (DEL_BEFORE | DEL_ACROSS)) > 0; }\n /**\n True when the token after the mapped position was deleted.\n */\n get deletedAfter() { return (this.delInfo & (DEL_AFTER | DEL_ACROSS)) > 0; }\n /**\n Tells whether any of the steps mapped through deletes across the\n position (including both the token before and after the\n position).\n */\n get deletedAcross() { return (this.delInfo & DEL_ACROSS) > 0; }\n}\n/**\nA map describing the deletions and insertions made by a step, which\ncan be used to find the correspondence between positions in the\npre-step version of a document and the same position in the\npost-step version.\n*/\nclass StepMap {\n /**\n Create a position map. The modifications to the document are\n represented as an array of numbers, in which each group of three\n represents a modified chunk as `[start, oldSize, newSize]`.\n */\n constructor(\n /**\n @internal\n */\n ranges, \n /**\n @internal\n */\n inverted = false) {\n this.ranges = ranges;\n this.inverted = inverted;\n if (!ranges.length && StepMap.empty)\n return StepMap.empty;\n }\n /**\n @internal\n */\n recover(value) {\n let diff = 0, index = recoverIndex(value);\n if (!this.inverted)\n for (let i = 0; i < index; i++)\n diff += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];\n return this.ranges[index * 3] + diff + recoverOffset(value);\n }\n mapResult(pos, assoc = 1) { return this._map(pos, assoc, false); }\n map(pos, assoc = 1) { return this._map(pos, assoc, true); }\n /**\n @internal\n */\n _map(pos, assoc, simple) {\n let diff = 0, oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;\n for (let i = 0; i < this.ranges.length; i += 3) {\n let start = this.ranges[i] - (this.inverted ? diff : 0);\n if (start > pos)\n break;\n let oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex], end = start + oldSize;\n if (pos <= end) {\n let side = !oldSize ? assoc : pos == start ? -1 : pos == end ? 1 : assoc;\n let result = start + diff + (side < 0 ? 0 : newSize);\n if (simple)\n return result;\n let recover = pos == (assoc < 0 ? start : end) ? null : makeRecover(i / 3, pos - start);\n let del = pos == start ? DEL_AFTER : pos == end ? DEL_BEFORE : DEL_ACROSS;\n if (assoc < 0 ? pos != start : pos != end)\n del |= DEL_SIDE;\n return new MapResult(result, del, recover);\n }\n diff += newSize - oldSize;\n }\n return simple ? pos + diff : new MapResult(pos + diff, 0, null);\n }\n /**\n @internal\n */\n touches(pos, recover) {\n let diff = 0, index = recoverIndex(recover);\n let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;\n for (let i = 0; i < this.ranges.length; i += 3) {\n let start = this.ranges[i] - (this.inverted ? diff : 0);\n if (start > pos)\n break;\n let oldSize = this.ranges[i + oldIndex], end = start + oldSize;\n if (pos <= end && i == index * 3)\n return true;\n diff += this.ranges[i + newIndex] - oldSize;\n }\n return false;\n }\n /**\n Calls the given function on each of the changed ranges included in\n this map.\n */\n forEach(f) {\n let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;\n for (let i = 0, diff = 0; i < this.ranges.length; i += 3) {\n let start = this.ranges[i], oldStart = start - (this.inverted ? diff : 0), newStart = start + (this.inverted ? 0 : diff);\n let oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex];\n f(oldStart, oldStart + oldSize, newStart, newStart + newSize);\n diff += newSize - oldSize;\n }\n }\n /**\n Create an inverted version of this map. The result can be used to\n map positions in the post-step document to the pre-step document.\n */\n invert() {\n return new StepMap(this.ranges, !this.inverted);\n }\n /**\n @internal\n */\n toString() {\n return (this.inverted ? \"-\" : \"\") + JSON.stringify(this.ranges);\n }\n /**\n Create a map that moves all positions by offset `n` (which may be\n negative). This can be useful when applying steps meant for a\n sub-document to a larger document, or vice-versa.\n */\n static offset(n) {\n return n == 0 ? StepMap.empty : new StepMap(n < 0 ? [0, -n, 0] : [0, 0, n]);\n }\n}\n/**\nA StepMap that contains no changed ranges.\n*/\nStepMap.empty = new StepMap([]);\n/**\nA mapping represents a pipeline of zero or more [step\nmaps](https://prosemirror.net/docs/ref/#transform.StepMap). It has special provisions for losslessly\nhandling mapping positions through a series of steps in which some\nsteps are inverted versions of earlier steps. (This comes up when\n‘[rebasing](https://prosemirror.net/docs/guide/#transform.rebasing)’ steps for\ncollaboration or history management.)\n*/\nclass Mapping {\n /**\n Create a new mapping with the given position maps.\n */\n constructor(maps, \n /**\n @internal\n */\n mirror, \n /**\n The starting position in the `maps` array, used when `map` or\n `mapResult` is called.\n */\n from = 0, \n /**\n The end position in the `maps` array.\n */\n to = maps ? maps.length : 0) {\n this.mirror = mirror;\n this.from = from;\n this.to = to;\n this._maps = maps || [];\n this.ownData = !(maps || mirror);\n }\n /**\n The step maps in this mapping.\n */\n get maps() { return this._maps; }\n /**\n Create a mapping that maps only through a part of this one.\n */\n slice(from = 0, to = this.maps.length) {\n return new Mapping(this._maps, this.mirror, from, to);\n }\n /**\n Add a step map to the end of this mapping. If `mirrors` is\n given, it should be the index of the step map that is the mirror\n image of this one.\n */\n appendMap(map, mirrors) {\n if (!this.ownData) {\n this._maps = this._maps.slice();\n this.mirror = this.mirror && this.mirror.slice();\n this.ownData = true;\n }\n this.to = this._maps.push(map);\n if (mirrors != null)\n this.setMirror(this._maps.length - 1, mirrors);\n }\n /**\n Add all the step maps in a given mapping to this one (preserving\n mirroring information).\n */\n appendMapping(mapping) {\n for (let i = 0, startSize = this._maps.length; i < mapping._maps.length; i++) {\n let mirr = mapping.getMirror(i);\n this.appendMap(mapping._maps[i], mirr != null && mirr < i ? startSize + mirr : undefined);\n }\n }\n /**\n Finds the offset of the step map that mirrors the map at the\n given offset, in this mapping (as per the second argument to\n `appendMap`).\n */\n getMirror(n) {\n if (this.mirror)\n for (let i = 0; i < this.mirror.length; i++)\n if (this.mirror[i] == n)\n return this.mirror[i + (i % 2 ? -1 : 1)];\n }\n /**\n @internal\n */\n setMirror(n, m) {\n if (!this.mirror)\n this.mirror = [];\n this.mirror.push(n, m);\n }\n /**\n Append the inverse of the given mapping to this one.\n */\n appendMappingInverted(mapping) {\n for (let i = mapping.maps.length - 1, totalSize = this._maps.length + mapping._maps.length; i >= 0; i--) {\n let mirr = mapping.getMirror(i);\n this.appendMap(mapping._maps[i].invert(), mirr != null && mirr > i ? totalSize - mirr - 1 : undefined);\n }\n }\n /**\n Create an inverted version of this mapping.\n */\n invert() {\n let inverse = new Mapping;\n inverse.appendMappingInverted(this);\n return inverse;\n }\n /**\n Map a position through this mapping.\n */\n map(pos, assoc = 1) {\n if (this.mirror)\n return this._map(pos, assoc, true);\n for (let i = this.from; i < this.to; i++)\n pos = this._maps[i].map(pos, assoc);\n return pos;\n }\n /**\n Map a position through this mapping, returning a mapping\n result.\n */\n mapResult(pos, assoc = 1) { return this._map(pos, assoc, false); }\n /**\n @internal\n */\n _map(pos, assoc, simple) {\n let delInfo = 0;\n for (let i = this.from; i < this.to; i++) {\n let map = this._maps[i], result = map.mapResult(pos, assoc);\n if (result.recover != null) {\n let corr = this.getMirror(i);\n if (corr != null && corr > i && corr < this.to) {\n i = corr;\n pos = this._maps[corr].recover(result.recover);\n continue;\n }\n }\n delInfo |= result.delInfo;\n pos = result.pos;\n }\n return simple ? pos : new MapResult(pos, delInfo, null);\n }\n}\n\nconst stepsByID = Object.create(null);\n/**\nA step object represents an atomic change. It generally applies\nonly to the document it was created for, since the positions\nstored in it will only make sense for that document.\n\nNew steps are defined by creating classes that extend `Step`,\noverriding the `apply`, `invert`, `map`, `getMap` and `fromJSON`\nmethods, and registering your class with a unique\nJSON-serialization identifier using\n[`Step.jsonID`](https://prosemirror.net/docs/ref/#transform.Step^jsonID).\n*/\nclass Step {\n /**\n Get the step map that represents the changes made by this step,\n and which can be used to transform between positions in the old\n and the new document.\n */\n getMap() { return StepMap.empty; }\n /**\n Try to merge this step with another one, to be applied directly\n after it. Returns the merged step when possible, null if the\n steps can't be merged.\n */\n merge(other) { return null; }\n /**\n Deserialize a step from its JSON representation. Will call\n through to the step class' own implementation of this method.\n */\n static fromJSON(schema, json) {\n if (!json || !json.stepType)\n throw new RangeError(\"Invalid input for Step.fromJSON\");\n let type = stepsByID[json.stepType];\n if (!type)\n throw new RangeError(`No step type ${json.stepType} defined`);\n return type.fromJSON(schema, json);\n }\n /**\n To be able to serialize steps to JSON, each step needs a string\n ID to attach to its JSON representation. Use this method to\n register an ID for your step classes. Try to pick something\n that's unlikely to clash with steps from other modules.\n */\n static jsonID(id, stepClass) {\n if (id in stepsByID)\n throw new RangeError(\"Duplicate use of step JSON ID \" + id);\n stepsByID[id] = stepClass;\n stepClass.prototype.jsonID = id;\n return stepClass;\n }\n}\n/**\nThe result of [applying](https://prosemirror.net/docs/ref/#transform.Step.apply) a step. Contains either a\nnew document or a failure value.\n*/\nclass StepResult {\n /**\n @internal\n */\n constructor(\n /**\n The transformed document, if successful.\n */\n doc, \n /**\n The failure message, if unsuccessful.\n */\n failed) {\n this.doc = doc;\n this.failed = failed;\n }\n /**\n Create a successful step result.\n */\n static ok(doc) { return new StepResult(doc, null); }\n /**\n Create a failed step result.\n */\n static fail(message) { return new StepResult(null, message); }\n /**\n Call [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) with the given\n arguments. Create a successful result if it succeeds, and a\n failed one if it throws a `ReplaceError`.\n */\n static fromReplace(doc, from, to, slice) {\n try {\n return StepResult.ok(doc.replace(from, to, slice));\n }\n catch (e) {\n if (e instanceof ReplaceError)\n return StepResult.fail(e.message);\n throw e;\n }\n }\n}\n\nfunction mapFragment(fragment, f, parent) {\n let mapped = [];\n for (let i = 0; i < fragment.childCount; i++) {\n let child = fragment.child(i);\n if (child.content.size)\n child = child.copy(mapFragment(child.content, f, child));\n if (child.isInline)\n child = f(child, parent, i);\n mapped.push(child);\n }\n return Fragment.fromArray(mapped);\n}\n/**\nAdd a mark to all inline content between two positions.\n*/\nclass AddMarkStep extends Step {\n /**\n Create a mark step.\n */\n constructor(\n /**\n The start of the marked range.\n */\n from, \n /**\n The end of the marked range.\n */\n to, \n /**\n The mark to add.\n */\n mark) {\n super();\n this.from = from;\n this.to = to;\n this.mark = mark;\n }\n apply(doc) {\n let oldSlice = doc.slice(this.from, this.to), $from = doc.resolve(this.from);\n let parent = $from.node($from.sharedDepth(this.to));\n let slice = new Slice(mapFragment(oldSlice.content, (node, parent) => {\n if (!node.isAtom || !parent.type.allowsMarkType(this.mark.type))\n return node;\n return node.mark(this.mark.addToSet(node.marks));\n }, parent), oldSlice.openStart, oldSlice.openEnd);\n return StepResult.fromReplace(doc, this.from, this.to, slice);\n }\n invert() {\n return new RemoveMarkStep(this.from, this.to, this.mark);\n }\n map(mapping) {\n let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);\n if (from.deleted && to.deleted || from.pos >= to.pos)\n return null;\n return new AddMarkStep(from.pos, to.pos, this.mark);\n }\n merge(other) {\n if (other instanceof AddMarkStep &&\n other.mark.eq(this.mark) &&\n this.from <= other.to && this.to >= other.from)\n return new AddMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);\n return null;\n }\n toJSON() {\n return { stepType: \"addMark\", mark: this.mark.toJSON(),\n from: this.from, to: this.to };\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\")\n throw new RangeError(\"Invalid input for AddMarkStep.fromJSON\");\n return new AddMarkStep(json.from, json.to, schema.markFromJSON(json.mark));\n }\n}\nStep.jsonID(\"addMark\", AddMarkStep);\n/**\nRemove a mark from all inline content between two positions.\n*/\nclass RemoveMarkStep extends Step {\n /**\n Create a mark-removing step.\n */\n constructor(\n /**\n The start of the unmarked range.\n */\n from, \n /**\n The end of the unmarked range.\n */\n to, \n /**\n The mark to remove.\n */\n mark) {\n super();\n this.from = from;\n this.to = to;\n this.mark = mark;\n }\n apply(doc) {\n let oldSlice = doc.slice(this.from, this.to);\n let slice = new Slice(mapFragment(oldSlice.content, node => {\n return node.mark(this.mark.removeFromSet(node.marks));\n }, doc), oldSlice.openStart, oldSlice.openEnd);\n return StepResult.fromReplace(doc, this.from, this.to, slice);\n }\n invert() {\n return new AddMarkStep(this.from, this.to, this.mark);\n }\n map(mapping) {\n let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);\n if (from.deleted && to.deleted || from.pos >= to.pos)\n return null;\n return new RemoveMarkStep(from.pos, to.pos, this.mark);\n }\n merge(other) {\n if (other instanceof RemoveMarkStep &&\n other.mark.eq(this.mark) &&\n this.from <= other.to && this.to >= other.from)\n return new RemoveMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);\n return null;\n }\n toJSON() {\n return { stepType: \"removeMark\", mark: this.mark.toJSON(),\n from: this.from, to: this.to };\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\")\n throw new RangeError(\"Invalid input for RemoveMarkStep.fromJSON\");\n return new RemoveMarkStep(json.from, json.to, schema.markFromJSON(json.mark));\n }\n}\nStep.jsonID(\"removeMark\", RemoveMarkStep);\n/**\nAdd a mark to a specific node.\n*/\nclass AddNodeMarkStep extends Step {\n /**\n Create a node mark step.\n */\n constructor(\n /**\n The position of the target node.\n */\n pos, \n /**\n The mark to add.\n */\n mark) {\n super();\n this.pos = pos;\n this.mark = mark;\n }\n apply(doc) {\n let node = doc.nodeAt(this.pos);\n if (!node)\n return StepResult.fail(\"No node at mark step's position\");\n let updated = node.type.create(node.attrs, null, this.mark.addToSet(node.marks));\n return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));\n }\n invert(doc) {\n let node = doc.nodeAt(this.pos);\n if (node) {\n let newSet = this.mark.addToSet(node.marks);\n if (newSet.length == node.marks.length) {\n for (let i = 0; i < node.marks.length; i++)\n if (!node.marks[i].isInSet(newSet))\n return new AddNodeMarkStep(this.pos, node.marks[i]);\n return new AddNodeMarkStep(this.pos, this.mark);\n }\n }\n return new RemoveNodeMarkStep(this.pos, this.mark);\n }\n map(mapping) {\n let pos = mapping.mapResult(this.pos, 1);\n return pos.deletedAfter ? null : new AddNodeMarkStep(pos.pos, this.mark);\n }\n toJSON() {\n return { stepType: \"addNodeMark\", pos: this.pos, mark: this.mark.toJSON() };\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.pos != \"number\")\n throw new RangeError(\"Invalid input for AddNodeMarkStep.fromJSON\");\n return new AddNodeMarkStep(json.pos, schema.markFromJSON(json.mark));\n }\n}\nStep.jsonID(\"addNodeMark\", AddNodeMarkStep);\n/**\nRemove a mark from a specific node.\n*/\nclass RemoveNodeMarkStep extends Step {\n /**\n Create a mark-removing step.\n */\n constructor(\n /**\n The position of the target node.\n */\n pos, \n /**\n The mark to remove.\n */\n mark) {\n super();\n this.pos = pos;\n this.mark = mark;\n }\n apply(doc) {\n let node = doc.nodeAt(this.pos);\n if (!node)\n return StepResult.fail(\"No node at mark step's position\");\n let updated = node.type.create(node.attrs, null, this.mark.removeFromSet(node.marks));\n return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));\n }\n invert(doc) {\n let node = doc.nodeAt(this.pos);\n if (!node || !this.mark.isInSet(node.marks))\n return this;\n return new AddNodeMarkStep(this.pos, this.mark);\n }\n map(mapping) {\n let pos = mapping.mapResult(this.pos, 1);\n return pos.deletedAfter ? null : new RemoveNodeMarkStep(pos.pos, this.mark);\n }\n toJSON() {\n return { stepType: \"removeNodeMark\", pos: this.pos, mark: this.mark.toJSON() };\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.pos != \"number\")\n throw new RangeError(\"Invalid input for RemoveNodeMarkStep.fromJSON\");\n return new RemoveNodeMarkStep(json.pos, schema.markFromJSON(json.mark));\n }\n}\nStep.jsonID(\"removeNodeMark\", RemoveNodeMarkStep);\n\n/**\nReplace a part of the document with a slice of new content.\n*/\nclass ReplaceStep extends Step {\n /**\n The given `slice` should fit the 'gap' between `from` and\n `to`—the depths must line up, and the surrounding nodes must be\n able to be joined with the open sides of the slice. When\n `structure` is true, the step will fail if the content between\n from and to is not just a sequence of closing and then opening\n tokens (this is to guard against rebased replace steps\n overwriting something they weren't supposed to).\n */\n constructor(\n /**\n The start position of the replaced range.\n */\n from, \n /**\n The end position of the replaced range.\n */\n to, \n /**\n The slice to insert.\n */\n slice, \n /**\n @internal\n */\n structure = false) {\n super();\n this.from = from;\n this.to = to;\n this.slice = slice;\n this.structure = structure;\n }\n apply(doc) {\n if (this.structure && contentBetween(doc, this.from, this.to))\n return StepResult.fail(\"Structure replace would overwrite content\");\n return StepResult.fromReplace(doc, this.from, this.to, this.slice);\n }\n getMap() {\n return new StepMap([this.from, this.to - this.from, this.slice.size]);\n }\n invert(doc) {\n return new ReplaceStep(this.from, this.from + this.slice.size, doc.slice(this.from, this.to));\n }\n map(mapping) {\n let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);\n if (from.deletedAcross && to.deletedAcross)\n return null;\n return new ReplaceStep(from.pos, Math.max(from.pos, to.pos), this.slice, this.structure);\n }\n merge(other) {\n if (!(other instanceof ReplaceStep) || other.structure || this.structure)\n return null;\n if (this.from + this.slice.size == other.from && !this.slice.openEnd && !other.slice.openStart) {\n let slice = this.slice.size + other.slice.size == 0 ? Slice.empty\n : new Slice(this.slice.content.append(other.slice.content), this.slice.openStart, other.slice.openEnd);\n return new ReplaceStep(this.from, this.to + (other.to - other.from), slice, this.structure);\n }\n else if (other.to == this.from && !this.slice.openStart && !other.slice.openEnd) {\n let slice = this.slice.size + other.slice.size == 0 ? Slice.empty\n : new Slice(other.slice.content.append(this.slice.content), other.slice.openStart, this.slice.openEnd);\n return new ReplaceStep(other.from, this.to, slice, this.structure);\n }\n else {\n return null;\n }\n }\n toJSON() {\n let json = { stepType: \"replace\", from: this.from, to: this.to };\n if (this.slice.size)\n json.slice = this.slice.toJSON();\n if (this.structure)\n json.structure = true;\n return json;\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\")\n throw new RangeError(\"Invalid input for ReplaceStep.fromJSON\");\n return new ReplaceStep(json.from, json.to, Slice.fromJSON(schema, json.slice), !!json.structure);\n }\n}\nStep.jsonID(\"replace\", ReplaceStep);\n/**\nReplace a part of the document with a slice of content, but\npreserve a range of the replaced content by moving it into the\nslice.\n*/\nclass ReplaceAroundStep extends Step {\n /**\n Create a replace-around step with the given range and gap.\n `insert` should be the point in the slice into which the content\n of the gap should be moved. `structure` has the same meaning as\n it has in the [`ReplaceStep`](https://prosemirror.net/docs/ref/#transform.ReplaceStep) class.\n */\n constructor(\n /**\n The start position of the replaced range.\n */\n from, \n /**\n The end position of the replaced range.\n */\n to, \n /**\n The start of preserved range.\n */\n gapFrom, \n /**\n The end of preserved range.\n */\n gapTo, \n /**\n The slice to insert.\n */\n slice, \n /**\n The position in the slice where the preserved range should be\n inserted.\n */\n insert, \n /**\n @internal\n */\n structure = false) {\n super();\n this.from = from;\n this.to = to;\n this.gapFrom = gapFrom;\n this.gapTo = gapTo;\n this.slice = slice;\n this.insert = insert;\n this.structure = structure;\n }\n apply(doc) {\n if (this.structure && (contentBetween(doc, this.from, this.gapFrom) ||\n contentBetween(doc, this.gapTo, this.to)))\n return StepResult.fail(\"Structure gap-replace would overwrite content\");\n let gap = doc.slice(this.gapFrom, this.gapTo);\n if (gap.openStart || gap.openEnd)\n return StepResult.fail(\"Gap is not a flat range\");\n let inserted = this.slice.insertAt(this.insert, gap.content);\n if (!inserted)\n return StepResult.fail(\"Content does not fit in gap\");\n return StepResult.fromReplace(doc, this.from, this.to, inserted);\n }\n getMap() {\n return new StepMap([this.from, this.gapFrom - this.from, this.insert,\n this.gapTo, this.to - this.gapTo, this.slice.size - this.insert]);\n }\n invert(doc) {\n let gap = this.gapTo - this.gapFrom;\n return new ReplaceAroundStep(this.from, this.from + this.slice.size + gap, this.from + this.insert, this.from + this.insert + gap, doc.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);\n }\n map(mapping) {\n let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);\n let gapFrom = this.from == this.gapFrom ? from.pos : mapping.map(this.gapFrom, -1);\n let gapTo = this.to == this.gapTo ? to.pos : mapping.map(this.gapTo, 1);\n if ((from.deletedAcross && to.deletedAcross) || gapFrom < from.pos || gapTo > to.pos)\n return null;\n return new ReplaceAroundStep(from.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);\n }\n toJSON() {\n let json = { stepType: \"replaceAround\", from: this.from, to: this.to,\n gapFrom: this.gapFrom, gapTo: this.gapTo, insert: this.insert };\n if (this.slice.size)\n json.slice = this.slice.toJSON();\n if (this.structure)\n json.structure = true;\n return json;\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\" ||\n typeof json.gapFrom != \"number\" || typeof json.gapTo != \"number\" || typeof json.insert != \"number\")\n throw new RangeError(\"Invalid input for ReplaceAroundStep.fromJSON\");\n return new ReplaceAroundStep(json.from, json.to, json.gapFrom, json.gapTo, Slice.fromJSON(schema, json.slice), json.insert, !!json.structure);\n }\n}\nStep.jsonID(\"replaceAround\", ReplaceAroundStep);\nfunction contentBetween(doc, from, to) {\n let $from = doc.resolve(from), dist = to - from, depth = $from.depth;\n while (dist > 0 && depth > 0 && $from.indexAfter(depth) == $from.node(depth).childCount) {\n depth--;\n dist--;\n }\n if (dist > 0) {\n let next = $from.node(depth).maybeChild($from.indexAfter(depth));\n while (dist > 0) {\n if (!next || next.isLeaf)\n return true;\n next = next.firstChild;\n dist--;\n }\n }\n return false;\n}\n\nfunction addMark(tr, from, to, mark) {\n let removed = [], added = [];\n let removing, adding;\n tr.doc.nodesBetween(from, to, (node, pos, parent) => {\n if (!node.isInline)\n return;\n let marks = node.marks;\n if (!mark.isInSet(marks) && parent.type.allowsMarkType(mark.type)) {\n let start = Math.max(pos, from), end = Math.min(pos + node.nodeSize, to);\n let newSet = mark.addToSet(marks);\n for (let i = 0; i < marks.length; i++) {\n if (!marks[i].isInSet(newSet)) {\n if (removing && removing.to == start && removing.mark.eq(marks[i]))\n removing.to = end;\n else\n removed.push(removing = new RemoveMarkStep(start, end, marks[i]));\n }\n }\n if (adding && adding.to == start)\n adding.to = end;\n else\n added.push(adding = new AddMarkStep(start, end, mark));\n }\n });\n removed.forEach(s => tr.step(s));\n added.forEach(s => tr.step(s));\n}\nfunction removeMark(tr, from, to, mark) {\n let matched = [], step = 0;\n tr.doc.nodesBetween(from, to, (node, pos) => {\n if (!node.isInline)\n return;\n step++;\n let toRemove = null;\n if (mark instanceof MarkType) {\n let set = node.marks, found;\n while (found = mark.isInSet(set)) {\n (toRemove || (toRemove = [])).push(found);\n set = found.removeFromSet(set);\n }\n }\n else if (mark) {\n if (mark.isInSet(node.marks))\n toRemove = [mark];\n }\n else {\n toRemove = node.marks;\n }\n if (toRemove && toRemove.length) {\n let end = Math.min(pos + node.nodeSize, to);\n for (let i = 0; i < toRemove.length; i++) {\n let style = toRemove[i], found;\n for (let j = 0; j < matched.length; j++) {\n let m = matched[j];\n if (m.step == step - 1 && style.eq(matched[j].style))\n found = m;\n }\n if (found) {\n found.to = end;\n found.step = step;\n }\n else {\n matched.push({ style, from: Math.max(pos, from), to: end, step });\n }\n }\n }\n });\n matched.forEach(m => tr.step(new RemoveMarkStep(m.from, m.to, m.style)));\n}\nfunction clearIncompatible(tr, pos, parentType, match = parentType.contentMatch, clearNewlines = true) {\n let node = tr.doc.nodeAt(pos);\n let replSteps = [], cur = pos + 1;\n for (let i = 0; i < node.childCount; i++) {\n let child = node.child(i), end = cur + child.nodeSize;\n let allowed = match.matchType(child.type);\n if (!allowed) {\n replSteps.push(new ReplaceStep(cur, end, Slice.empty));\n }\n else {\n match = allowed;\n for (let j = 0; j < child.marks.length; j++)\n if (!parentType.allowsMarkType(child.marks[j].type))\n tr.step(new RemoveMarkStep(cur, end, child.marks[j]));\n if (clearNewlines && child.isText && parentType.whitespace != \"pre\") {\n let m, newline = /\\r?\\n|\\r/g, slice;\n while (m = newline.exec(child.text)) {\n if (!slice)\n slice = new Slice(Fragment.from(parentType.schema.text(\" \", parentType.allowedMarks(child.marks))), 0, 0);\n replSteps.push(new ReplaceStep(cur + m.index, cur + m.index + m[0].length, slice));\n }\n }\n }\n cur = end;\n }\n if (!match.validEnd) {\n let fill = match.fillBefore(Fragment.empty, true);\n tr.replace(cur, cur, new Slice(fill, 0, 0));\n }\n for (let i = replSteps.length - 1; i >= 0; i--)\n tr.step(replSteps[i]);\n}\n\nfunction canCut(node, start, end) {\n return (start == 0 || node.canReplace(start, node.childCount)) &&\n (end == node.childCount || node.canReplace(0, end));\n}\n/**\nTry to find a target depth to which the content in the given range\ncan be lifted. Will not go across\n[isolating](https://prosemirror.net/docs/ref/#model.NodeSpec.isolating) parent nodes.\n*/\nfunction liftTarget(range) {\n let parent = range.parent;\n let content = parent.content.cutByIndex(range.startIndex, range.endIndex);\n for (let depth = range.depth, contentBefore = 0, contentAfter = 0;; --depth) {\n let node = range.$from.node(depth);\n let index = range.$from.index(depth) + contentBefore, endIndex = range.$to.indexAfter(depth) - contentAfter;\n if (depth < range.depth && node.canReplace(index, endIndex, content))\n return depth;\n if (depth == 0 || node.type.spec.isolating || !canCut(node, index, endIndex))\n break;\n if (index)\n contentBefore = 1;\n if (endIndex < node.childCount)\n contentAfter = 1;\n }\n return null;\n}\nfunction lift(tr, range, target) {\n let { $from, $to, depth } = range;\n let gapStart = $from.before(depth + 1), gapEnd = $to.after(depth + 1);\n let start = gapStart, end = gapEnd;\n let before = Fragment.empty, openStart = 0;\n for (let d = depth, splitting = false; d > target; d--)\n if (splitting || $from.index(d) > 0) {\n splitting = true;\n before = Fragment.from($from.node(d).copy(before));\n openStart++;\n }\n else {\n start--;\n }\n let after = Fragment.empty, openEnd = 0;\n for (let d = depth, splitting = false; d > target; d--)\n if (splitting || $to.after(d + 1) < $to.end(d)) {\n splitting = true;\n after = Fragment.from($to.node(d).copy(after));\n openEnd++;\n }\n else {\n end++;\n }\n tr.step(new ReplaceAroundStep(start, end, gapStart, gapEnd, new Slice(before.append(after), openStart, openEnd), before.size - openStart, true));\n}\n/**\nTry to find a valid way to wrap the content in the given range in a\nnode of the given type. May introduce extra nodes around and inside\nthe wrapper node, if necessary. Returns null if no valid wrapping\ncould be found. When `innerRange` is given, that range's content is\nused as the content to fit into the wrapping, instead of the\ncontent of `range`.\n*/\nfunction findWrapping(range, nodeType, attrs = null, innerRange = range) {\n let around = findWrappingOutside(range, nodeType);\n let inner = around && findWrappingInside(innerRange, nodeType);\n if (!inner)\n return null;\n return around.map(withAttrs)\n .concat({ type: nodeType, attrs }).concat(inner.map(withAttrs));\n}\nfunction withAttrs(type) { return { type, attrs: null }; }\nfunction findWrappingOutside(range, type) {\n let { parent, startIndex, endIndex } = range;\n let around = parent.contentMatchAt(startIndex).findWrapping(type);\n if (!around)\n return null;\n let outer = around.length ? around[0] : type;\n return parent.canReplaceWith(startIndex, endIndex, outer) ? around : null;\n}\nfunction findWrappingInside(range, type) {\n let { parent, startIndex, endIndex } = range;\n let inner = parent.child(startIndex);\n let inside = type.contentMatch.findWrapping(inner.type);\n if (!inside)\n return null;\n let lastType = inside.length ? inside[inside.length - 1] : type;\n let innerMatch = lastType.contentMatch;\n for (let i = startIndex; innerMatch && i < endIndex; i++)\n innerMatch = innerMatch.matchType(parent.child(i).type);\n if (!innerMatch || !innerMatch.validEnd)\n return null;\n return inside;\n}\nfunction wrap(tr, range, wrappers) {\n let content = Fragment.empty;\n for (let i = wrappers.length - 1; i >= 0; i--) {\n if (content.size) {\n let match = wrappers[i].type.contentMatch.matchFragment(content);\n if (!match || !match.validEnd)\n throw new RangeError(\"Wrapper type given to Transform.wrap does not form valid content of its parent wrapper\");\n }\n content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));\n }\n let start = range.start, end = range.end;\n tr.step(new ReplaceAroundStep(start, end, start, end, new Slice(content, 0, 0), wrappers.length, true));\n}\nfunction setBlockType(tr, from, to, type, attrs) {\n if (!type.isTextblock)\n throw new RangeError(\"Type given to setBlockType should be a textblock\");\n let mapFrom = tr.steps.length;\n tr.doc.nodesBetween(from, to, (node, pos) => {\n let attrsHere = typeof attrs == \"function\" ? attrs(node) : attrs;\n if (node.isTextblock && !node.hasMarkup(type, attrsHere) &&\n canChangeType(tr.doc, tr.mapping.slice(mapFrom).map(pos), type)) {\n let convertNewlines = null;\n if (type.schema.linebreakReplacement) {\n let pre = type.whitespace == \"pre\", supportLinebreak = !!type.contentMatch.matchType(type.schema.linebreakReplacement);\n if (pre && !supportLinebreak)\n convertNewlines = false;\n else if (!pre && supportLinebreak)\n convertNewlines = true;\n }\n // Ensure all markup that isn't allowed in the new node type is cleared\n if (convertNewlines === false)\n replaceLinebreaks(tr, node, pos, mapFrom);\n clearIncompatible(tr, tr.mapping.slice(mapFrom).map(pos, 1), type, undefined, convertNewlines === null);\n let mapping = tr.mapping.slice(mapFrom);\n let startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);\n tr.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type.create(attrsHere, null, node.marks)), 0, 0), 1, true));\n if (convertNewlines === true)\n replaceNewlines(tr, node, pos, mapFrom);\n return false;\n }\n });\n}\nfunction replaceNewlines(tr, node, pos, mapFrom) {\n node.forEach((child, offset) => {\n if (child.isText) {\n let m, newline = /\\r?\\n|\\r/g;\n while (m = newline.exec(child.text)) {\n let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset + m.index);\n tr.replaceWith(start, start + 1, node.type.schema.linebreakReplacement.create());\n }\n }\n });\n}\nfunction replaceLinebreaks(tr, node, pos, mapFrom) {\n node.forEach((child, offset) => {\n if (child.type == child.type.schema.linebreakReplacement) {\n let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset);\n tr.replaceWith(start, start + 1, node.type.schema.text(\"\\n\"));\n }\n });\n}\nfunction canChangeType(doc, pos, type) {\n let $pos = doc.resolve(pos), index = $pos.index();\n return $pos.parent.canReplaceWith(index, index + 1, type);\n}\n/**\nChange the type, attributes, and/or marks of the node at `pos`.\nWhen `type` isn't given, the existing node type is preserved,\n*/\nfunction setNodeMarkup(tr, pos, type, attrs, marks) {\n let node = tr.doc.nodeAt(pos);\n if (!node)\n throw new RangeError(\"No node at given position\");\n if (!type)\n type = node.type;\n let newNode = type.create(attrs, null, marks || node.marks);\n if (node.isLeaf)\n return tr.replaceWith(pos, pos + node.nodeSize, newNode);\n if (!type.validContent(node.content))\n throw new RangeError(\"Invalid content for node type \" + type.name);\n tr.step(new ReplaceAroundStep(pos, pos + node.nodeSize, pos + 1, pos + node.nodeSize - 1, new Slice(Fragment.from(newNode), 0, 0), 1, true));\n}\n/**\nCheck whether splitting at the given position is allowed.\n*/\nfunction canSplit(doc, pos, depth = 1, typesAfter) {\n let $pos = doc.resolve(pos), base = $pos.depth - depth;\n let innerType = (typesAfter && typesAfter[typesAfter.length - 1]) || $pos.parent;\n if (base < 0 || $pos.parent.type.spec.isolating ||\n !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) ||\n !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount)))\n return false;\n for (let d = $pos.depth - 1, i = depth - 2; d > base; d--, i--) {\n let node = $pos.node(d), index = $pos.index(d);\n if (node.type.spec.isolating)\n return false;\n let rest = node.content.cutByIndex(index, node.childCount);\n let overrideChild = typesAfter && typesAfter[i + 1];\n if (overrideChild)\n rest = rest.replaceChild(0, overrideChild.type.create(overrideChild.attrs));\n let after = (typesAfter && typesAfter[i]) || node;\n if (!node.canReplace(index + 1, node.childCount) || !after.type.validContent(rest))\n return false;\n }\n let index = $pos.indexAfter(base);\n let baseType = typesAfter && typesAfter[0];\n return $pos.node(base).canReplaceWith(index, index, baseType ? baseType.type : $pos.node(base + 1).type);\n}\nfunction split(tr, pos, depth = 1, typesAfter) {\n let $pos = tr.doc.resolve(pos), before = Fragment.empty, after = Fragment.empty;\n for (let d = $pos.depth, e = $pos.depth - depth, i = depth - 1; d > e; d--, i--) {\n before = Fragment.from($pos.node(d).copy(before));\n let typeAfter = typesAfter && typesAfter[i];\n after = Fragment.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d).copy(after));\n }\n tr.step(new ReplaceStep(pos, pos, new Slice(before.append(after), depth, depth), true));\n}\n/**\nTest whether the blocks before and after a given position can be\njoined.\n*/\nfunction canJoin(doc, pos) {\n let $pos = doc.resolve(pos), index = $pos.index();\n return joinable($pos.nodeBefore, $pos.nodeAfter) &&\n $pos.parent.canReplace(index, index + 1);\n}\nfunction canAppendWithSubstitutedLinebreaks(a, b) {\n if (!b.content.size)\n a.type.compatibleContent(b.type);\n let match = a.contentMatchAt(a.childCount);\n let { linebreakReplacement } = a.type.schema;\n for (let i = 0; i < b.childCount; i++) {\n let child = b.child(i);\n let type = child.type == linebreakReplacement ? a.type.schema.nodes.text : child.type;\n match = match.matchType(type);\n if (!match)\n return false;\n if (!a.type.allowsMarks(child.marks))\n return false;\n }\n return match.validEnd;\n}\nfunction joinable(a, b) {\n return !!(a && b && !a.isLeaf && canAppendWithSubstitutedLinebreaks(a, b));\n}\n/**\nFind an ancestor of the given position that can be joined to the\nblock before (or after if `dir` is positive). Returns the joinable\npoint, if any.\n*/\nfunction joinPoint(doc, pos, dir = -1) {\n let $pos = doc.resolve(pos);\n for (let d = $pos.depth;; d--) {\n let before, after, index = $pos.index(d);\n if (d == $pos.depth) {\n before = $pos.nodeBefore;\n after = $pos.nodeAfter;\n }\n else if (dir > 0) {\n before = $pos.node(d + 1);\n index++;\n after = $pos.node(d).maybeChild(index);\n }\n else {\n before = $pos.node(d).maybeChild(index - 1);\n after = $pos.node(d + 1);\n }\n if (before && !before.isTextblock && joinable(before, after) &&\n $pos.node(d).canReplace(index, index + 1))\n return pos;\n if (d == 0)\n break;\n pos = dir < 0 ? $pos.before(d) : $pos.after(d);\n }\n}\nfunction join(tr, pos, depth) {\n let convertNewlines = null;\n let { linebreakReplacement } = tr.doc.type.schema;\n let $before = tr.doc.resolve(pos - depth), beforeType = $before.node().type;\n if (linebreakReplacement && beforeType.inlineContent) {\n let pre = beforeType.whitespace == \"pre\";\n let supportLinebreak = !!beforeType.contentMatch.matchType(linebreakReplacement);\n if (pre && !supportLinebreak)\n convertNewlines = false;\n else if (!pre && supportLinebreak)\n convertNewlines = true;\n }\n let mapFrom = tr.steps.length;\n if (convertNewlines === false) {\n let $after = tr.doc.resolve(pos + depth);\n replaceLinebreaks(tr, $after.node(), $after.before(), mapFrom);\n }\n if (beforeType.inlineContent)\n clearIncompatible(tr, pos + depth - 1, beforeType, $before.node().contentMatchAt($before.index()), convertNewlines == null);\n let mapping = tr.mapping.slice(mapFrom), start = mapping.map(pos - depth);\n tr.step(new ReplaceStep(start, mapping.map(pos + depth, -1), Slice.empty, true));\n if (convertNewlines === true) {\n let $full = tr.doc.resolve(start);\n replaceNewlines(tr, $full.node(), $full.before(), tr.steps.length);\n }\n return tr;\n}\n/**\nTry to find a point where a node of the given type can be inserted\nnear `pos`, by searching up the node hierarchy when `pos` itself\nisn't a valid place but is at the start or end of a node. Return\nnull if no position was found.\n*/\nfunction insertPoint(doc, pos, nodeType) {\n let $pos = doc.resolve(pos);\n if ($pos.parent.canReplaceWith($pos.index(), $pos.index(), nodeType))\n return pos;\n if ($pos.parentOffset == 0)\n for (let d = $pos.depth - 1; d >= 0; d--) {\n let index = $pos.index(d);\n if ($pos.node(d).canReplaceWith(index, index, nodeType))\n return $pos.before(d + 1);\n if (index > 0)\n return null;\n }\n if ($pos.parentOffset == $pos.parent.content.size)\n for (let d = $pos.depth - 1; d >= 0; d--) {\n let index = $pos.indexAfter(d);\n if ($pos.node(d).canReplaceWith(index, index, nodeType))\n return $pos.after(d + 1);\n if (index < $pos.node(d).childCount)\n return null;\n }\n return null;\n}\n/**\nFinds a position at or around the given position where the given\nslice can be inserted. Will look at parent nodes' nearest boundary\nand try there, even if the original position wasn't directly at the\nstart or end of that node. Returns null when no position was found.\n*/\nfunction dropPoint(doc, pos, slice) {\n let $pos = doc.resolve(pos);\n if (!slice.content.size)\n return pos;\n let content = slice.content;\n for (let i = 0; i < slice.openStart; i++)\n content = content.firstChild.content;\n for (let pass = 1; pass <= (slice.openStart == 0 && slice.size ? 2 : 1); pass++) {\n for (let d = $pos.depth; d >= 0; d--) {\n let bias = d == $pos.depth ? 0 : $pos.pos <= ($pos.start(d + 1) + $pos.end(d + 1)) / 2 ? -1 : 1;\n let insertPos = $pos.index(d) + (bias > 0 ? 1 : 0);\n let parent = $pos.node(d), fits = false;\n if (pass == 1) {\n fits = parent.canReplace(insertPos, insertPos, content);\n }\n else {\n let wrapping = parent.contentMatchAt(insertPos).findWrapping(content.firstChild.type);\n fits = wrapping && parent.canReplaceWith(insertPos, insertPos, wrapping[0]);\n }\n if (fits)\n return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d + 1) : $pos.after(d + 1);\n }\n }\n return null;\n}\n\n/**\n‘Fit’ a slice into a given position in the document, producing a\n[step](https://prosemirror.net/docs/ref/#transform.Step) that inserts it. Will return null if\nthere's no meaningful way to insert the slice here, or inserting it\nwould be a no-op (an empty slice over an empty range).\n*/\nfunction replaceStep(doc, from, to = from, slice = Slice.empty) {\n if (from == to && !slice.size)\n return null;\n let $from = doc.resolve(from), $to = doc.resolve(to);\n // Optimization -- avoid work if it's obvious that it's not needed.\n if (fitsTrivially($from, $to, slice))\n return new ReplaceStep(from, to, slice);\n return new Fitter($from, $to, slice).fit();\n}\nfunction fitsTrivially($from, $to, slice) {\n return !slice.openStart && !slice.openEnd && $from.start() == $to.start() &&\n $from.parent.canReplace($from.index(), $to.index(), slice.content);\n}\n// Algorithm for 'placing' the elements of a slice into a gap:\n//\n// We consider the content of each node that is open to the left to be\n// independently placeable. I.e. in <p(\"foo\"), p(\"bar\")>, when the\n// paragraph on the left is open, \"foo\" can be placed (somewhere on\n// the left side of the replacement gap) independently from p(\"bar\").\n//\n// This class tracks the state of the placement progress in the\n// following properties:\n//\n// - `frontier` holds a stack of `{type, match}` objects that\n// represent the open side of the replacement. It starts at\n// `$from`, then moves forward as content is placed, and is finally\n// reconciled with `$to`.\n//\n// - `unplaced` is a slice that represents the content that hasn't\n// been placed yet.\n//\n// - `placed` is a fragment of placed content. Its open-start value\n// is implicit in `$from`, and its open-end value in `frontier`.\nclass Fitter {\n constructor($from, $to, unplaced) {\n this.$from = $from;\n this.$to = $to;\n this.unplaced = unplaced;\n this.frontier = [];\n this.placed = Fragment.empty;\n for (let i = 0; i <= $from.depth; i++) {\n let node = $from.node(i);\n this.frontier.push({\n type: node.type,\n match: node.contentMatchAt($from.indexAfter(i))\n });\n }\n for (let i = $from.depth; i > 0; i--)\n this.placed = Fragment.from($from.node(i).copy(this.placed));\n }\n get depth() { return this.frontier.length - 1; }\n fit() {\n // As long as there's unplaced content, try to place some of it.\n // If that fails, either increase the open score of the unplaced\n // slice, or drop nodes from it, and then try again.\n while (this.unplaced.size) {\n let fit = this.findFittable();\n if (fit)\n this.placeNodes(fit);\n else\n this.openMore() || this.dropNode();\n }\n // When there's inline content directly after the frontier _and_\n // directly after `this.$to`, we must generate a `ReplaceAround`\n // step that pulls that content into the node after the frontier.\n // That means the fitting must be done to the end of the textblock\n // node after `this.$to`, not `this.$to` itself.\n let moveInline = this.mustMoveInline(), placedSize = this.placed.size - this.depth - this.$from.depth;\n let $from = this.$from, $to = this.close(moveInline < 0 ? this.$to : $from.doc.resolve(moveInline));\n if (!$to)\n return null;\n // If closing to `$to` succeeded, create a step\n let content = this.placed, openStart = $from.depth, openEnd = $to.depth;\n while (openStart && openEnd && content.childCount == 1) { // Normalize by dropping open parent nodes\n content = content.firstChild.content;\n openStart--;\n openEnd--;\n }\n let slice = new Slice(content, openStart, openEnd);\n if (moveInline > -1)\n return new ReplaceAroundStep($from.pos, moveInline, this.$to.pos, this.$to.end(), slice, placedSize);\n if (slice.size || $from.pos != this.$to.pos) // Don't generate no-op steps\n return new ReplaceStep($from.pos, $to.pos, slice);\n return null;\n }\n // Find a position on the start spine of `this.unplaced` that has\n // content that can be moved somewhere on the frontier. Returns two\n // depths, one for the slice and one for the frontier.\n findFittable() {\n let startDepth = this.unplaced.openStart;\n for (let cur = this.unplaced.content, d = 0, openEnd = this.unplaced.openEnd; d < startDepth; d++) {\n let node = cur.firstChild;\n if (cur.childCount > 1)\n openEnd = 0;\n if (node.type.spec.isolating && openEnd <= d) {\n startDepth = d;\n break;\n }\n cur = node.content;\n }\n // Only try wrapping nodes (pass 2) after finding a place without\n // wrapping failed.\n for (let pass = 1; pass <= 2; pass++) {\n for (let sliceDepth = pass == 1 ? startDepth : this.unplaced.openStart; sliceDepth >= 0; sliceDepth--) {\n let fragment, parent = null;\n if (sliceDepth) {\n parent = contentAt(this.unplaced.content, sliceDepth - 1).firstChild;\n fragment = parent.content;\n }\n else {\n fragment = this.unplaced.content;\n }\n let first = fragment.firstChild;\n for (let frontierDepth = this.depth; frontierDepth >= 0; frontierDepth--) {\n let { type, match } = this.frontier[frontierDepth], wrap, inject = null;\n // In pass 1, if the next node matches, or there is no next\n // node but the parents look compatible, we've found a\n // place.\n if (pass == 1 && (first ? match.matchType(first.type) || (inject = match.fillBefore(Fragment.from(first), false))\n : parent && type.compatibleContent(parent.type)))\n return { sliceDepth, frontierDepth, parent, inject };\n // In pass 2, look for a set of wrapping nodes that make\n // `first` fit here.\n else if (pass == 2 && first && (wrap = match.findWrapping(first.type)))\n return { sliceDepth, frontierDepth, parent, wrap };\n // Don't continue looking further up if the parent node\n // would fit here.\n if (parent && match.matchType(parent.type))\n break;\n }\n }\n }\n }\n openMore() {\n let { content, openStart, openEnd } = this.unplaced;\n let inner = contentAt(content, openStart);\n if (!inner.childCount || inner.firstChild.isLeaf)\n return false;\n this.unplaced = new Slice(content, openStart + 1, Math.max(openEnd, inner.size + openStart >= content.size - openEnd ? openStart + 1 : 0));\n return true;\n }\n dropNode() {\n let { content, openStart, openEnd } = this.unplaced;\n let inner = contentAt(content, openStart);\n if (inner.childCount <= 1 && openStart > 0) {\n let openAtEnd = content.size - openStart <= openStart + inner.size;\n this.unplaced = new Slice(dropFromFragment(content, openStart - 1, 1), openStart - 1, openAtEnd ? openStart - 1 : openEnd);\n }\n else {\n this.unplaced = new Slice(dropFromFragment(content, openStart, 1), openStart, openEnd);\n }\n }\n // Move content from the unplaced slice at `sliceDepth` to the\n // frontier node at `frontierDepth`. Close that frontier node when\n // applicable.\n placeNodes({ sliceDepth, frontierDepth, parent, inject, wrap }) {\n while (this.depth > frontierDepth)\n this.closeFrontierNode();\n if (wrap)\n for (let i = 0; i < wrap.length; i++)\n this.openFrontierNode(wrap[i]);\n let slice = this.unplaced, fragment = parent ? parent.content : slice.content;\n let openStart = slice.openStart - sliceDepth;\n let taken = 0, add = [];\n let { match, type } = this.frontier[frontierDepth];\n if (inject) {\n for (let i = 0; i < inject.childCount; i++)\n add.push(inject.child(i));\n match = match.matchFragment(inject);\n }\n // Computes the amount of (end) open nodes at the end of the\n // fragment. When 0, the parent is open, but no more. When\n // negative, nothing is open.\n let openEndCount = (fragment.size + sliceDepth) - (slice.content.size - slice.openEnd);\n // Scan over the fragment, fitting as many child nodes as\n // possible.\n while (taken < fragment.childCount) {\n let next = fragment.child(taken), matches = match.matchType(next.type);\n if (!matches)\n break;\n taken++;\n if (taken > 1 || openStart == 0 || next.content.size) { // Drop empty open nodes\n match = matches;\n add.push(closeNodeStart(next.mark(type.allowedMarks(next.marks)), taken == 1 ? openStart : 0, taken == fragment.childCount ? openEndCount : -1));\n }\n }\n let toEnd = taken == fragment.childCount;\n if (!toEnd)\n openEndCount = -1;\n this.placed = addToFragment(this.placed, frontierDepth, Fragment.from(add));\n this.frontier[frontierDepth].match = match;\n // If the parent types match, and the entire node was moved, and\n // it's not open, close this frontier node right away.\n if (toEnd && openEndCount < 0 && parent && parent.type == this.frontier[this.depth].type && this.frontier.length > 1)\n this.closeFrontierNode();\n // Add new frontier nodes for any open nodes at the end.\n for (let i = 0, cur = fragment; i < openEndCount; i++) {\n let node = cur.lastChild;\n this.frontier.push({ type: node.type, match: node.contentMatchAt(node.childCount) });\n cur = node.content;\n }\n // Update `this.unplaced`. Drop the entire node from which we\n // placed it we got to its end, otherwise just drop the placed\n // nodes.\n this.unplaced = !toEnd ? new Slice(dropFromFragment(slice.content, sliceDepth, taken), slice.openStart, slice.openEnd)\n : sliceDepth == 0 ? Slice.empty\n : new Slice(dropFromFragment(slice.content, sliceDepth - 1, 1), sliceDepth - 1, openEndCount < 0 ? slice.openEnd : sliceDepth - 1);\n }\n mustMoveInline() {\n if (!this.$to.parent.isTextblock)\n return -1;\n let top = this.frontier[this.depth], level;\n if (!top.type.isTextblock || !contentAfterFits(this.$to, this.$to.depth, top.type, top.match, false) ||\n (this.$to.depth == this.depth && (level = this.findCloseLevel(this.$to)) && level.depth == this.depth))\n return -1;\n let { depth } = this.$to, after = this.$to.after(depth);\n while (depth > 1 && after == this.$to.end(--depth))\n ++after;\n return after;\n }\n findCloseLevel($to) {\n scan: for (let i = Math.min(this.depth, $to.depth); i >= 0; i--) {\n let { match, type } = this.frontier[i];\n let dropInner = i < $to.depth && $to.end(i + 1) == $to.pos + ($to.depth - (i + 1));\n let fit = contentAfterFits($to, i, type, match, dropInner);\n if (!fit)\n continue;\n for (let d = i - 1; d >= 0; d--) {\n let { match, type } = this.frontier[d];\n let matches = contentAfterFits($to, d, type, match, true);\n if (!matches || matches.childCount)\n continue scan;\n }\n return { depth: i, fit, move: dropInner ? $to.doc.resolve($to.after(i + 1)) : $to };\n }\n }\n close($to) {\n let close = this.findCloseLevel($to);\n if (!close)\n return null;\n while (this.depth > close.depth)\n this.closeFrontierNode();\n if (close.fit.childCount)\n this.placed = addToFragment(this.placed, close.depth, close.fit);\n $to = close.move;\n for (let d = close.depth + 1; d <= $to.depth; d++) {\n let node = $to.node(d), add = node.type.contentMatch.fillBefore(node.content, true, $to.index(d));\n this.openFrontierNode(node.type, node.attrs, add);\n }\n return $to;\n }\n openFrontierNode(type, attrs = null, content) {\n let top = this.frontier[this.depth];\n top.match = top.match.matchType(type);\n this.placed = addToFragment(this.placed, this.depth, Fragment.from(type.create(attrs, content)));\n this.frontier.push({ type, match: type.contentMatch });\n }\n closeFrontierNode() {\n let open = this.frontier.pop();\n let add = open.match.fillBefore(Fragment.empty, true);\n if (add.childCount)\n this.placed = addToFragment(this.placed, this.frontier.length, add);\n }\n}\nfunction dropFromFragment(fragment, depth, count) {\n if (depth == 0)\n return fragment.cutByIndex(count, fragment.childCount);\n return fragment.replaceChild(0, fragment.firstChild.copy(dropFromFragment(fragment.firstChild.content, depth - 1, count)));\n}\nfunction addToFragment(fragment, depth, content) {\n if (depth == 0)\n return fragment.append(content);\n return fragment.replaceChild(fragment.childCount - 1, fragment.lastChild.copy(addToFragment(fragment.lastChild.content, depth - 1, content)));\n}\nfunction contentAt(fragment, depth) {\n for (let i = 0; i < depth; i++)\n fragment = fragment.firstChild.content;\n return fragment;\n}\nfunction closeNodeStart(node, openStart, openEnd) {\n if (openStart <= 0)\n return node;\n let frag = node.content;\n if (openStart > 1)\n frag = frag.replaceChild(0, closeNodeStart(frag.firstChild, openStart - 1, frag.childCount == 1 ? openEnd - 1 : 0));\n if (openStart > 0) {\n frag = node.type.contentMatch.fillBefore(frag).append(frag);\n if (openEnd <= 0)\n frag = frag.append(node.type.contentMatch.matchFragment(frag).fillBefore(Fragment.empty, true));\n }\n return node.copy(frag);\n}\nfunction contentAfterFits($to, depth, type, match, open) {\n let node = $to.node(depth), index = open ? $to.indexAfter(depth) : $to.index(depth);\n if (index == node.childCount && !type.compatibleContent(node.type))\n return null;\n let fit = match.fillBefore(node.content, true, index);\n return fit && !invalidMarks(type, node.content, index) ? fit : null;\n}\nfunction invalidMarks(type, fragment, start) {\n for (let i = start; i < fragment.childCount; i++)\n if (!type.allowsMarks(fragment.child(i).marks))\n return true;\n return false;\n}\nfunction definesContent(type) {\n return type.spec.defining || type.spec.definingForContent;\n}\nfunction replaceRange(tr, from, to, slice) {\n if (!slice.size)\n return tr.deleteRange(from, to);\n let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to);\n if (fitsTrivially($from, $to, slice))\n return tr.step(new ReplaceStep(from, to, slice));\n let targetDepths = coveredDepths($from, $to);\n // Can't replace the whole document, so remove 0 if it's present\n if (targetDepths[targetDepths.length - 1] == 0)\n targetDepths.pop();\n // Negative numbers represent not expansion over the whole node at\n // that depth, but replacing from $from.before(-D) to $to.pos.\n let preferredTarget = -($from.depth + 1);\n targetDepths.unshift(preferredTarget);\n // This loop picks a preferred target depth, if one of the covering\n // depths is not outside of a defining node, and adds negative\n // depths for any depth that has $from at its start and does not\n // cross a defining node.\n for (let d = $from.depth, pos = $from.pos - 1; d > 0; d--, pos--) {\n let spec = $from.node(d).type.spec;\n if (spec.defining || spec.definingAsContext || spec.isolating)\n break;\n if (targetDepths.indexOf(d) > -1)\n preferredTarget = d;\n else if ($from.before(d) == pos)\n targetDepths.splice(1, 0, -d);\n }\n // Try to fit each possible depth of the slice into each possible\n // target depth, starting with the preferred depths.\n let preferredTargetIndex = targetDepths.indexOf(preferredTarget);\n let leftNodes = [], preferredDepth = slice.openStart;\n for (let content = slice.content, i = 0;; i++) {\n let node = content.firstChild;\n leftNodes.push(node);\n if (i == slice.openStart)\n break;\n content = node.content;\n }\n // Back up preferredDepth to cover defining textblocks directly\n // above it, possibly skipping a non-defining textblock.\n for (let d = preferredDepth - 1; d >= 0; d--) {\n let leftNode = leftNodes[d], def = definesContent(leftNode.type);\n if (def && !leftNode.sameMarkup($from.node(Math.abs(preferredTarget) - 1)))\n preferredDepth = d;\n else if (def || !leftNode.type.isTextblock)\n break;\n }\n for (let j = slice.openStart; j >= 0; j--) {\n let openDepth = (j + preferredDepth + 1) % (slice.openStart + 1);\n let insert = leftNodes[openDepth];\n if (!insert)\n continue;\n for (let i = 0; i < targetDepths.length; i++) {\n // Loop over possible expansion levels, starting with the\n // preferred one\n let targetDepth = targetDepths[(i + preferredTargetIndex) % targetDepths.length], expand = true;\n if (targetDepth < 0) {\n expand = false;\n targetDepth = -targetDepth;\n }\n let parent = $from.node(targetDepth - 1), index = $from.index(targetDepth - 1);\n if (parent.canReplaceWith(index, index, insert.type, insert.marks))\n return tr.replace($from.before(targetDepth), expand ? $to.after(targetDepth) : to, new Slice(closeFragment(slice.content, 0, slice.openStart, openDepth), openDepth, slice.openEnd));\n }\n }\n let startSteps = tr.steps.length;\n for (let i = targetDepths.length - 1; i >= 0; i--) {\n tr.replace(from, to, slice);\n if (tr.steps.length > startSteps)\n break;\n let depth = targetDepths[i];\n if (depth < 0)\n continue;\n from = $from.before(depth);\n to = $to.after(depth);\n }\n}\nfunction closeFragment(fragment, depth, oldOpen, newOpen, parent) {\n if (depth < oldOpen) {\n let first = fragment.firstChild;\n fragment = fragment.replaceChild(0, first.copy(closeFragment(first.content, depth + 1, oldOpen, newOpen, first)));\n }\n if (depth > newOpen) {\n let match = parent.contentMatchAt(0);\n let start = match.fillBefore(fragment).append(fragment);\n fragment = start.append(match.matchFragment(start).fillBefore(Fragment.empty, true));\n }\n return fragment;\n}\nfunction replaceRangeWith(tr, from, to, node) {\n if (!node.isInline && from == to && tr.doc.resolve(from).parent.content.size) {\n let point = insertPoint(tr.doc, from, node.type);\n if (point != null)\n from = to = point;\n }\n tr.replaceRange(from, to, new Slice(Fragment.from(node), 0, 0));\n}\nfunction deleteRange(tr, from, to) {\n let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to);\n let covered = coveredDepths($from, $to);\n for (let i = 0; i < covered.length; i++) {\n let depth = covered[i], last = i == covered.length - 1;\n if ((last && depth == 0) || $from.node(depth).type.contentMatch.validEnd)\n return tr.delete($from.start(depth), $to.end(depth));\n if (depth > 0 && (last || $from.node(depth - 1).canReplace($from.index(depth - 1), $to.indexAfter(depth - 1))))\n return tr.delete($from.before(depth), $to.after(depth));\n }\n for (let d = 1; d <= $from.depth && d <= $to.depth; d++) {\n if (from - $from.start(d) == $from.depth - d && to > $from.end(d) && $to.end(d) - to != $to.depth - d &&\n $from.start(d - 1) == $to.start(d - 1) && $from.node(d - 1).canReplace($from.index(d - 1), $to.index(d - 1)))\n return tr.delete($from.before(d), to);\n }\n tr.delete(from, to);\n}\n// Returns an array of all depths for which $from - $to spans the\n// whole content of the nodes at that depth.\nfunction coveredDepths($from, $to) {\n let result = [], minDepth = Math.min($from.depth, $to.depth);\n for (let d = minDepth; d >= 0; d--) {\n let start = $from.start(d);\n if (start < $from.pos - ($from.depth - d) ||\n $to.end(d) > $to.pos + ($to.depth - d) ||\n $from.node(d).type.spec.isolating ||\n $to.node(d).type.spec.isolating)\n break;\n if (start == $to.start(d) ||\n (d == $from.depth && d == $to.depth && $from.parent.inlineContent && $to.parent.inlineContent &&\n d && $to.start(d - 1) == start - 1))\n result.push(d);\n }\n return result;\n}\n\n/**\nUpdate an attribute in a specific node.\n*/\nclass AttrStep extends Step {\n /**\n Construct an attribute step.\n */\n constructor(\n /**\n The position of the target node.\n */\n pos, \n /**\n The attribute to set.\n */\n attr, \n // The attribute's new value.\n value) {\n super();\n this.pos = pos;\n this.attr = attr;\n this.value = value;\n }\n apply(doc) {\n let node = doc.nodeAt(this.pos);\n if (!node)\n return StepResult.fail(\"No node at attribute step's position\");\n let attrs = Object.create(null);\n for (let name in node.attrs)\n attrs[name] = node.attrs[name];\n attrs[this.attr] = this.value;\n let updated = node.type.create(attrs, null, node.marks);\n return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));\n }\n getMap() {\n return StepMap.empty;\n }\n invert(doc) {\n return new AttrStep(this.pos, this.attr, doc.nodeAt(this.pos).attrs[this.attr]);\n }\n map(mapping) {\n let pos = mapping.mapResult(this.pos, 1);\n return pos.deletedAfter ? null : new AttrStep(pos.pos, this.attr, this.value);\n }\n toJSON() {\n return { stepType: \"attr\", pos: this.pos, attr: this.attr, value: this.value };\n }\n static fromJSON(schema, json) {\n if (typeof json.pos != \"number\" || typeof json.attr != \"string\")\n throw new RangeError(\"Invalid input for AttrStep.fromJSON\");\n return new AttrStep(json.pos, json.attr, json.value);\n }\n}\nStep.jsonID(\"attr\", AttrStep);\n/**\nUpdate an attribute in the doc node.\n*/\nclass DocAttrStep extends Step {\n /**\n Construct an attribute step.\n */\n constructor(\n /**\n The attribute to set.\n */\n attr, \n // The attribute's new value.\n value) {\n super();\n this.attr = attr;\n this.value = value;\n }\n apply(doc) {\n let attrs = Object.create(null);\n for (let name in doc.attrs)\n attrs[name] = doc.attrs[name];\n attrs[this.attr] = this.value;\n let updated = doc.type.create(attrs, doc.content, doc.marks);\n return StepResult.ok(updated);\n }\n getMap() {\n return StepMap.empty;\n }\n invert(doc) {\n return new DocAttrStep(this.attr, doc.attrs[this.attr]);\n }\n map(mapping) {\n return this;\n }\n toJSON() {\n return { stepType: \"docAttr\", attr: this.attr, value: this.value };\n }\n static fromJSON(schema, json) {\n if (typeof json.attr != \"string\")\n throw new RangeError(\"Invalid input for DocAttrStep.fromJSON\");\n return new DocAttrStep(json.attr, json.value);\n }\n}\nStep.jsonID(\"docAttr\", DocAttrStep);\n\n/**\n@internal\n*/\nlet TransformError = class extends Error {\n};\nTransformError = function TransformError(message) {\n let err = Error.call(this, message);\n err.__proto__ = TransformError.prototype;\n return err;\n};\nTransformError.prototype = Object.create(Error.prototype);\nTransformError.prototype.constructor = TransformError;\nTransformError.prototype.name = \"TransformError\";\n/**\nAbstraction to build up and track an array of\n[steps](https://prosemirror.net/docs/ref/#transform.Step) representing a document transformation.\n\nMost transforming methods return the `Transform` object itself, so\nthat they can be chained.\n*/\nclass Transform {\n /**\n Create a transform that starts with the given document.\n */\n constructor(\n /**\n The current document (the result of applying the steps in the\n transform).\n */\n doc) {\n this.doc = doc;\n /**\n The steps in this transform.\n */\n this.steps = [];\n /**\n The documents before each of the steps.\n */\n this.docs = [];\n /**\n A mapping with the maps for each of the steps in this transform.\n */\n this.mapping = new Mapping;\n }\n /**\n The starting document.\n */\n get before() { return this.docs.length ? this.docs[0] : this.doc; }\n /**\n Apply a new step in this transform, saving the result. Throws an\n error when the step fails.\n */\n step(step) {\n let result = this.maybeStep(step);\n if (result.failed)\n throw new TransformError(result.failed);\n return this;\n }\n /**\n Try to apply a step in this transformation, ignoring it if it\n fails. Returns the step result.\n */\n maybeStep(step) {\n let result = step.apply(this.doc);\n if (!result.failed)\n this.addStep(step, result.doc);\n return result;\n }\n /**\n True when the document has been changed (when there are any\n steps).\n */\n get docChanged() {\n return this.steps.length > 0;\n }\n /**\n Return a single range, in post-transform document positions,\n that covers all content changed by this transform. Returns null\n if no replacements are made. Note that this will ignore changes\n that add/remove marks without replacing the underlying content.\n */\n changedRange() {\n let from = 1e9, to = -1e9;\n for (let i = 0; i < this.mapping.maps.length; i++) {\n let map = this.mapping.maps[i];\n if (i) {\n from = map.map(from, 1);\n to = map.map(to, -1);\n }\n map.forEach((_f, _t, fromB, toB) => {\n from = Math.min(from, fromB);\n to = Math.max(to, toB);\n });\n }\n return from == 1e9 ? null : { from, to };\n }\n /**\n @internal\n */\n addStep(step, doc) {\n this.docs.push(this.doc);\n this.steps.push(step);\n this.mapping.appendMap(step.getMap());\n this.doc = doc;\n }\n /**\n Replace the part of the document between `from` and `to` with the\n given `slice`.\n */\n replace(from, to = from, slice = Slice.empty) {\n let step = replaceStep(this.doc, from, to, slice);\n if (step)\n this.step(step);\n return this;\n }\n /**\n Replace the given range with the given content, which may be a\n fragment, node, or array of nodes.\n */\n replaceWith(from, to, content) {\n return this.replace(from, to, new Slice(Fragment.from(content), 0, 0));\n }\n /**\n Delete the content between the given positions.\n */\n delete(from, to) {\n return this.replace(from, to, Slice.empty);\n }\n /**\n Insert the given content at the given position.\n */\n insert(pos, content) {\n return this.replaceWith(pos, pos, content);\n }\n /**\n Replace a range of the document with a given slice, using\n `from`, `to`, and the slice's\n [`openStart`](https://prosemirror.net/docs/ref/#model.Slice.openStart) property as hints, rather\n than fixed start and end points. This method may grow the\n replaced area or close open nodes in the slice in order to get a\n fit that is more in line with WYSIWYG expectations, by dropping\n fully covered parent nodes of the replaced region when they are\n marked [non-defining as\n context](https://prosemirror.net/docs/ref/#model.NodeSpec.definingAsContext), or including an\n open parent node from the slice that _is_ marked as [defining\n its content](https://prosemirror.net/docs/ref/#model.NodeSpec.definingForContent).\n \n This is the method, for example, to handle paste. The similar\n [`replace`](https://prosemirror.net/docs/ref/#transform.Transform.replace) method is a more\n primitive tool which will _not_ move the start and end of its given\n range, and is useful in situations where you need more precise\n control over what happens.\n */\n replaceRange(from, to, slice) {\n replaceRange(this, from, to, slice);\n return this;\n }\n /**\n Replace the given range with a node, but use `from` and `to` as\n hints, rather than precise positions. When from and to are the same\n and are at the start or end of a parent node in which the given\n node doesn't fit, this method may _move_ them out towards a parent\n that does allow the given node to be placed. When the given range\n completely covers a parent node, this method may completely replace\n that parent node.\n */\n replaceRangeWith(from, to, node) {\n replaceRangeWith(this, from, to, node);\n return this;\n }\n /**\n Delete the given range, expanding it to cover fully covered\n parent nodes until a valid replace is found.\n */\n deleteRange(from, to) {\n deleteRange(this, from, to);\n return this;\n }\n /**\n Split the content in the given range off from its parent, if there\n is sibling content before or after it, and move it up the tree to\n the depth specified by `target`. You'll probably want to use\n [`liftTarget`](https://prosemirror.net/docs/ref/#transform.liftTarget) to compute `target`, to make\n sure the lift is valid.\n */\n lift(range, target) {\n lift(this, range, target);\n return this;\n }\n /**\n Join the blocks around the given position. If depth is 2, their\n last and first siblings are also joined, and so on.\n */\n join(pos, depth = 1) {\n join(this, pos, depth);\n return this;\n }\n /**\n Wrap the given [range](https://prosemirror.net/docs/ref/#model.NodeRange) in the given set of wrappers.\n The wrappers are assumed to be valid in this position, and should\n probably be computed with [`findWrapping`](https://prosemirror.net/docs/ref/#transform.findWrapping).\n */\n wrap(range, wrappers) {\n wrap(this, range, wrappers);\n return this;\n }\n /**\n Set the type of all textblocks (partly) between `from` and `to` to\n the given node type with the given attributes.\n */\n setBlockType(from, to = from, type, attrs = null) {\n setBlockType(this, from, to, type, attrs);\n return this;\n }\n /**\n Change the type, attributes, and/or marks of the node at `pos`.\n When `type` isn't given, the existing node type is preserved,\n */\n setNodeMarkup(pos, type, attrs = null, marks) {\n setNodeMarkup(this, pos, type, attrs, marks);\n return this;\n }\n /**\n Set a single attribute on a given node to a new value.\n The `pos` addresses the document content. Use `setDocAttribute`\n to set attributes on the document itself.\n */\n setNodeAttribute(pos, attr, value) {\n this.step(new AttrStep(pos, attr, value));\n return this;\n }\n /**\n Set a single attribute on the document to a new value.\n */\n setDocAttribute(attr, value) {\n this.step(new DocAttrStep(attr, value));\n return this;\n }\n /**\n Add a mark to the node at position `pos`.\n */\n addNodeMark(pos, mark) {\n this.step(new AddNodeMarkStep(pos, mark));\n return this;\n }\n /**\n Remove a mark (or all marks of the given type) from the node at\n position `pos`.\n */\n removeNodeMark(pos, mark) {\n let node = this.doc.nodeAt(pos);\n if (!node)\n throw new RangeError(\"No node at position \" + pos);\n if (mark instanceof Mark) {\n if (mark.isInSet(node.marks))\n this.step(new RemoveNodeMarkStep(pos, mark));\n }\n else {\n let set = node.marks, found, steps = [];\n while (found = mark.isInSet(set)) {\n steps.push(new RemoveNodeMarkStep(pos, found));\n set = found.removeFromSet(set);\n }\n for (let i = steps.length - 1; i >= 0; i--)\n this.step(steps[i]);\n }\n return this;\n }\n /**\n Split the node at the given position, and optionally, if `depth` is\n greater than one, any number of nodes above that. By default, the\n parts split off will inherit the node type of the original node.\n This can be changed by passing an array of types and attributes to\n use after the split (with the outermost nodes coming first).\n */\n split(pos, depth = 1, typesAfter) {\n split(this, pos, depth, typesAfter);\n return this;\n }\n /**\n Add the given mark to the inline content between `from` and `to`.\n */\n addMark(from, to, mark) {\n addMark(this, from, to, mark);\n return this;\n }\n /**\n Remove marks from inline nodes between `from` and `to`. When\n `mark` is a single mark, remove precisely that mark. When it is\n a mark type, remove all marks of that type. When it is null,\n remove all marks of any type.\n */\n removeMark(from, to, mark) {\n removeMark(this, from, to, mark);\n return this;\n }\n /**\n Removes all marks and nodes from the content of the node at\n `pos` that don't match the given new parent node type. Accepts\n an optional starting [content match](https://prosemirror.net/docs/ref/#model.ContentMatch) as\n third argument.\n */\n clearIncompatible(pos, parentType, match) {\n clearIncompatible(this, pos, parentType, match);\n return this;\n }\n}\n\nexport { AddMarkStep, AddNodeMarkStep, AttrStep, DocAttrStep, MapResult, Mapping, RemoveMarkStep, RemoveNodeMarkStep, ReplaceAroundStep, ReplaceStep, Step, StepMap, StepResult, Transform, TransformError, canJoin, canSplit, dropPoint, findWrapping, insertPoint, joinPoint, liftTarget, replaceStep };\n","import { Slice, Fragment, Mark, Node } from 'prosemirror-model';\nimport { ReplaceStep, ReplaceAroundStep, Transform } from 'prosemirror-transform';\n\nconst classesById = Object.create(null);\n/**\nSuperclass for editor selections. Every selection type should\nextend this. Should not be instantiated directly.\n*/\nclass Selection {\n /**\n Initialize a selection with the head and anchor and ranges. If no\n ranges are given, constructs a single range across `$anchor` and\n `$head`.\n */\n constructor(\n /**\n The resolved anchor of the selection (the side that stays in\n place when the selection is modified).\n */\n $anchor, \n /**\n The resolved head of the selection (the side that moves when\n the selection is modified).\n */\n $head, ranges) {\n this.$anchor = $anchor;\n this.$head = $head;\n this.ranges = ranges || [new SelectionRange($anchor.min($head), $anchor.max($head))];\n }\n /**\n The selection's anchor, as an unresolved position.\n */\n get anchor() { return this.$anchor.pos; }\n /**\n The selection's head.\n */\n get head() { return this.$head.pos; }\n /**\n The lower bound of the selection's main range.\n */\n get from() { return this.$from.pos; }\n /**\n The upper bound of the selection's main range.\n */\n get to() { return this.$to.pos; }\n /**\n The resolved lower bound of the selection's main range.\n */\n get $from() {\n return this.ranges[0].$from;\n }\n /**\n The resolved upper bound of the selection's main range.\n */\n get $to() {\n return this.ranges[0].$to;\n }\n /**\n Indicates whether the selection contains any content.\n */\n get empty() {\n let ranges = this.ranges;\n for (let i = 0; i < ranges.length; i++)\n if (ranges[i].$from.pos != ranges[i].$to.pos)\n return false;\n return true;\n }\n /**\n Get the content of this selection as a slice.\n */\n content() {\n return this.$from.doc.slice(this.from, this.to, true);\n }\n /**\n Replace the selection with a slice or, if no slice is given,\n delete the selection. Will append to the given transaction.\n */\n replace(tr, content = Slice.empty) {\n // Put the new selection at the position after the inserted\n // content. When that ended in an inline node, search backwards,\n // to get the position after that node. If not, search forward.\n let lastNode = content.content.lastChild, lastParent = null;\n for (let i = 0; i < content.openEnd; i++) {\n lastParent = lastNode;\n lastNode = lastNode.lastChild;\n }\n let mapFrom = tr.steps.length, ranges = this.ranges;\n for (let i = 0; i < ranges.length; i++) {\n let { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);\n tr.replaceRange(mapping.map($from.pos), mapping.map($to.pos), i ? Slice.empty : content);\n if (i == 0)\n selectionToInsertionEnd(tr, mapFrom, (lastNode ? lastNode.isInline : lastParent && lastParent.isTextblock) ? -1 : 1);\n }\n }\n /**\n Replace the selection with the given node, appending the changes\n to the given transaction.\n */\n replaceWith(tr, node) {\n let mapFrom = tr.steps.length, ranges = this.ranges;\n for (let i = 0; i < ranges.length; i++) {\n let { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);\n let from = mapping.map($from.pos), to = mapping.map($to.pos);\n if (i) {\n tr.deleteRange(from, to);\n }\n else {\n tr.replaceRangeWith(from, to, node);\n selectionToInsertionEnd(tr, mapFrom, node.isInline ? -1 : 1);\n }\n }\n }\n /**\n Find a valid cursor or leaf node selection starting at the given\n position and searching back if `dir` is negative, and forward if\n positive. When `textOnly` is true, only consider cursor\n selections. Will return null when no valid selection position is\n found.\n */\n static findFrom($pos, dir, textOnly = false) {\n let inner = $pos.parent.inlineContent ? new TextSelection($pos)\n : findSelectionIn($pos.node(0), $pos.parent, $pos.pos, $pos.index(), dir, textOnly);\n if (inner)\n return inner;\n for (let depth = $pos.depth - 1; depth >= 0; depth--) {\n let found = dir < 0\n ? findSelectionIn($pos.node(0), $pos.node(depth), $pos.before(depth + 1), $pos.index(depth), dir, textOnly)\n : findSelectionIn($pos.node(0), $pos.node(depth), $pos.after(depth + 1), $pos.index(depth) + 1, dir, textOnly);\n if (found)\n return found;\n }\n return null;\n }\n /**\n Find a valid cursor or leaf node selection near the given\n position. Searches forward first by default, but if `bias` is\n negative, it will search backwards first.\n */\n static near($pos, bias = 1) {\n return this.findFrom($pos, bias) || this.findFrom($pos, -bias) || new AllSelection($pos.node(0));\n }\n /**\n Find the cursor or leaf node selection closest to the start of\n the given document. Will return an\n [`AllSelection`](https://prosemirror.net/docs/ref/#state.AllSelection) if no valid position\n exists.\n */\n static atStart(doc) {\n return findSelectionIn(doc, doc, 0, 0, 1) || new AllSelection(doc);\n }\n /**\n Find the cursor or leaf node selection closest to the end of the\n given document.\n */\n static atEnd(doc) {\n return findSelectionIn(doc, doc, doc.content.size, doc.childCount, -1) || new AllSelection(doc);\n }\n /**\n Deserialize the JSON representation of a selection. Must be\n implemented for custom classes (as a static class method).\n */\n static fromJSON(doc, json) {\n if (!json || !json.type)\n throw new RangeError(\"Invalid input for Selection.fromJSON\");\n let cls = classesById[json.type];\n if (!cls)\n throw new RangeError(`No selection type ${json.type} defined`);\n return cls.fromJSON(doc, json);\n }\n /**\n To be able to deserialize selections from JSON, custom selection\n classes must register themselves with an ID string, so that they\n can be disambiguated. Try to pick something that's unlikely to\n clash with classes from other modules.\n */\n static jsonID(id, selectionClass) {\n if (id in classesById)\n throw new RangeError(\"Duplicate use of selection JSON ID \" + id);\n classesById[id] = selectionClass;\n selectionClass.prototype.jsonID = id;\n return selectionClass;\n }\n /**\n Get a [bookmark](https://prosemirror.net/docs/ref/#state.SelectionBookmark) for this selection,\n which is a value that can be mapped without having access to a\n current document, and later resolved to a real selection for a\n given document again. (This is used mostly by the history to\n track and restore old selections.) The default implementation of\n this method just converts the selection to a text selection and\n returns the bookmark for that.\n */\n getBookmark() {\n return TextSelection.between(this.$anchor, this.$head).getBookmark();\n }\n}\nSelection.prototype.visible = true;\n/**\nRepresents a selected range in a document.\n*/\nclass SelectionRange {\n /**\n Create a range.\n */\n constructor(\n /**\n The lower bound of the range.\n */\n $from, \n /**\n The upper bound of the range.\n */\n $to) {\n this.$from = $from;\n this.$to = $to;\n }\n}\nlet warnedAboutTextSelection = false;\nfunction checkTextSelection($pos) {\n if (!warnedAboutTextSelection && !$pos.parent.inlineContent) {\n warnedAboutTextSelection = true;\n console[\"warn\"](\"TextSelection endpoint not pointing into a node with inline content (\" + $pos.parent.type.name + \")\");\n }\n}\n/**\nA text selection represents a classical editor selection, with a\nhead (the moving side) and anchor (immobile side), both of which\npoint into textblock nodes. It can be empty (a regular cursor\nposition).\n*/\nclass TextSelection extends Selection {\n /**\n Construct a text selection between the given points.\n */\n constructor($anchor, $head = $anchor) {\n checkTextSelection($anchor);\n checkTextSelection($head);\n super($anchor, $head);\n }\n /**\n Returns a resolved position if this is a cursor selection (an\n empty text selection), and null otherwise.\n */\n get $cursor() { return this.$anchor.pos == this.$head.pos ? this.$head : null; }\n map(doc, mapping) {\n let $head = doc.resolve(mapping.map(this.head));\n if (!$head.parent.inlineContent)\n return Selection.near($head);\n let $anchor = doc.resolve(mapping.map(this.anchor));\n return new TextSelection($anchor.parent.inlineContent ? $anchor : $head, $head);\n }\n replace(tr, content = Slice.empty) {\n super.replace(tr, content);\n if (content == Slice.empty) {\n let marks = this.$from.marksAcross(this.$to);\n if (marks)\n tr.ensureMarks(marks);\n }\n }\n eq(other) {\n return other instanceof TextSelection && other.anchor == this.anchor && other.head == this.head;\n }\n getBookmark() {\n return new TextBookmark(this.anchor, this.head);\n }\n toJSON() {\n return { type: \"text\", anchor: this.anchor, head: this.head };\n }\n /**\n @internal\n */\n static fromJSON(doc, json) {\n if (typeof json.anchor != \"number\" || typeof json.head != \"number\")\n throw new RangeError(\"Invalid input for TextSelection.fromJSON\");\n return new TextSelection(doc.resolve(json.anchor), doc.resolve(json.head));\n }\n /**\n Create a text selection from non-resolved positions.\n */\n static create(doc, anchor, head = anchor) {\n let $anchor = doc.resolve(anchor);\n return new this($anchor, head == anchor ? $anchor : doc.resolve(head));\n }\n /**\n Return a text selection that spans the given positions or, if\n they aren't text positions, find a text selection near them.\n `bias` determines whether the method searches forward (default)\n or backwards (negative number) first. Will fall back to calling\n [`Selection.near`](https://prosemirror.net/docs/ref/#state.Selection^near) when the document\n doesn't contain a valid text position.\n */\n static between($anchor, $head, bias) {\n let dPos = $anchor.pos - $head.pos;\n if (!bias || dPos)\n bias = dPos >= 0 ? 1 : -1;\n if (!$head.parent.inlineContent) {\n let found = Selection.findFrom($head, bias, true) || Selection.findFrom($head, -bias, true);\n if (found)\n $head = found.$head;\n else\n return Selection.near($head, bias);\n }\n if (!$anchor.parent.inlineContent) {\n if (dPos == 0) {\n $anchor = $head;\n }\n else {\n $anchor = (Selection.findFrom($anchor, -bias, true) || Selection.findFrom($anchor, bias, true)).$anchor;\n if (($anchor.pos < $head.pos) != (dPos < 0))\n $anchor = $head;\n }\n }\n return new TextSelection($anchor, $head);\n }\n}\nSelection.jsonID(\"text\", TextSelection);\nclass TextBookmark {\n constructor(anchor, head) {\n this.anchor = anchor;\n this.head = head;\n }\n map(mapping) {\n return new TextBookmark(mapping.map(this.anchor), mapping.map(this.head));\n }\n resolve(doc) {\n return TextSelection.between(doc.resolve(this.anchor), doc.resolve(this.head));\n }\n}\n/**\nA node selection is a selection that points at a single node. All\nnodes marked [selectable](https://prosemirror.net/docs/ref/#model.NodeSpec.selectable) can be the\ntarget of a node selection. In such a selection, `from` and `to`\npoint directly before and after the selected node, `anchor` equals\n`from`, and `head` equals `to`..\n*/\nclass NodeSelection extends Selection {\n /**\n Create a node selection. Does not verify the validity of its\n argument.\n */\n constructor($pos) {\n let node = $pos.nodeAfter;\n let $end = $pos.node(0).resolve($pos.pos + node.nodeSize);\n super($pos, $end);\n this.node = node;\n }\n map(doc, mapping) {\n let { deleted, pos } = mapping.mapResult(this.anchor);\n let $pos = doc.resolve(pos);\n if (deleted)\n return Selection.near($pos);\n return new NodeSelection($pos);\n }\n content() {\n return new Slice(Fragment.from(this.node), 0, 0);\n }\n eq(other) {\n return other instanceof NodeSelection && other.anchor == this.anchor;\n }\n toJSON() {\n return { type: \"node\", anchor: this.anchor };\n }\n getBookmark() { return new NodeBookmark(this.anchor); }\n /**\n @internal\n */\n static fromJSON(doc, json) {\n if (typeof json.anchor != \"number\")\n throw new RangeError(\"Invalid input for NodeSelection.fromJSON\");\n return new NodeSelection(doc.resolve(json.anchor));\n }\n /**\n Create a node selection from non-resolved positions.\n */\n static create(doc, from) {\n return new NodeSelection(doc.resolve(from));\n }\n /**\n Determines whether the given node may be selected as a node\n selection.\n */\n static isSelectable(node) {\n return !node.isText && node.type.spec.selectable !== false;\n }\n}\nNodeSelection.prototype.visible = false;\nSelection.jsonID(\"node\", NodeSelection);\nclass NodeBookmark {\n constructor(anchor) {\n this.anchor = anchor;\n }\n map(mapping) {\n let { deleted, pos } = mapping.mapResult(this.anchor);\n return deleted ? new TextBookmark(pos, pos) : new NodeBookmark(pos);\n }\n resolve(doc) {\n let $pos = doc.resolve(this.anchor), node = $pos.nodeAfter;\n if (node && NodeSelection.isSelectable(node))\n return new NodeSelection($pos);\n return Selection.near($pos);\n }\n}\n/**\nA selection type that represents selecting the whole document\n(which can not necessarily be expressed with a text selection, when\nthere are for example leaf block nodes at the start or end of the\ndocument).\n*/\nclass AllSelection extends Selection {\n /**\n Create an all-selection over the given document.\n */\n constructor(doc) {\n super(doc.resolve(0), doc.resolve(doc.content.size));\n }\n replace(tr, content = Slice.empty) {\n if (content == Slice.empty) {\n tr.delete(0, tr.doc.content.size);\n let sel = Selection.atStart(tr.doc);\n if (!sel.eq(tr.selection))\n tr.setSelection(sel);\n }\n else {\n super.replace(tr, content);\n }\n }\n toJSON() { return { type: \"all\" }; }\n /**\n @internal\n */\n static fromJSON(doc) { return new AllSelection(doc); }\n map(doc) { return new AllSelection(doc); }\n eq(other) { return other instanceof AllSelection; }\n getBookmark() { return AllBookmark; }\n}\nSelection.jsonID(\"all\", AllSelection);\nconst AllBookmark = {\n map() { return this; },\n resolve(doc) { return new AllSelection(doc); }\n};\n// FIXME we'll need some awareness of text direction when scanning for selections\n// Try to find a selection inside the given node. `pos` points at the\n// position where the search starts. When `text` is true, only return\n// text selections.\nfunction findSelectionIn(doc, node, pos, index, dir, text = false) {\n if (node.inlineContent)\n return TextSelection.create(doc, pos);\n for (let i = index - (dir > 0 ? 0 : 1); dir > 0 ? i < node.childCount : i >= 0; i += dir) {\n let child = node.child(i);\n if (!child.isAtom) {\n let inner = findSelectionIn(doc, child, pos + dir, dir < 0 ? child.childCount : 0, dir, text);\n if (inner)\n return inner;\n }\n else if (!text && NodeSelection.isSelectable(child)) {\n return NodeSelection.create(doc, pos - (dir < 0 ? child.nodeSize : 0));\n }\n pos += child.nodeSize * dir;\n }\n return null;\n}\nfunction selectionToInsertionEnd(tr, startLen, bias) {\n let last = tr.steps.length - 1;\n if (last < startLen)\n return;\n let step = tr.steps[last];\n if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep))\n return;\n let map = tr.mapping.maps[last], end;\n map.forEach((_from, _to, _newFrom, newTo) => { if (end == null)\n end = newTo; });\n tr.setSelection(Selection.near(tr.doc.resolve(end), bias));\n}\n\nconst UPDATED_SEL = 1, UPDATED_MARKS = 2, UPDATED_SCROLL = 4;\n/**\nAn editor state transaction, which can be applied to a state to\ncreate an updated state. Use\n[`EditorState.tr`](https://prosemirror.net/docs/ref/#state.EditorState.tr) to create an instance.\n\nTransactions track changes to the document (they are a subclass of\n[`Transform`](https://prosemirror.net/docs/ref/#transform.Transform)), but also other state changes,\nlike selection updates and adjustments of the set of [stored\nmarks](https://prosemirror.net/docs/ref/#state.EditorState.storedMarks). In addition, you can store\nmetadata properties in a transaction, which are extra pieces of\ninformation that client code or plugins can use to describe what a\ntransaction represents, so that they can update their [own\nstate](https://prosemirror.net/docs/ref/#state.StateField) accordingly.\n\nThe [editor view](https://prosemirror.net/docs/ref/#view.EditorView) uses a few metadata\nproperties: it will attach a property `\"pointer\"` with the value\n`true` to selection transactions directly caused by mouse or touch\ninput, a `\"composition\"` property holding an ID identifying the\ncomposition that caused it to transactions caused by composed DOM\ninput, and a `\"uiEvent\"` property of that may be `\"paste\"`,\n`\"cut\"`, or `\"drop\"`.\n*/\nclass Transaction extends Transform {\n /**\n @internal\n */\n constructor(state) {\n super(state.doc);\n // The step count for which the current selection is valid.\n this.curSelectionFor = 0;\n // Bitfield to track which aspects of the state were updated by\n // this transaction.\n this.updated = 0;\n // Object used to store metadata properties for the transaction.\n this.meta = Object.create(null);\n this.time = Date.now();\n this.curSelection = state.selection;\n this.storedMarks = state.storedMarks;\n }\n /**\n The transaction's current selection. This defaults to the editor\n selection [mapped](https://prosemirror.net/docs/ref/#state.Selection.map) through the steps in the\n transaction, but can be overwritten with\n [`setSelection`](https://prosemirror.net/docs/ref/#state.Transaction.setSelection).\n */\n get selection() {\n if (this.curSelectionFor < this.steps.length) {\n this.curSelection = this.curSelection.map(this.doc, this.mapping.slice(this.curSelectionFor));\n this.curSelectionFor = this.steps.length;\n }\n return this.curSelection;\n }\n /**\n Update the transaction's current selection. Will determine the\n selection that the editor gets when the transaction is applied.\n */\n setSelection(selection) {\n if (selection.$from.doc != this.doc)\n throw new RangeError(\"Selection passed to setSelection must point at the current document\");\n this.curSelection = selection;\n this.curSelectionFor = this.steps.length;\n this.updated = (this.updated | UPDATED_SEL) & ~UPDATED_MARKS;\n this.storedMarks = null;\n return this;\n }\n /**\n Whether the selection was explicitly updated by this transaction.\n */\n get selectionSet() {\n return (this.updated & UPDATED_SEL) > 0;\n }\n /**\n Set the current stored marks.\n */\n setStoredMarks(marks) {\n this.storedMarks = marks;\n this.updated |= UPDATED_MARKS;\n return this;\n }\n /**\n Make sure the current stored marks or, if that is null, the marks\n at the selection, match the given set of marks. Does nothing if\n this is already the case.\n */\n ensureMarks(marks) {\n if (!Mark.sameSet(this.storedMarks || this.selection.$from.marks(), marks))\n this.setStoredMarks(marks);\n return this;\n }\n /**\n Add a mark to the set of stored marks.\n */\n addStoredMark(mark) {\n return this.ensureMarks(mark.addToSet(this.storedMarks || this.selection.$head.marks()));\n }\n /**\n Remove a mark or mark type from the set of stored marks.\n */\n removeStoredMark(mark) {\n return this.ensureMarks(mark.removeFromSet(this.storedMarks || this.selection.$head.marks()));\n }\n /**\n Whether the stored marks were explicitly set for this transaction.\n */\n get storedMarksSet() {\n return (this.updated & UPDATED_MARKS) > 0;\n }\n /**\n @internal\n */\n addStep(step, doc) {\n super.addStep(step, doc);\n this.updated = this.updated & ~UPDATED_MARKS;\n this.storedMarks = null;\n }\n /**\n Update the timestamp for the transaction.\n */\n setTime(time) {\n this.time = time;\n return this;\n }\n /**\n Replace the current selection with the given slice.\n */\n replaceSelection(slice) {\n this.selection.replace(this, slice);\n return this;\n }\n /**\n Replace the selection with the given node. When `inheritMarks` is\n true and the content is inline, it inherits the marks from the\n place where it is inserted.\n */\n replaceSelectionWith(node, inheritMarks = true) {\n let selection = this.selection;\n if (inheritMarks)\n node = node.mark(this.storedMarks || (selection.empty ? selection.$from.marks() : (selection.$from.marksAcross(selection.$to) || Mark.none)));\n selection.replaceWith(this, node);\n return this;\n }\n /**\n Delete the selection.\n */\n deleteSelection() {\n this.selection.replace(this);\n return this;\n }\n /**\n Replace the given range, or the selection if no range is given,\n with a text node containing the given string.\n */\n insertText(text, from, to) {\n let schema = this.doc.type.schema;\n if (from == null) {\n if (!text)\n return this.deleteSelection();\n return this.replaceSelectionWith(schema.text(text), true);\n }\n else {\n if (to == null)\n to = from;\n if (!text)\n return this.deleteRange(from, to);\n let marks = this.storedMarks;\n if (!marks) {\n let $from = this.doc.resolve(from);\n marks = to == from ? $from.marks() : $from.marksAcross(this.doc.resolve(to));\n }\n this.replaceRangeWith(from, to, schema.text(text, marks));\n if (!this.selection.empty && this.selection.to == from + text.length)\n this.setSelection(Selection.near(this.selection.$to));\n return this;\n }\n }\n /**\n Store a metadata property in this transaction, keyed either by\n name or by plugin.\n */\n setMeta(key, value) {\n this.meta[typeof key == \"string\" ? key : key.key] = value;\n return this;\n }\n /**\n Retrieve a metadata property for a given name or plugin.\n */\n getMeta(key) {\n return this.meta[typeof key == \"string\" ? key : key.key];\n }\n /**\n Returns true if this transaction doesn't contain any metadata,\n and can thus safely be extended.\n */\n get isGeneric() {\n for (let _ in this.meta)\n return false;\n return true;\n }\n /**\n Indicate that the editor should scroll the selection into view\n when updated to the state produced by this transaction.\n */\n scrollIntoView() {\n this.updated |= UPDATED_SCROLL;\n return this;\n }\n /**\n True when this transaction has had `scrollIntoView` called on it.\n */\n get scrolledIntoView() {\n return (this.updated & UPDATED_SCROLL) > 0;\n }\n}\n\nfunction bind(f, self) {\n return !self || !f ? f : f.bind(self);\n}\nclass FieldDesc {\n constructor(name, desc, self) {\n this.name = name;\n this.init = bind(desc.init, self);\n this.apply = bind(desc.apply, self);\n }\n}\nconst baseFields = [\n new FieldDesc(\"doc\", {\n init(config) { return config.doc || config.schema.topNodeType.createAndFill(); },\n apply(tr) { return tr.doc; }\n }),\n new FieldDesc(\"selection\", {\n init(config, instance) { return config.selection || Selection.atStart(instance.doc); },\n apply(tr) { return tr.selection; }\n }),\n new FieldDesc(\"storedMarks\", {\n init(config) { return config.storedMarks || null; },\n apply(tr, _marks, _old, state) { return state.selection.$cursor ? tr.storedMarks : null; }\n }),\n new FieldDesc(\"scrollToSelection\", {\n init() { return 0; },\n apply(tr, prev) { return tr.scrolledIntoView ? prev + 1 : prev; }\n })\n];\n// Object wrapping the part of a state object that stays the same\n// across transactions. Stored in the state's `config` property.\nclass Configuration {\n constructor(schema, plugins) {\n this.schema = schema;\n this.plugins = [];\n this.pluginsByKey = Object.create(null);\n this.fields = baseFields.slice();\n if (plugins)\n plugins.forEach(plugin => {\n if (this.pluginsByKey[plugin.key])\n throw new RangeError(\"Adding different instances of a keyed plugin (\" + plugin.key + \")\");\n this.plugins.push(plugin);\n this.pluginsByKey[plugin.key] = plugin;\n if (plugin.spec.state)\n this.fields.push(new FieldDesc(plugin.key, plugin.spec.state, plugin));\n });\n }\n}\n/**\nThe state of a ProseMirror editor is represented by an object of\nthis type. A state is a persistent data structure—it isn't\nupdated, but rather a new state value is computed from an old one\nusing the [`apply`](https://prosemirror.net/docs/ref/#state.EditorState.apply) method.\n\nA state holds a number of built-in fields, and plugins can\n[define](https://prosemirror.net/docs/ref/#state.PluginSpec.state) additional fields.\n*/\nclass EditorState {\n /**\n @internal\n */\n constructor(\n /**\n @internal\n */\n config) {\n this.config = config;\n }\n /**\n The schema of the state's document.\n */\n get schema() {\n return this.config.schema;\n }\n /**\n The plugins that are active in this state.\n */\n get plugins() {\n return this.config.plugins;\n }\n /**\n Apply the given transaction to produce a new state.\n */\n apply(tr) {\n return this.applyTransaction(tr).state;\n }\n /**\n @internal\n */\n filterTransaction(tr, ignore = -1) {\n for (let i = 0; i < this.config.plugins.length; i++)\n if (i != ignore) {\n let plugin = this.config.plugins[i];\n if (plugin.spec.filterTransaction && !plugin.spec.filterTransaction.call(plugin, tr, this))\n return false;\n }\n return true;\n }\n /**\n Verbose variant of [`apply`](https://prosemirror.net/docs/ref/#state.EditorState.apply) that\n returns the precise transactions that were applied (which might\n be influenced by the [transaction\n hooks](https://prosemirror.net/docs/ref/#state.PluginSpec.filterTransaction) of\n plugins) along with the new state.\n */\n applyTransaction(rootTr) {\n if (!this.filterTransaction(rootTr))\n return { state: this, transactions: [] };\n let trs = [rootTr], newState = this.applyInner(rootTr), seen = null;\n // This loop repeatedly gives plugins a chance to respond to\n // transactions as new transactions are added, making sure to only\n // pass the transactions the plugin did not see before.\n for (;;) {\n let haveNew = false;\n for (let i = 0; i < this.config.plugins.length; i++) {\n let plugin = this.config.plugins[i];\n if (plugin.spec.appendTransaction) {\n let n = seen ? seen[i].n : 0, oldState = seen ? seen[i].state : this;\n let tr = n < trs.length &&\n plugin.spec.appendTransaction.call(plugin, n ? trs.slice(n) : trs, oldState, newState);\n if (tr && newState.filterTransaction(tr, i)) {\n tr.setMeta(\"appendedTransaction\", rootTr);\n if (!seen) {\n seen = [];\n for (let j = 0; j < this.config.plugins.length; j++)\n seen.push(j < i ? { state: newState, n: trs.length } : { state: this, n: 0 });\n }\n trs.push(tr);\n newState = newState.applyInner(tr);\n haveNew = true;\n }\n if (seen)\n seen[i] = { state: newState, n: trs.length };\n }\n }\n if (!haveNew)\n return { state: newState, transactions: trs };\n }\n }\n /**\n @internal\n */\n applyInner(tr) {\n if (!tr.before.eq(this.doc))\n throw new RangeError(\"Applying a mismatched transaction\");\n let newInstance = new EditorState(this.config), fields = this.config.fields;\n for (let i = 0; i < fields.length; i++) {\n let field = fields[i];\n newInstance[field.name] = field.apply(tr, this[field.name], this, newInstance);\n }\n return newInstance;\n }\n /**\n Accessor that constructs and returns a new [transaction](https://prosemirror.net/docs/ref/#state.Transaction) from this state.\n */\n get tr() { return new Transaction(this); }\n /**\n Create a new state.\n */\n static create(config) {\n let $config = new Configuration(config.doc ? config.doc.type.schema : config.schema, config.plugins);\n let instance = new EditorState($config);\n for (let i = 0; i < $config.fields.length; i++)\n instance[$config.fields[i].name] = $config.fields[i].init(config, instance);\n return instance;\n }\n /**\n Create a new state based on this one, but with an adjusted set\n of active plugins. State fields that exist in both sets of\n plugins are kept unchanged. Those that no longer exist are\n dropped, and those that are new are initialized using their\n [`init`](https://prosemirror.net/docs/ref/#state.StateField.init) method, passing in the new\n configuration object..\n */\n reconfigure(config) {\n let $config = new Configuration(this.schema, config.plugins);\n let fields = $config.fields, instance = new EditorState($config);\n for (let i = 0; i < fields.length; i++) {\n let name = fields[i].name;\n instance[name] = this.hasOwnProperty(name) ? this[name] : fields[i].init(config, instance);\n }\n return instance;\n }\n /**\n Serialize this state to JSON. If you want to serialize the state\n of plugins, pass an object mapping property names to use in the\n resulting JSON object to plugin objects. The argument may also be\n a string or number, in which case it is ignored, to support the\n way `JSON.stringify` calls `toString` methods.\n */\n toJSON(pluginFields) {\n let result = { doc: this.doc.toJSON(), selection: this.selection.toJSON() };\n if (this.storedMarks)\n result.storedMarks = this.storedMarks.map(m => m.toJSON());\n if (pluginFields && typeof pluginFields == 'object')\n for (let prop in pluginFields) {\n if (prop == \"doc\" || prop == \"selection\")\n throw new RangeError(\"The JSON fields `doc` and `selection` are reserved\");\n let plugin = pluginFields[prop], state = plugin.spec.state;\n if (state && state.toJSON)\n result[prop] = state.toJSON.call(plugin, this[plugin.key]);\n }\n return result;\n }\n /**\n Deserialize a JSON representation of a state. `config` should\n have at least a `schema` field, and should contain array of\n plugins to initialize the state with. `pluginFields` can be used\n to deserialize the state of plugins, by associating plugin\n instances with the property names they use in the JSON object.\n */\n static fromJSON(config, json, pluginFields) {\n if (!json)\n throw new RangeError(\"Invalid input for EditorState.fromJSON\");\n if (!config.schema)\n throw new RangeError(\"Required config field 'schema' missing\");\n let $config = new Configuration(config.schema, config.plugins);\n let instance = new EditorState($config);\n $config.fields.forEach(field => {\n if (field.name == \"doc\") {\n instance.doc = Node.fromJSON(config.schema, json.doc);\n }\n else if (field.name == \"selection\") {\n instance.selection = Selection.fromJSON(instance.doc, json.selection);\n }\n else if (field.name == \"storedMarks\") {\n if (json.storedMarks)\n instance.storedMarks = json.storedMarks.map(config.schema.markFromJSON);\n }\n else {\n if (pluginFields)\n for (let prop in pluginFields) {\n let plugin = pluginFields[prop], state = plugin.spec.state;\n if (plugin.key == field.name && state && state.fromJSON &&\n Object.prototype.hasOwnProperty.call(json, prop)) {\n instance[field.name] = state.fromJSON.call(plugin, config, json[prop], instance);\n return;\n }\n }\n instance[field.name] = field.init(config, instance);\n }\n });\n return instance;\n }\n}\n\nfunction bindProps(obj, self, target) {\n for (let prop in obj) {\n let val = obj[prop];\n if (val instanceof Function)\n val = val.bind(self);\n else if (prop == \"handleDOMEvents\")\n val = bindProps(val, self, {});\n target[prop] = val;\n }\n return target;\n}\n/**\nPlugins bundle functionality that can be added to an editor.\nThey are part of the [editor state](https://prosemirror.net/docs/ref/#state.EditorState) and\nmay influence that state and the view that contains it.\n*/\nclass Plugin {\n /**\n Create a plugin.\n */\n constructor(\n /**\n The plugin's [spec object](https://prosemirror.net/docs/ref/#state.PluginSpec).\n */\n spec) {\n this.spec = spec;\n /**\n The [props](https://prosemirror.net/docs/ref/#view.EditorProps) exported by this plugin.\n */\n this.props = {};\n if (spec.props)\n bindProps(spec.props, this, this.props);\n this.key = spec.key ? spec.key.key : createKey(\"plugin\");\n }\n /**\n Extract the plugin's state field from an editor state.\n */\n getState(state) { return state[this.key]; }\n}\nconst keys = Object.create(null);\nfunction createKey(name) {\n if (name in keys)\n return name + \"$\" + ++keys[name];\n keys[name] = 0;\n return name + \"$\";\n}\n/**\nA key is used to [tag](https://prosemirror.net/docs/ref/#state.PluginSpec.key) plugins in a way\nthat makes it possible to find them, given an editor state.\nAssigning a key does mean only one plugin of that type can be\nactive in a state.\n*/\nclass PluginKey {\n /**\n Create a plugin key.\n */\n constructor(name = \"key\") { this.key = createKey(name); }\n /**\n Get the active plugin with this key, if any, from an editor\n state.\n */\n get(state) { return state.config.pluginsByKey[this.key]; }\n /**\n Get the plugin's state from an editor state.\n */\n getState(state) { return state[this.key]; }\n}\n\nexport { AllSelection, EditorState, NodeSelection, Plugin, PluginKey, Selection, SelectionRange, TextSelection, Transaction };\n","export var base = {\n 8: \"Backspace\",\n 9: \"Tab\",\n 10: \"Enter\",\n 12: \"NumLock\",\n 13: \"Enter\",\n 16: \"Shift\",\n 17: \"Control\",\n 18: \"Alt\",\n 20: \"CapsLock\",\n 27: \"Escape\",\n 32: \" \",\n 33: \"PageUp\",\n 34: \"PageDown\",\n 35: \"End\",\n 36: \"Home\",\n 37: \"ArrowLeft\",\n 38: \"ArrowUp\",\n 39: \"ArrowRight\",\n 40: \"ArrowDown\",\n 44: \"PrintScreen\",\n 45: \"Insert\",\n 46: \"Delete\",\n 59: \";\",\n 61: \"=\",\n 91: \"Meta\",\n 92: \"Meta\",\n 106: \"*\",\n 107: \"+\",\n 108: \",\",\n 109: \"-\",\n 110: \".\",\n 111: \"/\",\n 144: \"NumLock\",\n 145: \"ScrollLock\",\n 160: \"Shift\",\n 161: \"Shift\",\n 162: \"Control\",\n 163: \"Control\",\n 164: \"Alt\",\n 165: \"Alt\",\n 173: \"-\",\n 186: \";\",\n 187: \"=\",\n 188: \",\",\n 189: \"-\",\n 190: \".\",\n 191: \"/\",\n 192: \"`\",\n 219: \"[\",\n 220: \"\\\\\",\n 221: \"]\",\n 222: \"'\"\n}\n\nexport var shift = {\n 48: \")\",\n 49: \"!\",\n 50: \"@\",\n 51: \"#\",\n 52: \"$\",\n 53: \"%\",\n 54: \"^\",\n 55: \"&\",\n 56: \"*\",\n 57: \"(\",\n 59: \":\",\n 61: \"+\",\n 173: \"_\",\n 186: \":\",\n 187: \"+\",\n 188: \"<\",\n 189: \"_\",\n 190: \">\",\n 191: \"?\",\n 192: \"~\",\n 219: \"{\",\n 220: \"|\",\n 221: \"}\",\n 222: \"\\\"\"\n}\n\nvar mac = typeof navigator != \"undefined\" && /Mac/.test(navigator.platform)\nvar ie = typeof navigator != \"undefined\" && /MSIE \\d|Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(navigator.userAgent)\n\n// Fill in the digit keys\nfor (var i = 0; i < 10; i++) base[48 + i] = base[96 + i] = String(i)\n\n// The function keys\nfor (var i = 1; i <= 24; i++) base[i + 111] = \"F\" + i\n\n// And the alphabetic keys\nfor (var i = 65; i <= 90; i++) {\n base[i] = String.fromCharCode(i + 32)\n shift[i] = String.fromCharCode(i)\n}\n\n// For each code that doesn't have a shift-equivalent, copy the base name\nfor (var code in base) if (!shift.hasOwnProperty(code)) shift[code] = base[code]\n\nexport function keyName(event) {\n // On macOS, keys held with Shift and Cmd don't reflect the effect of Shift in `.key`.\n // On IE, shift effect is never included in `.key`.\n var ignoreKey = mac && event.metaKey && event.shiftKey && !event.ctrlKey && !event.altKey ||\n ie && event.shiftKey && event.key && event.key.length == 1 ||\n event.key == \"Unidentified\"\n var name = (!ignoreKey && event.key) ||\n (event.shiftKey ? shift : base)[event.keyCode] ||\n event.key || \"Unidentified\"\n // Edge sometimes produces wrong names (Issue #3)\n if (name == \"Esc\") name = \"Escape\"\n if (name == \"Del\") name = \"Delete\"\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8860571/\n if (name == \"Left\") name = \"ArrowLeft\"\n if (name == \"Up\") name = \"ArrowUp\"\n if (name == \"Right\") name = \"ArrowRight\"\n if (name == \"Down\") name = \"ArrowDown\"\n return name\n}\n","import { keyName, base } from 'w3c-keyname';\nimport { Plugin } from 'prosemirror-state';\n\nconst mac = typeof navigator != \"undefined\" && /Mac|iP(hone|[oa]d)/.test(navigator.platform);\nconst windows = typeof navigator != \"undefined\" && /Win/.test(navigator.platform);\nfunction normalizeKeyName(name) {\n let parts = name.split(/-(?!$)/), result = parts[parts.length - 1];\n if (result == \"Space\")\n result = \" \";\n let alt, ctrl, shift, meta;\n for (let i = 0; i < parts.length - 1; i++) {\n let mod = parts[i];\n if (/^(cmd|meta|m)$/i.test(mod))\n meta = true;\n else if (/^a(lt)?$/i.test(mod))\n alt = true;\n else if (/^(c|ctrl|control)$/i.test(mod))\n ctrl = true;\n else if (/^s(hift)?$/i.test(mod))\n shift = true;\n else if (/^mod$/i.test(mod)) {\n if (mac)\n meta = true;\n else\n ctrl = true;\n }\n else\n throw new Error(\"Unrecognized modifier name: \" + mod);\n }\n if (alt)\n result = \"Alt-\" + result;\n if (ctrl)\n result = \"Ctrl-\" + result;\n if (meta)\n result = \"Meta-\" + result;\n if (shift)\n result = \"Shift-\" + result;\n return result;\n}\nfunction normalize(map) {\n let copy = Object.create(null);\n for (let prop in map)\n copy[normalizeKeyName(prop)] = map[prop];\n return copy;\n}\nfunction modifiers(name, event, shift = true) {\n if (event.altKey)\n name = \"Alt-\" + name;\n if (event.ctrlKey)\n name = \"Ctrl-\" + name;\n if (event.metaKey)\n name = \"Meta-\" + name;\n if (shift && event.shiftKey)\n name = \"Shift-\" + name;\n return name;\n}\n/**\nCreate a keymap plugin for the given set of bindings.\n\nBindings should map key names to [command](https://prosemirror.net/docs/ref/#commands)-style\nfunctions, which will be called with `(EditorState, dispatch,\nEditorView)` arguments, and should return true when they've handled\nthe key. Note that the view argument isn't part of the command\nprotocol, but can be used as an escape hatch if a binding needs to\ndirectly interact with the UI.\n\nKey names may be strings like `\"Shift-Ctrl-Enter\"`—a key\nidentifier prefixed with zero or more modifiers. Key identifiers\nare based on the strings that can appear in\n[`KeyEvent.key`](https:developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key).\nUse lowercase letters to refer to letter keys (or uppercase letters\nif you want shift to be held). You may use `\"Space\"` as an alias\nfor the `\" \"` name.\n\nModifiers can be given in any order. `Shift-` (or `s-`), `Alt-` (or\n`a-`), `Ctrl-` (or `c-` or `Control-`) and `Cmd-` (or `m-` or\n`Meta-`) are recognized. For characters that are created by holding\nshift, the `Shift-` prefix is implied, and should not be added\nexplicitly.\n\nYou can use `Mod-` as a shorthand for `Cmd-` on Mac and `Ctrl-` on\nother platforms.\n\nYou can add multiple keymap plugins to an editor. The order in\nwhich they appear determines their precedence (the ones early in\nthe array get to dispatch first).\n*/\nfunction keymap(bindings) {\n return new Plugin({ props: { handleKeyDown: keydownHandler(bindings) } });\n}\n/**\nGiven a set of bindings (using the same format as\n[`keymap`](https://prosemirror.net/docs/ref/#keymap.keymap)), return a [keydown\nhandler](https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyDown) that handles them.\n*/\nfunction keydownHandler(bindings) {\n let map = normalize(bindings);\n return function (view, event) {\n let name = keyName(event), baseName, direct = map[modifiers(name, event)];\n if (direct && direct(view.state, view.dispatch, view))\n return true;\n // A character key\n if (name.length == 1 && name != \" \") {\n if (event.shiftKey) {\n // In case the name was already modified by shift, try looking\n // it up without its shift modifier\n let noShift = map[modifiers(name, event, false)];\n if (noShift && noShift(view.state, view.dispatch, view))\n return true;\n }\n if ((event.altKey || event.metaKey || event.ctrlKey) &&\n // Ctrl-Alt may be used for AltGr on Windows\n !(windows && event.ctrlKey && event.altKey) &&\n (baseName = base[event.keyCode]) && baseName != name) {\n // Try falling back to the keyCode when there's a modifier\n // active or the character produced isn't ASCII, and our table\n // produces a different name from the the keyCode. See #668,\n // #1060, #1529.\n let fromCode = map[modifiers(baseName, event)];\n if (fromCode && fromCode(view.state, view.dispatch, view))\n return true;\n }\n }\n return false;\n };\n}\n\nexport { keydownHandler, keymap };\n","import { NodeSelection, Plugin, PluginKey, Selection, SelectionRange, TextSelection } from \"prosemirror-state\";\nimport { Fragment, Slice } from \"prosemirror-model\";\nimport { Decoration, DecorationSet } from \"prosemirror-view\";\nimport { keydownHandler } from \"prosemirror-keymap\";\nimport { Transform } from \"prosemirror-transform\";\n\n//#region src/tablemap.ts\nlet readFromCache;\nlet addToCache;\nif (typeof WeakMap != \"undefined\") {\n\tlet cache = /* @__PURE__ */ new WeakMap();\n\treadFromCache = (key) => cache.get(key);\n\taddToCache = (key, value) => {\n\t\tcache.set(key, value);\n\t\treturn value;\n\t};\n} else {\n\tconst cache = [];\n\tconst cacheSize = 10;\n\tlet cachePos = 0;\n\treadFromCache = (key) => {\n\t\tfor (let i = 0; i < cache.length; i += 2) if (cache[i] == key) return cache[i + 1];\n\t};\n\taddToCache = (key, value) => {\n\t\tif (cachePos == cacheSize) cachePos = 0;\n\t\tcache[cachePos++] = key;\n\t\treturn cache[cachePos++] = value;\n\t};\n}\n/**\n* A table map describes the structure of a given table. To avoid\n* recomputing them all the time, they are cached per table node. To\n* be able to do that, positions saved in the map are relative to the\n* start of the table, rather than the start of the document.\n*\n* @public\n*/\nvar TableMap = class {\n\tconstructor(width, height, map, problems) {\n\t\tthis.width = width;\n\t\tthis.height = height;\n\t\tthis.map = map;\n\t\tthis.problems = problems;\n\t}\n\tfindCell(pos) {\n\t\tfor (let i = 0; i < this.map.length; i++) {\n\t\t\tconst curPos = this.map[i];\n\t\t\tif (curPos != pos) continue;\n\t\t\tconst left = i % this.width;\n\t\t\tconst top = i / this.width | 0;\n\t\t\tlet right = left + 1;\n\t\t\tlet bottom = top + 1;\n\t\t\tfor (let j = 1; right < this.width && this.map[i + j] == curPos; j++) right++;\n\t\t\tfor (let j = 1; bottom < this.height && this.map[i + this.width * j] == curPos; j++) bottom++;\n\t\t\treturn {\n\t\t\t\tleft,\n\t\t\t\ttop,\n\t\t\t\tright,\n\t\t\t\tbottom\n\t\t\t};\n\t\t}\n\t\tthrow new RangeError(`No cell with offset ${pos} found`);\n\t}\n\tcolCount(pos) {\n\t\tfor (let i = 0; i < this.map.length; i++) if (this.map[i] == pos) return i % this.width;\n\t\tthrow new RangeError(`No cell with offset ${pos} found`);\n\t}\n\tnextCell(pos, axis, dir) {\n\t\tconst { left, right, top, bottom } = this.findCell(pos);\n\t\tif (axis == \"horiz\") {\n\t\t\tif (dir < 0 ? left == 0 : right == this.width) return null;\n\t\t\treturn this.map[top * this.width + (dir < 0 ? left - 1 : right)];\n\t\t} else {\n\t\t\tif (dir < 0 ? top == 0 : bottom == this.height) return null;\n\t\t\treturn this.map[left + this.width * (dir < 0 ? top - 1 : bottom)];\n\t\t}\n\t}\n\trectBetween(a, b) {\n\t\tconst { left: leftA, right: rightA, top: topA, bottom: bottomA } = this.findCell(a);\n\t\tconst { left: leftB, right: rightB, top: topB, bottom: bottomB } = this.findCell(b);\n\t\treturn {\n\t\t\tleft: Math.min(leftA, leftB),\n\t\t\ttop: Math.min(topA, topB),\n\t\t\tright: Math.max(rightA, rightB),\n\t\t\tbottom: Math.max(bottomA, bottomB)\n\t\t};\n\t}\n\tcellsInRect(rect) {\n\t\tconst result = [];\n\t\tconst seen = {};\n\t\tfor (let row = rect.top; row < rect.bottom; row++) for (let col = rect.left; col < rect.right; col++) {\n\t\t\tconst index = row * this.width + col;\n\t\t\tconst pos = this.map[index];\n\t\t\tif (seen[pos]) continue;\n\t\t\tseen[pos] = true;\n\t\t\tif (col == rect.left && col && this.map[index - 1] == pos || row == rect.top && row && this.map[index - this.width] == pos) continue;\n\t\t\tresult.push(pos);\n\t\t}\n\t\treturn result;\n\t}\n\tpositionAt(row, col, table) {\n\t\tfor (let i = 0, rowStart = 0;; i++) {\n\t\t\tconst rowEnd = rowStart + table.child(i).nodeSize;\n\t\t\tif (i == row) {\n\t\t\t\tlet index = col + row * this.width;\n\t\t\t\tconst rowEndIndex = (row + 1) * this.width;\n\t\t\t\twhile (index < rowEndIndex && this.map[index] < rowStart) index++;\n\t\t\t\treturn index == rowEndIndex ? rowEnd - 1 : this.map[index];\n\t\t\t}\n\t\t\trowStart = rowEnd;\n\t\t}\n\t}\n\tstatic get(table) {\n\t\treturn readFromCache(table) || addToCache(table, computeMap(table));\n\t}\n};\nfunction computeMap(table) {\n\tif (table.type.spec.tableRole != \"table\") throw new RangeError(\"Not a table node: \" + table.type.name);\n\tconst width = findWidth(table), height = table.childCount;\n\tconst map = [];\n\tlet mapPos = 0;\n\tlet problems = null;\n\tconst colWidths = [];\n\tfor (let i = 0, e = width * height; i < e; i++) map[i] = 0;\n\tfor (let row = 0, pos = 0; row < height; row++) {\n\t\tconst rowNode = table.child(row);\n\t\tpos++;\n\t\tfor (let i = 0;; i++) {\n\t\t\twhile (mapPos < map.length && map[mapPos] != 0) mapPos++;\n\t\t\tif (i == rowNode.childCount) break;\n\t\t\tconst cellNode = rowNode.child(i);\n\t\t\tconst { colspan, rowspan, colwidth } = cellNode.attrs;\n\t\t\tfor (let h = 0; h < rowspan; h++) {\n\t\t\t\tif (h + row >= height) {\n\t\t\t\t\t(problems || (problems = [])).push({\n\t\t\t\t\t\ttype: \"overlong_rowspan\",\n\t\t\t\t\t\tpos,\n\t\t\t\t\t\tn: rowspan - h\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tconst start = mapPos + h * width;\n\t\t\t\tfor (let w = 0; w < colspan; w++) {\n\t\t\t\t\tif (map[start + w] == 0) map[start + w] = pos;\n\t\t\t\t\telse (problems || (problems = [])).push({\n\t\t\t\t\t\ttype: \"collision\",\n\t\t\t\t\t\trow,\n\t\t\t\t\t\tpos,\n\t\t\t\t\t\tn: colspan - w\n\t\t\t\t\t});\n\t\t\t\t\tconst colW = colwidth && colwidth[w];\n\t\t\t\t\tif (colW) {\n\t\t\t\t\t\tconst widthIndex = (start + w) % width * 2, prev = colWidths[widthIndex];\n\t\t\t\t\t\tif (prev == null || prev != colW && colWidths[widthIndex + 1] == 1) {\n\t\t\t\t\t\t\tcolWidths[widthIndex] = colW;\n\t\t\t\t\t\t\tcolWidths[widthIndex + 1] = 1;\n\t\t\t\t\t\t} else if (prev == colW) colWidths[widthIndex + 1]++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tmapPos += colspan;\n\t\t\tpos += cellNode.nodeSize;\n\t\t}\n\t\tconst expectedPos = (row + 1) * width;\n\t\tlet missing = 0;\n\t\twhile (mapPos < expectedPos) if (map[mapPos++] == 0) missing++;\n\t\tif (missing) (problems || (problems = [])).push({\n\t\t\ttype: \"missing\",\n\t\t\trow,\n\t\t\tn: missing\n\t\t});\n\t\tpos++;\n\t}\n\tif (width === 0 || height === 0) (problems || (problems = [])).push({ type: \"zero_sized\" });\n\tconst tableMap = new TableMap(width, height, map, problems);\n\tlet badWidths = false;\n\tfor (let i = 0; !badWidths && i < colWidths.length; i += 2) if (colWidths[i] != null && colWidths[i + 1] < height) badWidths = true;\n\tif (badWidths) findBadColWidths(tableMap, colWidths, table);\n\treturn tableMap;\n}\nfunction findWidth(table) {\n\tlet width = -1;\n\tlet hasRowSpan = false;\n\tfor (let row = 0; row < table.childCount; row++) {\n\t\tconst rowNode = table.child(row);\n\t\tlet rowWidth = 0;\n\t\tif (hasRowSpan) for (let j = 0; j < row; j++) {\n\t\t\tconst prevRow = table.child(j);\n\t\t\tfor (let i = 0; i < prevRow.childCount; i++) {\n\t\t\t\tconst cell = prevRow.child(i);\n\t\t\t\tif (j + cell.attrs.rowspan > row) rowWidth += cell.attrs.colspan;\n\t\t\t}\n\t\t}\n\t\tfor (let i = 0; i < rowNode.childCount; i++) {\n\t\t\tconst cell = rowNode.child(i);\n\t\t\trowWidth += cell.attrs.colspan;\n\t\t\tif (cell.attrs.rowspan > 1) hasRowSpan = true;\n\t\t}\n\t\tif (width == -1) width = rowWidth;\n\t\telse if (width != rowWidth) width = Math.max(width, rowWidth);\n\t}\n\treturn width;\n}\nfunction findBadColWidths(map, colWidths, table) {\n\tif (!map.problems) map.problems = [];\n\tconst seen = {};\n\tfor (let i = 0; i < map.map.length; i++) {\n\t\tconst pos = map.map[i];\n\t\tif (seen[pos]) continue;\n\t\tseen[pos] = true;\n\t\tconst node = table.nodeAt(pos);\n\t\tif (!node) throw new RangeError(`No cell with offset ${pos} found`);\n\t\tlet updated = null;\n\t\tconst attrs = node.attrs;\n\t\tfor (let j = 0; j < attrs.colspan; j++) {\n\t\t\tconst colWidth = colWidths[(i + j) % map.width * 2];\n\t\t\tif (colWidth != null && (!attrs.colwidth || attrs.colwidth[j] != colWidth)) (updated || (updated = freshColWidth(attrs)))[j] = colWidth;\n\t\t}\n\t\tif (updated) map.problems.unshift({\n\t\t\ttype: \"colwidth mismatch\",\n\t\t\tpos,\n\t\t\tcolwidth: updated\n\t\t});\n\t}\n}\nfunction freshColWidth(attrs) {\n\tif (attrs.colwidth) return attrs.colwidth.slice();\n\tconst result = [];\n\tfor (let i = 0; i < attrs.colspan; i++) result.push(0);\n\treturn result;\n}\n\n//#endregion\n//#region src/schema.ts\nfunction getCellAttrs(dom, extraAttrs) {\n\tif (typeof dom === \"string\") return {};\n\tconst widthAttr = dom.getAttribute(\"data-colwidth\");\n\tconst widths = widthAttr && /^\\d+(,\\d+)*$/.test(widthAttr) ? widthAttr.split(\",\").map((s) => Number(s)) : null;\n\tconst colspan = Number(dom.getAttribute(\"colspan\") || 1);\n\tconst result = {\n\t\tcolspan,\n\t\trowspan: Number(dom.getAttribute(\"rowspan\") || 1),\n\t\tcolwidth: widths && widths.length == colspan ? widths : null\n\t};\n\tfor (const prop in extraAttrs) {\n\t\tconst getter = extraAttrs[prop].getFromDOM;\n\t\tconst value = getter && getter(dom);\n\t\tif (value != null) result[prop] = value;\n\t}\n\treturn result;\n}\nfunction setCellAttrs(node, extraAttrs) {\n\tconst attrs = {};\n\tif (node.attrs.colspan != 1) attrs.colspan = node.attrs.colspan;\n\tif (node.attrs.rowspan != 1) attrs.rowspan = node.attrs.rowspan;\n\tif (node.attrs.colwidth) attrs[\"data-colwidth\"] = node.attrs.colwidth.join(\",\");\n\tfor (const prop in extraAttrs) {\n\t\tconst setter = extraAttrs[prop].setDOMAttr;\n\t\tif (setter) setter(node.attrs[prop], attrs);\n\t}\n\treturn attrs;\n}\nfunction validateColwidth(value) {\n\tif (value === null) return;\n\tif (!Array.isArray(value)) throw new TypeError(\"colwidth must be null or an array\");\n\tfor (const item of value) if (typeof item !== \"number\") throw new TypeError(\"colwidth must be null or an array of numbers\");\n}\n/**\n* This function creates a set of [node\n* specs](http://prosemirror.net/docs/ref/#model.SchemaSpec.nodes) for\n* `table`, `table_row`, and `table_cell` nodes types as used by this\n* module. The result can then be added to the set of nodes when\n* creating a schema.\n*\n* @public\n*/\nfunction tableNodes(options) {\n\tconst extraAttrs = options.cellAttributes || {};\n\tconst cellAttrs = {\n\t\tcolspan: {\n\t\t\tdefault: 1,\n\t\t\tvalidate: \"number\"\n\t\t},\n\t\trowspan: {\n\t\t\tdefault: 1,\n\t\t\tvalidate: \"number\"\n\t\t},\n\t\tcolwidth: {\n\t\t\tdefault: null,\n\t\t\tvalidate: validateColwidth\n\t\t}\n\t};\n\tfor (const prop in extraAttrs) cellAttrs[prop] = {\n\t\tdefault: extraAttrs[prop].default,\n\t\tvalidate: extraAttrs[prop].validate\n\t};\n\treturn {\n\t\ttable: {\n\t\t\tcontent: \"table_row+\",\n\t\t\ttableRole: \"table\",\n\t\t\tisolating: true,\n\t\t\tgroup: options.tableGroup,\n\t\t\tparseDOM: [{ tag: \"table\" }],\n\t\t\ttoDOM() {\n\t\t\t\treturn [\"table\", [\"tbody\", 0]];\n\t\t\t}\n\t\t},\n\t\ttable_row: {\n\t\t\tcontent: \"(table_cell | table_header)*\",\n\t\t\ttableRole: \"row\",\n\t\t\tparseDOM: [{ tag: \"tr\" }],\n\t\t\ttoDOM() {\n\t\t\t\treturn [\"tr\", 0];\n\t\t\t}\n\t\t},\n\t\ttable_cell: {\n\t\t\tcontent: options.cellContent,\n\t\t\tattrs: cellAttrs,\n\t\t\ttableRole: \"cell\",\n\t\t\tisolating: true,\n\t\t\tparseDOM: [{\n\t\t\t\ttag: \"td\",\n\t\t\t\tgetAttrs: (dom) => getCellAttrs(dom, extraAttrs)\n\t\t\t}],\n\t\t\ttoDOM(node) {\n\t\t\t\treturn [\n\t\t\t\t\t\"td\",\n\t\t\t\t\tsetCellAttrs(node, extraAttrs),\n\t\t\t\t\t0\n\t\t\t\t];\n\t\t\t}\n\t\t},\n\t\ttable_header: {\n\t\t\tcontent: options.cellContent,\n\t\t\tattrs: cellAttrs,\n\t\t\ttableRole: \"header_cell\",\n\t\t\tisolating: true,\n\t\t\tparseDOM: [{\n\t\t\t\ttag: \"th\",\n\t\t\t\tgetAttrs: (dom) => getCellAttrs(dom, extraAttrs)\n\t\t\t}],\n\t\t\ttoDOM(node) {\n\t\t\t\treturn [\n\t\t\t\t\t\"th\",\n\t\t\t\t\tsetCellAttrs(node, extraAttrs),\n\t\t\t\t\t0\n\t\t\t\t];\n\t\t\t}\n\t\t}\n\t};\n}\n/**\n* @public\n*/\nfunction tableNodeTypes(schema) {\n\tlet result = schema.cached.tableNodeTypes;\n\tif (!result) {\n\t\tresult = schema.cached.tableNodeTypes = {};\n\t\tfor (const name in schema.nodes) {\n\t\t\tconst type = schema.nodes[name], role = type.spec.tableRole;\n\t\t\tif (role) result[role] = type;\n\t\t}\n\t}\n\treturn result;\n}\n\n//#endregion\n//#region src/util.ts\n/**\n* @public\n*/\nconst tableEditingKey = new PluginKey(\"selectingCells\");\n/**\n* @public\n*/\nfunction cellAround($pos) {\n\tfor (let d = $pos.depth - 1; d > 0; d--) if ($pos.node(d).type.spec.tableRole == \"row\") return $pos.node(0).resolve($pos.before(d + 1));\n\treturn null;\n}\nfunction cellWrapping($pos) {\n\tfor (let d = $pos.depth; d > 0; d--) {\n\t\tconst role = $pos.node(d).type.spec.tableRole;\n\t\tif (role === \"cell\" || role === \"header_cell\") return $pos.node(d);\n\t}\n\treturn null;\n}\n/**\n* @public\n*/\nfunction isInTable(state) {\n\tconst $head = state.selection.$head;\n\tfor (let d = $head.depth; d > 0; d--) if ($head.node(d).type.spec.tableRole == \"row\") return true;\n\treturn false;\n}\n/**\n* @internal\n*/\nfunction selectionCell(state) {\n\tconst sel = state.selection;\n\tif (\"$anchorCell\" in sel && sel.$anchorCell) return sel.$anchorCell.pos > sel.$headCell.pos ? sel.$anchorCell : sel.$headCell;\n\telse if (\"node\" in sel && sel.node && sel.node.type.spec.tableRole == \"cell\") return sel.$anchor;\n\tconst $cell = cellAround(sel.$head) || cellNear(sel.$head);\n\tif ($cell) return $cell;\n\tthrow new RangeError(`No cell found around position ${sel.head}`);\n}\n/**\n* @public\n*/\nfunction cellNear($pos) {\n\tfor (let after = $pos.nodeAfter, pos = $pos.pos; after; after = after.firstChild, pos++) {\n\t\tconst role = after.type.spec.tableRole;\n\t\tif (role == \"cell\" || role == \"header_cell\") return $pos.doc.resolve(pos);\n\t}\n\tfor (let before = $pos.nodeBefore, pos = $pos.pos; before; before = before.lastChild, pos--) {\n\t\tconst role = before.type.spec.tableRole;\n\t\tif (role == \"cell\" || role == \"header_cell\") return $pos.doc.resolve(pos - before.nodeSize);\n\t}\n}\n/**\n* @public\n*/\nfunction pointsAtCell($pos) {\n\treturn $pos.parent.type.spec.tableRole == \"row\" && !!$pos.nodeAfter;\n}\n/**\n* @public\n*/\nfunction moveCellForward($pos) {\n\treturn $pos.node(0).resolve($pos.pos + $pos.nodeAfter.nodeSize);\n}\n/**\n* @internal\n*/\nfunction inSameTable($cellA, $cellB) {\n\treturn $cellA.depth == $cellB.depth && $cellA.pos >= $cellB.start(-1) && $cellA.pos <= $cellB.end(-1);\n}\n/**\n* @public\n*/\nfunction findCell($pos) {\n\treturn TableMap.get($pos.node(-1)).findCell($pos.pos - $pos.start(-1));\n}\n/**\n* @public\n*/\nfunction colCount($pos) {\n\treturn TableMap.get($pos.node(-1)).colCount($pos.pos - $pos.start(-1));\n}\n/**\n* @public\n*/\nfunction nextCell($pos, axis, dir) {\n\tconst table = $pos.node(-1);\n\tconst map = TableMap.get(table);\n\tconst tableStart = $pos.start(-1);\n\tconst moved = map.nextCell($pos.pos - tableStart, axis, dir);\n\treturn moved == null ? null : $pos.node(0).resolve(tableStart + moved);\n}\n/**\n* @public\n*/\nfunction removeColSpan(attrs, pos, n = 1) {\n\tconst result = {\n\t\t...attrs,\n\t\tcolspan: attrs.colspan - n\n\t};\n\tif (result.colwidth) {\n\t\tresult.colwidth = result.colwidth.slice();\n\t\tresult.colwidth.splice(pos, n);\n\t\tif (!result.colwidth.some((w) => w > 0)) result.colwidth = null;\n\t}\n\treturn result;\n}\n/**\n* @public\n*/\nfunction addColSpan(attrs, pos, n = 1) {\n\tconst result = {\n\t\t...attrs,\n\t\tcolspan: attrs.colspan + n\n\t};\n\tif (result.colwidth) {\n\t\tresult.colwidth = result.colwidth.slice();\n\t\tfor (let i = 0; i < n; i++) result.colwidth.splice(pos, 0, 0);\n\t}\n\treturn result;\n}\n/**\n* @public\n*/\nfunction columnIsHeader(map, table, col) {\n\tconst headerCell = tableNodeTypes(table.type.schema).header_cell;\n\tfor (let row = 0; row < map.height; row++) if (table.nodeAt(map.map[col + row * map.width]).type != headerCell) return false;\n\treturn true;\n}\n\n//#endregion\n//#region src/cellselection.ts\n/**\n* A [`Selection`](http://prosemirror.net/docs/ref/#state.Selection)\n* subclass that represents a cell selection spanning part of a table.\n* With the plugin enabled, these will be created when the user\n* selects across cells, and will be drawn by giving selected cells a\n* `selectedCell` CSS class.\n*\n* @public\n*/\nvar CellSelection = class CellSelection extends Selection {\n\tconstructor($anchorCell, $headCell = $anchorCell) {\n\t\tconst table = $anchorCell.node(-1);\n\t\tconst map = TableMap.get(table);\n\t\tconst tableStart = $anchorCell.start(-1);\n\t\tconst rect = map.rectBetween($anchorCell.pos - tableStart, $headCell.pos - tableStart);\n\t\tconst doc = $anchorCell.node(0);\n\t\tconst cells = map.cellsInRect(rect).filter((p) => p != $headCell.pos - tableStart);\n\t\tcells.unshift($headCell.pos - tableStart);\n\t\tconst ranges = cells.map((pos) => {\n\t\t\tconst cell = table.nodeAt(pos);\n\t\t\tif (!cell) throw new RangeError(`No cell with offset ${pos} found`);\n\t\t\tconst from = tableStart + pos + 1;\n\t\t\treturn new SelectionRange(doc.resolve(from), doc.resolve(from + cell.content.size));\n\t\t});\n\t\tsuper(ranges[0].$from, ranges[0].$to, ranges);\n\t\tthis.$anchorCell = $anchorCell;\n\t\tthis.$headCell = $headCell;\n\t}\n\tmap(doc, mapping) {\n\t\tconst $anchorCell = doc.resolve(mapping.map(this.$anchorCell.pos));\n\t\tconst $headCell = doc.resolve(mapping.map(this.$headCell.pos));\n\t\tif (pointsAtCell($anchorCell) && pointsAtCell($headCell) && inSameTable($anchorCell, $headCell)) {\n\t\t\tconst tableChanged = this.$anchorCell.node(-1) != $anchorCell.node(-1);\n\t\t\tif (tableChanged && this.isRowSelection()) return CellSelection.rowSelection($anchorCell, $headCell);\n\t\t\telse if (tableChanged && this.isColSelection()) return CellSelection.colSelection($anchorCell, $headCell);\n\t\t\telse return new CellSelection($anchorCell, $headCell);\n\t\t}\n\t\treturn TextSelection.between($anchorCell, $headCell);\n\t}\n\tcontent() {\n\t\tconst table = this.$anchorCell.node(-1);\n\t\tconst map = TableMap.get(table);\n\t\tconst tableStart = this.$anchorCell.start(-1);\n\t\tconst rect = map.rectBetween(this.$anchorCell.pos - tableStart, this.$headCell.pos - tableStart);\n\t\tconst seen = {};\n\t\tconst rows = [];\n\t\tfor (let row = rect.top; row < rect.bottom; row++) {\n\t\t\tconst rowContent = [];\n\t\t\tfor (let index = row * map.width + rect.left, col = rect.left; col < rect.right; col++, index++) {\n\t\t\t\tconst pos = map.map[index];\n\t\t\t\tif (seen[pos]) continue;\n\t\t\t\tseen[pos] = true;\n\t\t\t\tconst cellRect = map.findCell(pos);\n\t\t\t\tlet cell = table.nodeAt(pos);\n\t\t\t\tif (!cell) throw new RangeError(`No cell with offset ${pos} found`);\n\t\t\t\tconst extraLeft = rect.left - cellRect.left;\n\t\t\t\tconst extraRight = cellRect.right - rect.right;\n\t\t\t\tif (extraLeft > 0 || extraRight > 0) {\n\t\t\t\t\tlet attrs = cell.attrs;\n\t\t\t\t\tif (extraLeft > 0) attrs = removeColSpan(attrs, 0, extraLeft);\n\t\t\t\t\tif (extraRight > 0) attrs = removeColSpan(attrs, attrs.colspan - extraRight, extraRight);\n\t\t\t\t\tif (cellRect.left < rect.left) {\n\t\t\t\t\t\tcell = cell.type.createAndFill(attrs);\n\t\t\t\t\t\tif (!cell) throw new RangeError(`Could not create cell with attrs ${JSON.stringify(attrs)}`);\n\t\t\t\t\t} else cell = cell.type.create(attrs, cell.content);\n\t\t\t\t}\n\t\t\t\tif (cellRect.top < rect.top || cellRect.bottom > rect.bottom) {\n\t\t\t\t\tconst attrs = {\n\t\t\t\t\t\t...cell.attrs,\n\t\t\t\t\t\trowspan: Math.min(cellRect.bottom, rect.bottom) - Math.max(cellRect.top, rect.top)\n\t\t\t\t\t};\n\t\t\t\t\tif (cellRect.top < rect.top) cell = cell.type.createAndFill(attrs);\n\t\t\t\t\telse cell = cell.type.create(attrs, cell.content);\n\t\t\t\t}\n\t\t\t\trowContent.push(cell);\n\t\t\t}\n\t\t\trows.push(table.child(row).copy(Fragment.from(rowContent)));\n\t\t}\n\t\tconst fragment = this.isColSelection() && this.isRowSelection() ? table : rows;\n\t\treturn new Slice(Fragment.from(fragment), 1, 1);\n\t}\n\treplace(tr, content = Slice.empty) {\n\t\tconst mapFrom = tr.steps.length, ranges = this.ranges;\n\t\tfor (let i = 0; i < ranges.length; i++) {\n\t\t\tconst { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);\n\t\t\ttr.replace(mapping.map($from.pos), mapping.map($to.pos), i ? Slice.empty : content);\n\t\t}\n\t\tconst sel = Selection.findFrom(tr.doc.resolve(tr.mapping.slice(mapFrom).map(this.to)), -1);\n\t\tif (sel) tr.setSelection(sel);\n\t}\n\treplaceWith(tr, node) {\n\t\tthis.replace(tr, new Slice(Fragment.from(node), 0, 0));\n\t}\n\tforEachCell(f) {\n\t\tconst table = this.$anchorCell.node(-1);\n\t\tconst map = TableMap.get(table);\n\t\tconst tableStart = this.$anchorCell.start(-1);\n\t\tconst cells = map.cellsInRect(map.rectBetween(this.$anchorCell.pos - tableStart, this.$headCell.pos - tableStart));\n\t\tfor (let i = 0; i < cells.length; i++) f(table.nodeAt(cells[i]), tableStart + cells[i]);\n\t}\n\tisColSelection() {\n\t\tconst anchorTop = this.$anchorCell.index(-1);\n\t\tconst headTop = this.$headCell.index(-1);\n\t\tif (Math.min(anchorTop, headTop) > 0) return false;\n\t\tconst anchorBottom = anchorTop + this.$anchorCell.nodeAfter.attrs.rowspan;\n\t\tconst headBottom = headTop + this.$headCell.nodeAfter.attrs.rowspan;\n\t\treturn Math.max(anchorBottom, headBottom) == this.$headCell.node(-1).childCount;\n\t}\n\tstatic colSelection($anchorCell, $headCell = $anchorCell) {\n\t\tconst table = $anchorCell.node(-1);\n\t\tconst map = TableMap.get(table);\n\t\tconst tableStart = $anchorCell.start(-1);\n\t\tconst anchorRect = map.findCell($anchorCell.pos - tableStart);\n\t\tconst headRect = map.findCell($headCell.pos - tableStart);\n\t\tconst doc = $anchorCell.node(0);\n\t\tif (anchorRect.top <= headRect.top) {\n\t\t\tif (anchorRect.top > 0) $anchorCell = doc.resolve(tableStart + map.map[anchorRect.left]);\n\t\t\tif (headRect.bottom < map.height) $headCell = doc.resolve(tableStart + map.map[map.width * (map.height - 1) + headRect.right - 1]);\n\t\t} else {\n\t\t\tif (headRect.top > 0) $headCell = doc.resolve(tableStart + map.map[headRect.left]);\n\t\t\tif (anchorRect.bottom < map.height) $anchorCell = doc.resolve(tableStart + map.map[map.width * (map.height - 1) + anchorRect.right - 1]);\n\t\t}\n\t\treturn new CellSelection($anchorCell, $headCell);\n\t}\n\tisRowSelection() {\n\t\tconst table = this.$anchorCell.node(-1);\n\t\tconst map = TableMap.get(table);\n\t\tconst tableStart = this.$anchorCell.start(-1);\n\t\tconst anchorLeft = map.colCount(this.$anchorCell.pos - tableStart);\n\t\tconst headLeft = map.colCount(this.$headCell.pos - tableStart);\n\t\tif (Math.min(anchorLeft, headLeft) > 0) return false;\n\t\tconst anchorRight = anchorLeft + this.$anchorCell.nodeAfter.attrs.colspan;\n\t\tconst headRight = headLeft + this.$headCell.nodeAfter.attrs.colspan;\n\t\treturn Math.max(anchorRight, headRight) == map.width;\n\t}\n\teq(other) {\n\t\treturn other instanceof CellSelection && other.$anchorCell.pos == this.$anchorCell.pos && other.$headCell.pos == this.$headCell.pos;\n\t}\n\tstatic rowSelection($anchorCell, $headCell = $anchorCell) {\n\t\tconst table = $anchorCell.node(-1);\n\t\tconst map = TableMap.get(table);\n\t\tconst tableStart = $anchorCell.start(-1);\n\t\tconst anchorRect = map.findCell($anchorCell.pos - tableStart);\n\t\tconst headRect = map.findCell($headCell.pos - tableStart);\n\t\tconst doc = $anchorCell.node(0);\n\t\tif (anchorRect.left <= headRect.left) {\n\t\t\tif (anchorRect.left > 0) $anchorCell = doc.resolve(tableStart + map.map[anchorRect.top * map.width]);\n\t\t\tif (headRect.right < map.width) $headCell = doc.resolve(tableStart + map.map[map.width * (headRect.top + 1) - 1]);\n\t\t} else {\n\t\t\tif (headRect.left > 0) $headCell = doc.resolve(tableStart + map.map[headRect.top * map.width]);\n\t\t\tif (anchorRect.right < map.width) $anchorCell = doc.resolve(tableStart + map.map[map.width * (anchorRect.top + 1) - 1]);\n\t\t}\n\t\treturn new CellSelection($anchorCell, $headCell);\n\t}\n\ttoJSON() {\n\t\treturn {\n\t\t\ttype: \"cell\",\n\t\t\tanchor: this.$anchorCell.pos,\n\t\t\thead: this.$headCell.pos\n\t\t};\n\t}\n\tstatic fromJSON(doc, json) {\n\t\treturn new CellSelection(doc.resolve(json.anchor), doc.resolve(json.head));\n\t}\n\tstatic create(doc, anchorCell, headCell = anchorCell) {\n\t\treturn new CellSelection(doc.resolve(anchorCell), doc.resolve(headCell));\n\t}\n\tgetBookmark() {\n\t\treturn new CellBookmark(this.$anchorCell.pos, this.$headCell.pos);\n\t}\n};\nCellSelection.prototype.visible = false;\nSelection.jsonID(\"cell\", CellSelection);\n/**\n* @public\n*/\nvar CellBookmark = class CellBookmark {\n\tconstructor(anchor, head) {\n\t\tthis.anchor = anchor;\n\t\tthis.head = head;\n\t}\n\tmap(mapping) {\n\t\treturn new CellBookmark(mapping.map(this.anchor), mapping.map(this.head));\n\t}\n\tresolve(doc) {\n\t\tconst $anchorCell = doc.resolve(this.anchor), $headCell = doc.resolve(this.head);\n\t\tif ($anchorCell.parent.type.spec.tableRole == \"row\" && $headCell.parent.type.spec.tableRole == \"row\" && $anchorCell.index() < $anchorCell.parent.childCount && $headCell.index() < $headCell.parent.childCount && inSameTable($anchorCell, $headCell)) return new CellSelection($anchorCell, $headCell);\n\t\telse return Selection.near($headCell, 1);\n\t}\n};\nfunction drawCellSelection(state) {\n\tif (!(state.selection instanceof CellSelection)) return null;\n\tconst cells = [];\n\tstate.selection.forEachCell((node, pos) => {\n\t\tcells.push(Decoration.node(pos, pos + node.nodeSize, { class: \"selectedCell\" }));\n\t});\n\treturn DecorationSet.create(state.doc, cells);\n}\nfunction isCellBoundarySelection({ $from, $to }) {\n\tif ($from.pos == $to.pos || $from.pos < $to.pos - 6) return false;\n\tlet afterFrom = $from.pos;\n\tlet beforeTo = $to.pos;\n\tlet depth = $from.depth;\n\tfor (; depth >= 0; depth--, afterFrom++) if ($from.after(depth + 1) < $from.end(depth)) break;\n\tfor (let d = $to.depth; d >= 0; d--, beforeTo--) if ($to.before(d + 1) > $to.start(d)) break;\n\treturn afterFrom == beforeTo && /row|table/.test($from.node(depth).type.spec.tableRole);\n}\nfunction isTextSelectionAcrossCells({ $from, $to }) {\n\tlet fromCellBoundaryNode;\n\tlet toCellBoundaryNode;\n\tfor (let i = $from.depth; i > 0; i--) {\n\t\tconst node = $from.node(i);\n\t\tif (node.type.spec.tableRole === \"cell\" || node.type.spec.tableRole === \"header_cell\") {\n\t\t\tfromCellBoundaryNode = node;\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor (let i = $to.depth; i > 0; i--) {\n\t\tconst node = $to.node(i);\n\t\tif (node.type.spec.tableRole === \"cell\" || node.type.spec.tableRole === \"header_cell\") {\n\t\t\ttoCellBoundaryNode = node;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn fromCellBoundaryNode !== toCellBoundaryNode && $to.parentOffset === 0;\n}\nfunction normalizeSelection(state, tr, allowTableNodeSelection) {\n\tconst sel = (tr || state).selection;\n\tconst doc = (tr || state).doc;\n\tlet normalize;\n\tlet role;\n\tif (sel instanceof NodeSelection && (role = sel.node.type.spec.tableRole)) {\n\t\tif (role == \"cell\" || role == \"header_cell\") normalize = CellSelection.create(doc, sel.from);\n\t\telse if (role == \"row\") {\n\t\t\tconst $cell = doc.resolve(sel.from + 1);\n\t\t\tnormalize = CellSelection.rowSelection($cell, $cell);\n\t\t} else if (!allowTableNodeSelection) {\n\t\t\tconst map = TableMap.get(sel.node);\n\t\t\tconst start = sel.from + 1;\n\t\t\tconst lastCell = start + map.map[map.width * map.height - 1];\n\t\t\tnormalize = CellSelection.create(doc, start + 1, lastCell);\n\t\t}\n\t} else if (sel instanceof TextSelection && isCellBoundarySelection(sel)) normalize = TextSelection.create(doc, sel.from);\n\telse if (sel instanceof TextSelection && isTextSelectionAcrossCells(sel)) normalize = TextSelection.create(doc, sel.$from.start(), sel.$from.end());\n\tif (normalize) (tr || (tr = state.tr)).setSelection(normalize);\n\treturn tr;\n}\n\n//#endregion\n//#region src/fixtables.ts\n/**\n* @public\n*/\nconst fixTablesKey = new PluginKey(\"fix-tables\");\n/**\n* Helper for iterating through the nodes in a document that changed\n* compared to the given previous document. Useful for avoiding\n* duplicate work on each transaction.\n*\n* @public\n*/\nfunction changedDescendants(old, cur, offset, f) {\n\tconst oldSize = old.childCount, curSize = cur.childCount;\n\touter: for (let i = 0, j = 0; i < curSize; i++) {\n\t\tconst child = cur.child(i);\n\t\tfor (let scan = j, e = Math.min(oldSize, i + 3); scan < e; scan++) if (old.child(scan) == child) {\n\t\t\tj = scan + 1;\n\t\t\toffset += child.nodeSize;\n\t\t\tcontinue outer;\n\t\t}\n\t\tf(child, offset);\n\t\tif (j < oldSize && old.child(j).sameMarkup(child)) changedDescendants(old.child(j), child, offset + 1, f);\n\t\telse child.nodesBetween(0, child.content.size, f, offset + 1);\n\t\toffset += child.nodeSize;\n\t}\n}\n/**\n* Inspect all tables in the given state's document and return a\n* transaction that fixes them, if necessary. If `oldState` was\n* provided, that is assumed to hold a previous, known-good state,\n* which will be used to avoid re-scanning unchanged parts of the\n* document.\n*\n* @public\n*/\nfunction fixTables(state, oldState) {\n\tlet tr;\n\tconst check = (node, pos) => {\n\t\tif (node.type.spec.tableRole == \"table\") tr = fixTable(state, node, pos, tr);\n\t};\n\tif (!oldState) state.doc.descendants(check);\n\telse if (oldState.doc != state.doc) changedDescendants(oldState.doc, state.doc, 0, check);\n\treturn tr;\n}\nfunction fixTable(state, table, tablePos, tr) {\n\tconst map = TableMap.get(table);\n\tif (!map.problems) return tr;\n\tif (!tr) tr = state.tr;\n\tconst mustAdd = [];\n\tfor (let i = 0; i < map.height; i++) mustAdd.push(0);\n\tfor (let i = 0; i < map.problems.length; i++) {\n\t\tconst prob = map.problems[i];\n\t\tif (prob.type == \"collision\") {\n\t\t\tconst cell = table.nodeAt(prob.pos);\n\t\t\tif (!cell) continue;\n\t\t\tconst attrs = cell.attrs;\n\t\t\tfor (let j = 0; j < attrs.rowspan; j++) mustAdd[prob.row + j] += prob.n;\n\t\t\ttr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, removeColSpan(attrs, attrs.colspan - prob.n, prob.n));\n\t\t} else if (prob.type == \"missing\") mustAdd[prob.row] += prob.n;\n\t\telse if (prob.type == \"overlong_rowspan\") {\n\t\t\tconst cell = table.nodeAt(prob.pos);\n\t\t\tif (!cell) continue;\n\t\t\ttr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, {\n\t\t\t\t...cell.attrs,\n\t\t\t\trowspan: cell.attrs.rowspan - prob.n\n\t\t\t});\n\t\t} else if (prob.type == \"colwidth mismatch\") {\n\t\t\tconst cell = table.nodeAt(prob.pos);\n\t\t\tif (!cell) continue;\n\t\t\ttr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, {\n\t\t\t\t...cell.attrs,\n\t\t\t\tcolwidth: prob.colwidth\n\t\t\t});\n\t\t} else if (prob.type == \"zero_sized\") {\n\t\t\tconst pos = tr.mapping.map(tablePos);\n\t\t\ttr.delete(pos, pos + table.nodeSize);\n\t\t}\n\t}\n\tlet first, last;\n\tfor (let i = 0; i < mustAdd.length; i++) if (mustAdd[i]) {\n\t\tif (first == null) first = i;\n\t\tlast = i;\n\t}\n\tfor (let i = 0, pos = tablePos + 1; i < map.height; i++) {\n\t\tconst row = table.child(i);\n\t\tconst end = pos + row.nodeSize;\n\t\tconst add = mustAdd[i];\n\t\tif (add > 0) {\n\t\t\tlet role = \"cell\";\n\t\t\tif (row.firstChild) role = row.firstChild.type.spec.tableRole;\n\t\t\tconst nodes = [];\n\t\t\tfor (let j = 0; j < add; j++) {\n\t\t\t\tconst node = tableNodeTypes(state.schema)[role].createAndFill();\n\t\t\t\tif (node) nodes.push(node);\n\t\t\t}\n\t\t\tconst side = (i == 0 || first == i - 1) && last == i ? pos + 1 : end - 1;\n\t\t\ttr.insert(tr.mapping.map(side), nodes);\n\t\t}\n\t\tpos = end;\n\t}\n\treturn tr.setMeta(fixTablesKey, { fixTables: true });\n}\n\n//#endregion\n//#region src/utils/convert.ts\n/**\n* This function will transform the table node into a matrix of rows and columns\n* respecting merged cells, for example this table:\n*\n* ```\n* ┌──────┬──────┬─────────────┐\n* │ A1 │ B1 │ C1 │\n* ├──────┼──────┴──────┬──────┤\n* │ A2 │ B2 │ │\n* ├──────┼─────────────┤ D1 │\n* │ A3 │ B3 │ C3 │ │\n* └──────┴──────┴──────┴──────┘\n* ```\n*\n* will be converted to the below:\n*\n* ```javascript\n* [\n* [A1, B1, C1, null],\n* [A2, B2, null, D1],\n* [A3, B3, C3, null],\n* ]\n* ```\n* @internal\n*/\nfunction convertTableNodeToArrayOfRows(tableNode) {\n\tconst map = TableMap.get(tableNode);\n\tconst rows = [];\n\tconst rowCount = map.height;\n\tconst colCount$1 = map.width;\n\tfor (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n\t\tconst row = [];\n\t\tfor (let colIndex = 0; colIndex < colCount$1; colIndex++) {\n\t\t\tconst cellIndex = rowIndex * colCount$1 + colIndex;\n\t\t\tconst cellPos = map.map[cellIndex];\n\t\t\tif (rowIndex > 0) {\n\t\t\t\tconst topCellIndex = cellIndex - colCount$1;\n\t\t\t\tif (cellPos === map.map[topCellIndex]) {\n\t\t\t\t\trow.push(null);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (colIndex > 0) {\n\t\t\t\tconst leftCellIndex = cellIndex - 1;\n\t\t\t\tif (cellPos === map.map[leftCellIndex]) {\n\t\t\t\t\trow.push(null);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\trow.push(tableNode.nodeAt(cellPos));\n\t\t}\n\t\trows.push(row);\n\t}\n\treturn rows;\n}\n/**\n* Convert an array of rows to a table node.\n*\n* @internal\n*/\nfunction convertArrayOfRowsToTableNode(tableNode, arrayOfNodes) {\n\tconst newRows = [];\n\tconst map = TableMap.get(tableNode);\n\tconst rowCount = map.height;\n\tconst colCount$1 = map.width;\n\tfor (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n\t\tconst oldRow = tableNode.child(rowIndex);\n\t\tconst newCells = [];\n\t\tfor (let colIndex = 0; colIndex < colCount$1; colIndex++) {\n\t\t\tconst cell = arrayOfNodes[rowIndex][colIndex];\n\t\t\tif (!cell) continue;\n\t\t\tconst cellPos = map.map[rowIndex * map.width + colIndex];\n\t\t\tconst oldCell = tableNode.nodeAt(cellPos);\n\t\t\tif (!oldCell) continue;\n\t\t\tconst newCell = oldCell.type.createChecked(cell.attrs, cell.content, cell.marks);\n\t\t\tnewCells.push(newCell);\n\t\t}\n\t\tconst newRow = oldRow.type.createChecked(oldRow.attrs, newCells, oldRow.marks);\n\t\tnewRows.push(newRow);\n\t}\n\treturn tableNode.type.createChecked(tableNode.attrs, newRows, tableNode.marks);\n}\n\n//#endregion\n//#region src/utils/move-row-in-array-of-rows.ts\n/**\n* Move a row in an array of rows.\n*\n* @internal\n*/\nfunction moveRowInArrayOfRows(rows, indexesOrigin, indexesTarget, directionOverride) {\n\tconst direction = indexesOrigin[0] > indexesTarget[0] ? -1 : 1;\n\tconst rowsExtracted = rows.splice(indexesOrigin[0], indexesOrigin.length);\n\tconst positionOffset = rowsExtracted.length % 2 === 0 ? 1 : 0;\n\tlet target;\n\tif (directionOverride === -1 && direction === 1) target = indexesTarget[0] - 1;\n\telse if (directionOverride === 1 && direction === -1) target = indexesTarget[indexesTarget.length - 1] - positionOffset + 1;\n\telse target = direction === -1 ? indexesTarget[0] : indexesTarget[indexesTarget.length - 1] - positionOffset;\n\trows.splice(target, 0, ...rowsExtracted);\n\treturn rows;\n}\n\n//#endregion\n//#region src/utils/query.ts\n/**\n* Checks if the given object is a `CellSelection` instance.\n*\n* @internal\n*/\nfunction isCellSelection(value) {\n\treturn value instanceof CellSelection;\n}\n/**\n* Find the closest table node for a given position.\n*\n* @public\n*/\nfunction findTable($pos) {\n\treturn findParentNode((node) => node.type.spec.tableRole === \"table\", $pos);\n}\n/**\n* Try to find the anchor and head cell in the same table by using the given\n* anchor and head as hit points, or fallback to the selection's anchor and\n* head.\n*\n* @public\n*/\nfunction findCellRange(selection, anchorHit, headHit) {\n\tvar _ref, _ref2;\n\tif (anchorHit == null && headHit == null && isCellSelection(selection)) return [selection.$anchorCell, selection.$headCell];\n\tconst anchor = (_ref = anchorHit !== null && anchorHit !== void 0 ? anchorHit : headHit) !== null && _ref !== void 0 ? _ref : selection.anchor;\n\tconst head = (_ref2 = headHit !== null && headHit !== void 0 ? headHit : anchorHit) !== null && _ref2 !== void 0 ? _ref2 : selection.head;\n\tconst doc = selection.$head.doc;\n\tconst $anchorCell = findCellPos(doc, anchor);\n\tconst $headCell = findCellPos(doc, head);\n\tif ($anchorCell && $headCell && inSameTable($anchorCell, $headCell)) return [$anchorCell, $headCell];\n\treturn null;\n}\n/**\n* Try to find a resolved pos of a cell by using the given pos as a hit point.\n*\n* @public\n*/\nfunction findCellPos(doc, pos) {\n\tconst $pos = doc.resolve(pos);\n\treturn cellAround($pos) || cellNear($pos);\n}\n/**\n* Find the closest parent node that satisfies the predicate.\n*\n* @internal\n*/\nfunction findParentNode(predicate, $pos) {\n\tfor (let depth = $pos.depth; depth >= 0; depth -= 1) {\n\t\tconst node = $pos.node(depth);\n\t\tif (predicate(node)) return {\n\t\t\tnode,\n\t\t\tpos: depth === 0 ? 0 : $pos.before(depth),\n\t\t\tstart: $pos.start(depth),\n\t\t\tdepth\n\t\t};\n\t}\n\treturn null;\n}\n\n//#endregion\n//#region src/utils/get-cells.ts\n/**\n* Returns an array of cells in a column at the specified column index.\n*\n* @internal\n*/\nfunction getCellsInColumn(columnIndex, selection) {\n\tconst table = findTable(selection.$from);\n\tif (!table) return;\n\tconst map = TableMap.get(table.node);\n\tif (columnIndex < 0 || columnIndex > map.width - 1) return;\n\treturn map.cellsInRect({\n\t\tleft: columnIndex,\n\t\tright: columnIndex + 1,\n\t\ttop: 0,\n\t\tbottom: map.height\n\t}).map((nodePos) => {\n\t\tconst node = table.node.nodeAt(nodePos);\n\t\tconst pos = nodePos + table.start;\n\t\treturn {\n\t\t\tpos,\n\t\t\tstart: pos + 1,\n\t\t\tnode,\n\t\t\tdepth: table.depth + 2\n\t\t};\n\t});\n}\n/**\n* Returns an array of cells in a row at the specified row index.\n*\n* @internal\n*/\nfunction getCellsInRow(rowIndex, selection) {\n\tconst table = findTable(selection.$from);\n\tif (!table) return;\n\tconst map = TableMap.get(table.node);\n\tif (rowIndex < 0 || rowIndex > map.height - 1) return;\n\treturn map.cellsInRect({\n\t\tleft: 0,\n\t\tright: map.width,\n\t\ttop: rowIndex,\n\t\tbottom: rowIndex + 1\n\t}).map((nodePos) => {\n\t\tconst node = table.node.nodeAt(nodePos);\n\t\tconst pos = nodePos + table.start;\n\t\treturn {\n\t\t\tpos,\n\t\t\tstart: pos + 1,\n\t\t\tnode,\n\t\t\tdepth: table.depth + 2\n\t\t};\n\t});\n}\n\n//#endregion\n//#region src/utils/selection-range.ts\n/**\n* Returns a range of rectangular selection spanning all merged cells around a\n* column at index `columnIndex`.\n*\n* Original implementation from Atlassian (Apache License 2.0)\n*\n* https://bitbucket.org/atlassian/atlassian-frontend-mirror/src/5f91cb871e8248bc3bae5ddc30bb9fd9200fadbb/editor/editor-tables/src/utils/get-selection-range-in-column.ts#editor/editor-tables/src/utils/get-selection-range-in-column.ts\n*\n* @internal\n*/\nfunction getSelectionRangeInColumn(tr, startColIndex, endColIndex = startColIndex) {\n\tlet startIndex = startColIndex;\n\tlet endIndex = endColIndex;\n\tfor (let i = startColIndex; i >= 0; i--) {\n\t\tconst cells = getCellsInColumn(i, tr.selection);\n\t\tif (cells) cells.forEach((cell) => {\n\t\t\tconst maybeEndIndex = cell.node.attrs.colspan + i - 1;\n\t\t\tif (maybeEndIndex >= startIndex) startIndex = i;\n\t\t\tif (maybeEndIndex > endIndex) endIndex = maybeEndIndex;\n\t\t});\n\t}\n\tfor (let i = startColIndex; i <= endIndex; i++) {\n\t\tconst cells = getCellsInColumn(i, tr.selection);\n\t\tif (cells) cells.forEach((cell) => {\n\t\t\tconst maybeEndIndex = cell.node.attrs.colspan + i - 1;\n\t\t\tif (cell.node.attrs.colspan > 1 && maybeEndIndex > endIndex) endIndex = maybeEndIndex;\n\t\t});\n\t}\n\tconst indexes = [];\n\tfor (let i = startIndex; i <= endIndex; i++) {\n\t\tconst maybeCells = getCellsInColumn(i, tr.selection);\n\t\tif (maybeCells && maybeCells.length > 0) indexes.push(i);\n\t}\n\tstartIndex = indexes[0];\n\tendIndex = indexes[indexes.length - 1];\n\tconst firstSelectedColumnCells = getCellsInColumn(startIndex, tr.selection);\n\tconst firstRowCells = getCellsInRow(0, tr.selection);\n\tif (!firstSelectedColumnCells || !firstRowCells) return;\n\tconst $anchor = tr.doc.resolve(firstSelectedColumnCells[firstSelectedColumnCells.length - 1].pos);\n\tlet headCell;\n\tfor (let i = endIndex; i >= startIndex; i--) {\n\t\tconst columnCells = getCellsInColumn(i, tr.selection);\n\t\tif (columnCells && columnCells.length > 0) {\n\t\t\tfor (let j = firstRowCells.length - 1; j >= 0; j--) if (firstRowCells[j].pos === columnCells[0].pos) {\n\t\t\t\theadCell = columnCells[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (headCell) break;\n\t\t}\n\t}\n\tif (!headCell) return;\n\treturn {\n\t\t$anchor,\n\t\t$head: tr.doc.resolve(headCell.pos),\n\t\tindexes\n\t};\n}\n/**\n* Returns a range of rectangular selection spanning all merged cells around a\n* row at index `rowIndex`.\n*\n* Original implementation from Atlassian (Apache License 2.0)\n*\n* https://bitbucket.org/atlassian/atlassian-frontend-mirror/src/5f91cb871e8248bc3bae5ddc30bb9fd9200fadbb/editor/editor-tables/src/utils/get-selection-range-in-row.ts#editor/editor-tables/src/utils/get-selection-range-in-row.ts\n*\n* @internal\n*/\nfunction getSelectionRangeInRow(tr, startRowIndex, endRowIndex = startRowIndex) {\n\tlet startIndex = startRowIndex;\n\tlet endIndex = endRowIndex;\n\tfor (let i = startRowIndex; i >= 0; i--) {\n\t\tconst cells = getCellsInRow(i, tr.selection);\n\t\tif (cells) cells.forEach((cell) => {\n\t\t\tconst maybeEndIndex = cell.node.attrs.rowspan + i - 1;\n\t\t\tif (maybeEndIndex >= startIndex) startIndex = i;\n\t\t\tif (maybeEndIndex > endIndex) endIndex = maybeEndIndex;\n\t\t});\n\t}\n\tfor (let i = startRowIndex; i <= endIndex; i++) {\n\t\tconst cells = getCellsInRow(i, tr.selection);\n\t\tif (cells) cells.forEach((cell) => {\n\t\t\tconst maybeEndIndex = cell.node.attrs.rowspan + i - 1;\n\t\t\tif (cell.node.attrs.rowspan > 1 && maybeEndIndex > endIndex) endIndex = maybeEndIndex;\n\t\t});\n\t}\n\tconst indexes = [];\n\tfor (let i = startIndex; i <= endIndex; i++) {\n\t\tconst maybeCells = getCellsInRow(i, tr.selection);\n\t\tif (maybeCells && maybeCells.length > 0) indexes.push(i);\n\t}\n\tstartIndex = indexes[0];\n\tendIndex = indexes[indexes.length - 1];\n\tconst firstSelectedRowCells = getCellsInRow(startIndex, tr.selection);\n\tconst firstColumnCells = getCellsInColumn(0, tr.selection);\n\tif (!firstSelectedRowCells || !firstColumnCells) return;\n\tconst $anchor = tr.doc.resolve(firstSelectedRowCells[firstSelectedRowCells.length - 1].pos);\n\tlet headCell;\n\tfor (let i = endIndex; i >= startIndex; i--) {\n\t\tconst rowCells = getCellsInRow(i, tr.selection);\n\t\tif (rowCells && rowCells.length > 0) {\n\t\t\tfor (let j = firstColumnCells.length - 1; j >= 0; j--) if (firstColumnCells[j].pos === rowCells[0].pos) {\n\t\t\t\theadCell = rowCells[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (headCell) break;\n\t\t}\n\t}\n\tif (!headCell) return;\n\treturn {\n\t\t$anchor,\n\t\t$head: tr.doc.resolve(headCell.pos),\n\t\tindexes\n\t};\n}\n\n//#endregion\n//#region src/utils/transpose.ts\n/**\n* Transposes a 2D array by flipping columns to rows.\n*\n* Transposition is a familiar algebra concept where the matrix is flipped\n* along its diagonal. For more details, see:\n* https://en.wikipedia.org/wiki/Transpose\n*\n* @example\n* ```javascript\n* const arr = [\n* ['a1', 'a2', 'a3'],\n* ['b1', 'b2', 'b3'],\n* ['c1', 'c2', 'c3'],\n* ['d1', 'd2', 'd3'],\n* ];\n*\n* const result = transpose(arr);\n* result === [\n* ['a1', 'b1', 'c1', 'd1'],\n* ['a2', 'b2', 'c2', 'd2'],\n* ['a3', 'b3', 'c3', 'd3'],\n* ]\n* ```\n*/\nfunction transpose(array) {\n\treturn array[0].map((_, i) => {\n\t\treturn array.map((column) => column[i]);\n\t});\n}\n\n//#endregion\n//#region src/utils/move-column.ts\n/**\n* Move a column from index `origin` to index `target`.\n*\n* @internal\n*/\nfunction moveColumn(moveColParams) {\n\tvar _getSelectionRangeInC, _getSelectionRangeInC2;\n\tconst { tr, originIndex, targetIndex, select, pos } = moveColParams;\n\tconst table = findTable(tr.doc.resolve(pos));\n\tif (!table) return false;\n\tconst indexesOriginColumn = (_getSelectionRangeInC = getSelectionRangeInColumn(tr, originIndex)) === null || _getSelectionRangeInC === void 0 ? void 0 : _getSelectionRangeInC.indexes;\n\tconst indexesTargetColumn = (_getSelectionRangeInC2 = getSelectionRangeInColumn(tr, targetIndex)) === null || _getSelectionRangeInC2 === void 0 ? void 0 : _getSelectionRangeInC2.indexes;\n\tif (!indexesOriginColumn || !indexesTargetColumn) return false;\n\tif (indexesOriginColumn.includes(targetIndex)) return false;\n\tconst newTable = moveTableColumn$1(table.node, indexesOriginColumn, indexesTargetColumn, 0);\n\ttr.replaceWith(table.pos, table.pos + table.node.nodeSize, newTable);\n\tif (!select) return true;\n\tconst map = TableMap.get(newTable);\n\tconst start = table.start;\n\tconst index = targetIndex;\n\tconst lastCell = map.positionAt(map.height - 1, index, newTable);\n\tconst $lastCell = tr.doc.resolve(start + lastCell);\n\tconst firstCell = map.positionAt(0, index, newTable);\n\tconst $firstCell = tr.doc.resolve(start + firstCell);\n\ttr.setSelection(CellSelection.colSelection($lastCell, $firstCell));\n\treturn true;\n}\nfunction moveTableColumn$1(table, indexesOrigin, indexesTarget, direction) {\n\tlet rows = transpose(convertTableNodeToArrayOfRows(table));\n\trows = moveRowInArrayOfRows(rows, indexesOrigin, indexesTarget, direction);\n\trows = transpose(rows);\n\treturn convertArrayOfRowsToTableNode(table, rows);\n}\n\n//#endregion\n//#region src/utils/move-row.ts\n/**\n* Move a row from index `origin` to index `target`.\n*\n* @internal\n*/\nfunction moveRow(moveRowParams) {\n\tvar _getSelectionRangeInR, _getSelectionRangeInR2;\n\tconst { tr, originIndex, targetIndex, select, pos } = moveRowParams;\n\tconst table = findTable(tr.doc.resolve(pos));\n\tif (!table) return false;\n\tconst indexesOriginRow = (_getSelectionRangeInR = getSelectionRangeInRow(tr, originIndex)) === null || _getSelectionRangeInR === void 0 ? void 0 : _getSelectionRangeInR.indexes;\n\tconst indexesTargetRow = (_getSelectionRangeInR2 = getSelectionRangeInRow(tr, targetIndex)) === null || _getSelectionRangeInR2 === void 0 ? void 0 : _getSelectionRangeInR2.indexes;\n\tif (!indexesOriginRow || !indexesTargetRow) return false;\n\tif (indexesOriginRow.includes(targetIndex)) return false;\n\tconst newTable = moveTableRow$1(table.node, indexesOriginRow, indexesTargetRow, 0);\n\ttr.replaceWith(table.pos, table.pos + table.node.nodeSize, newTable);\n\tif (!select) return true;\n\tconst map = TableMap.get(newTable);\n\tconst start = table.start;\n\tconst index = targetIndex;\n\tconst lastCell = map.positionAt(index, map.width - 1, newTable);\n\tconst $lastCell = tr.doc.resolve(start + lastCell);\n\tconst firstCell = map.positionAt(index, 0, newTable);\n\tconst $firstCell = tr.doc.resolve(start + firstCell);\n\ttr.setSelection(CellSelection.rowSelection($lastCell, $firstCell));\n\treturn true;\n}\nfunction moveTableRow$1(table, indexesOrigin, indexesTarget, direction) {\n\tlet rows = convertTableNodeToArrayOfRows(table);\n\trows = moveRowInArrayOfRows(rows, indexesOrigin, indexesTarget, direction);\n\treturn convertArrayOfRowsToTableNode(table, rows);\n}\n\n//#endregion\n//#region src/commands.ts\n/**\n* Helper to get the selected rectangle in a table, if any. Adds table\n* map, table node, and table start offset to the object for\n* convenience.\n*\n* @public\n*/\nfunction selectedRect(state) {\n\tconst sel = state.selection;\n\tconst $pos = selectionCell(state);\n\tconst table = $pos.node(-1);\n\tconst tableStart = $pos.start(-1);\n\tconst map = TableMap.get(table);\n\treturn {\n\t\t...sel instanceof CellSelection ? map.rectBetween(sel.$anchorCell.pos - tableStart, sel.$headCell.pos - tableStart) : map.findCell($pos.pos - tableStart),\n\t\ttableStart,\n\t\tmap,\n\t\ttable\n\t};\n}\n/**\n* Add a column at the given position in a table.\n*\n* @public\n*/\nfunction addColumn(tr, { map, tableStart, table }, col) {\n\tlet refColumn = col > 0 ? -1 : 0;\n\tif (columnIsHeader(map, table, col + refColumn)) refColumn = col == 0 || col == map.width ? null : 0;\n\tfor (let row = 0; row < map.height; row++) {\n\t\tconst index = row * map.width + col;\n\t\tif (col > 0 && col < map.width && map.map[index - 1] == map.map[index]) {\n\t\t\tconst pos = map.map[index];\n\t\t\tconst cell = table.nodeAt(pos);\n\t\t\ttr.setNodeMarkup(tr.mapping.map(tableStart + pos), null, addColSpan(cell.attrs, col - map.colCount(pos)));\n\t\t\trow += cell.attrs.rowspan - 1;\n\t\t} else {\n\t\t\tconst type = refColumn == null ? tableNodeTypes(table.type.schema).cell : table.nodeAt(map.map[index + refColumn]).type;\n\t\t\tconst pos = map.positionAt(row, col, table);\n\t\t\ttr.insert(tr.mapping.map(tableStart + pos), type.createAndFill());\n\t\t}\n\t}\n\treturn tr;\n}\n/**\n* Command to add a column before the column with the selection.\n*\n* @public\n*/\nfunction addColumnBefore(state, dispatch) {\n\tif (!isInTable(state)) return false;\n\tif (dispatch) {\n\t\tconst rect = selectedRect(state);\n\t\tdispatch(addColumn(state.tr, rect, rect.left));\n\t}\n\treturn true;\n}\n/**\n* Command to add a column after the column with the selection.\n*\n* @public\n*/\nfunction addColumnAfter(state, dispatch) {\n\tif (!isInTable(state)) return false;\n\tif (dispatch) {\n\t\tconst rect = selectedRect(state);\n\t\tdispatch(addColumn(state.tr, rect, rect.right));\n\t}\n\treturn true;\n}\n/**\n* @public\n*/\nfunction removeColumn(tr, { map, table, tableStart }, col) {\n\tconst mapStart = tr.mapping.maps.length;\n\tfor (let row = 0; row < map.height;) {\n\t\tconst index = row * map.width + col;\n\t\tconst pos = map.map[index];\n\t\tconst cell = table.nodeAt(pos);\n\t\tconst attrs = cell.attrs;\n\t\tif (col > 0 && map.map[index - 1] == pos || col < map.width - 1 && map.map[index + 1] == pos) tr.setNodeMarkup(tr.mapping.slice(mapStart).map(tableStart + pos), null, removeColSpan(attrs, col - map.colCount(pos)));\n\t\telse {\n\t\t\tconst start = tr.mapping.slice(mapStart).map(tableStart + pos);\n\t\t\ttr.delete(start, start + cell.nodeSize);\n\t\t}\n\t\trow += attrs.rowspan;\n\t}\n}\n/**\n* Command function that removes the selected columns from a table.\n*\n* @public\n*/\nfunction deleteColumn(state, dispatch) {\n\tif (!isInTable(state)) return false;\n\tif (dispatch) {\n\t\tconst rect = selectedRect(state);\n\t\tconst tr = state.tr;\n\t\tif (rect.left == 0 && rect.right == rect.map.width) return false;\n\t\tfor (let i = rect.right - 1;; i--) {\n\t\t\tremoveColumn(tr, rect, i);\n\t\t\tif (i == rect.left) break;\n\t\t\tconst table = rect.tableStart ? tr.doc.nodeAt(rect.tableStart - 1) : tr.doc;\n\t\t\tif (!table) throw new RangeError(\"No table found\");\n\t\t\trect.table = table;\n\t\t\trect.map = TableMap.get(table);\n\t\t}\n\t\tdispatch(tr);\n\t}\n\treturn true;\n}\n/**\n* @public\n*/\nfunction rowIsHeader(map, table, row) {\n\tvar _table$nodeAt;\n\tconst headerCell = tableNodeTypes(table.type.schema).header_cell;\n\tfor (let col = 0; col < map.width; col++) if (((_table$nodeAt = table.nodeAt(map.map[col + row * map.width])) === null || _table$nodeAt === void 0 ? void 0 : _table$nodeAt.type) != headerCell) return false;\n\treturn true;\n}\n/**\n* @public\n*/\nfunction addRow(tr, { map, tableStart, table }, row) {\n\tlet rowPos = tableStart;\n\tfor (let i = 0; i < row; i++) rowPos += table.child(i).nodeSize;\n\tconst cells = [];\n\tlet refRow = row > 0 ? -1 : 0;\n\tif (rowIsHeader(map, table, row + refRow)) refRow = row == 0 || row == map.height ? null : 0;\n\tfor (let col = 0, index = map.width * row; col < map.width; col++, index++) if (row > 0 && row < map.height && map.map[index] == map.map[index - map.width]) {\n\t\tconst pos = map.map[index];\n\t\tconst attrs = table.nodeAt(pos).attrs;\n\t\ttr.setNodeMarkup(tableStart + pos, null, {\n\t\t\t...attrs,\n\t\t\trowspan: attrs.rowspan + 1\n\t\t});\n\t\tcol += attrs.colspan - 1;\n\t} else {\n\t\tvar _table$nodeAt2;\n\t\tconst type = refRow == null ? tableNodeTypes(table.type.schema).cell : (_table$nodeAt2 = table.nodeAt(map.map[index + refRow * map.width])) === null || _table$nodeAt2 === void 0 ? void 0 : _table$nodeAt2.type;\n\t\tconst node = type === null || type === void 0 ? void 0 : type.createAndFill();\n\t\tif (node) cells.push(node);\n\t}\n\ttr.insert(rowPos, tableNodeTypes(table.type.schema).row.create(null, cells));\n\treturn tr;\n}\n/**\n* Add a table row before the selection.\n*\n* @public\n*/\nfunction addRowBefore(state, dispatch) {\n\tif (!isInTable(state)) return false;\n\tif (dispatch) {\n\t\tconst rect = selectedRect(state);\n\t\tdispatch(addRow(state.tr, rect, rect.top));\n\t}\n\treturn true;\n}\n/**\n* Add a table row after the selection.\n*\n* @public\n*/\nfunction addRowAfter(state, dispatch) {\n\tif (!isInTable(state)) return false;\n\tif (dispatch) {\n\t\tconst rect = selectedRect(state);\n\t\tdispatch(addRow(state.tr, rect, rect.bottom));\n\t}\n\treturn true;\n}\n/**\n* @public\n*/\nfunction removeRow(tr, { map, table, tableStart }, row) {\n\tlet rowPos = 0;\n\tfor (let i = 0; i < row; i++) rowPos += table.child(i).nodeSize;\n\tconst nextRow = rowPos + table.child(row).nodeSize;\n\tconst mapFrom = tr.mapping.maps.length;\n\ttr.delete(rowPos + tableStart, nextRow + tableStart);\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (let col = 0, index = row * map.width; col < map.width; col++, index++) {\n\t\tconst pos = map.map[index];\n\t\tif (seen.has(pos)) continue;\n\t\tseen.add(pos);\n\t\tif (row > 0 && pos == map.map[index - map.width]) {\n\t\t\tconst attrs = table.nodeAt(pos).attrs;\n\t\t\ttr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos + tableStart), null, {\n\t\t\t\t...attrs,\n\t\t\t\trowspan: attrs.rowspan - 1\n\t\t\t});\n\t\t\tcol += attrs.colspan - 1;\n\t\t} else if (row < map.height && pos == map.map[index + map.width]) {\n\t\t\tconst cell = table.nodeAt(pos);\n\t\t\tconst attrs = cell.attrs;\n\t\t\tconst copy = cell.type.create({\n\t\t\t\t...attrs,\n\t\t\t\trowspan: cell.attrs.rowspan - 1\n\t\t\t}, cell.content);\n\t\t\tconst newPos = map.positionAt(row + 1, col, table);\n\t\t\ttr.insert(tr.mapping.slice(mapFrom).map(tableStart + newPos), copy);\n\t\t\tcol += attrs.colspan - 1;\n\t\t}\n\t}\n}\n/**\n* Remove the selected rows from a table.\n*\n* @public\n*/\nfunction deleteRow(state, dispatch) {\n\tif (!isInTable(state)) return false;\n\tif (dispatch) {\n\t\tconst rect = selectedRect(state), tr = state.tr;\n\t\tif (rect.top == 0 && rect.bottom == rect.map.height) return false;\n\t\tfor (let i = rect.bottom - 1;; i--) {\n\t\t\tremoveRow(tr, rect, i);\n\t\t\tif (i == rect.top) break;\n\t\t\tconst table = rect.tableStart ? tr.doc.nodeAt(rect.tableStart - 1) : tr.doc;\n\t\t\tif (!table) throw new RangeError(\"No table found\");\n\t\t\trect.table = table;\n\t\t\trect.map = TableMap.get(rect.table);\n\t\t}\n\t\tdispatch(tr);\n\t}\n\treturn true;\n}\nfunction isEmpty(cell) {\n\tconst c = cell.content;\n\treturn c.childCount == 1 && c.child(0).isTextblock && c.child(0).childCount == 0;\n}\nfunction cellsOverlapRectangle({ width, height, map }, rect) {\n\tlet indexTop = rect.top * width + rect.left, indexLeft = indexTop;\n\tlet indexBottom = (rect.bottom - 1) * width + rect.left, indexRight = indexTop + (rect.right - rect.left - 1);\n\tfor (let i = rect.top; i < rect.bottom; i++) {\n\t\tif (rect.left > 0 && map[indexLeft] == map[indexLeft - 1] || rect.right < width && map[indexRight] == map[indexRight + 1]) return true;\n\t\tindexLeft += width;\n\t\tindexRight += width;\n\t}\n\tfor (let i = rect.left; i < rect.right; i++) {\n\t\tif (rect.top > 0 && map[indexTop] == map[indexTop - width] || rect.bottom < height && map[indexBottom] == map[indexBottom + width]) return true;\n\t\tindexTop++;\n\t\tindexBottom++;\n\t}\n\treturn false;\n}\n/**\n* Merge the selected cells into a single cell. Only available when\n* the selected cells' outline forms a rectangle.\n*\n* @public\n*/\nfunction mergeCells(state, dispatch) {\n\tconst sel = state.selection;\n\tif (!(sel instanceof CellSelection) || sel.$anchorCell.pos == sel.$headCell.pos) return false;\n\tconst rect = selectedRect(state), { map } = rect;\n\tif (cellsOverlapRectangle(map, rect)) return false;\n\tif (dispatch) {\n\t\tconst tr = state.tr;\n\t\tconst seen = {};\n\t\tlet content = Fragment.empty;\n\t\tlet mergedPos;\n\t\tlet mergedCell;\n\t\tfor (let row = rect.top; row < rect.bottom; row++) for (let col = rect.left; col < rect.right; col++) {\n\t\t\tconst cellPos = map.map[row * map.width + col];\n\t\t\tconst cell = rect.table.nodeAt(cellPos);\n\t\t\tif (seen[cellPos] || !cell) continue;\n\t\t\tseen[cellPos] = true;\n\t\t\tif (mergedPos == null) {\n\t\t\t\tmergedPos = cellPos;\n\t\t\t\tmergedCell = cell;\n\t\t\t} else {\n\t\t\t\tif (!isEmpty(cell)) content = content.append(cell.content);\n\t\t\t\tconst mapped = tr.mapping.map(cellPos + rect.tableStart);\n\t\t\t\ttr.delete(mapped, mapped + cell.nodeSize);\n\t\t\t}\n\t\t}\n\t\tif (mergedPos == null || mergedCell == null) return true;\n\t\ttr.setNodeMarkup(mergedPos + rect.tableStart, null, {\n\t\t\t...addColSpan(mergedCell.attrs, mergedCell.attrs.colspan, rect.right - rect.left - mergedCell.attrs.colspan),\n\t\t\trowspan: rect.bottom - rect.top\n\t\t});\n\t\tif (content.size > 0) {\n\t\t\tconst end = mergedPos + 1 + mergedCell.content.size;\n\t\t\tconst start = isEmpty(mergedCell) ? mergedPos + 1 : end;\n\t\t\ttr.replaceWith(start + rect.tableStart, end + rect.tableStart, content);\n\t\t}\n\t\ttr.setSelection(new CellSelection(tr.doc.resolve(mergedPos + rect.tableStart)));\n\t\tdispatch(tr);\n\t}\n\treturn true;\n}\n/**\n* Split a selected cell, whose rowpan or colspan is greater than one,\n* into smaller cells. Use the first cell type for the new cells.\n*\n* @public\n*/\nfunction splitCell(state, dispatch) {\n\tconst nodeTypes = tableNodeTypes(state.schema);\n\treturn splitCellWithType(({ node }) => {\n\t\treturn nodeTypes[node.type.spec.tableRole];\n\t})(state, dispatch);\n}\n/**\n* Split a selected cell, whose rowpan or colspan is greater than one,\n* into smaller cells with the cell type (th, td) returned by getType function.\n*\n* @public\n*/\nfunction splitCellWithType(getCellType) {\n\treturn (state, dispatch) => {\n\t\tconst sel = state.selection;\n\t\tlet cellNode;\n\t\tlet cellPos;\n\t\tif (!(sel instanceof CellSelection)) {\n\t\t\tvar _cellAround;\n\t\t\tcellNode = cellWrapping(sel.$from);\n\t\t\tif (!cellNode) return false;\n\t\t\tcellPos = (_cellAround = cellAround(sel.$from)) === null || _cellAround === void 0 ? void 0 : _cellAround.pos;\n\t\t} else {\n\t\t\tif (sel.$anchorCell.pos != sel.$headCell.pos) return false;\n\t\t\tcellNode = sel.$anchorCell.nodeAfter;\n\t\t\tcellPos = sel.$anchorCell.pos;\n\t\t}\n\t\tif (cellNode == null || cellPos == null) return false;\n\t\tif (cellNode.attrs.colspan == 1 && cellNode.attrs.rowspan == 1) return false;\n\t\tif (dispatch) {\n\t\t\tlet baseAttrs = cellNode.attrs;\n\t\t\tconst attrs = [];\n\t\t\tconst colwidth = baseAttrs.colwidth;\n\t\t\tif (baseAttrs.rowspan > 1) baseAttrs = {\n\t\t\t\t...baseAttrs,\n\t\t\t\trowspan: 1\n\t\t\t};\n\t\t\tif (baseAttrs.colspan > 1) baseAttrs = {\n\t\t\t\t...baseAttrs,\n\t\t\t\tcolspan: 1\n\t\t\t};\n\t\t\tconst rect = selectedRect(state), tr = state.tr;\n\t\t\tfor (let i = 0; i < rect.right - rect.left; i++) attrs.push(colwidth ? {\n\t\t\t\t...baseAttrs,\n\t\t\t\tcolwidth: colwidth && colwidth[i] ? [colwidth[i]] : null\n\t\t\t} : baseAttrs);\n\t\t\tlet lastCell;\n\t\t\tfor (let row = rect.top; row < rect.bottom; row++) {\n\t\t\t\tlet pos = rect.map.positionAt(row, rect.left, rect.table);\n\t\t\t\tif (row == rect.top) pos += cellNode.nodeSize;\n\t\t\t\tfor (let col = rect.left, i = 0; col < rect.right; col++, i++) {\n\t\t\t\t\tif (col == rect.left && row == rect.top) continue;\n\t\t\t\t\ttr.insert(lastCell = tr.mapping.map(pos + rect.tableStart, 1), getCellType({\n\t\t\t\t\t\tnode: cellNode,\n\t\t\t\t\t\trow,\n\t\t\t\t\t\tcol\n\t\t\t\t\t}).createAndFill(attrs[i]));\n\t\t\t\t}\n\t\t\t}\n\t\t\ttr.setNodeMarkup(cellPos, getCellType({\n\t\t\t\tnode: cellNode,\n\t\t\t\trow: rect.top,\n\t\t\t\tcol: rect.left\n\t\t\t}), attrs[0]);\n\t\t\tif (sel instanceof CellSelection) tr.setSelection(new CellSelection(tr.doc.resolve(sel.$anchorCell.pos), lastCell ? tr.doc.resolve(lastCell) : void 0));\n\t\t\tdispatch(tr);\n\t\t}\n\t\treturn true;\n\t};\n}\n/**\n* Returns a command that sets the given attribute to the given value,\n* and is only available when the currently selected cell doesn't\n* already have that attribute set to that value.\n*\n* @public\n*/\nfunction setCellAttr(name, value) {\n\treturn function(state, dispatch) {\n\t\tif (!isInTable(state)) return false;\n\t\tconst $cell = selectionCell(state);\n\t\tif ($cell.nodeAfter.attrs[name] === value) return false;\n\t\tif (dispatch) {\n\t\t\tconst tr = state.tr;\n\t\t\tif (state.selection instanceof CellSelection) state.selection.forEachCell((node, pos) => {\n\t\t\t\tif (node.attrs[name] !== value) tr.setNodeMarkup(pos, null, {\n\t\t\t\t\t...node.attrs,\n\t\t\t\t\t[name]: value\n\t\t\t\t});\n\t\t\t});\n\t\t\telse tr.setNodeMarkup($cell.pos, null, {\n\t\t\t\t...$cell.nodeAfter.attrs,\n\t\t\t\t[name]: value\n\t\t\t});\n\t\t\tdispatch(tr);\n\t\t}\n\t\treturn true;\n\t};\n}\nfunction deprecated_toggleHeader(type) {\n\treturn function(state, dispatch) {\n\t\tif (!isInTable(state)) return false;\n\t\tif (dispatch) {\n\t\t\tconst types = tableNodeTypes(state.schema);\n\t\t\tconst rect = selectedRect(state), tr = state.tr;\n\t\t\tconst cells = rect.map.cellsInRect(type == \"column\" ? {\n\t\t\t\tleft: rect.left,\n\t\t\t\ttop: 0,\n\t\t\t\tright: rect.right,\n\t\t\t\tbottom: rect.map.height\n\t\t\t} : type == \"row\" ? {\n\t\t\t\tleft: 0,\n\t\t\t\ttop: rect.top,\n\t\t\t\tright: rect.map.width,\n\t\t\t\tbottom: rect.bottom\n\t\t\t} : rect);\n\t\t\tconst nodes = cells.map((pos) => rect.table.nodeAt(pos));\n\t\t\tfor (let i = 0; i < cells.length; i++) if (nodes[i].type == types.header_cell) tr.setNodeMarkup(rect.tableStart + cells[i], types.cell, nodes[i].attrs);\n\t\t\tif (tr.steps.length === 0) for (let i = 0; i < cells.length; i++) tr.setNodeMarkup(rect.tableStart + cells[i], types.header_cell, nodes[i].attrs);\n\t\t\tdispatch(tr);\n\t\t}\n\t\treturn true;\n\t};\n}\nfunction isHeaderEnabledByType(type, rect, types) {\n\tconst cellPositions = rect.map.cellsInRect({\n\t\tleft: 0,\n\t\ttop: 0,\n\t\tright: type == \"row\" ? rect.map.width : 1,\n\t\tbottom: type == \"column\" ? rect.map.height : 1\n\t});\n\tfor (let i = 0; i < cellPositions.length; i++) {\n\t\tconst cell = rect.table.nodeAt(cellPositions[i]);\n\t\tif (cell && cell.type !== types.header_cell) return false;\n\t}\n\treturn true;\n}\n/**\n* Toggles between row/column header and normal cells (Only applies to first row/column).\n* For deprecated behavior pass `useDeprecatedLogic` in options with true.\n*\n* @public\n*/\nfunction toggleHeader(type, options) {\n\toptions = options || { useDeprecatedLogic: false };\n\tif (options.useDeprecatedLogic) return deprecated_toggleHeader(type);\n\treturn function(state, dispatch) {\n\t\tif (!isInTable(state)) return false;\n\t\tif (dispatch) {\n\t\t\tconst types = tableNodeTypes(state.schema);\n\t\t\tconst rect = selectedRect(state), tr = state.tr;\n\t\t\tconst isHeaderRowEnabled = isHeaderEnabledByType(\"row\", rect, types);\n\t\t\tconst isHeaderColumnEnabled = isHeaderEnabledByType(\"column\", rect, types);\n\t\t\tconst selectionStartsAt = (type === \"column\" ? isHeaderRowEnabled : type === \"row\" ? isHeaderColumnEnabled : false) ? 1 : 0;\n\t\t\tconst cellsRect = type == \"column\" ? {\n\t\t\t\tleft: 0,\n\t\t\t\ttop: selectionStartsAt,\n\t\t\t\tright: 1,\n\t\t\t\tbottom: rect.map.height\n\t\t\t} : type == \"row\" ? {\n\t\t\t\tleft: selectionStartsAt,\n\t\t\t\ttop: 0,\n\t\t\t\tright: rect.map.width,\n\t\t\t\tbottom: 1\n\t\t\t} : rect;\n\t\t\tconst newType = type == \"column\" ? isHeaderColumnEnabled ? types.cell : types.header_cell : type == \"row\" ? isHeaderRowEnabled ? types.cell : types.header_cell : types.cell;\n\t\t\trect.map.cellsInRect(cellsRect).forEach((relativeCellPos) => {\n\t\t\t\tconst cellPos = relativeCellPos + rect.tableStart;\n\t\t\t\tconst cell = tr.doc.nodeAt(cellPos);\n\t\t\t\tif (cell) tr.setNodeMarkup(cellPos, newType, cell.attrs);\n\t\t\t});\n\t\t\tdispatch(tr);\n\t\t}\n\t\treturn true;\n\t};\n}\n/**\n* Toggles whether the selected row contains header cells.\n*\n* @public\n*/\nconst toggleHeaderRow = toggleHeader(\"row\", { useDeprecatedLogic: true });\n/**\n* Toggles whether the selected column contains header cells.\n*\n* @public\n*/\nconst toggleHeaderColumn = toggleHeader(\"column\", { useDeprecatedLogic: true });\n/**\n* Toggles whether the selected cells are header cells.\n*\n* @public\n*/\nconst toggleHeaderCell = toggleHeader(\"cell\", { useDeprecatedLogic: true });\nfunction findNextCell($cell, dir) {\n\tif (dir < 0) {\n\t\tconst before = $cell.nodeBefore;\n\t\tif (before) return $cell.pos - before.nodeSize;\n\t\tfor (let row = $cell.index(-1) - 1, rowEnd = $cell.before(); row >= 0; row--) {\n\t\t\tconst rowNode = $cell.node(-1).child(row);\n\t\t\tconst lastChild = rowNode.lastChild;\n\t\t\tif (lastChild) return rowEnd - 1 - lastChild.nodeSize;\n\t\t\trowEnd -= rowNode.nodeSize;\n\t\t}\n\t} else {\n\t\tif ($cell.index() < $cell.parent.childCount - 1) return $cell.pos + $cell.nodeAfter.nodeSize;\n\t\tconst table = $cell.node(-1);\n\t\tfor (let row = $cell.indexAfter(-1), rowStart = $cell.after(); row < table.childCount; row++) {\n\t\t\tconst rowNode = table.child(row);\n\t\t\tif (rowNode.childCount) return rowStart + 1;\n\t\t\trowStart += rowNode.nodeSize;\n\t\t}\n\t}\n\treturn null;\n}\n/**\n* Returns a command for selecting the next (direction=1) or previous\n* (direction=-1) cell in a table.\n*\n* @public\n*/\nfunction goToNextCell(direction) {\n\treturn function(state, dispatch) {\n\t\tif (!isInTable(state)) return false;\n\t\tconst cell = findNextCell(selectionCell(state), direction);\n\t\tif (cell == null) return false;\n\t\tif (dispatch) {\n\t\t\tconst $cell = state.doc.resolve(cell);\n\t\t\tdispatch(state.tr.setSelection(TextSelection.between($cell, moveCellForward($cell))).scrollIntoView());\n\t\t}\n\t\treturn true;\n\t};\n}\n/**\n* Deletes the table around the selection, if any.\n*\n* @public\n*/\nfunction deleteTable(state, dispatch) {\n\tconst $pos = state.selection.$anchor;\n\tfor (let d = $pos.depth; d > 0; d--) if ($pos.node(d).type.spec.tableRole == \"table\") {\n\t\tif (dispatch) dispatch(state.tr.delete($pos.before(d), $pos.after(d)).scrollIntoView());\n\t\treturn true;\n\t}\n\treturn false;\n}\n/**\n* Deletes the content of the selected cells, if they are not empty.\n*\n* @public\n*/\nfunction deleteCellSelection(state, dispatch) {\n\tconst sel = state.selection;\n\tif (!(sel instanceof CellSelection)) return false;\n\tif (dispatch) {\n\t\tconst tr = state.tr;\n\t\tconst baseContent = tableNodeTypes(state.schema).cell.createAndFill().content;\n\t\tsel.forEachCell((cell, pos) => {\n\t\t\tif (!cell.content.eq(baseContent)) tr.replace(tr.mapping.map(pos + 1), tr.mapping.map(pos + cell.nodeSize - 1), new Slice(baseContent, 0, 0));\n\t\t});\n\t\tif (tr.docChanged) dispatch(tr);\n\t}\n\treturn true;\n}\n/**\n* Move a table row from index `from` to index `to`.\n*\n* @public\n*/\nfunction moveTableRow(options) {\n\treturn (state, dispatch) => {\n\t\tconst { from: originIndex, to: targetIndex, select = true, pos = state.selection.from } = options;\n\t\tconst tr = state.tr;\n\t\tif (moveRow({\n\t\t\ttr,\n\t\t\toriginIndex,\n\t\t\ttargetIndex,\n\t\t\tselect,\n\t\t\tpos\n\t\t})) {\n\t\t\tdispatch === null || dispatch === void 0 || dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t};\n}\n/**\n* Move a table column from index `from` to index `to`.\n*\n* @public\n*/\nfunction moveTableColumn(options) {\n\treturn (state, dispatch) => {\n\t\tconst { from: originIndex, to: targetIndex, select = true, pos = state.selection.from } = options;\n\t\tconst tr = state.tr;\n\t\tif (moveColumn({\n\t\t\ttr,\n\t\t\toriginIndex,\n\t\t\ttargetIndex,\n\t\t\tselect,\n\t\t\tpos\n\t\t})) {\n\t\t\tdispatch === null || dispatch === void 0 || dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t};\n}\n\n//#endregion\n//#region src/copypaste.ts\n/**\n* Get a rectangular area of cells from a slice, or null if the outer\n* nodes of the slice aren't table cells or rows.\n*\n* @internal\n*/\nfunction pastedCells(slice) {\n\tif (slice.size === 0) return null;\n\tlet { content, openStart, openEnd } = slice;\n\twhile (content.childCount == 1 && (openStart > 0 && openEnd > 0 || content.child(0).type.spec.tableRole == \"table\")) {\n\t\topenStart--;\n\t\topenEnd--;\n\t\tcontent = content.child(0).content;\n\t}\n\tconst first = content.child(0);\n\tconst role = first.type.spec.tableRole;\n\tconst schema = first.type.schema, rows = [];\n\tif (role == \"row\") for (let i = 0; i < content.childCount; i++) {\n\t\tlet cells = content.child(i).content;\n\t\tconst left = i ? 0 : Math.max(0, openStart - 1);\n\t\tconst right = i < content.childCount - 1 ? 0 : Math.max(0, openEnd - 1);\n\t\tif (left || right) cells = fitSlice(tableNodeTypes(schema).row, new Slice(cells, left, right)).content;\n\t\trows.push(cells);\n\t}\n\telse if (role == \"cell\" || role == \"header_cell\") rows.push(openStart || openEnd ? fitSlice(tableNodeTypes(schema).row, new Slice(content, openStart, openEnd)).content : content);\n\telse return null;\n\treturn ensureRectangular(schema, rows);\n}\nfunction ensureRectangular(schema, rows) {\n\tconst widths = [];\n\tfor (let i = 0; i < rows.length; i++) {\n\t\tconst row = rows[i];\n\t\tfor (let j = row.childCount - 1; j >= 0; j--) {\n\t\t\tconst { rowspan, colspan } = row.child(j).attrs;\n\t\t\tfor (let r = i; r < i + rowspan; r++) widths[r] = (widths[r] || 0) + colspan;\n\t\t}\n\t}\n\tlet width = 0;\n\tfor (let r = 0; r < widths.length; r++) width = Math.max(width, widths[r]);\n\tfor (let r = 0; r < widths.length; r++) {\n\t\tif (r >= rows.length) rows.push(Fragment.empty);\n\t\tif (widths[r] < width) {\n\t\t\tconst empty = tableNodeTypes(schema).cell.createAndFill();\n\t\t\tconst cells = [];\n\t\t\tfor (let i = widths[r]; i < width; i++) cells.push(empty);\n\t\t\trows[r] = rows[r].append(Fragment.from(cells));\n\t\t}\n\t}\n\treturn {\n\t\theight: rows.length,\n\t\twidth,\n\t\trows\n\t};\n}\nfunction fitSlice(nodeType, slice) {\n\tconst node = nodeType.createAndFill();\n\treturn new Transform(node).replace(0, node.content.size, slice).doc;\n}\n/**\n* Clip or extend (repeat) the given set of cells to cover the given\n* width and height. Will clip rowspan/colspan cells at the edges when\n* they stick out.\n*\n* @internal\n*/\nfunction clipCells({ width, height, rows }, newWidth, newHeight) {\n\tif (width != newWidth) {\n\t\tconst added = [];\n\t\tconst newRows = [];\n\t\tfor (let row = 0; row < rows.length; row++) {\n\t\t\tconst frag = rows[row], cells = [];\n\t\t\tfor (let col = added[row] || 0, i = 0; col < newWidth; i++) {\n\t\t\t\tlet cell = frag.child(i % frag.childCount);\n\t\t\t\tif (col + cell.attrs.colspan > newWidth) cell = cell.type.createChecked(removeColSpan(cell.attrs, cell.attrs.colspan, col + cell.attrs.colspan - newWidth), cell.content);\n\t\t\t\tcells.push(cell);\n\t\t\t\tcol += cell.attrs.colspan;\n\t\t\t\tfor (let j = 1; j < cell.attrs.rowspan; j++) added[row + j] = (added[row + j] || 0) + cell.attrs.colspan;\n\t\t\t}\n\t\t\tnewRows.push(Fragment.from(cells));\n\t\t}\n\t\trows = newRows;\n\t\twidth = newWidth;\n\t}\n\tif (height != newHeight) {\n\t\tconst newRows = [];\n\t\tfor (let row = 0, i = 0; row < newHeight; row++, i++) {\n\t\t\tconst cells = [], source = rows[i % height];\n\t\t\tfor (let j = 0; j < source.childCount; j++) {\n\t\t\t\tlet cell = source.child(j);\n\t\t\t\tif (row + cell.attrs.rowspan > newHeight) cell = cell.type.create({\n\t\t\t\t\t...cell.attrs,\n\t\t\t\t\trowspan: Math.max(1, newHeight - cell.attrs.rowspan)\n\t\t\t\t}, cell.content);\n\t\t\t\tcells.push(cell);\n\t\t\t}\n\t\t\tnewRows.push(Fragment.from(cells));\n\t\t}\n\t\trows = newRows;\n\t\theight = newHeight;\n\t}\n\treturn {\n\t\twidth,\n\t\theight,\n\t\trows\n\t};\n}\nfunction growTable(tr, map, table, start, width, height, mapFrom) {\n\tconst schema = tr.doc.type.schema;\n\tconst types = tableNodeTypes(schema);\n\tlet empty;\n\tlet emptyHead;\n\tif (width > map.width) for (let row = 0, rowEnd = 0; row < map.height; row++) {\n\t\tconst rowNode = table.child(row);\n\t\trowEnd += rowNode.nodeSize;\n\t\tconst cells = [];\n\t\tlet add;\n\t\tif (rowNode.lastChild == null || rowNode.lastChild.type == types.cell) add = empty || (empty = types.cell.createAndFill());\n\t\telse add = emptyHead || (emptyHead = types.header_cell.createAndFill());\n\t\tfor (let i = map.width; i < width; i++) cells.push(add);\n\t\ttr.insert(tr.mapping.slice(mapFrom).map(rowEnd - 1 + start), cells);\n\t}\n\tif (height > map.height) {\n\t\tconst cells = [];\n\t\tfor (let i = 0, start$1 = (map.height - 1) * map.width; i < Math.max(map.width, width); i++) {\n\t\t\tconst header = i >= map.width ? false : table.nodeAt(map.map[start$1 + i]).type == types.header_cell;\n\t\t\tcells.push(header ? emptyHead || (emptyHead = types.header_cell.createAndFill()) : empty || (empty = types.cell.createAndFill()));\n\t\t}\n\t\tconst emptyRow = types.row.create(null, Fragment.from(cells)), rows = [];\n\t\tfor (let i = map.height; i < height; i++) rows.push(emptyRow);\n\t\ttr.insert(tr.mapping.slice(mapFrom).map(start + table.nodeSize - 2), rows);\n\t}\n\treturn !!(empty || emptyHead);\n}\nfunction isolateHorizontal(tr, map, table, start, left, right, top, mapFrom) {\n\tif (top == 0 || top == map.height) return false;\n\tlet found = false;\n\tfor (let col = left; col < right; col++) {\n\t\tconst index = top * map.width + col, pos = map.map[index];\n\t\tif (map.map[index - map.width] == pos) {\n\t\t\tfound = true;\n\t\t\tconst cell = table.nodeAt(pos);\n\t\t\tconst { top: cellTop, left: cellLeft } = map.findCell(pos);\n\t\t\ttr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos + start), null, {\n\t\t\t\t...cell.attrs,\n\t\t\t\trowspan: top - cellTop\n\t\t\t});\n\t\t\ttr.insert(tr.mapping.slice(mapFrom).map(map.positionAt(top, cellLeft, table)), cell.type.createAndFill({\n\t\t\t\t...cell.attrs,\n\t\t\t\trowspan: cellTop + cell.attrs.rowspan - top\n\t\t\t}));\n\t\t\tcol += cell.attrs.colspan - 1;\n\t\t}\n\t}\n\treturn found;\n}\nfunction isolateVertical(tr, map, table, start, top, bottom, left, mapFrom) {\n\tif (left == 0 || left == map.width) return false;\n\tlet found = false;\n\tfor (let row = top; row < bottom; row++) {\n\t\tconst index = row * map.width + left, pos = map.map[index];\n\t\tif (map.map[index - 1] == pos) {\n\t\t\tfound = true;\n\t\t\tconst cell = table.nodeAt(pos);\n\t\t\tconst cellLeft = map.colCount(pos);\n\t\t\tconst updatePos = tr.mapping.slice(mapFrom).map(pos + start);\n\t\t\ttr.setNodeMarkup(updatePos, null, removeColSpan(cell.attrs, left - cellLeft, cell.attrs.colspan - (left - cellLeft)));\n\t\t\ttr.insert(updatePos + cell.nodeSize, cell.type.createAndFill(removeColSpan(cell.attrs, 0, left - cellLeft)));\n\t\t\trow += cell.attrs.rowspan - 1;\n\t\t}\n\t}\n\treturn found;\n}\n/**\n* Insert the given set of cells (as returned by `pastedCells`) into a\n* table, at the position pointed at by rect.\n*\n* @internal\n*/\nfunction insertCells(state, dispatch, tableStart, rect, cells) {\n\tlet table = tableStart ? state.doc.nodeAt(tableStart - 1) : state.doc;\n\tif (!table) throw new Error(\"No table found\");\n\tlet map = TableMap.get(table);\n\tconst { top, left } = rect;\n\tconst right = left + cells.width, bottom = top + cells.height;\n\tconst tr = state.tr;\n\tlet mapFrom = 0;\n\tfunction recomp() {\n\t\ttable = tableStart ? tr.doc.nodeAt(tableStart - 1) : tr.doc;\n\t\tif (!table) throw new Error(\"No table found\");\n\t\tmap = TableMap.get(table);\n\t\tmapFrom = tr.mapping.maps.length;\n\t}\n\tif (growTable(tr, map, table, tableStart, right, bottom, mapFrom)) recomp();\n\tif (isolateHorizontal(tr, map, table, tableStart, left, right, top, mapFrom)) recomp();\n\tif (isolateHorizontal(tr, map, table, tableStart, left, right, bottom, mapFrom)) recomp();\n\tif (isolateVertical(tr, map, table, tableStart, top, bottom, left, mapFrom)) recomp();\n\tif (isolateVertical(tr, map, table, tableStart, top, bottom, right, mapFrom)) recomp();\n\tfor (let row = top; row < bottom; row++) {\n\t\tconst from = map.positionAt(row, left, table), to = map.positionAt(row, right, table);\n\t\ttr.replace(tr.mapping.slice(mapFrom).map(from + tableStart), tr.mapping.slice(mapFrom).map(to + tableStart), new Slice(cells.rows[row - top], 0, 0));\n\t}\n\trecomp();\n\ttr.setSelection(new CellSelection(tr.doc.resolve(tableStart + map.positionAt(top, left, table)), tr.doc.resolve(tableStart + map.positionAt(bottom - 1, right - 1, table))));\n\tdispatch(tr);\n}\n\n//#endregion\n//#region src/input.ts\nconst handleKeyDown = keydownHandler({\n\tArrowLeft: arrow(\"horiz\", -1),\n\tArrowRight: arrow(\"horiz\", 1),\n\tArrowUp: arrow(\"vert\", -1),\n\tArrowDown: arrow(\"vert\", 1),\n\t\"Shift-ArrowLeft\": shiftArrow(\"horiz\", -1),\n\t\"Shift-ArrowRight\": shiftArrow(\"horiz\", 1),\n\t\"Shift-ArrowUp\": shiftArrow(\"vert\", -1),\n\t\"Shift-ArrowDown\": shiftArrow(\"vert\", 1),\n\tBackspace: deleteCellSelection,\n\t\"Mod-Backspace\": deleteCellSelection,\n\tDelete: deleteCellSelection,\n\t\"Mod-Delete\": deleteCellSelection\n});\nfunction maybeSetSelection(state, dispatch, selection) {\n\tif (selection.eq(state.selection)) return false;\n\tif (dispatch) dispatch(state.tr.setSelection(selection).scrollIntoView());\n\treturn true;\n}\n/**\n* @internal\n*/\nfunction arrow(axis, dir) {\n\treturn (state, dispatch, view) => {\n\t\tif (!view) return false;\n\t\tconst sel = state.selection;\n\t\tif (sel instanceof CellSelection) return maybeSetSelection(state, dispatch, Selection.near(sel.$headCell, dir));\n\t\tif (axis != \"horiz\" && !sel.empty) return false;\n\t\tconst end = atEndOfCell(view, axis, dir);\n\t\tif (end == null) return false;\n\t\tif (axis == \"horiz\") return maybeSetSelection(state, dispatch, Selection.near(state.doc.resolve(sel.head + dir), dir));\n\t\telse {\n\t\t\tconst $cell = state.doc.resolve(end);\n\t\t\tconst $next = nextCell($cell, axis, dir);\n\t\t\tlet newSel;\n\t\t\tif ($next) newSel = Selection.near($next, 1);\n\t\t\telse if (dir < 0) newSel = Selection.near(state.doc.resolve($cell.before(-1)), -1);\n\t\t\telse newSel = Selection.near(state.doc.resolve($cell.after(-1)), 1);\n\t\t\treturn maybeSetSelection(state, dispatch, newSel);\n\t\t}\n\t};\n}\nfunction shiftArrow(axis, dir) {\n\treturn (state, dispatch, view) => {\n\t\tif (!view) return false;\n\t\tconst sel = state.selection;\n\t\tlet cellSel;\n\t\tif (sel instanceof CellSelection) cellSel = sel;\n\t\telse {\n\t\t\tconst end = atEndOfCell(view, axis, dir);\n\t\t\tif (end == null) return false;\n\t\t\tcellSel = new CellSelection(state.doc.resolve(end));\n\t\t}\n\t\tconst $head = nextCell(cellSel.$headCell, axis, dir);\n\t\tif (!$head) return false;\n\t\treturn maybeSetSelection(state, dispatch, new CellSelection(cellSel.$anchorCell, $head));\n\t};\n}\nfunction handleTripleClick(view, pos) {\n\tconst doc = view.state.doc, $cell = cellAround(doc.resolve(pos));\n\tif (!$cell) return false;\n\tview.dispatch(view.state.tr.setSelection(new CellSelection($cell)));\n\treturn true;\n}\n/**\n* @public\n*/\nfunction handlePaste(view, _, slice) {\n\tif (!isInTable(view.state)) return false;\n\tlet cells = pastedCells(slice);\n\tconst sel = view.state.selection;\n\tif (sel instanceof CellSelection) {\n\t\tif (!cells) cells = {\n\t\t\twidth: 1,\n\t\t\theight: 1,\n\t\t\trows: [Fragment.from(fitSlice(tableNodeTypes(view.state.schema).cell, slice))]\n\t\t};\n\t\tconst table = sel.$anchorCell.node(-1);\n\t\tconst start = sel.$anchorCell.start(-1);\n\t\tconst rect = TableMap.get(table).rectBetween(sel.$anchorCell.pos - start, sel.$headCell.pos - start);\n\t\tcells = clipCells(cells, rect.right - rect.left, rect.bottom - rect.top);\n\t\tinsertCells(view.state, view.dispatch, start, rect, cells);\n\t\treturn true;\n\t} else if (cells) {\n\t\tconst $cell = selectionCell(view.state);\n\t\tconst start = $cell.start(-1);\n\t\tinsertCells(view.state, view.dispatch, start, TableMap.get($cell.node(-1)).findCell($cell.pos - start), cells);\n\t\treturn true;\n\t} else return false;\n}\nfunction handleMouseDown$1(view, startEvent) {\n\tvar _cellUnderMouse;\n\tif (startEvent.button != 0) return;\n\tif (startEvent.ctrlKey || startEvent.metaKey) return;\n\tconst startDOMCell = domInCell(view, startEvent.target);\n\tlet $anchor;\n\tif (startEvent.shiftKey && view.state.selection instanceof CellSelection) {\n\t\tsetCellSelection(view.state.selection.$anchorCell, startEvent);\n\t\tstartEvent.preventDefault();\n\t} else if (startEvent.shiftKey && startDOMCell && ($anchor = cellAround(view.state.selection.$anchor)) != null && ((_cellUnderMouse = cellUnderMouse(view, startEvent)) === null || _cellUnderMouse === void 0 ? void 0 : _cellUnderMouse.pos) != $anchor.pos) {\n\t\tsetCellSelection($anchor, startEvent);\n\t\tstartEvent.preventDefault();\n\t} else if (!startDOMCell) return;\n\tfunction setCellSelection($anchor$1, event) {\n\t\tlet $head = cellUnderMouse(view, event);\n\t\tconst starting = tableEditingKey.getState(view.state) == null;\n\t\tif (!$head || !inSameTable($anchor$1, $head)) if (starting) $head = $anchor$1;\n\t\telse return;\n\t\tconst selection = new CellSelection($anchor$1, $head);\n\t\tif (starting || !view.state.selection.eq(selection)) {\n\t\t\tconst tr = view.state.tr.setSelection(selection);\n\t\t\tif (starting) tr.setMeta(tableEditingKey, $anchor$1.pos);\n\t\t\tview.dispatch(tr);\n\t\t}\n\t}\n\tfunction stop() {\n\t\tview.root.removeEventListener(\"mouseup\", stop);\n\t\tview.root.removeEventListener(\"dragstart\", stop);\n\t\tview.root.removeEventListener(\"mousemove\", move);\n\t\tif (tableEditingKey.getState(view.state) != null) view.dispatch(view.state.tr.setMeta(tableEditingKey, -1));\n\t}\n\tfunction move(_event) {\n\t\tconst event = _event;\n\t\tconst anchor = tableEditingKey.getState(view.state);\n\t\tlet $anchor$1;\n\t\tif (anchor != null) $anchor$1 = view.state.doc.resolve(anchor);\n\t\telse if (domInCell(view, event.target) != startDOMCell) {\n\t\t\t$anchor$1 = cellUnderMouse(view, startEvent);\n\t\t\tif (!$anchor$1) return stop();\n\t\t}\n\t\tif ($anchor$1) setCellSelection($anchor$1, event);\n\t}\n\tview.root.addEventListener(\"mouseup\", stop);\n\tview.root.addEventListener(\"dragstart\", stop);\n\tview.root.addEventListener(\"mousemove\", move);\n}\nfunction atEndOfCell(view, axis, dir) {\n\tif (!(view.state.selection instanceof TextSelection)) return null;\n\tconst { $head } = view.state.selection;\n\tfor (let d = $head.depth - 1; d >= 0; d--) {\n\t\tconst parent = $head.node(d);\n\t\tif ((dir < 0 ? $head.index(d) : $head.indexAfter(d)) != (dir < 0 ? 0 : parent.childCount)) return null;\n\t\tif (parent.type.spec.tableRole == \"cell\" || parent.type.spec.tableRole == \"header_cell\") {\n\t\t\tconst cellPos = $head.before(d);\n\t\t\tconst dirStr = axis == \"vert\" ? dir > 0 ? \"down\" : \"up\" : dir > 0 ? \"right\" : \"left\";\n\t\t\treturn view.endOfTextblock(dirStr) ? cellPos : null;\n\t\t}\n\t}\n\treturn null;\n}\nfunction domInCell(view, dom) {\n\tfor (; dom && dom != view.dom; dom = dom.parentNode) if (dom.nodeName == \"TD\" || dom.nodeName == \"TH\") return dom;\n\treturn null;\n}\nfunction cellUnderMouse(view, event) {\n\tconst mousePos = view.posAtCoords({\n\t\tleft: event.clientX,\n\t\ttop: event.clientY\n\t});\n\tif (!mousePos) return null;\n\tlet { inside, pos } = mousePos;\n\treturn inside >= 0 && cellAround(view.state.doc.resolve(inside)) || cellAround(view.state.doc.resolve(pos));\n}\n\n//#endregion\n//#region src/tableview.ts\n/**\n* @public\n*/\nvar TableView = class {\n\tconstructor(node, defaultCellMinWidth) {\n\t\tthis.node = node;\n\t\tthis.defaultCellMinWidth = defaultCellMinWidth;\n\t\tthis.dom = document.createElement(\"div\");\n\t\tthis.dom.className = \"tableWrapper\";\n\t\tthis.table = this.dom.appendChild(document.createElement(\"table\"));\n\t\tthis.table.style.setProperty(\"--default-cell-min-width\", `${defaultCellMinWidth}px`);\n\t\tthis.colgroup = this.table.appendChild(document.createElement(\"colgroup\"));\n\t\tupdateColumnsOnResize(node, this.colgroup, this.table, defaultCellMinWidth);\n\t\tthis.contentDOM = this.table.appendChild(document.createElement(\"tbody\"));\n\t}\n\tupdate(node) {\n\t\tif (node.type != this.node.type) return false;\n\t\tthis.node = node;\n\t\tupdateColumnsOnResize(node, this.colgroup, this.table, this.defaultCellMinWidth);\n\t\treturn true;\n\t}\n\tignoreMutation(record) {\n\t\treturn record.type == \"attributes\" && (record.target == this.table || this.colgroup.contains(record.target));\n\t}\n};\n/**\n* @public\n*/\nfunction updateColumnsOnResize(node, colgroup, table, defaultCellMinWidth, overrideCol, overrideValue) {\n\tlet totalWidth = 0;\n\tlet fixedWidth = true;\n\tlet nextDOM = colgroup.firstChild;\n\tconst row = node.firstChild;\n\tif (!row) return;\n\tfor (let i = 0, col = 0; i < row.childCount; i++) {\n\t\tconst { colspan, colwidth } = row.child(i).attrs;\n\t\tfor (let j = 0; j < colspan; j++, col++) {\n\t\t\tconst hasWidth = overrideCol == col ? overrideValue : colwidth && colwidth[j];\n\t\t\tconst cssWidth = hasWidth ? hasWidth + \"px\" : \"\";\n\t\t\ttotalWidth += hasWidth || defaultCellMinWidth;\n\t\t\tif (!hasWidth) fixedWidth = false;\n\t\t\tif (!nextDOM) {\n\t\t\t\tconst col$1 = document.createElement(\"col\");\n\t\t\t\tcol$1.style.width = cssWidth;\n\t\t\t\tcolgroup.appendChild(col$1);\n\t\t\t} else {\n\t\t\t\tif (nextDOM.style.width != cssWidth) nextDOM.style.width = cssWidth;\n\t\t\t\tnextDOM = nextDOM.nextSibling;\n\t\t\t}\n\t\t}\n\t}\n\twhile (nextDOM) {\n\t\tvar _nextDOM$parentNode;\n\t\tconst after = nextDOM.nextSibling;\n\t\t(_nextDOM$parentNode = nextDOM.parentNode) === null || _nextDOM$parentNode === void 0 || _nextDOM$parentNode.removeChild(nextDOM);\n\t\tnextDOM = after;\n\t}\n\tif (fixedWidth) {\n\t\ttable.style.width = totalWidth + \"px\";\n\t\ttable.style.minWidth = \"\";\n\t} else {\n\t\ttable.style.width = \"\";\n\t\ttable.style.minWidth = totalWidth + \"px\";\n\t}\n}\n\n//#endregion\n//#region src/columnresizing.ts\n/**\n* @public\n*/\nconst columnResizingPluginKey = new PluginKey(\"tableColumnResizing\");\n/**\n* @public\n*/\nfunction columnResizing({ handleWidth = 5, cellMinWidth = 25, defaultCellMinWidth = 100, View = TableView, lastColumnResizable = true } = {}) {\n\tconst plugin = new Plugin({\n\t\tkey: columnResizingPluginKey,\n\t\tstate: {\n\t\t\tinit(_, state) {\n\t\t\t\tvar _plugin$spec;\n\t\t\t\tconst nodeViews = (_plugin$spec = plugin.spec) === null || _plugin$spec === void 0 || (_plugin$spec = _plugin$spec.props) === null || _plugin$spec === void 0 ? void 0 : _plugin$spec.nodeViews;\n\t\t\t\tconst tableName = tableNodeTypes(state.schema).table.name;\n\t\t\t\tif (View && nodeViews) nodeViews[tableName] = (node, view) => {\n\t\t\t\t\treturn new View(node, defaultCellMinWidth, view);\n\t\t\t\t};\n\t\t\t\treturn new ResizeState(-1, false);\n\t\t\t},\n\t\t\tapply(tr, prev) {\n\t\t\t\treturn prev.apply(tr);\n\t\t\t}\n\t\t},\n\t\tprops: {\n\t\t\tattributes: (state) => {\n\t\t\t\tconst pluginState = columnResizingPluginKey.getState(state);\n\t\t\t\treturn pluginState && pluginState.activeHandle > -1 ? { class: \"resize-cursor\" } : {};\n\t\t\t},\n\t\t\thandleDOMEvents: {\n\t\t\t\tmousemove: (view, event) => {\n\t\t\t\t\thandleMouseMove(view, event, handleWidth, lastColumnResizable);\n\t\t\t\t},\n\t\t\t\tmouseleave: (view) => {\n\t\t\t\t\thandleMouseLeave(view);\n\t\t\t\t},\n\t\t\t\tmousedown: (view, event) => {\n\t\t\t\t\thandleMouseDown(view, event, cellMinWidth, defaultCellMinWidth);\n\t\t\t\t}\n\t\t\t},\n\t\t\tdecorations: (state) => {\n\t\t\t\tconst pluginState = columnResizingPluginKey.getState(state);\n\t\t\t\tif (pluginState && pluginState.activeHandle > -1) return handleDecorations(state, pluginState.activeHandle);\n\t\t\t},\n\t\t\tnodeViews: {}\n\t\t}\n\t});\n\treturn plugin;\n}\n/**\n* @public\n*/\nvar ResizeState = class ResizeState {\n\tconstructor(activeHandle, dragging) {\n\t\tthis.activeHandle = activeHandle;\n\t\tthis.dragging = dragging;\n\t}\n\tapply(tr) {\n\t\tconst state = this;\n\t\tconst action = tr.getMeta(columnResizingPluginKey);\n\t\tif (action && action.setHandle != null) return new ResizeState(action.setHandle, false);\n\t\tif (action && action.setDragging !== void 0) return new ResizeState(state.activeHandle, action.setDragging);\n\t\tif (state.activeHandle > -1 && tr.docChanged) {\n\t\t\tlet handle = tr.mapping.map(state.activeHandle, -1);\n\t\t\tif (!pointsAtCell(tr.doc.resolve(handle))) handle = -1;\n\t\t\treturn new ResizeState(handle, state.dragging);\n\t\t}\n\t\treturn state;\n\t}\n};\nfunction handleMouseMove(view, event, handleWidth, lastColumnResizable) {\n\tif (!view.editable) return;\n\tconst pluginState = columnResizingPluginKey.getState(view.state);\n\tif (!pluginState) return;\n\tif (!pluginState.dragging) {\n\t\tconst target = domCellAround(event.target);\n\t\tlet cell = -1;\n\t\tif (target) {\n\t\t\tconst { left, right } = target.getBoundingClientRect();\n\t\t\tif (event.clientX - left <= handleWidth) cell = edgeCell(view, event, \"left\", handleWidth);\n\t\t\telse if (right - event.clientX <= handleWidth) cell = edgeCell(view, event, \"right\", handleWidth);\n\t\t}\n\t\tif (cell != pluginState.activeHandle) {\n\t\t\tif (!lastColumnResizable && cell !== -1) {\n\t\t\t\tconst $cell = view.state.doc.resolve(cell);\n\t\t\t\tconst table = $cell.node(-1);\n\t\t\t\tconst map = TableMap.get(table);\n\t\t\t\tconst tableStart = $cell.start(-1);\n\t\t\t\tif (map.colCount($cell.pos - tableStart) + $cell.nodeAfter.attrs.colspan - 1 == map.width - 1) return;\n\t\t\t}\n\t\t\tupdateHandle(view, cell);\n\t\t}\n\t}\n}\nfunction handleMouseLeave(view) {\n\tif (!view.editable) return;\n\tconst pluginState = columnResizingPluginKey.getState(view.state);\n\tif (pluginState && pluginState.activeHandle > -1 && !pluginState.dragging) updateHandle(view, -1);\n}\nfunction handleMouseDown(view, event, cellMinWidth, defaultCellMinWidth) {\n\tvar _view$dom$ownerDocume;\n\tif (!view.editable) return false;\n\tconst win = (_view$dom$ownerDocume = view.dom.ownerDocument.defaultView) !== null && _view$dom$ownerDocume !== void 0 ? _view$dom$ownerDocume : window;\n\tconst pluginState = columnResizingPluginKey.getState(view.state);\n\tif (!pluginState || pluginState.activeHandle == -1 || pluginState.dragging) return false;\n\tconst cell = view.state.doc.nodeAt(pluginState.activeHandle);\n\tconst width = currentColWidth(view, pluginState.activeHandle, cell.attrs);\n\tview.dispatch(view.state.tr.setMeta(columnResizingPluginKey, { setDragging: {\n\t\tstartX: event.clientX,\n\t\tstartWidth: width\n\t} }));\n\tfunction finish(event$1) {\n\t\twin.removeEventListener(\"mouseup\", finish);\n\t\twin.removeEventListener(\"mousemove\", move);\n\t\tconst pluginState$1 = columnResizingPluginKey.getState(view.state);\n\t\tif (pluginState$1 === null || pluginState$1 === void 0 ? void 0 : pluginState$1.dragging) {\n\t\t\tupdateColumnWidth(view, pluginState$1.activeHandle, draggedWidth(pluginState$1.dragging, event$1, cellMinWidth));\n\t\t\tview.dispatch(view.state.tr.setMeta(columnResizingPluginKey, { setDragging: null }));\n\t\t}\n\t}\n\tfunction move(event$1) {\n\t\tif (!event$1.which) return finish(event$1);\n\t\tconst pluginState$1 = columnResizingPluginKey.getState(view.state);\n\t\tif (!pluginState$1) return;\n\t\tif (pluginState$1.dragging) {\n\t\t\tconst dragged = draggedWidth(pluginState$1.dragging, event$1, cellMinWidth);\n\t\t\tdisplayColumnWidth(view, pluginState$1.activeHandle, dragged, defaultCellMinWidth);\n\t\t}\n\t}\n\tdisplayColumnWidth(view, pluginState.activeHandle, width, defaultCellMinWidth);\n\twin.addEventListener(\"mouseup\", finish);\n\twin.addEventListener(\"mousemove\", move);\n\tevent.preventDefault();\n\treturn true;\n}\nfunction currentColWidth(view, cellPos, { colspan, colwidth }) {\n\tconst width = colwidth && colwidth[colwidth.length - 1];\n\tif (width) return width;\n\tconst dom = view.domAtPos(cellPos);\n\tlet domWidth = dom.node.childNodes[dom.offset].offsetWidth, parts = colspan;\n\tif (colwidth) {\n\t\tfor (let i = 0; i < colspan; i++) if (colwidth[i]) {\n\t\t\tdomWidth -= colwidth[i];\n\t\t\tparts--;\n\t\t}\n\t}\n\treturn domWidth / parts;\n}\nfunction domCellAround(target) {\n\twhile (target && target.nodeName != \"TD\" && target.nodeName != \"TH\") target = target.classList && target.classList.contains(\"ProseMirror\") ? null : target.parentNode;\n\treturn target;\n}\nfunction edgeCell(view, event, side, handleWidth) {\n\tconst offset = side == \"right\" ? -handleWidth : handleWidth;\n\tconst found = view.posAtCoords({\n\t\tleft: event.clientX + offset,\n\t\ttop: event.clientY\n\t});\n\tif (!found) return -1;\n\tconst { pos } = found;\n\tconst $cell = cellAround(view.state.doc.resolve(pos));\n\tif (!$cell) return -1;\n\tif (side == \"right\") return $cell.pos;\n\tconst map = TableMap.get($cell.node(-1)), start = $cell.start(-1);\n\tconst index = map.map.indexOf($cell.pos - start);\n\treturn index % map.width == 0 ? -1 : start + map.map[index - 1];\n}\nfunction draggedWidth(dragging, event, resizeMinWidth) {\n\tconst offset = event.clientX - dragging.startX;\n\treturn Math.max(resizeMinWidth, dragging.startWidth + offset);\n}\nfunction updateHandle(view, value) {\n\tview.dispatch(view.state.tr.setMeta(columnResizingPluginKey, { setHandle: value }));\n}\nfunction updateColumnWidth(view, cell, width) {\n\tconst $cell = view.state.doc.resolve(cell);\n\tconst table = $cell.node(-1), map = TableMap.get(table), start = $cell.start(-1);\n\tconst col = map.colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;\n\tconst tr = view.state.tr;\n\tfor (let row = 0; row < map.height; row++) {\n\t\tconst mapIndex = row * map.width + col;\n\t\tif (row && map.map[mapIndex] == map.map[mapIndex - map.width]) continue;\n\t\tconst pos = map.map[mapIndex];\n\t\tconst attrs = table.nodeAt(pos).attrs;\n\t\tconst index = attrs.colspan == 1 ? 0 : col - map.colCount(pos);\n\t\tif (attrs.colwidth && attrs.colwidth[index] == width) continue;\n\t\tconst colwidth = attrs.colwidth ? attrs.colwidth.slice() : zeroes(attrs.colspan);\n\t\tcolwidth[index] = width;\n\t\ttr.setNodeMarkup(start + pos, null, {\n\t\t\t...attrs,\n\t\t\tcolwidth\n\t\t});\n\t}\n\tif (tr.docChanged) view.dispatch(tr);\n}\nfunction displayColumnWidth(view, cell, width, defaultCellMinWidth) {\n\tconst $cell = view.state.doc.resolve(cell);\n\tconst table = $cell.node(-1), start = $cell.start(-1);\n\tconst col = TableMap.get(table).colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;\n\tlet dom = view.domAtPos($cell.start(-1)).node;\n\twhile (dom && dom.nodeName != \"TABLE\") dom = dom.parentNode;\n\tif (!dom) return;\n\tupdateColumnsOnResize(table, dom.firstChild, dom, defaultCellMinWidth, col, width);\n}\nfunction zeroes(n) {\n\treturn Array(n).fill(0);\n}\nfunction handleDecorations(state, cell) {\n\tconst decorations = [];\n\tconst $cell = state.doc.resolve(cell);\n\tconst table = $cell.node(-1);\n\tif (!table) return DecorationSet.empty;\n\tconst map = TableMap.get(table);\n\tconst start = $cell.start(-1);\n\tconst col = map.colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;\n\tfor (let row = 0; row < map.height; row++) {\n\t\tconst index = col + row * map.width;\n\t\tif ((col == map.width - 1 || map.map[index] != map.map[index + 1]) && (row == 0 || map.map[index] != map.map[index - map.width])) {\n\t\t\tvar _columnResizingPlugin;\n\t\t\tconst cellPos = map.map[index];\n\t\t\tconst pos = start + cellPos + table.nodeAt(cellPos).nodeSize - 1;\n\t\t\tconst dom = document.createElement(\"div\");\n\t\t\tdom.className = \"column-resize-handle\";\n\t\t\tif ((_columnResizingPlugin = columnResizingPluginKey.getState(state)) === null || _columnResizingPlugin === void 0 ? void 0 : _columnResizingPlugin.dragging) decorations.push(Decoration.node(start + cellPos, start + cellPos + table.nodeAt(cellPos).nodeSize, { class: \"column-resize-dragging\" }));\n\t\t\tdecorations.push(Decoration.widget(pos, dom));\n\t\t}\n\t}\n\treturn DecorationSet.create(state.doc, decorations);\n}\n\n//#endregion\n//#region src/index.ts\n/**\n* Creates a [plugin](http://prosemirror.net/docs/ref/#state.Plugin)\n* that, when added to an editor, enables cell-selection, handles\n* cell-based copy/paste, and makes sure tables stay well-formed (each\n* row has the same width, and cells don't overlap).\n*\n* You should probably put this plugin near the end of your array of\n* plugins, since it handles mouse and arrow key events in tables\n* rather broadly, and other plugins, like the gap cursor or the\n* column-width dragging plugin, might want to get a turn first to\n* perform more specific behavior.\n*\n* @public\n*/\nfunction tableEditing({ allowTableNodeSelection = false } = {}) {\n\treturn new Plugin({\n\t\tkey: tableEditingKey,\n\t\tstate: {\n\t\t\tinit() {\n\t\t\t\treturn null;\n\t\t\t},\n\t\t\tapply(tr, cur) {\n\t\t\t\tconst set = tr.getMeta(tableEditingKey);\n\t\t\t\tif (set != null) return set == -1 ? null : set;\n\t\t\t\tif (cur == null || !tr.docChanged) return cur;\n\t\t\t\tconst { deleted, pos } = tr.mapping.mapResult(cur);\n\t\t\t\treturn deleted ? null : pos;\n\t\t\t}\n\t\t},\n\t\tprops: {\n\t\t\tdecorations: drawCellSelection,\n\t\t\thandleDOMEvents: { mousedown: handleMouseDown$1 },\n\t\t\tcreateSelectionBetween(view) {\n\t\t\t\treturn tableEditingKey.getState(view.state) != null ? view.state.selection : null;\n\t\t\t},\n\t\t\thandleTripleClick,\n\t\t\thandleKeyDown,\n\t\t\thandlePaste\n\t\t},\n\t\tappendTransaction(_, oldState, state) {\n\t\t\treturn normalizeSelection(state, fixTables(state, oldState), allowTableNodeSelection);\n\t\t}\n\t});\n}\n\n//#endregion\nexport { CellBookmark, CellSelection, ResizeState, TableMap, TableView, clipCells as __clipCells, insertCells as __insertCells, pastedCells as __pastedCells, addColSpan, addColumn, addColumnAfter, addColumnBefore, addRow, addRowAfter, addRowBefore, cellAround, cellNear, colCount, columnIsHeader, columnResizing, columnResizingPluginKey, deleteCellSelection, deleteColumn, deleteRow, deleteTable, findCell, findCellPos, findCellRange, findTable, fixTables, fixTablesKey, goToNextCell, handlePaste, inSameTable, isInTable, mergeCells, moveCellForward, moveTableColumn, moveTableRow, nextCell, pointsAtCell, removeColSpan, removeColumn, removeRow, rowIsHeader, selectedRect, selectionCell, setCellAttr, splitCell, splitCellWithType, tableEditing, tableEditingKey, tableNodeTypes, tableNodes, toggleHeader, toggleHeaderCell, toggleHeaderColumn, toggleHeaderRow, updateColumnsOnResize };\n//# sourceMappingURL=index.js.map","// Prevent tree-shaking from removing Vue's `h` and `Fragment`,\n// which are required at runtime for TSX to work.\nexport function keepAlive(..._args: unknown[]) {}\n","import clsx from 'clsx'\nimport DOMPurify from 'dompurify'\nimport { h } from 'vue'\n\nimport { keepAlive } from '../keep-alive'\n\nkeepAlive(h)\n\ntype IconProps = {\n icon?: string | null\n class?: string\n onClick?: (event: PointerEvent) => void\n}\n\nexport function Icon({ icon, class: className, onClick }: IconProps) {\n return (\n <span\n class={clsx('milkdown-icon', className)}\n onPointerdown={onClick}\n innerHTML={icon ? DOMPurify.sanitize(icon.trim()) : undefined}\n />\n )\n}\n\nIcon.props = {\n icon: {\n type: String,\n required: false,\n },\n class: {\n type: String,\n required: false,\n },\n onClick: {\n type: Function,\n required: false,\n },\n}\n","import type { DragContext, Refs } from '../view/types'\n\nexport function prepareDndContext(refs: Refs): DragContext | undefined {\n const {\n dragPreviewRef,\n tableWrapperRef,\n contentWrapperRef,\n yLineHandleRef,\n xLineHandleRef,\n } = refs\n\n const preview = dragPreviewRef.value\n if (!preview) return\n const wrapper = tableWrapperRef.value\n if (!wrapper) return\n const content = contentWrapperRef.value\n if (!content) return\n const contentRoot = content.querySelector('tbody')\n if (!contentRoot) return\n const previewRoot = preview.querySelector('tbody')\n if (!previewRoot) return\n const yHandle = yLineHandleRef.value\n if (!yHandle) return\n const xHandle = xLineHandleRef.value\n if (!xHandle) return\n\n const context = {\n preview,\n wrapper,\n content,\n contentRoot,\n previewRoot,\n yHandle,\n xHandle,\n }\n\n return context\n}\n","export function clearPreview(previewRoot: HTMLElement) {\n while (previewRoot.firstChild) previewRoot.removeChild(previewRoot.firstChild)\n}\n\nexport function renderPreview(\n axis: 'x' | 'y',\n preview: HTMLElement,\n previewRoot: HTMLElement,\n tableContent: HTMLElement,\n index: number\n) {\n const { width: tableWidth, height: tableHeight } = tableContent\n .querySelector('tbody')!\n .getBoundingClientRect()\n if (axis === 'y') {\n const rows = tableContent.querySelectorAll('tr')\n const row = rows[index]\n if (!row) return\n\n previewRoot.appendChild(row.cloneNode(true))\n const height = row.getBoundingClientRect().height\n\n Object.assign(preview.style, {\n width: `${tableWidth}px`,\n height: `${height}px`,\n })\n\n preview.dataset.show = 'true'\n\n return\n }\n\n if (axis === 'x') {\n const rows = tableContent.querySelectorAll('tr')\n let width: number | undefined\n\n Array.from(rows).forEach((row) => {\n const col = row.children[index]\n if (!col) return\n\n if (width === undefined) width = col.getBoundingClientRect().width\n\n const tr = col.parentElement!.cloneNode(false)\n const clone = col.cloneNode(true)\n tr.appendChild(clone)\n previewRoot.appendChild(tr)\n })\n\n Object.assign(preview.style, {\n width: `${width}px`,\n height: `${tableHeight}px`,\n })\n\n preview.dataset.show = 'true'\n\n return\n }\n}\n","import type { Ctx } from '@jvs-milkdown/ctx'\n\nimport { editorViewCtx } from '@jvs-milkdown/core'\n\nimport type { DragContext, Refs } from '../view/types'\n\nimport { prepareDndContext } from './prepare-dnd-context'\nimport { clearPreview, renderPreview } from './preview'\n\nexport function createDragRowHandler(refs: Refs, ctx?: Ctx) {\n return (event: DragEvent) => {\n handleDrag(refs, event, ctx, (context) => {\n updateDragInfo('y', event, context, refs)\n\n const { preview, content, previewRoot } = context\n\n clearPreview(previewRoot)\n\n const { hoverIndex } = refs\n const [rowIndex] = hoverIndex.value\n renderPreview('y', preview, previewRoot, content, rowIndex)\n })\n }\n}\n\nexport function createDragColHandler(refs: Refs, ctx?: Ctx) {\n return (event: DragEvent) => {\n handleDrag(refs, event, ctx, (context) => {\n updateDragInfo('x', event, context, refs)\n\n const { preview, content, previewRoot } = context\n\n const { hoverIndex } = refs\n const [_, colIndex] = hoverIndex.value\n\n clearPreview(previewRoot)\n\n renderPreview('x', preview, previewRoot, content, colIndex)\n })\n }\n}\n\nfunction updateDragInfo(\n axis: 'x' | 'y',\n event: DragEvent,\n context: DragContext,\n refs: Refs\n) {\n const { xHandle, yHandle, preview } = context\n xHandle.dataset.displayType = axis === 'y' ? 'indicator' : 'none'\n yHandle.dataset.displayType = axis === 'x' ? 'indicator' : 'none'\n\n const { hoverIndex, dragInfo } = refs\n const [rowIndex, colIndex] = hoverIndex.value\n\n dragInfo.value = {\n startCoords: [event.clientX, event.clientY],\n startIndex: axis === 'y' ? rowIndex : colIndex,\n endIndex: axis === 'y' ? rowIndex : colIndex,\n type: axis === 'y' ? 'row' : 'col',\n }\n\n preview.dataset.direction = axis === 'y' ? 'vertical' : 'horizontal'\n}\n\nfunction handleDrag(\n refs: Refs,\n event: DragEvent,\n ctx: Ctx | undefined,\n fn: (context: DragContext) => void\n) {\n const view = ctx?.get(editorViewCtx)\n if (!view?.editable) return\n\n event.stopPropagation()\n if (event.dataTransfer) event.dataTransfer.effectAllowed = 'move'\n\n const context = prepareDndContext(refs)\n\n if (!context) return\n\n // This is to avoid a chrome bug:\n // https://stackoverflow.com/questions/14203734/dragend-dragenter-and-dragleave-firing-off-immediately-when-i-drag\n requestAnimationFrame(() => {\n fn(context)\n })\n}\n","import type { Node } from '@jvs-milkdown/prose/model'\nimport type { EditorView } from '@jvs-milkdown/prose/view'\nimport type { Ref } from 'vue'\n\nimport { findParent } from '@jvs-milkdown/prose'\nimport { CellSelection, findTable } from '@jvs-milkdown/prose/tables'\n\nimport type { CellIndex, Refs } from './types'\n\nfunction findNodeIndex(parent: Node, child: Node) {\n for (let i = 0; i < parent.childCount; i++) {\n if (parent.child(i) === child) return i\n }\n return -1\n}\n\nexport function findPointerIndex(\n event: PointerEvent,\n view?: EditorView\n): CellIndex | undefined {\n if (!view) return\n\n try {\n const posAtCoords = view.posAtCoords({\n left: event.clientX,\n top: event.clientY,\n })\n if (!posAtCoords) return\n const pos = posAtCoords?.inside\n if (pos == null || pos < 0) return\n\n const $pos = view.state.doc.resolve(pos)\n const node = view.state.doc.nodeAt(pos)\n if (!node) return\n\n const cellType = ['table_cell', 'table_header']\n const rowType = ['table_row', 'table_header_row']\n\n const cell = cellType.includes(node.type.name)\n ? node\n : findParent((node) => cellType.includes(node.type.name))($pos)?.node\n const row = findParent((node) => rowType.includes(node.type.name))(\n $pos\n )?.node\n const table = findParent((node) => node.type.name === 'table')($pos)?.node\n if (!cell || !row || !table) return\n\n const columnIndex = findNodeIndex(row, cell)\n const rowIndex = findNodeIndex(table, row)\n\n return [rowIndex, columnIndex]\n } catch {\n return undefined\n }\n}\n\nexport function getRelatedDOM(\n contentWrapperRef: Ref<HTMLElement | undefined>,\n [rowIndex, columnIndex]: CellIndex\n) {\n const content = contentWrapperRef.value\n if (!content) return\n const rows = content.querySelectorAll('tr')\n const row = rows[rowIndex]\n if (!row) return\n\n const firstRow = rows[0]\n if (!firstRow) return\n\n const headerCol = firstRow.children[columnIndex]\n if (!headerCol) return\n\n const col = row.children[columnIndex]\n if (!col) return\n\n return {\n row,\n col,\n headerCol,\n }\n}\n\nexport function recoveryStateBetweenUpdate(\n refs: Refs,\n view?: EditorView,\n node?: Node\n) {\n if (!node) return\n if (!view) return\n const { selection } = view.state\n if (!(selection instanceof CellSelection)) return\n\n const { $from } = selection\n const table = findTable($from)\n if (!table || table.node !== node) return\n\n if (selection.isColSelection()) {\n const { $head } = selection\n const colIndex = $head.index($head.depth - 1)\n refs.hoverIndex.value = [0, colIndex]\n return\n }\n if (selection.isRowSelection()) {\n const { $head } = selection\n const rowNode = findParent(\n (node) =>\n node.type.name === 'table_row' || node.type.name === 'table_header_row'\n )($head)\n if (!rowNode) return\n const rowIndex = findNodeIndex(table.node, rowNode.node)\n refs.hoverIndex.value = [rowIndex, 0]\n }\n}\n","function findDragOverElement(\n elements: Element[],\n pointer: number,\n axis: 'x' | 'y'\n): [Element, number] | undefined {\n const startProp = axis === 'x' ? 'left' : 'top'\n const endProp = axis === 'x' ? 'right' : 'bottom'\n const lastIndex = elements.length - 1\n\n const index = elements.findIndex((el, index) => {\n const rect = el.getBoundingClientRect()\n const boundaryStart = rect[startProp]\n const boundaryEnd = rect[endProp]\n\n // The pointer is within the boundary of the current element.\n if (boundaryStart <= pointer && pointer <= boundaryEnd) return true\n // The pointer is beyond the last element.\n if (index === lastIndex && pointer > boundaryEnd) return true\n // The pointer is before the first element.\n if (index === 0 && pointer < boundaryStart) return true\n\n return false\n })\n\n const element = elements[index]\n\n return element ? [element, index] : undefined\n}\n\nexport function getDragOverColumn(\n table: Element,\n pointerX: number\n): [element: Element, index: number] | undefined {\n const firstRow = table.querySelector('tr')\n if (!firstRow) return\n const cells = Array.from(firstRow.children)\n return findDragOverElement(cells, pointerX, 'x')\n}\n\nexport function getDragOverRow(\n table: Element,\n pointerY: number\n): [element: Element, index: number] | undefined {\n const rows = Array.from(table.querySelectorAll('tr'))\n return findDragOverElement(rows, pointerY, 'y')\n}\n","import { computePosition, offset } from '@floating-ui/dom'\nimport { throttle } from 'lodash-es'\n\nimport type { Refs } from '../view/types'\n\nimport { getRelatedDOM } from '../view/utils'\nimport { getDragOverColumn, getDragOverRow } from './calc-drag-over'\nimport { prepareDndContext } from './prepare-dnd-context'\n\nexport function createDragOverHandler(refs: Refs): (e: DragEvent) => void {\n return throttle((e: DragEvent) => {\n const context = prepareDndContext(refs)\n if (!context) return\n const { preview, content, contentRoot, xHandle, yHandle } = context\n const { dragInfo, hoverIndex } = refs\n\n if (preview.dataset.show === 'false') return\n const dom = getRelatedDOM(refs.contentWrapperRef, hoverIndex.value!)\n if (!dom) return\n const firstRow = contentRoot.querySelector('tr')\n if (!firstRow) return\n const info = dragInfo.value\n if (!info) return\n\n if (!contentRoot.offsetParent) return\n\n const wrapperOffsetTop = (contentRoot.offsetParent as HTMLElement).offsetTop\n const wrapperOffsetLeft = (contentRoot.offsetParent as HTMLElement)\n .offsetLeft\n\n if (info.type === 'col') {\n const width = dom.col.getBoundingClientRect().width\n const { left, width: fullWidth } = contentRoot.getBoundingClientRect()\n const leftGap = wrapperOffsetLeft - left\n const previewLeft = e.clientX + leftGap - width / 2\n\n const [startX] = info.startCoords\n const direction = startX < e.clientX ? 'right' : 'left'\n\n preview.style.top = `${wrapperOffsetTop}px`\n const previewLeftOffset =\n previewLeft < left + leftGap - 20\n ? left + leftGap - 20\n : previewLeft > left + fullWidth + leftGap - width + 20\n ? left + fullWidth + leftGap - width + 20\n : previewLeft\n\n preview.style.left = `${previewLeftOffset}px`\n\n const dragOverColumn = getDragOverColumn(contentRoot, e.clientX)\n if (dragOverColumn) {\n const [col, index] = dragOverColumn\n const yHandleWidth = yHandle.getBoundingClientRect().width\n const contentBoundary = content.getBoundingClientRect()\n info.endIndex = index\n\n computePosition(col, yHandle, {\n placement: direction === 'left' ? 'left' : 'right',\n middleware: [offset(direction === 'left' ? -1 * yHandleWidth : 0)],\n })\n .then(({ x }) => {\n yHandle.dataset.show = 'true'\n Object.assign(yHandle.style, {\n height: `${contentBoundary.height}px`,\n left: `${x}px`,\n top: `${wrapperOffsetTop}px`,\n })\n })\n .catch(console.error)\n }\n } else if (info.type === 'row') {\n const height = dom.row.getBoundingClientRect().height\n const { top, height: fullHeight } = contentRoot.getBoundingClientRect()\n\n const topGap = wrapperOffsetTop - top\n const previewTop = e.clientY + topGap - height / 2\n\n const [_, startY] = info.startCoords\n const direction = startY < e.clientY ? 'down' : 'up'\n\n const previewTopOffset =\n previewTop < top + topGap - 20\n ? top + topGap - 20\n : previewTop > top + fullHeight + topGap - height + 20\n ? top + fullHeight + topGap - height + 20\n : previewTop\n\n preview.style.top = `${previewTopOffset}px`\n preview.style.left = `${wrapperOffsetLeft}px`\n\n const dragOverRow = getDragOverRow(contentRoot, e.clientY)\n if (dragOverRow) {\n const [row, index] = dragOverRow\n const xHandleHeight = xHandle.getBoundingClientRect().height\n const contentBoundary = content.getBoundingClientRect()\n info.endIndex = index\n\n computePosition(row, xHandle, {\n placement: direction === 'up' ? 'top' : 'bottom',\n middleware: [offset(direction === 'up' ? -1 * xHandleHeight : 0)],\n })\n .then(({ y }) => {\n xHandle.dataset.show = 'true'\n Object.assign(xHandle.style, {\n width: `${contentBoundary.width}px`,\n top: `${y}px`,\n })\n })\n .catch(console.error)\n }\n }\n }, 20)\n}\n","import type { Ctx } from '@jvs-milkdown/ctx'\n\nimport { commandsCtx, editorViewCtx } from '@jvs-milkdown/core'\nimport {\n moveColCommand,\n moveRowCommand,\n selectColCommand,\n selectRowCommand,\n} from '@jvs-milkdown/preset-gfm'\nimport { onMounted, onUnmounted } from 'vue'\n\nimport type { CellIndex, Refs } from './types'\n\nimport {\n createDragColHandler,\n createDragRowHandler,\n} from '../dnd/create-drag-handler'\nimport { createDragOverHandler } from '../dnd/drag-over-handler'\n\nexport function useDragHandlers(\n refs: Refs,\n ctx?: Ctx,\n getPos?: () => number | undefined\n) {\n const { dragPreviewRef, yLineHandleRef, xLineHandleRef, dragInfo } = refs\n\n const dragRow = createDragRowHandler(refs, ctx)\n const dragCol = createDragColHandler(refs, ctx)\n\n const onDragEnd = () => {\n const preview = dragPreviewRef.value\n if (!preview) return\n\n if (preview.dataset.show === 'false') return\n\n const previewRoot = preview?.querySelector('tbody')\n\n while (previewRoot?.firstChild)\n previewRoot?.removeChild(previewRoot.firstChild)\n\n if (preview) preview.dataset.show = 'false'\n }\n\n const onDrop = () => {\n const preview = dragPreviewRef.value\n if (!preview) return\n const yHandle = yLineHandleRef.value\n if (!yHandle) return\n const xHandle = xLineHandleRef.value\n if (!xHandle) return\n const info = dragInfo.value\n if (!info) return\n if (!ctx) return\n if (preview.dataset.show === 'false') return\n\n yHandle.dataset.show = 'false'\n xHandle.dataset.show = 'false'\n\n if (info.startIndex === info.endIndex) return\n\n const commands = ctx.get(commandsCtx)\n const payload = {\n from: info.startIndex,\n to: info.endIndex,\n pos: (getPos?.() ?? 0) + 1,\n }\n if (info.type === 'col') {\n commands.call(selectColCommand.key, {\n pos: payload.pos,\n index: info.startIndex,\n })\n commands.call(moveColCommand.key, payload)\n const index: CellIndex = [0, info.endIndex]\n refs.hoverIndex.value = index\n } else {\n commands.call(selectRowCommand.key, {\n pos: payload.pos,\n index: info.startIndex,\n })\n commands.call(moveRowCommand.key, payload)\n const index: CellIndex = [info.endIndex, 0]\n refs.hoverIndex.value = index\n }\n\n requestAnimationFrame(() => {\n ctx.get(editorViewCtx).focus()\n })\n }\n const onDragOver = createDragOverHandler(refs)\n\n onMounted(() => {\n window.addEventListener('dragover', onDragOver)\n window.addEventListener('dragend', onDragEnd)\n window.addEventListener('drop', onDrop)\n })\n\n onUnmounted(() => {\n window.removeEventListener('dragover', onDragOver)\n window.removeEventListener('dragend', onDragEnd)\n window.removeEventListener('drop', onDrop)\n })\n\n return {\n dragRow,\n dragCol,\n }\n}\n","import type { Ctx } from '@jvs-milkdown/ctx'\n\nimport { commandsCtx, editorViewCtx } from '@jvs-milkdown/core'\nimport {\n addColAfterCommand,\n addColBeforeCommand,\n addRowAfterCommand,\n addRowBeforeCommand,\n deleteSelectedCellsCommand,\n mergeCellsCommand,\n selectColCommand,\n selectRowCommand,\n setAlignCommand,\n} from '@jvs-milkdown/preset-gfm'\nimport { TextSelection } from '@jvs-milkdown/prose/state'\nimport {\n CellSelection,\n selectedRect,\n splitCellWithType,\n} from '@jvs-milkdown/prose/tables'\n\nimport type { Refs } from './types'\n\nexport function useOperation(\n refs: Refs,\n ctx?: Ctx,\n getPos?: () => number | undefined\n) {\n const { contentWrapperRef, hoverIndex } = refs\n\n const addRowByIndex = (index: number) => {\n if (!ctx || !ctx.get(editorViewCtx).editable) return\n\n const rows = Array.from(\n contentWrapperRef.value?.querySelectorAll('tr') ?? []\n )\n const commands = ctx.get(commandsCtx)\n const pos = (getPos?.() ?? 0) + 1\n if (rows.length === index) {\n commands.call(selectRowCommand.key, { pos, index: index - 1 })\n commands.call(addRowAfterCommand.key)\n } else {\n commands.call(selectRowCommand.key, { pos, index })\n commands.call(addRowBeforeCommand.key)\n }\n\n commands.call(selectRowCommand.key, { pos, index })\n }\n\n const addColByIndex = (index: number) => {\n if (!ctx || !ctx.get(editorViewCtx).editable) return\n const cols = Array.from(\n contentWrapperRef.value?.querySelector('tr')?.children ?? []\n )\n const commands = ctx.get(commandsCtx)\n\n const pos = (getPos?.() ?? 0) + 1\n if (cols.length === index) {\n commands.call(selectColCommand.key, { pos, index: index - 1 })\n commands.call(addColAfterCommand.key)\n } else {\n commands.call(selectColCommand.key, { pos, index })\n commands.call(addColBeforeCommand.key)\n }\n commands.call(selectColCommand.key, { pos, index })\n }\n\n const selectCol = () => {\n if (!ctx) return\n const [_, colIndex] = hoverIndex.value!\n const commands = ctx.get(commandsCtx)\n const pos = (getPos?.() ?? 0) + 1\n commands.call(selectColCommand.key, { pos, index: colIndex })\n }\n\n const selectRow = () => {\n if (!ctx) return\n const [rowIndex, _] = hoverIndex.value!\n const commands = ctx.get(commandsCtx)\n const pos = (getPos?.() ?? 0) + 1\n commands.call(selectRowCommand.key, { pos, index: rowIndex })\n }\n\n const deleteSelected = (e: PointerEvent) => {\n if (!ctx) return\n\n if (!ctx.get(editorViewCtx).editable) return\n\n e.preventDefault()\n e.stopPropagation()\n const commands = ctx.get(commandsCtx)\n commands.call(deleteSelectedCellsCommand.key)\n requestAnimationFrame(() => {\n ctx.get(editorViewCtx).focus()\n })\n }\n\n const onAlign =\n (direction: 'left' | 'center' | 'right') => (e: PointerEvent) => {\n if (!ctx) return\n\n if (!ctx.get(editorViewCtx).editable) return\n\n e.preventDefault()\n e.stopPropagation()\n const commands = ctx.get(commandsCtx)\n commands.call(setAlignCommand.key, direction)\n requestAnimationFrame(() => {\n ctx.get(editorViewCtx).focus()\n })\n }\n\n const onMergeCells = (e: PointerEvent) => {\n if (!ctx) return\n if (!ctx.get(editorViewCtx).editable) return\n e.preventDefault()\n e.stopPropagation()\n const commands = ctx.get(commandsCtx)\n commands.call(mergeCellsCommand.key)\n requestAnimationFrame(() => {\n ctx.get(editorViewCtx).focus()\n })\n }\n\n const onSplitCell = (e: PointerEvent) => {\n if (!ctx) return\n if (!ctx.get(editorViewCtx).editable) return\n e.preventDefault()\n e.stopPropagation()\n const view = ctx.get(editorViewCtx)\n const { state } = view\n const { selection } = state\n\n // Find the merged cell\n let cellNode: ReturnType<typeof selection.$from.node> | null = null\n let cellPos: number | null = null\n\n if (selection instanceof CellSelection) {\n selection.forEachCell((cell, pos) => {\n if (\n !cellNode &&\n ((cell.attrs.rowspan ?? 1) > 1 || (cell.attrs.colspan ?? 1) > 1)\n ) {\n cellNode = cell\n cellPos = pos\n }\n })\n } else {\n const { $from } = selection\n for (let d = $from.depth; d > 0; d--) {\n const n = $from.node(d)\n if (n.type.name === 'table_cell' || n.type.name === 'table_header') {\n cellNode = n\n cellPos = $from.before(d)\n break\n }\n }\n }\n\n if (!cellNode || cellPos == null) return\n if (\n (cellNode.attrs.colspan ?? 1) == 1 &&\n (cellNode.attrs.rowspan ?? 1) == 1\n )\n return\n\n // Set selection to TextSelection inside the merged cell.\n // This avoids the prosemirror-tables bug where splitCell creates\n // a CellSelection using unmapped positions after the split.\n const $cellPos = state.doc.resolve(cellPos + 2)\n view.dispatch(state.tr.setSelection(TextSelection.near($cellPos)))\n\n // Use splitCellWithType to produce correct cell types per row.\n // prosemirror-tables' splitCell always uses the merged cell's type\n // (e.g. table_header) for ALL new cells, but milkdown's schema\n // requires table_header in table_header_row and table_cell in\n // table_row. Without this, inserts into body rows fail due to\n // schema mismatch, corrupting the table.\n const newState = view.state\n const { table } = selectedRect(newState)\n const { schema } = newState\n\n splitCellWithType(({ row }) => {\n const rowNode = table.child(row)\n return rowNode.type.name === 'table_header_row'\n ? schema.nodes.table_header!\n : schema.nodes.table_cell!\n })(newState, (tr) => {\n view.dispatch(tr)\n })\n\n requestAnimationFrame(() => {\n view.focus()\n })\n }\n\n return {\n addRowByIndex,\n addColByIndex,\n selectCol,\n selectRow,\n deleteSelected,\n onAlign,\n onMergeCells,\n onSplitCell,\n }\n}\n","import type { EditorView } from '@jvs-milkdown/prose/view'\n\nimport type { Refs } from './types'\n\nexport function usePointerHandlers(_refs: Refs, _view?: EditorView) {\n const pointerMove = (_e: PointerEvent) => {}\n const pointerLeave = () => {}\n\n return {\n pointerMove,\n pointerLeave,\n }\n}\n","import type { Ctx } from '@jvs-milkdown/ctx'\nimport type { Node } from '@jvs-milkdown/prose/model'\nimport type { EditorView } from '@jvs-milkdown/prose/view'\n\nimport { computePosition } from '@floating-ui/dom'\nimport { CellSelection } from '@jvs-milkdown/prose/tables'\nimport {\n defineComponent,\n ref,\n type VNodeRef,\n h,\n onMounted,\n onBeforeUnmount,\n type Ref,\n} from 'vue'\n\nimport type { TableBlockConfig } from '../config'\nimport type { CellIndex, DragInfo, Refs } from './types'\n\nimport { Icon } from '../../__internal__/components/icon'\nimport { keepAlive } from '../../__internal__/keep-alive'\nimport { useDragHandlers } from './drag'\nimport { useOperation } from './operation'\nimport { usePointerHandlers } from './pointer'\nimport { recoveryStateBetweenUpdate } from './utils'\n\nkeepAlive(h)\n\ntype TableBlockProps = {\n view: EditorView\n ctx: Ctx\n getPos: () => number | undefined\n config: TableBlockConfig\n onMount: (div: Element) => void\n node: Ref<Node>\n}\n\nexport const TableBlock = defineComponent<TableBlockProps>({\n props: {\n view: {\n type: Object,\n required: true,\n },\n ctx: {\n type: Object,\n required: true,\n },\n getPos: {\n type: Function,\n required: true,\n },\n config: {\n type: Object,\n required: true,\n },\n onMount: {\n type: Function,\n required: true,\n },\n node: {\n type: Object,\n required: true,\n },\n },\n setup({ view, node, ctx, getPos, config, onMount }) {\n const contentWrapperRef = ref<HTMLElement>()\n let contentMounted = false\n const contentWrapperFunctionRef: VNodeRef = (div) => {\n if (div == null) return\n if (div instanceof HTMLElement) {\n contentWrapperRef.value = div\n if (!contentMounted) {\n onMount(div)\n contentMounted = true\n }\n } else {\n contentWrapperRef.value = undefined\n }\n }\n const tableWrapperRef = ref<HTMLDivElement>()\n const dragPreviewRef = ref<HTMLDivElement>()\n const hoverIndex = ref<CellIndex>([0, 0])\n const lineHoverIndex = ref<CellIndex>([-1, -1])\n const dragInfo = ref<DragInfo>()\n const yLineHandleRef = ref<HTMLDivElement>()\n const xLineHandleRef = ref<HTMLDivElement>()\n\n // --- Column resize state ---\n const resizingCol = ref(-1)\n const colWidths = ref<number[]>([])\n\n const syncColWidths = () => {\n if (resizingCol.value >= 0) return\n const firstRow = node.value.firstChild\n if (!firstRow) return\n const colCount = firstRow.content.childCount\n const widths: number[] = []\n const hasBounds = colBounds.value.length === colCount\n for (let i = 0; i < colCount; i++) {\n const cell = firstRow.content.child(i)\n const w = cell.attrs.colwidth\n if (Array.isArray(w) && w[0]) {\n widths.push(w[0])\n } else if (hasBounds) {\n widths.push(Math.round(colBounds.value[i]!.width))\n } else {\n widths.push(0)\n }\n }\n colWidths.value = widths\n }\n\n const refs: Refs = {\n dragPreviewRef,\n tableWrapperRef,\n contentWrapperRef,\n yLineHandleRef,\n xLineHandleRef,\n hoverIndex,\n lineHoverIndex,\n dragInfo,\n }\n\n const { pointerLeave, pointerMove } = usePointerHandlers(refs, view)\n const { dragRow, dragCol } = useDragHandlers(refs, ctx, getPos)\n const {\n\n addRowByIndex,\n addColByIndex,\n selectCol,\n selectRow,\n deleteSelected,\n onAlign,\n onMergeCells,\n onSplitCell,\n } = useOperation(refs, ctx, getPos)\n\n // --- Floating cell toolbar state ---\n const cellToolbarRef = ref<HTMLDivElement>()\n const showCellToolbar = ref(false)\n const canMerge = ref(false)\n const canSplit = ref(false)\n\n const updateCellToolbar = () => {\n const { selection } = view.state\n const tablePos = getPos()\n if (tablePos == null) {\n showCellToolbar.value = false\n return\n }\n const tableEnd = tablePos + node.value.nodeSize\n if (selection.from < tablePos || selection.from > tableEnd) {\n showCellToolbar.value = false\n return\n }\n\n if (selection instanceof CellSelection) {\n // Compute merge/split availability\n let _cellCount = 0\n let hasMerged = false\n selection.forEachCell((cell) => {\n _cellCount++\n if ((cell.attrs.rowspan ?? 1) > 1 || (cell.attrs.colspan ?? 1) > 1) {\n hasMerged = true\n }\n })\n canMerge.value = _cellCount > 1\n canSplit.value = hasMerged\n } else {\n // TextSelection: only show toolbar for CellSelection-based actions\n showCellToolbar.value = false\n return\n }\n\n if (!canMerge.value && !canSplit.value) {\n showCellToolbar.value = false\n return\n }\n\n showCellToolbar.value = true\n\n // Position toolbar above the first selected cell using floating-ui\n requestAnimationFrame(() => {\n const toolbar = cellToolbarRef.value\n const content = contentWrapperRef.value\n if (!toolbar || !content) return\n\n const selectedCells = content.querySelectorAll('.selectedCell')\n let refEl: Element | null =\n selectedCells.length > 0 ? selectedCells[0]! : null\n\n if (!refEl && !(view.state.selection instanceof CellSelection)) {\n const { $from } = view.state.selection\n for (let d = $from.depth; d > 0; d--) {\n const node = $from.node(d)\n if (\n node.type.name === 'table_cell' ||\n node.type.name === 'table_header'\n ) {\n const cellPos = $from.before(d)\n const dom = view.nodeDOM(cellPos)\n if (dom instanceof HTMLElement) refEl = dom\n break\n }\n }\n }\n\n if (!refEl) return\n\n computePosition(refEl, toolbar, { placement: 'top' })\n .then(({ x, y }) => {\n toolbar.style.left = `${x}px`\n toolbar.style.top = `${y}px`\n toolbar.dataset.show = 'true'\n })\n .catch(console.error)\n })\n }\n\n const colBounds = ref<{ left: number; width: number }[]>([])\n const rowBounds = ref<{ top: number; height: number }[]>([])\n\n let ro: ResizeObserver | null = null\n let mo: MutationObserver | null = null\n\n const updateBounds = () => {\n const content = contentWrapperRef.value\n if (!content) return\n\n const firstRow = content.querySelector('tr')\n const tableRect = content.getBoundingClientRect()\n\n if (firstRow) {\n colBounds.value = Array.from(firstRow.children).map((c) => {\n const rect = c.getBoundingClientRect()\n return { left: rect.left - tableRect.left, width: rect.width }\n })\n }\n\n const rows = content.querySelectorAll('tr')\n rowBounds.value = Array.from(rows).map((c) => {\n const rect = c.getBoundingClientRect()\n return { top: rect.top - tableRect.top, height: rect.height }\n })\n syncColWidths()\n }\n\n const startResize = (e: PointerEvent, colIndex: number) => {\n if (!view.editable) return\n e.preventDefault()\n e.stopPropagation()\n const startX = e.clientX\n const startWidth = colBounds.value[colIndex]?.width ?? 100\n resizingCol.value = colIndex\n\n const onMove = (ev: PointerEvent) => {\n const delta = ev.clientX - startX\n const newWidth = Math.max(50, startWidth + delta)\n colWidths.value = colWidths.value.map((w, i) =>\n i === colIndex ? newWidth : w\n )\n }\n\n const onUp = (ev: PointerEvent) => {\n document.removeEventListener('pointermove', onMove)\n document.removeEventListener('pointerup', onUp)\n\n const delta = ev.clientX - startX\n const newWidth = Math.max(50, startWidth + delta)\n\n // Commit via ProseMirror transaction\n const tablePos = getPos()\n if (tablePos == null) {\n resizingCol.value = -1\n return\n }\n const tableNode = node.value\n let tr = view.state.tr\n let pos = tablePos + 1\n\n tableNode.forEach((row) => {\n let cellIdx = 0\n row.forEach((cell, _offset, cellNodePos) => {\n if (cellIdx === colIndex) {\n const absPos = tablePos + 1 + cellNodePos\n const colwidth = [Math.round(newWidth)]\n tr = tr.setNodeMarkup(absPos, undefined, {\n ...cell.attrs,\n colwidth,\n })\n }\n cellIdx++\n })\n pos += row.nodeSize\n })\n\n resizingCol.value = -1\n if (tr.docChanged) view.dispatch(tr)\n }\n\n document.addEventListener('pointermove', onMove)\n document.addEventListener('pointerup', onUp)\n }\n\n const activeColIndex = ref(-1)\n const activeRowIndex = ref(-1)\n\n // Listen for ProseMirror state updates\n const dispatchListener = () => {\n updateCellToolbar()\n\n // Update active handler button groups based on selection\n const { selection } = view.state\n if (selection instanceof CellSelection) {\n if (selection.isColSelection()) {\n const { $head } = selection\n activeColIndex.value = $head.index($head.depth - 1)\n activeRowIndex.value = -1\n } else if (selection.isRowSelection()) {\n activeColIndex.value = -1\n // Simple approach for row index: derive from hoverIndex which is updated by pointer? Or compute.\n // recoveryStateBetweenUpdate updates hoverIndex.\n } else {\n activeColIndex.value = -1\n activeRowIndex.value = -1\n }\n } else {\n activeColIndex.value = -1\n activeRowIndex.value = -1\n }\n }\n\n onMounted(() => {\n requestAnimationFrame(() => {\n if (view.editable) recoveryStateBetweenUpdate(refs, view, node.value)\n syncColWidths()\n })\n view.dom.addEventListener('keyup', dispatchListener)\n view.dom.addEventListener('pointerup', dispatchListener)\n updateCellToolbar()\n\n ro = new ResizeObserver(() => {\n requestAnimationFrame(updateBounds)\n })\n mo = new MutationObserver((mutations) => {\n let shouldUpdate = false\n for (const mut of mutations) {\n if (mut.type === 'childList') {\n for (const node of mut.addedNodes) {\n if (\n node instanceof HTMLElement &&\n ['TR', 'TD', 'TH', 'TBODY'].includes(node.nodeName)\n )\n shouldUpdate = true\n }\n for (const node of mut.removedNodes) {\n if (\n node instanceof HTMLElement &&\n ['TR', 'TD', 'TH', 'TBODY'].includes(node.nodeName)\n )\n shouldUpdate = true\n }\n } else if (mut.type === 'attributes') {\n shouldUpdate = true\n }\n }\n if (shouldUpdate) {\n requestAnimationFrame(updateBounds)\n }\n })\n\n if (contentWrapperRef.value) {\n ro.observe(contentWrapperRef.value)\n mo.observe(contentWrapperRef.value, {\n childList: true,\n subtree: true,\n attributes: true,\n })\n }\n })\n\n onBeforeUnmount(() => {\n view.dom.removeEventListener('keyup', dispatchListener)\n view.dom.removeEventListener('pointerup', dispatchListener)\n if (ro) ro.disconnect()\n if (mo) mo.disconnect()\n })\n\n return () => {\n updateCellToolbar()\n\n return (\n <div\n onDragstart={(e) => e.preventDefault()}\n onDragover={(e) => e.preventDefault()}\n onDragleave={(e) => e.preventDefault()}\n onPointermove={pointerMove}\n onPointerleave={pointerLeave}\n class=\"milkdown-table-wrapper-outer\"\n >\n {/* Floating cell toolbar (merge/split) */}\n <div\n ref={cellToolbarRef}\n data-show={showCellToolbar.value ? 'true' : 'false'}\n class=\"cell-toolbar\"\n contenteditable=\"false\"\n onPointerdown={(e: PointerEvent) => e.stopPropagation()}\n >\n {canMerge.value && (\n <button\n type=\"button\"\n class=\"cell-toolbar-btn\"\n onPointerdown={onMergeCells}\n >\n <Icon icon={config.renderButton('merge_cells')} />\n </button>\n )}\n {canSplit.value && (\n <button\n type=\"button\"\n class=\"cell-toolbar-btn\"\n onPointerdown={onSplitCell}\n >\n <Icon icon={config.renderButton('split_cell')} />\n </button>\n )}\n </div>\n\n <div class=\"table-wrapper\" ref={tableWrapperRef}>\n {/* Fixed Col Drag Handles */}\n <div contenteditable=\"false\" class=\"fixed-handles-col\">\n {colBounds.value.map((bound, i) => (\n <div\n key={`col-${i}`}\n class=\"handle cell-handle fixed\"\n data-role=\"col-drag-handle\"\n draggable=\"true\"\n style={{ left: `${bound.left}px`, width: `${bound.width}px` }}\n onDragstart={(e) => {\n hoverIndex.value = [0, i]\n dragCol(e)\n }}\n onClick={() => {\n hoverIndex.value = [0, i]\n selectCol()\n activeColIndex.value = i\n activeRowIndex.value = -1\n }}\n onPointerdown={(e: PointerEvent) => e.stopPropagation()}\n onPointermove={(e: PointerEvent) => e.stopPropagation()}\n >\n <div\n class=\"button-group\"\n data-show={activeColIndex.value === i ? 'true' : 'false'}\n onPointermove={(e: PointerEvent) => e.stopPropagation()}\n >\n <button\n type=\"button\"\n onPointerdown={(e) => {\n hoverIndex.value = [0, i]\n onAlign('left')(e)\n }}\n >\n <Icon icon={config.renderButton('align_col_left')} />\n </button>\n <button\n type=\"button\"\n onPointerdown={(e) => {\n hoverIndex.value = [0, i]\n onAlign('center')(e)\n }}\n >\n <Icon icon={config.renderButton('align_col_center')} />\n </button>\n <button\n type=\"button\"\n onPointerdown={(e) => {\n hoverIndex.value = [0, i]\n onAlign('right')(e)\n }}\n >\n <Icon icon={config.renderButton('align_col_right')} />\n </button>\n <button\n type=\"button\"\n onPointerdown={(e) => {\n hoverIndex.value = [0, i]\n deleteSelected(e)\n }}\n >\n <Icon icon={config.renderButton('delete_col')} />\n </button>\n </div>\n </div>\n ))}\n </div>\n\n {/* Add Col Dots */}\n <div contenteditable=\"false\" class=\"add-dots-col\">\n {[\n ...colBounds.value.map((b) => b.left),\n colBounds.value.length\n ? colBounds.value[colBounds.value.length - 1]!.left +\n colBounds.value[colBounds.value.length - 1]!.width\n : 0,\n ].map((left, i) => (\n <div\n key={`add-col-${i}`}\n class=\"add-dot\"\n style={{ left: `${left}px` }}\n onClick={() => addColByIndex(i)}\n onPointerdown={(e: PointerEvent) => e.stopPropagation()}\n >\n <Icon icon={config.renderButton('add_col')} />\n </div>\n ))}\n </div>\n\n {/* Column Resize Handles */}\n <div contenteditable=\"false\" class=\"resize-handles-col\">\n {colBounds.value.map((bound, i) => (\n <div\n key={`resize-${i}`}\n class={[\n 'col-resize-handle',\n resizingCol.value === i ? 'active' : '',\n ].join(' ')}\n style={{\n left: `${bound.left + bound.width - 3}px`,\n }}\n onPointerdown={(e: PointerEvent) => startResize(e, i)}\n />\n ))}\n </div>\n\n {/* Fixed Row Drag Handles */}\n <div contenteditable=\"false\" class=\"fixed-handles-row\">\n {rowBounds.value.map((bound, i) => (\n <div\n key={`row-${i}`}\n class=\"handle cell-handle fixed\"\n data-role=\"row-drag-handle\"\n draggable=\"true\"\n style={{ top: `${bound.top}px`, height: `${bound.height}px` }}\n onDragstart={(e) => {\n hoverIndex.value = [i, 0]\n dragRow(e)\n }}\n onClick={() => {\n hoverIndex.value = [i, 0]\n selectRow()\n activeRowIndex.value = i\n activeColIndex.value = -1\n }}\n onPointerdown={(e: PointerEvent) => e.stopPropagation()}\n >\n <div\n class=\"button-group\"\n data-show={activeRowIndex.value === i ? 'true' : 'false'}\n onPointermove={(e: PointerEvent) => e.stopPropagation()}\n >\n <button\n type=\"button\"\n onPointerdown={(e) => {\n hoverIndex.value = [i, 0]\n deleteSelected(e)\n }}\n >\n <Icon icon={config.renderButton('delete_row')} />\n </button>\n </div>\n </div>\n ))}\n </div>\n\n {/* Add Row Dots */}\n <div contenteditable=\"false\" class=\"add-dots-row\">\n {[\n ...rowBounds.value.map((b) => b.top),\n rowBounds.value.length\n ? rowBounds.value[rowBounds.value.length - 1]!.top +\n rowBounds.value[rowBounds.value.length - 1]!.height\n : 0,\n ].map((top, i) => (\n <div\n key={`add-row-${i}`}\n class=\"add-dot\"\n style={{ top: `${top}px` }}\n onClick={() => addRowByIndex(i)}\n onPointerdown={(e: PointerEvent) => e.stopPropagation()}\n >\n <Icon icon={config.renderButton('add_row')} />\n </div>\n ))}\n </div>\n\n <div\n data-show=\"false\"\n class=\"drag-preview\"\n data-direction=\"vertical\"\n ref={dragPreviewRef}\n >\n <table>\n <tbody></tbody>\n </table>\n </div>\n\n <table ref={contentWrapperFunctionRef} class=\"children\">\n <colgroup>\n {colWidths.value.map((w, i) => (\n <col\n key={i}\n style={w > 0 ? { width: `${w}px` } : undefined}\n />\n ))}\n </colgroup>\n </table>\n </div>\n </div>\n )\n }\n },\n})\n","import type { Ctx } from '@jvs-milkdown/ctx'\nimport type { Node } from '@jvs-milkdown/prose/model'\nimport type {\n EditorView,\n NodeView,\n NodeViewConstructor,\n ViewMutationRecord,\n} from '@jvs-milkdown/prose/view'\n\nimport { tableSchema } from '@jvs-milkdown/preset-gfm'\nimport { $view } from '@jvs-milkdown/utils'\nimport {\n createApp,\n shallowRef,\n triggerRef,\n type App,\n type ShallowRef,\n} from 'vue'\n\nimport { withMeta } from '../../__internal__/meta'\nimport { tableBlockConfig } from '../config'\nimport { TableBlock } from './component'\n\nexport class TableNodeView implements NodeView {\n dom: HTMLElement\n contentDOM: HTMLElement\n app: App\n\n nodeRef: ShallowRef<Node>\n #selectionUpdateScheduled = false\n\n constructor(\n public ctx: Ctx,\n public node: Node,\n public view: EditorView,\n public getPos: () => number | undefined\n ) {\n const dom = document.createElement('div')\n dom.className = 'milkdown-table-block'\n\n const contentDOM = document.createElement('tbody')\n this.contentDOM = contentDOM\n contentDOM.setAttribute('data-content-dom', 'true')\n contentDOM.classList.add('content-dom')\n this.nodeRef = shallowRef(node)\n\n const app = createApp(TableBlock, {\n view,\n ctx,\n getPos,\n config: ctx.get(tableBlockConfig.key),\n onMount: (div: Element) => {\n div.appendChild(contentDOM)\n },\n node: this.nodeRef,\n })\n app.mount(dom)\n this.app = app\n\n this.dom = dom\n }\n\n update(node: Node) {\n if (node.type !== this.node.type) return false\n\n if (node.sameMarkup(this.node) && node.content.eq(this.node.content)) {\n // Content unchanged — still trigger a reactive tick for selection-based UI (cell toolbar)\n if (!this.#selectionUpdateScheduled) {\n this.#selectionUpdateScheduled = true\n queueMicrotask(() => {\n triggerRef(this.nodeRef)\n this.#selectionUpdateScheduled = false\n })\n }\n return true\n }\n\n this.node = node\n this.nodeRef.value = node\n\n return true\n }\n\n stopEvent(e: Event) {\n if (e.type === 'drop' || e.type.startsWith('drag')) return true\n\n if (e.type === 'mousedown' || e.type === 'pointerdown') {\n if (e.target instanceof Element && e.target.closest('button')) return true\n }\n\n return false\n }\n\n ignoreMutation(mutation: ViewMutationRecord) {\n if (!this.dom || !this.contentDOM) return true\n\n if ((mutation.type as unknown) === 'selection') return false\n\n if (this.contentDOM === mutation.target && mutation.type === 'attributes')\n return true\n\n if (this.contentDOM.contains(mutation.target)) return false\n\n return true\n }\n\n destroy() {\n this.app.unmount()\n this.dom.remove()\n this.contentDOM.remove()\n }\n}\n\nexport const tableBlockView = $view(\n tableSchema.node,\n (ctx): NodeViewConstructor => {\n return (initialNode, view, getPos) => {\n return new TableNodeView(ctx, initialNode, view, getPos)\n }\n }\n)\n\nwithMeta(tableBlockView, {\n displayName: 'NodeView<table-block>',\n group: 'TableBlock',\n})\n","import type { MilkdownPlugin } from '@jvs-milkdown/ctx'\n\nimport { tableBlockConfig } from './config'\nimport { tableBlockView } from './view'\n\nexport * from './view'\nexport * from './config'\n\nexport const tableBlock: MilkdownPlugin[] = [tableBlockConfig, tableBlockView]\n"],"names":["__spreadValues","mac","node","index","_a","_b"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,SAAS,QAAA,CACd,QACA,IAAA,EACG;AACH,EAAA,MAAA,CAAO,OAAO,MAAA,EAAQ;AAAA,IACpB,IAAA,EAAMA,gBAAA,CAAA;AAAA,MACJ,OAAA,EAAS;AAAA,KAAA,EACN,IAAA;AAAA,GAEN,CAAA;AAED,EAAA,OAAO,MAAA;AACT;;;;;;;;;;;;;;;;;;ACOA,MAAM,uBAAA,GAA4C;AAAA,EAChD,YAAA,EAAc,CAAC,UAAA,KAAe;AAC5B,IAAA,QAAQ,UAAA;AAAY,MAClB,KAAK,SAAA;AACH,QAAA,OAAO,GAAA;AAAA,MACT,KAAK,SAAA;AACH,QAAA,OAAO,GAAA;AAAA,MACT,KAAK,YAAA;AACH,QAAA,OAAO,GAAA;AAAA,MACT,KAAK,YAAA;AACH,QAAA,OAAO,GAAA;AAAA,MACT,KAAK,gBAAA;AACH,QAAA,OAAO,MAAA;AAAA,MACT,KAAK,kB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