@tiptap/extension-dropcursor 2.0.0-beta.2 → 2.0.0-beta.20
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.md +1 -1
- package/README.md +2 -2
- package/dist/packages/extension-dropcursor/src/dropcursor.d.ts +1 -1
- package/dist/tiptap-extension-dropcursor.cjs.js +7 -5
- package/dist/tiptap-extension-dropcursor.cjs.js.map +1 -1
- package/dist/tiptap-extension-dropcursor.esm.js +7 -6
- package/dist/tiptap-extension-dropcursor.esm.js.map +1 -1
- package/dist/tiptap-extension-dropcursor.umd.js +10 -8
- package/dist/tiptap-extension-dropcursor.umd.js.map +1 -1
- package/package.json +9 -5
- package/src/dropcursor.ts +6 -4
- package/CHANGELOG.md +0 -123
- package/dist/tiptap-extension-dropcursor.bundle.umd.min.js +0 -2
- package/dist/tiptap-extension-dropcursor.bundle.umd.min.js.map +0 -1
package/LICENSE.md
CHANGED
package/README.md
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
## Introduction
|
|
8
8
|
tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a toolkit for building rich text WYSIWYG editors, which is already in use at many well-known companies such as *New York Times*, *The Guardian* or *Atlassian*.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Official Documentation
|
|
11
11
|
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
|
12
12
|
|
|
13
13
|
## License
|
|
14
|
-
tiptap is open
|
|
14
|
+
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap/blob/main/LICENSE.md).
|
|
@@ -7,10 +7,12 @@ var prosemirrorDropcursor = require('prosemirror-dropcursor');
|
|
|
7
7
|
|
|
8
8
|
const Dropcursor = core.Extension.create({
|
|
9
9
|
name: 'dropCursor',
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
addOptions() {
|
|
11
|
+
return {
|
|
12
|
+
color: 'currentColor',
|
|
13
|
+
width: 1,
|
|
14
|
+
class: null,
|
|
15
|
+
};
|
|
14
16
|
},
|
|
15
17
|
addProseMirrorPlugins() {
|
|
16
18
|
return [
|
|
@@ -20,5 +22,5 @@ const Dropcursor = core.Extension.create({
|
|
|
20
22
|
});
|
|
21
23
|
|
|
22
24
|
exports.Dropcursor = Dropcursor;
|
|
23
|
-
exports
|
|
25
|
+
exports["default"] = Dropcursor;
|
|
24
26
|
//# sourceMappingURL=tiptap-extension-dropcursor.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-extension-dropcursor.cjs.js","sources":["../src/dropcursor.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport { dropCursor } from 'prosemirror-dropcursor'\n\nexport interface DropcursorOptions {\n color: string | null,\n width: number | null,\n class: string | null,\n}\n\nexport const Dropcursor = Extension.create<DropcursorOptions>({\n name: 'dropCursor',\n\n
|
|
1
|
+
{"version":3,"file":"tiptap-extension-dropcursor.cjs.js","sources":["../src/dropcursor.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport { dropCursor } from 'prosemirror-dropcursor'\n\nexport interface DropcursorOptions {\n color: string | null,\n width: number | null,\n class: string | null,\n}\n\nexport const Dropcursor = Extension.create<DropcursorOptions>({\n name: 'dropCursor',\n\n addOptions() {\n return {\n color: 'currentColor',\n width: 1,\n class: null,\n }\n },\n\n addProseMirrorPlugins() {\n return [\n dropCursor(this.options),\n ]\n },\n})\n"],"names":["Extension","dropCursor"],"mappings":";;;;;;;MASa,UAAU,GAAGA,cAAS,CAAC,MAAM,CAAoB;IAC5D,IAAI,EAAE,YAAY;IAElB,UAAU;QACR,OAAO;YACL,KAAK,EAAE,cAAc;YACrB,KAAK,EAAE,CAAC;YACR,KAAK,EAAE,IAAI;SACZ,CAAA;KACF;IAED,qBAAqB;QACnB,OAAO;YACLC,gCAAU,CAAC,IAAI,CAAC,OAAO,CAAC;SACzB,CAAA;KACF;CACF;;;;;"}
|
|
@@ -3,10 +3,12 @@ import { dropCursor } from 'prosemirror-dropcursor';
|
|
|
3
3
|
|
|
4
4
|
const Dropcursor = Extension.create({
|
|
5
5
|
name: 'dropCursor',
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
addOptions() {
|
|
7
|
+
return {
|
|
8
|
+
color: 'currentColor',
|
|
9
|
+
width: 1,
|
|
10
|
+
class: null,
|
|
11
|
+
};
|
|
10
12
|
},
|
|
11
13
|
addProseMirrorPlugins() {
|
|
12
14
|
return [
|
|
@@ -15,6 +17,5 @@ const Dropcursor = Extension.create({
|
|
|
15
17
|
},
|
|
16
18
|
});
|
|
17
19
|
|
|
18
|
-
export default
|
|
19
|
-
export { Dropcursor };
|
|
20
|
+
export { Dropcursor, Dropcursor as default };
|
|
20
21
|
//# sourceMappingURL=tiptap-extension-dropcursor.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-extension-dropcursor.esm.js","sources":["../src/dropcursor.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport { dropCursor } from 'prosemirror-dropcursor'\n\nexport interface DropcursorOptions {\n color: string | null,\n width: number | null,\n class: string | null,\n}\n\nexport const Dropcursor = Extension.create<DropcursorOptions>({\n name: 'dropCursor',\n\n
|
|
1
|
+
{"version":3,"file":"tiptap-extension-dropcursor.esm.js","sources":["../src/dropcursor.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport { dropCursor } from 'prosemirror-dropcursor'\n\nexport interface DropcursorOptions {\n color: string | null,\n width: number | null,\n class: string | null,\n}\n\nexport const Dropcursor = Extension.create<DropcursorOptions>({\n name: 'dropCursor',\n\n addOptions() {\n return {\n color: 'currentColor',\n width: 1,\n class: null,\n }\n },\n\n addProseMirrorPlugins() {\n return [\n dropCursor(this.options),\n ]\n },\n})\n"],"names":[],"mappings":";;;MASa,UAAU,GAAG,SAAS,CAAC,MAAM,CAAoB;IAC5D,IAAI,EAAE,YAAY;IAElB,UAAU;QACR,OAAO;YACL,KAAK,EAAE,cAAc;YACrB,KAAK,EAAE,CAAC;YACR,KAAK,EAAE,IAAI;SACZ,CAAA;KACF;IAED,qBAAqB;QACnB,OAAO;YACL,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC;SACzB,CAAA;KACF;CACF;;;;"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tiptap/core'), require('prosemirror-dropcursor')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', '@tiptap/core', 'prosemirror-dropcursor'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global[
|
|
5
|
-
}(this, (function (exports, core, prosemirrorDropcursor) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/extension-dropcursor"] = {}, global.core, global.prosemirrorDropcursor));
|
|
5
|
+
})(this, (function (exports, core, prosemirrorDropcursor) { 'use strict';
|
|
6
6
|
|
|
7
7
|
const Dropcursor = core.Extension.create({
|
|
8
8
|
name: 'dropCursor',
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
addOptions() {
|
|
10
|
+
return {
|
|
11
|
+
color: 'currentColor',
|
|
12
|
+
width: 1,
|
|
13
|
+
class: null,
|
|
14
|
+
};
|
|
13
15
|
},
|
|
14
16
|
addProseMirrorPlugins() {
|
|
15
17
|
return [
|
|
@@ -19,9 +21,9 @@
|
|
|
19
21
|
});
|
|
20
22
|
|
|
21
23
|
exports.Dropcursor = Dropcursor;
|
|
22
|
-
exports
|
|
24
|
+
exports["default"] = Dropcursor;
|
|
23
25
|
|
|
24
26
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
25
27
|
|
|
26
|
-
}))
|
|
28
|
+
}));
|
|
27
29
|
//# sourceMappingURL=tiptap-extension-dropcursor.umd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-extension-dropcursor.umd.js","sources":["../src/dropcursor.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport { dropCursor } from 'prosemirror-dropcursor'\n\nexport interface DropcursorOptions {\n color: string | null,\n width: number | null,\n class: string | null,\n}\n\nexport const Dropcursor = Extension.create<DropcursorOptions>({\n name: 'dropCursor',\n\n
|
|
1
|
+
{"version":3,"file":"tiptap-extension-dropcursor.umd.js","sources":["../src/dropcursor.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport { dropCursor } from 'prosemirror-dropcursor'\n\nexport interface DropcursorOptions {\n color: string | null,\n width: number | null,\n class: string | null,\n}\n\nexport const Dropcursor = Extension.create<DropcursorOptions>({\n name: 'dropCursor',\n\n addOptions() {\n return {\n color: 'currentColor',\n width: 1,\n class: null,\n }\n },\n\n addProseMirrorPlugins() {\n return [\n dropCursor(this.options),\n ]\n },\n})\n"],"names":["Extension","dropCursor"],"mappings":";;;;;;QASa,UAAU,GAAGA,cAAS,CAAC,MAAM,CAAoB;MAC5D,IAAI,EAAE,YAAY;MAElB,UAAU;UACR,OAAO;cACL,KAAK,EAAE,cAAc;cACrB,KAAK,EAAE,CAAC;cACR,KAAK,EAAE,IAAI;WACZ,CAAA;OACF;MAED,qBAAqB;UACnB,OAAO;cACLC,gCAAU,CAAC,IAAI,CAAC,OAAO,CAAC;WACzB,CAAA;OACF;GACF;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiptap/extension-dropcursor",
|
|
3
3
|
"description": "dropcursor extension for tiptap",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.20",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
"main": "dist/tiptap-extension-dropcursor.cjs.js",
|
|
16
16
|
"umd": "dist/tiptap-extension-dropcursor.umd.js",
|
|
17
17
|
"module": "dist/tiptap-extension-dropcursor.esm.js",
|
|
18
|
-
"unpkg": "dist/tiptap-extension-dropcursor.bundle.umd.min.js",
|
|
19
18
|
"types": "dist/packages/extension-dropcursor/src/index.d.ts",
|
|
20
19
|
"files": [
|
|
21
20
|
"src",
|
|
@@ -25,8 +24,13 @@
|
|
|
25
24
|
"@tiptap/core": "^2.0.0-beta.1"
|
|
26
25
|
},
|
|
27
26
|
"dependencies": {
|
|
28
|
-
"@types/prosemirror-dropcursor": "^1.0.
|
|
29
|
-
"prosemirror-dropcursor": "^1.3.
|
|
27
|
+
"@types/prosemirror-dropcursor": "^1.0.3",
|
|
28
|
+
"prosemirror-dropcursor": "^1.3.5"
|
|
30
29
|
},
|
|
31
|
-
"
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/ueberdosis/tiptap",
|
|
33
|
+
"directory": "packages/extension-dropcursor"
|
|
34
|
+
},
|
|
35
|
+
"gitHead": "642627ec3635a1d8fa851887d75bee5f193ec63b"
|
|
32
36
|
}
|
package/src/dropcursor.ts
CHANGED
|
@@ -10,10 +10,12 @@ export interface DropcursorOptions {
|
|
|
10
10
|
export const Dropcursor = Extension.create<DropcursorOptions>({
|
|
11
11
|
name: 'dropCursor',
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
addOptions() {
|
|
14
|
+
return {
|
|
15
|
+
color: 'currentColor',
|
|
16
|
+
width: 1,
|
|
17
|
+
class: null,
|
|
18
|
+
}
|
|
17
19
|
},
|
|
18
20
|
|
|
19
21
|
addProseMirrorPlugins() {
|
package/CHANGELOG.md
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-dropcursor@2.0.0-beta.1...@tiptap/extension-dropcursor@2.0.0-beta.2) (2021-04-06)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @tiptap/extension-dropcursor
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-dropcursor@2.0.0-alpha.11...@tiptap/extension-dropcursor@2.0.0-beta.1) (2021-03-05)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @tiptap/extension-dropcursor
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# [2.0.0-alpha.11](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-dropcursor@2.0.0-alpha.10...@tiptap/extension-dropcursor@2.0.0-alpha.11) (2021-02-16)
|
|
23
|
-
|
|
24
|
-
**Note:** Version bump only for package @tiptap/extension-dropcursor
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# [2.0.0-alpha.10](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-dropcursor@2.0.0-alpha.9...@tiptap/extension-dropcursor@2.0.0-alpha.10) (2021-02-07)
|
|
31
|
-
|
|
32
|
-
**Note:** Version bump only for package @tiptap/extension-dropcursor
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
# [2.0.0-alpha.9](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-dropcursor@2.0.0-alpha.8...@tiptap/extension-dropcursor@2.0.0-alpha.9) (2021-02-05)
|
|
39
|
-
|
|
40
|
-
**Note:** Version bump only for package @tiptap/extension-dropcursor
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
# [2.0.0-alpha.8](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-dropcursor@2.0.0-alpha.7...@tiptap/extension-dropcursor@2.0.0-alpha.8) (2021-01-29)
|
|
47
|
-
|
|
48
|
-
**Note:** Version bump only for package @tiptap/extension-dropcursor
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
# [2.0.0-alpha.7](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-dropcursor@2.0.0-alpha.6...@tiptap/extension-dropcursor@2.0.0-alpha.7) (2021-01-29)
|
|
55
|
-
|
|
56
|
-
**Note:** Version bump only for package @tiptap/extension-dropcursor
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
# [2.0.0-alpha.6](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-dropcursor@2.0.0-alpha.5...@tiptap/extension-dropcursor@2.0.0-alpha.6) (2021-01-28)
|
|
63
|
-
|
|
64
|
-
**Note:** Version bump only for package @tiptap/extension-dropcursor
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
# [2.0.0-alpha.5](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-dropcursor@2.0.0-alpha.4...@tiptap/extension-dropcursor@2.0.0-alpha.5) (2020-12-18)
|
|
71
|
-
|
|
72
|
-
**Note:** Version bump only for package @tiptap/extension-dropcursor
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
# [2.0.0-alpha.4](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-dropcursor@2.0.0-alpha.3...@tiptap/extension-dropcursor@2.0.0-alpha.4) (2020-12-02)
|
|
79
|
-
|
|
80
|
-
**Note:** Version bump only for package @tiptap/extension-dropcursor
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
# [2.0.0-alpha.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-dropcursor@2.0.0-alpha.2...@tiptap/extension-dropcursor@2.0.0-alpha.3) (2020-11-19)
|
|
87
|
-
|
|
88
|
-
**Note:** Version bump only for package @tiptap/extension-dropcursor
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
# [2.0.0-alpha.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-dropcursor@2.0.0-alpha.1...@tiptap/extension-dropcursor@2.0.0-alpha.2) (2020-11-19)
|
|
95
|
-
|
|
96
|
-
**Note:** Version bump only for package @tiptap/extension-dropcursor
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
# [2.0.0-alpha.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-dropcursor@1.0.0-alpha.2...@tiptap/extension-dropcursor@2.0.0-alpha.1) (2020-11-18)
|
|
103
|
-
|
|
104
|
-
**Note:** Version bump only for package @tiptap/extension-dropcursor
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
# [1.0.0-alpha.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-dropcursor@1.0.0-alpha.1...@tiptap/extension-dropcursor@1.0.0-alpha.2) (2020-11-16)
|
|
111
|
-
|
|
112
|
-
**Note:** Version bump only for package @tiptap/extension-dropcursor
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
# 1.0.0-alpha.1 (2020-11-16)
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
### Reverts
|
|
122
|
-
|
|
123
|
-
* Revert "use global namespace" ([0c9ce26](https://github.com/ueberdosis/tiptap-next/commit/0c9ce26c02c07d88a757c01b0a9d7f9e2b0b7502))
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@tiptap/core")):"function"==typeof define&&define.amd?define(["exports","@tiptap/core"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@tiptap/extension-dropcursor"]={},t["@tiptap/core"])}(this,(function(t,e){"use strict";function n(t,e,r){for(var o=0;;o++){if(o==t.childCount||o==e.childCount)return t.childCount==e.childCount?null:r;var i=t.child(o),s=e.child(o);if(i!=s){if(!i.sameMarkup(s))return r;if(i.isText&&i.text!=s.text){for(var a=0;i.text[a]==s.text[a];a++)r++;return r}if(i.content.size||s.content.size){var p=n(i.content,s.content,r+1);if(null!=p)return p}r+=i.nodeSize}else r+=i.nodeSize}}function r(t,e,n,o){for(var i=t.childCount,s=e.childCount;;){if(0==i||0==s)return i==s?null:{a:n,b:o};var a=t.child(--i),p=e.child(--s),h=a.nodeSize;if(a!=p){if(!a.sameMarkup(p))return{a:n,b:o};if(a.isText&&a.text!=p.text){for(var c=0,f=Math.min(a.text.length,p.text.length);c<f&&a.text[a.text.length-c-1]==p.text[p.text.length-c-1];)c++,n--,o--;return{a:n,b:o}}if(a.content.size||p.content.size){var u=r(a.content,p.content,n-1,o-1);if(u)return u}n-=h,o-=h}else n-=h,o-=h}}var o=function(t,e){if(this.content=t,this.size=e||0,null==e)for(var n=0;n<t.length;n++)this.size+=t[n].nodeSize},i={firstChild:{configurable:!0},lastChild:{configurable:!0},childCount:{configurable:!0}};o.prototype.nodesBetween=function(t,e,n,r,o){void 0===r&&(r=0);for(var i=0,s=0;s<e;i++){var a=this.content[i],p=s+a.nodeSize;if(p>t&&!1!==n(a,r+s,o,i)&&a.content.size){var h=s+1;a.nodesBetween(Math.max(0,t-h),Math.min(a.content.size,e-h),n,r+h)}s=p}},o.prototype.descendants=function(t){this.nodesBetween(0,this.size,t)},o.prototype.textBetween=function(t,e,n,r){var o="",i=!0;return this.nodesBetween(t,e,(function(s,a){s.isText?(o+=s.text.slice(Math.max(t,a)-a,e-a),i=!n):s.isLeaf&&r?(o+=r,i=!n):!i&&s.isBlock&&(o+=n,i=!0)}),0),o},o.prototype.append=function(t){if(!t.size)return this;if(!this.size)return t;var e=this.lastChild,n=t.firstChild,r=this.content.slice(),i=0;for(e.isText&&e.sameMarkup(n)&&(r[r.length-1]=e.withText(e.text+n.text),i=1);i<t.content.length;i++)r.push(t.content[i]);return new o(r,this.size+t.size)},o.prototype.cut=function(t,e){if(null==e&&(e=this.size),0==t&&e==this.size)return this;var n=[],r=0;if(e>t)for(var i=0,s=0;s<e;i++){var a=this.content[i],p=s+a.nodeSize;p>t&&((s<t||p>e)&&(a=a.isText?a.cut(Math.max(0,t-s),Math.min(a.text.length,e-s)):a.cut(Math.max(0,t-s-1),Math.min(a.content.size,e-s-1))),n.push(a),r+=a.nodeSize),s=p}return new o(n,r)},o.prototype.cutByIndex=function(t,e){return t==e?o.empty:0==t&&e==this.content.length?this:new o(this.content.slice(t,e))},o.prototype.replaceChild=function(t,e){var n=this.content[t];if(n==e)return this;var r=this.content.slice(),i=this.size+e.nodeSize-n.nodeSize;return r[t]=e,new o(r,i)},o.prototype.addToStart=function(t){return new o([t].concat(this.content),this.size+t.nodeSize)},o.prototype.addToEnd=function(t){return new o(this.content.concat(t),this.size+t.nodeSize)},o.prototype.eq=function(t){if(this.content.length!=t.content.length)return!1;for(var e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))return!1;return!0},i.firstChild.get=function(){return this.content.length?this.content[0]:null},i.lastChild.get=function(){return this.content.length?this.content[this.content.length-1]:null},i.childCount.get=function(){return this.content.length},o.prototype.child=function(t){var e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e},o.prototype.maybeChild=function(t){return this.content[t]},o.prototype.forEach=function(t){for(var e=0,n=0;e<this.content.length;e++){var r=this.content[e];t(r,n,e),n+=r.nodeSize}},o.prototype.findDiffStart=function(t,e){return void 0===e&&(e=0),n(this,t,e)},o.prototype.findDiffEnd=function(t,e,n){return void 0===e&&(e=this.size),void 0===n&&(n=t.size),r(this,t,e,n)},o.prototype.findIndex=function(t,e){if(void 0===e&&(e=-1),0==t)return a(0,t);if(t==this.size)return a(this.content.length,t);if(t>this.size||t<0)throw new RangeError("Position "+t+" outside of fragment ("+this+")");for(var n=0,r=0;;n++){var o=r+this.child(n).nodeSize;if(o>=t)return o==t||e>0?a(n+1,o):a(n,r);r=o}},o.prototype.toString=function(){return"<"+this.toStringInner()+">"},o.prototype.toStringInner=function(){return this.content.join(", ")},o.prototype.toJSON=function(){return this.content.length?this.content.map((function(t){return t.toJSON()})):null},o.fromJSON=function(t,e){if(!e)return o.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new o(e.map(t.nodeFromJSON))},o.fromArray=function(t){if(!t.length)return o.empty;for(var e,n=0,r=0;r<t.length;r++){var i=t[r];n+=i.nodeSize,r&&i.isText&&t[r-1].sameMarkup(i)?(e||(e=t.slice(0,r)),e[e.length-1]=i.withText(e[e.length-1].text+i.text)):e&&e.push(i)}return new o(e||t,n)},o.from=function(t){if(!t)return o.empty;if(t instanceof o)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new o([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))},Object.defineProperties(o.prototype,i);var s={index:0,offset:0};function a(t,e){return s.index=t,s.offset=e,s}function p(t,e){if(t===e)return!0;if(!t||"object"!=typeof t||!e||"object"!=typeof e)return!1;var n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(var r=0;r<t.length;r++)if(!p(t[r],e[r]))return!1}else{for(var o in t)if(!(o in e)||!p(t[o],e[o]))return!1;for(var i in e)if(!(i in t))return!1}return!0}o.empty=new o([],0);var h=function(t,e){this.type=t,this.attrs=e};function c(t){var e=Error.call(this,t);return e.__proto__=c.prototype,e}h.prototype.addToSet=function(t){for(var e,n=!1,r=0;r<t.length;r++){var o=t[r];if(this.eq(o))return t;if(this.type.excludes(o.type))e||(e=t.slice(0,r));else{if(o.type.excludes(this.type))return t;!n&&o.type.rank>this.type.rank&&(e||(e=t.slice(0,r)),e.push(this),n=!0),e&&e.push(o)}}return e||(e=t.slice()),n||e.push(this),e},h.prototype.removeFromSet=function(t){for(var e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t},h.prototype.isInSet=function(t){for(var e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1},h.prototype.eq=function(t){return this==t||this.type==t.type&&p(this.attrs,t.attrs)},h.prototype.toJSON=function(){var t={type:this.type.name};for(var e in this.attrs){t.attrs=this.attrs;break}return t},h.fromJSON=function(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");var n=t.marks[e.type];if(!n)throw new RangeError("There is no mark type "+e.type+" in this schema");return n.create(e.attrs)},h.sameSet=function(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].eq(e[n]))return!1;return!0},h.setFrom=function(t){if(!t||0==t.length)return h.none;if(t instanceof h)return[t];var e=t.slice();return e.sort((function(t,e){return t.type.rank-e.type.rank})),e},h.none=[],c.prototype=Object.create(Error.prototype),c.prototype.constructor=c,c.prototype.name="ReplaceError";var f=function(t,e,n){this.content=t,this.openStart=e,this.openEnd=n},u={size:{configurable:!0}};function l(t,e,n){var r=t.findIndex(e),o=r.index,i=r.offset,s=t.maybeChild(o),a=t.findIndex(n),p=a.index,h=a.offset;if(i==e||s.isText){if(h!=n&&!t.child(p).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(o!=p)throw new RangeError("Removing non-flat range");return t.replaceChild(o,s.copy(l(s.content,e-i-1,n-i-1)))}function d(t,e,n,r){var o=t.findIndex(e),i=o.index,s=o.offset,a=t.maybeChild(i);if(s==e||a.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));var p=d(a.content,e-s-1,n);return p&&t.replaceChild(i,a.copy(p))}function m(t,e,n){if(n.openStart>t.depth)throw new c("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new c("Inconsistent open depths");return v(t,e,n,0)}function v(t,e,n,r){var i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){var a=v(t,e,n,r+1);return s.copy(s.content.replaceChild(i,a))}if(n.content.size){if(n.openStart||n.openEnd||t.depth!=r||e.depth!=r){var p=function(t,e){for(var n=e.depth-t.openStart,r=e.node(n).copy(t.content),i=n-1;i>=0;i--)r=e.node(i).copy(o.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}(n,t);return k(s,S(t,p.start,p.end,e,r))}var h=t.parent,c=h.content;return k(h,c.cut(0,t.parentOffset).append(n.content).append(c.cut(e.parentOffset)))}return k(s,b(t,e,r))}function y(t,e){if(!e.type.compatibleContent(t.type))throw new c("Cannot join "+e.type.name+" onto "+t.type.name)}function g(t,e,n){var r=t.node(n);return y(r,e.node(n)),r}function w(t,e){var n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function x(t,e,n,r){var o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(w(t.nodeAfter,r),i++));for(var a=i;a<s;a++)w(o.child(a),r);e&&e.depth==n&&e.textOffset&&w(e.nodeBefore,r)}function k(t,e){if(!t.type.validContent(e))throw new c("Invalid content for node "+t.type.name);return t.copy(e)}function S(t,e,n,r,i){var s=t.depth>i&&g(t,e,i+1),a=r.depth>i&&g(n,r,i+1),p=[];return x(null,t,i,p),s&&a&&e.index(i)==n.index(i)?(y(s,a),w(k(s,S(t,e,n,r,i+1)),p)):(s&&w(k(s,b(t,e,i+1)),p),x(e,n,i,p),a&&w(k(a,b(n,r,i+1)),p)),x(r,null,i,p),new o(p)}function b(t,e,n){var r=[];(x(null,t,n,r),t.depth>n)&&w(k(g(t,e,n+1),b(t,e,n+1)),r);return x(e,null,n,r),new o(r)}u.size.get=function(){return this.content.size-this.openStart-this.openEnd},f.prototype.insertAt=function(t,e){var n=d(this.content,t+this.openStart,e,null);return n&&new f(n,this.openStart,this.openEnd)},f.prototype.removeBetween=function(t,e){return new f(l(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)},f.prototype.eq=function(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd},f.prototype.toString=function(){return this.content+"("+this.openStart+","+this.openEnd+")"},f.prototype.toJSON=function(){if(!this.content.size)return null;var t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t},f.fromJSON=function(t,e){if(!e)return f.empty;var n=e.openStart||0,r=e.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new f(o.fromJSON(t,e.content),n,r)},f.maxOpen=function(t,e){void 0===e&&(e=!0);for(var n=0,r=0,o=t.firstChild;o&&!o.isLeaf&&(e||!o.type.spec.isolating);o=o.firstChild)n++;for(var i=t.lastChild;i&&!i.isLeaf&&(e||!i.type.spec.isolating);i=i.lastChild)r++;return new f(t,n,r)},Object.defineProperties(f.prototype,u),f.empty=new f(o.empty,0,0);var M=function(t,e,n){this.pos=t,this.path=e,this.depth=e.length/3-1,this.parentOffset=n},O={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};M.prototype.resolveDepth=function(t){return null==t?this.depth:t<0?this.depth+t:t},O.parent.get=function(){return this.node(this.depth)},O.doc.get=function(){return this.node(0)},M.prototype.node=function(t){return this.path[3*this.resolveDepth(t)]},M.prototype.index=function(t){return this.path[3*this.resolveDepth(t)+1]},M.prototype.indexAfter=function(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)},M.prototype.start=function(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1},M.prototype.end=function(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size},M.prototype.before=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]},M.prototype.after=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize},O.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},O.nodeAfter.get=function(){var t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;var n=this.pos-this.path[this.path.length-1],r=t.child(e);return n?t.child(e).cut(n):r},O.nodeBefore.get=function(){var t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)},M.prototype.posAtIndex=function(t,e){e=this.resolveDepth(e);for(var n=this.path[3*e],r=0==e?0:this.path[3*e-1]+1,o=0;o<t;o++)r+=n.child(o).nodeSize;return r},M.prototype.marks=function(){var t=this.parent,e=this.index();if(0==t.content.size)return h.none;if(this.textOffset)return t.child(e).marks;var n=t.maybeChild(e-1),r=t.maybeChild(e);if(!n){var o=n;n=r,r=o}for(var i=n.marks,s=0;s<i.length;s++)!1!==i[s].type.spec.inclusive||r&&i[s].isInSet(r.marks)||(i=i[s--].removeFromSet(i));return i},M.prototype.marksAcross=function(t){var e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;for(var n=e.marks,r=t.parent.maybeChild(t.index()),o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n},M.prototype.sharedDepth=function(t){for(var e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0},M.prototype.blockRange=function(t,e){if(void 0===t&&(t=this),t.pos<this.pos)return t.blockRange(this);for(var n=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);n>=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new N(this,t,n)},M.prototype.sameParent=function(t){return this.pos-this.parentOffset==t.pos-t.parentOffset},M.prototype.max=function(t){return t.pos>this.pos?t:this},M.prototype.min=function(t){return t.pos<this.pos?t:this},M.prototype.toString=function(){for(var t="",e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset},M.resolve=function(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");for(var n=[],r=0,o=e,i=t;;){var s=i.content.findIndex(o),a=s.index,p=s.offset,h=o-p;if(n.push(i,a,r+p),!h)break;if((i=i.child(a)).isText)break;o=h-1,r+=p+1}return new M(e,n,o)},M.resolveCached=function(t,e){for(var n=0;n<C.length;n++){var r=C[n];if(r.pos==e&&r.doc==t)return r}var o=C[T]=M.resolve(t,e);return T=(T+1)%E,o},Object.defineProperties(M.prototype,O);var C=[],T=0,E=12,N=function(t,e,n){this.$from=t,this.$to=e,this.depth=n},z={start:{configurable:!0},end:{configurable:!0},parent:{configurable:!0},startIndex:{configurable:!0},endIndex:{configurable:!0}};z.start.get=function(){return this.$from.before(this.depth+1)},z.end.get=function(){return this.$to.after(this.depth+1)},z.parent.get=function(){return this.$from.node(this.depth)},z.startIndex.get=function(){return this.$from.index(this.depth)},z.endIndex.get=function(){return this.$to.indexAfter(this.depth)},Object.defineProperties(N.prototype,z);var R=Object.create(null),I=function(t,e,n,r){this.type=t,this.attrs=e,this.content=n||o.empty,this.marks=r||h.none},A={nodeSize:{configurable:!0},childCount:{configurable:!0},textContent:{configurable:!0},firstChild:{configurable:!0},lastChild:{configurable:!0},isBlock:{configurable:!0},isTextblock:{configurable:!0},inlineContent:{configurable:!0},isInline:{configurable:!0},isText:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0}};A.nodeSize.get=function(){return this.isLeaf?1:2+this.content.size},A.childCount.get=function(){return this.content.childCount},I.prototype.child=function(t){return this.content.child(t)},I.prototype.maybeChild=function(t){return this.content.maybeChild(t)},I.prototype.forEach=function(t){this.content.forEach(t)},I.prototype.nodesBetween=function(t,e,n,r){void 0===r&&(r=0),this.content.nodesBetween(t,e,n,r,this)},I.prototype.descendants=function(t){this.nodesBetween(0,this.content.size,t)},A.textContent.get=function(){return this.textBetween(0,this.content.size,"")},I.prototype.textBetween=function(t,e,n,r){return this.content.textBetween(t,e,n,r)},A.firstChild.get=function(){return this.content.firstChild},A.lastChild.get=function(){return this.content.lastChild},I.prototype.eq=function(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)},I.prototype.sameMarkup=function(t){return this.hasMarkup(t.type,t.attrs,t.marks)},I.prototype.hasMarkup=function(t,e,n){return this.type==t&&p(this.attrs,e||t.defaultAttrs||R)&&h.sameSet(this.marks,n||h.none)},I.prototype.copy=function(t){return void 0===t&&(t=null),t==this.content?this:new this.constructor(this.type,this.attrs,t,this.marks)},I.prototype.mark=function(t){return t==this.marks?this:new this.constructor(this.type,this.attrs,this.content,t)},I.prototype.cut=function(t,e){return 0==t&&e==this.content.size?this:this.copy(this.content.cut(t,e))},I.prototype.slice=function(t,e,n){if(void 0===e&&(e=this.content.size),void 0===n&&(n=!1),t==e)return f.empty;var r=this.resolve(t),o=this.resolve(e),i=n?0:r.sharedDepth(e),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new f(a,r.depth-i,o.depth-i)},I.prototype.replace=function(t,e,n){return m(this.resolve(t),this.resolve(e),n)},I.prototype.nodeAt=function(t){for(var e=this;;){var n=e.content.findIndex(t),r=n.index,o=n.offset;if(!(e=e.maybeChild(r)))return null;if(o==t||e.isText)return e;t-=o+1}},I.prototype.childAfter=function(t){var e=this.content.findIndex(t),n=e.index,r=e.offset;return{node:this.content.maybeChild(n),index:n,offset:r}},I.prototype.childBefore=function(t){if(0==t)return{node:null,index:0,offset:0};var e=this.content.findIndex(t),n=e.index,r=e.offset;if(r<t)return{node:this.content.child(n),index:n,offset:r};var o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}},I.prototype.resolve=function(t){return M.resolveCached(this,t)},I.prototype.resolveNoCache=function(t){return M.resolve(this,t)},I.prototype.rangeHasMark=function(t,e,n){var r=!1;return e>t&&this.nodesBetween(t,e,(function(t){return n.isInSet(t.marks)&&(r=!0),!r})),r},A.isBlock.get=function(){return this.type.isBlock},A.isTextblock.get=function(){return this.type.isTextblock},A.inlineContent.get=function(){return this.type.inlineContent},A.isInline.get=function(){return this.type.isInline},A.isText.get=function(){return this.type.isText},A.isLeaf.get=function(){return this.type.isLeaf},A.isAtom.get=function(){return this.type.isAtom},I.prototype.toString=function(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);var t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),function(t,e){for(var n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}(this.marks,t)},I.prototype.contentMatchAt=function(t){var e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e},I.prototype.canReplace=function(t,e,n,r,i){void 0===n&&(n=o.empty),void 0===r&&(r=0),void 0===i&&(i=n.childCount);var s=this.contentMatchAt(t).matchFragment(n,r,i),a=s&&s.matchFragment(this.content,e);if(!a||!a.validEnd)return!1;for(var p=r;p<i;p++)if(!this.type.allowsMarks(n.child(p).marks))return!1;return!0},I.prototype.canReplaceWith=function(t,e,n,r){if(r&&!this.type.allowsMarks(r))return!1;var o=this.contentMatchAt(t).matchType(n),i=o&&o.matchFragment(this.content,e);return!!i&&i.validEnd},I.prototype.canAppend=function(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)},I.prototype.check=function(){if(!this.type.validContent(this.content))throw new RangeError("Invalid content for node "+this.type.name+": "+this.content.toString().slice(0,50));this.content.forEach((function(t){return t.check()}))},I.prototype.toJSON=function(){var t={type:this.type.name};for(var e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map((function(t){return t.toJSON()}))),t},I.fromJSON=function(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");var n=null;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=e.marks.map(t.markFromJSON)}if("text"==e.type){if("string"!=typeof e.text)throw new RangeError("Invalid text node in JSON");return t.text(e.text,n)}var r=o.fromJSON(t,e.content);return t.nodeType(e.type).create(e.attrs,r,n)},Object.defineProperties(I.prototype,A);var F=function(t){this.validEnd=t,this.next=[],this.wrapCache=[]},J={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};F.parse=function(t,e){var n=new $(t,e);if(null==n.next)return F.empty;var r=B(n);n.next&&n.err("Unexpected trailing text");var o=function(t){var e=Object.create(null);return n(W(t,0));function n(r){var o=[];r.forEach((function(e){t[e].forEach((function(e){var n=e.term,r=e.to;if(n){var i=o.indexOf(n),s=i>-1&&o[i+1];W(t,r).forEach((function(t){s||o.push(n,s=[]),-1==s.indexOf(t)&&s.push(t)}))}}))}));for(var i=e[r.join(",")]=new F(r.indexOf(t.length-1)>-1),s=0;s<o.length;s+=2){var a=o[s+1].sort(L);i.next.push(o[s],e[a.join(",")]||n(a))}return i}}(function(t){var e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(t,n,r){var o={term:r,to:n};return e[t].push(o),o}function o(t,e){t.forEach((function(t){return t.to=e}))}function i(t,e){if("choice"==t.type)return t.exprs.reduce((function(t,n){return t.concat(i(n,e))}),[]);if("seq"==t.type)for(var s=0;;s++){var a=i(t.exprs[s],e);if(s==t.exprs.length-1)return a;o(a,e=n())}else{if("star"==t.type){var p=n();return r(e,p),o(i(t.expr,p),p),[r(p)]}if("plus"==t.type){var h=n();return o(i(t.expr,e),h),o(i(t.expr,h),h),[r(h)]}if("opt"==t.type)return[r(e)].concat(i(t.expr,e));if("range"==t.type){for(var c=e,f=0;f<t.min;f++){var u=n();o(i(t.expr,c),u),c=u}if(-1==t.max)o(i(t.expr,c),c);else for(var l=t.min;l<t.max;l++){var d=n();r(c,d),o(i(t.expr,c),d),c=d}return[r(c)]}if("name"==t.type)return[r(e,null,t.value)]}}}(r));return function(t,e){for(var n=0,r=[t];n<r.length;n++){for(var o=r[n],i=!o.validEnd,s=[],a=0;a<o.next.length;a+=2){var p=o.next[a],h=o.next[a+1];s.push(p.name),!i||p.isText||p.hasRequiredAttrs()||(i=!1),-1==r.indexOf(h)&&r.push(h)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o},F.prototype.matchType=function(t){for(var e=0;e<this.next.length;e+=2)if(this.next[e]==t)return this.next[e+1];return null},F.prototype.matchFragment=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=t.childCount);for(var r=this,o=e;r&&o<n;o++)r=r.matchType(t.child(o).type);return r},J.inlineContent.get=function(){var t=this.next[0];return!!t&&t.isInline},J.defaultType.get=function(){for(var t=0;t<this.next.length;t+=2){var e=this.next[t];if(!e.isText&&!e.hasRequiredAttrs())return e}},F.prototype.compatible=function(t){for(var e=0;e<this.next.length;e+=2)for(var n=0;n<t.next.length;n+=2)if(this.next[e]==t.next[n])return!0;return!1},F.prototype.fillBefore=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=0);var r=[this];return function i(s,a){var p=s.matchFragment(t,n);if(p&&(!e||p.validEnd))return o.from(a.map((function(t){return t.createAndFill()})));for(var h=0;h<s.next.length;h+=2){var c=s.next[h],f=s.next[h+1];if(!c.isText&&!c.hasRequiredAttrs()&&-1==r.indexOf(f)){r.push(f);var u=i(f,a.concat(c));if(u)return u}}}(this,[])},F.prototype.findWrapping=function(t){for(var e=0;e<this.wrapCache.length;e+=2)if(this.wrapCache[e]==t)return this.wrapCache[e+1];var n=this.computeWrapping(t);return this.wrapCache.push(t,n),n},F.prototype.computeWrapping=function(t){for(var e=Object.create(null),n=[{match:this,type:null,via:null}];n.length;){var r=n.shift(),o=r.match;if(o.matchType(t)){for(var i=[],s=r;s.type;s=s.via)i.push(s.type);return i.reverse()}for(var a=0;a<o.next.length;a+=2){var p=o.next[a];p.isLeaf||p.hasRequiredAttrs()||p.name in e||r.type&&!o.next[a+1].validEnd||(n.push({match:p.contentMatch,type:p,via:r}),e[p.name]=!0)}}},J.edgeCount.get=function(){return this.next.length>>1},F.prototype.edge=function(t){var e=t<<1;if(e>=this.next.length)throw new RangeError("There's no "+t+"th edge in this content match");return{type:this.next[e],next:this.next[e+1]}},F.prototype.toString=function(){var t=[];return function e(n){t.push(n);for(var r=1;r<n.next.length;r+=2)-1==t.indexOf(n.next[r])&&e(n.next[r])}(this),t.map((function(e,n){for(var r=n+(e.validEnd?"*":" ")+" ",o=0;o<e.next.length;o+=2)r+=(o?", ":"")+e.next[o].name+"->"+t.indexOf(e.next[o+1]);return r})).join("\n")},Object.defineProperties(F.prototype,J),F.empty=new F(!0);var $=function(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()},j={next:{configurable:!0}};function B(t){var e=[];do{e.push(P(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function P(t){var e=[];do{e.push(D(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function D(t){for(var e=function(t){if(t.eat("(")){var e=B(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){var n=function(t,e){var n=t.nodeTypes,r=n[e];if(r)return[r];var o=[];for(var i in n){var s=n[i];s.groups.indexOf(e)>-1&&o.push(s)}0==o.length&&t.err("No node type or group '"+e+"' found");return o}(t,t.next).map((function(e){return null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}}));return t.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}t.err("Unexpected token '"+t.next+"'")}(t);;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=q(t,e)}return e}function _(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");var e=Number(t.next);return t.pos++,e}function q(t,e){var n=_(t),r=n;return t.eat(",")&&(r="}"!=t.next?_(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function L(t,e){return e-t}function W(t,e){var n=[];return function e(r){var o=t[r];if(1==o.length&&!o[0].term)return e(o[0].to);n.push(r);for(var i=0;i<o.length;i++){var s=o[i],a=s.term,p=s.to;a||-1!=n.indexOf(p)||e(p)}}(e),n.sort(L)}function V(t){var e=Object.create(null);for(var n in t){var r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function U(t,e){var n=Object.create(null);for(var r in t){var o=e&&e[r];if(void 0===o){var i=t[r];if(!i.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=i.default}n[r]=o}return n}function G(t){var e=Object.create(null);if(t)for(var n in t)e[n]=new Y(t[n]);return e}j.next.get=function(){return this.tokens[this.pos]},$.prototype.eat=function(t){return this.next==t&&(this.pos++||!0)},$.prototype.err=function(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")},Object.defineProperties($.prototype,j);var K=function(t,e,n){this.name=t,this.schema=e,this.spec=n,this.groups=n.group?n.group.split(" "):[],this.attrs=G(n.attrs),this.defaultAttrs=V(this.attrs),this.contentMatch=null,this.markSet=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==t),this.isText="text"==t},X={isInline:{configurable:!0},isTextblock:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0}};X.isInline.get=function(){return!this.isBlock},X.isTextblock.get=function(){return this.isBlock&&this.inlineContent},X.isLeaf.get=function(){return this.contentMatch==F.empty},X.isAtom.get=function(){return this.isLeaf||this.spec.atom},K.prototype.hasRequiredAttrs=function(){for(var t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1},K.prototype.compatibleContent=function(t){return this==t||this.contentMatch.compatible(t.contentMatch)},K.prototype.computeAttrs=function(t){return!t&&this.defaultAttrs?this.defaultAttrs:U(this.attrs,t)},K.prototype.create=function(t,e,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new I(this,this.computeAttrs(t),o.from(e),h.setFrom(n))},K.prototype.createChecked=function(t,e,n){if(e=o.from(e),!this.validContent(e))throw new RangeError("Invalid content for node "+this.name);return new I(this,this.computeAttrs(t),e,h.setFrom(n))},K.prototype.createAndFill=function(t,e,n){if(t=this.computeAttrs(t),(e=o.from(e)).size){var r=this.contentMatch.fillBefore(e);if(!r)return null;e=r.append(e)}var i=this.contentMatch.matchFragment(e).fillBefore(o.empty,!0);return i?new I(this,t,e.append(i),h.setFrom(n)):null},K.prototype.validContent=function(t){var e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(var n=0;n<t.childCount;n++)if(!this.allowsMarks(t.child(n).marks))return!1;return!0},K.prototype.allowsMarkType=function(t){return null==this.markSet||this.markSet.indexOf(t)>-1},K.prototype.allowsMarks=function(t){if(null==this.markSet)return!0;for(var e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0},K.prototype.allowedMarks=function(t){if(null==this.markSet)return t;for(var e,n=0;n<t.length;n++)this.allowsMarkType(t[n].type)?e&&e.push(t[n]):e||(e=t.slice(0,n));return e?e.length?e:h.empty:t},K.compile=function(t,e){var n=Object.create(null);t.forEach((function(t,r){return n[t]=new K(t,e,r)}));var r=e.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(var o in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n},Object.defineProperties(K.prototype,X);var Y=function(t){this.hasDefault=Object.prototype.hasOwnProperty.call(t,"default"),this.default=t.default},H={isRequired:{configurable:!0}};H.isRequired.get=function(){return!this.hasDefault},Object.defineProperties(Y.prototype,H);var Q=function(t,e,n,r){this.name=t,this.schema=n,this.spec=r,this.attrs=G(r.attrs),this.rank=e,this.excluded=null;var o=V(this.attrs);this.instance=o&&new h(this,o)};Q.prototype.create=function(t){return!t&&this.instance?this.instance:new h(this,U(this.attrs,t))},Q.compile=function(t,e){var n=Object.create(null),r=0;return t.forEach((function(t,o){return n[t]=new Q(t,r++,e,o)})),n},Q.prototype.removeFromSet=function(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t},Q.prototype.isInSet=function(t){for(var e=0;e<t.length;e++)if(t[e].type==this)return t[e]},Q.prototype.excludes=function(t){return this.excluded.indexOf(t)>-1};var Z=function(t,e){var n=this;this.schema=t,this.rules=e,this.tags=[],this.styles=[],e.forEach((function(t){t.tag?n.tags.push(t):t.style&&n.styles.push(t)})),this.normalizeLists=!this.tags.some((function(e){if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;var n=t.nodes[e.node];return n.contentMatch.matchType(n)}))};Z.prototype.parse=function(t,e){void 0===e&&(e={});var n=new it(this,e,!1);return n.addAll(t,null,e.from,e.to),n.finish()},Z.prototype.parseSlice=function(t,e){void 0===e&&(e={});var n=new it(this,e,!0);return n.addAll(t,null,e.from,e.to),f.maxOpen(n.finish())},Z.prototype.matchTag=function(t,e,n){for(var r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){var o=this.tags[r];if(at(t,o.tag)&&(void 0===o.namespace||t.namespaceURI==o.namespace)&&(!o.context||e.matchesContext(o.context))){if(o.getAttrs){var i=o.getAttrs(t);if(!1===i)continue;o.attrs=i}return o}}},Z.prototype.matchStyle=function(t,e,n,r){for(var o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){var i=this.styles[o];if(!(0!=i.style.indexOf(t)||i.context&&!n.matchesContext(i.context)||i.style.length>t.length&&(61!=i.style.charCodeAt(t.length)||i.style.slice(t.length+1)!=e))){if(i.getAttrs){var s=i.getAttrs(e);if(!1===s)continue;i.attrs=s}return i}}},Z.schemaRules=function(t){var e=[];function n(t){for(var n=null==t.priority?50:t.priority,r=0;r<e.length;r++){var o=e[r];if((null==o.priority?50:o.priority)<n)break}e.splice(r,0,t)}var r=function(e){var r=t.marks[e].spec.parseDOM;r&&r.forEach((function(t){n(t=pt(t)),t.mark=e}))};for(var o in t.marks)r(o);var i;for(var s in t.nodes)i=void 0,(i=t.nodes[s].spec.parseDOM)&&i.forEach((function(t){n(t=pt(t)),t.node=s}));return e},Z.fromSchema=function(t){return t.cached.domParser||(t.cached.domParser=new Z(t,Z.schemaRules(t)))};var tt={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},et={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},nt={ol:!0,ul:!0};function rt(t){return(t?1:0)|("full"===t?2:0)}var ot=function(t,e,n,r,o,i,s){this.type=t,this.attrs=e,this.solid=o,this.match=i||(4&s?null:t.contentMatch),this.options=s,this.content=[],this.marks=n,this.activeMarks=h.none,this.pendingMarks=r,this.stashMarks=[]};ot.prototype.findWrapping=function(t){if(!this.match){if(!this.type)return[];var e=this.type.contentMatch.fillBefore(o.from(t));if(!e){var n,r=this.type.contentMatch;return(n=r.findWrapping(t.type))?(this.match=r,n):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)},ot.prototype.finish=function(t){if(!(1&this.options)){var e,n=this.content[this.content.length-1];n&&n.isText&&(e=/[ \t\r\n\u000c]+$/.exec(n.text))&&(n.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length)))}var r=o.from(this.content);return!t&&this.match&&(r=r.append(this.match.fillBefore(o.empty,!0))),this.type?this.type.create(this.attrs,r,this.marks):r},ot.prototype.popFromStashMark=function(t){for(var e=this.stashMarks.length-1;e>=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]},ot.prototype.applyPending=function(t){for(var e=0,n=this.pendingMarks;e<n.length;e++){var r=n[e];(this.type?this.type.allowsMarkType(r.type):ht(r.type,t))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}};var it=function(t,e,n){this.parser=t,this.options=e,this.isOpen=n;var r,o=e.topNode,i=rt(e.preserveWhitespace)|(n?4:0);r=o?new ot(o.type,o.attrs,h.none,h.none,!0,e.topMatch||o.type.contentMatch,i):new ot(n?null:t.schema.topNodeType,null,h.none,h.none,!0,null,i),this.nodes=[r],this.open=0,this.find=e.findPositions,this.needsBlock=!1},st={top:{configurable:!0},currentPos:{configurable:!0}};function at(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function pt(t){var e={};for(var n in t)e[n]=t[n];return e}function ht(t,e){var n=e.schema.nodes,r=function(r){var o=n[r];if(o.allowsMarkType(t)){var i=[],s=function(t){i.push(t);for(var n=0;n<t.edgeCount;n++){var r=t.edge(n),o=r.type,a=r.next;if(o==e)return!0;if(i.indexOf(a)<0&&s(a))return!0}};return s(o.contentMatch)?{v:!0}:void 0}};for(var o in n){var i=r(o);if(i)return i.v}}st.top.get=function(){return this.nodes[this.open]},it.prototype.addDOM=function(t){if(3==t.nodeType)this.addTextNode(t);else if(1==t.nodeType){var e=t.getAttribute("style"),n=e?this.readStyles(function(t){var e,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];for(;e=n.exec(t);)r.push(e[1],e[2].trim());return r}(e)):null,r=this.top;if(null!=n)for(var o=0;o<n.length;o++)this.addPendingMark(n[o]);if(this.addElement(t),null!=n)for(var i=0;i<n.length;i++)this.removePendingMark(n[i],r)}},it.prototype.addTextNode=function(t){var e=t.nodeValue,n=this.top;if((n.type?n.type.inlineContent:n.content.length&&n.content[0].isInline)||/[^ \t\r\n\u000c]/.test(e)){if(1&n.options)2&n.options||(e=e.replace(/\r?\n|\r/g," "));else if(e=e.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(e)&&this.open==this.nodes.length-1){var r=n.content[n.content.length-1],o=t.previousSibling;(!r||o&&"BR"==o.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(e=e.slice(1))}e&&this.insertNode(this.parser.schema.text(e)),this.findInText(t)}else this.findInside(t)},it.prototype.addElement=function(t,e){var n,r=t.nodeName.toLowerCase();nt.hasOwnProperty(r)&&this.parser.normalizeLists&&function(t){for(var e=t.firstChild,n=null;e;e=e.nextSibling){var r=1==e.nodeType?e.nodeName.toLowerCase():null;r&&nt.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):"li"==r?n=e:r&&(n=null)}}(t);var o=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(n=this.parser.matchTag(t,this,e));if(o?o.ignore:et.hasOwnProperty(r))this.findInside(t);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(t=o.skip);var i,s=this.top,a=this.needsBlock;if(tt.hasOwnProperty(r))i=!0,s.type||(this.needsBlock=!0);else if(!t.firstChild)return void this.leafFallback(t);this.addAll(t),i&&this.sync(s),this.needsBlock=a}else this.addElementByRule(t,o,!1===o.consuming?n:null)},it.prototype.leafFallback=function(t){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"))},it.prototype.readStyles=function(t){var e=h.none;t:for(var n=0;n<t.length;n+=2)for(var r=null;;){var o=this.parser.matchStyle(t[n],t[n+1],this,r);if(!o)continue t;if(o.ignore)return null;if(e=this.parser.schema.marks[o.mark].create(o.attrs).addToSet(e),!1!==o.consuming)break;r=o}return e},it.prototype.addElementByRule=function(t,e,n){var r,o,i,s=this;e.node?(o=this.parser.schema.nodes[e.node]).isLeaf?this.insertNode(o.create(e.attrs))||this.leafFallback(t):r=this.enter(o,e.attrs,e.preserveWhitespace):(i=this.parser.schema.marks[e.mark].create(e.attrs),this.addPendingMark(i));var a=this.top;if(o&&o.isLeaf)this.findInside(t);else if(n)this.addElement(t,n);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach((function(t){return s.insertNode(t)}));else{var p=e.contentElement;"string"==typeof p?p=t.querySelector(p):"function"==typeof p&&(p=p(t)),p||(p=t),this.findAround(t,p,!0),this.addAll(p,r)}r&&(this.sync(a),this.open--),i&&this.removePendingMark(i,a)},it.prototype.addAll=function(t,e,n,r){for(var o=n||0,i=n?t.childNodes[n]:t.firstChild,s=null==r?null:t.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(t,o),this.addDOM(i),e&&tt.hasOwnProperty(i.nodeName.toLowerCase())&&this.sync(e);this.findAtPoint(t,o)},it.prototype.findPlace=function(t){for(var e,n,r=this.open;r>=0;r--){var o=this.nodes[r],i=o.findWrapping(t);if(i&&(!e||e.length>i.length)&&(e=i,n=o,!i.length))break;if(o.solid)break}if(!e)return!1;this.sync(n);for(var s=0;s<e.length;s++)this.enterInner(e[s],null,!1);return!0},it.prototype.insertNode=function(t){if(t.isInline&&this.needsBlock&&!this.top.type){var e=this.textblockFromContext();e&&this.enterInner(e)}if(this.findPlace(t)){this.closeExtra();var n=this.top;n.applyPending(t.type),n.match&&(n.match=n.match.matchType(t.type));for(var r=n.activeMarks,o=0;o<t.marks.length;o++)n.type&&!n.type.allowsMarkType(t.marks[o].type)||(r=t.marks[o].addToSet(r));return n.content.push(t.mark(r)),!0}return!1},it.prototype.enter=function(t,e,n){var r=this.findPlace(t.create(e));return r&&this.enterInner(t,e,!0,n),r},it.prototype.enterInner=function(t,e,n,r){this.closeExtra();var o=this.top;o.applyPending(t),o.match=o.match&&o.match.matchType(t,e);var i=null==r?-5&o.options:rt(r);4&o.options&&0==o.content.length&&(i|=4),this.nodes.push(new ot(t,e,o.activeMarks,o.pendingMarks,n,null,i)),this.open++},it.prototype.closeExtra=function(t){var e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}},it.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},it.prototype.sync=function(t){for(var e=this.open;e>=0;e--)if(this.nodes[e]==t)return void(this.open=e)},st.currentPos.get=function(){this.closeExtra();for(var t=0,e=this.open;e>=0;e--){for(var n=this.nodes[e].content,r=n.length-1;r>=0;r--)t+=n[r].nodeSize;e&&t++}return t},it.prototype.findAtPoint=function(t,e){if(this.find)for(var n=0;n<this.find.length;n++)this.find[n].node==t&&this.find[n].offset==e&&(this.find[n].pos=this.currentPos)},it.prototype.findInside=function(t){if(this.find)for(var e=0;e<this.find.length;e++)null==this.find[e].pos&&1==t.nodeType&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)},it.prototype.findAround=function(t,e,n){if(t!=e&&this.find)for(var r=0;r<this.find.length;r++){if(null==this.find[r].pos&&1==t.nodeType&&t.contains(this.find[r].node))e.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}},it.prototype.findInText=function(t){if(this.find)for(var e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))},it.prototype.matchesContext=function(t){var e=this;if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);var n=t.split("/"),r=this.options.context,o=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=function(t,a){for(;t>=0;t--){var p=n[t];if(""==p){if(t==n.length-1||0==t)continue;for(;a>=i;a--)if(s(t-1,a))return!0;return!1}var h=a>0||0==a&&o?e.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!h||h.name!=p&&-1==h.groups.indexOf(p))return!1;a--}return!0};return s(n.length-1,this.open)},it.prototype.textblockFromContext=function(){var t=this.options.context;if(t)for(var e=t.depth;e>=0;e--){var n=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(var r in this.parser.schema.nodes){var o=this.parser.schema.nodes[r];if(o.isTextblock&&o.defaultAttrs)return o}},it.prototype.addPendingMark=function(t){var e=function(t,e){for(var n=0;n<e.length;n++)if(t.eq(e[n]))return e[n]}(t,this.top.pendingMarks);e&&this.top.stashMarks.push(e),this.top.pendingMarks=t.addToSet(this.top.pendingMarks)},it.prototype.removePendingMark=function(t,e){for(var n=this.open;n>=0;n--){var r=this.nodes[n];if(r.pendingMarks.lastIndexOf(t)>-1)r.pendingMarks=t.removeFromSet(r.pendingMarks);else{r.activeMarks=t.removeFromSet(r.activeMarks);var o=r.popFromStashMark(t);o&&r.type&&r.type.allowsMarkType(o.type)&&(r.activeMarks=o.addToSet(r.activeMarks))}if(r==e)break}},Object.defineProperties(it.prototype,st);var ct=function(t,e){this.nodes=t||{},this.marks=e||{}};function ft(t){var e={};for(var n in t){var r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function ut(t){return t.document||window.document}ct.prototype.serializeFragment=function(t,e,n){var r=this;void 0===e&&(e={}),n||(n=ut(e).createDocumentFragment());var o=n,i=null;return t.forEach((function(t){if(i||t.marks.length){i||(i=[]);for(var n=0,s=0;n<i.length&&s<t.marks.length;){var a=t.marks[s];if(r.marks[a.type.name]){if(!a.eq(i[n])||!1===a.type.spec.spanning)break;n+=2,s++}else s++}for(;n<i.length;)o=i.pop(),i.pop();for(;s<t.marks.length;){var p=t.marks[s++],h=r.serializeMark(p,t.isInline,e);h&&(i.push(p,o),o.appendChild(h.dom),o=h.contentDOM||h.dom)}}o.appendChild(r.serializeNode(t,e))})),n},ct.prototype.serializeNode=function(t,e){void 0===e&&(e={});var n=ct.renderSpec(ut(e),this.nodes[t.type.name](t)),r=n.dom,o=n.contentDOM;if(o){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");e.onContent?e.onContent(t,o,e):this.serializeFragment(t.content,e,o)}return r},ct.prototype.serializeNodeAndMarks=function(t,e){void 0===e&&(e={});for(var n=this.serializeNode(t,e),r=t.marks.length-1;r>=0;r--){var o=this.serializeMark(t.marks[r],t.isInline,e);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n},ct.prototype.serializeMark=function(t,e,n){void 0===n&&(n={});var r=this.marks[t.type.name];return r&&ct.renderSpec(ut(n),r(t,e))},ct.renderSpec=function(t,e,n){if(void 0===n&&(n=null),"string"==typeof e)return{dom:t.createTextNode(e)};if(null!=e.nodeType)return{dom:e};if(e.dom&&null!=e.dom.nodeType)return e;var r=e[0],o=r.indexOf(" ");o>0&&(n=r.slice(0,o),r=r.slice(o+1));var i=null,s=n?t.createElementNS(n,r):t.createElement(r),a=e[1],p=1;if(a&&"object"==typeof a&&null==a.nodeType&&!Array.isArray(a))for(var h in p=2,a)if(null!=a[h]){var c=h.indexOf(" ");c>0?s.setAttributeNS(h.slice(0,c),h.slice(c+1),a[h]):s.setAttribute(h,a[h])}for(var f=p;f<e.length;f++){var u=e[f];if(0===u){if(f<e.length-1||f>p)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}var l=ct.renderSpec(t,u,n),d=l.dom,m=l.contentDOM;if(s.appendChild(d),m){if(i)throw new RangeError("Multiple content holes");i=m}}return{dom:s,contentDOM:i}},ct.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new ct(this.nodesFromSchema(t),this.marksFromSchema(t)))},ct.nodesFromSchema=function(t){var e=ft(t.nodes);return e.text||(e.text=function(t){return t.text}),e},ct.marksFromSchema=function(t){return ft(t.marks)};var lt=Math.pow(2,16);function dt(t){return 65535&t}var mt=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=null),this.pos=t,this.deleted=e,this.recover=n},vt=function(t,e){void 0===e&&(e=!1),this.ranges=t,this.inverted=e};vt.prototype.recover=function(t){var e=0,n=dt(t);if(!this.inverted)for(var r=0;r<n;r++)e+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+e+function(t){return(t-(65535&t))/lt}(t)},vt.prototype.mapResult=function(t,e){return void 0===e&&(e=1),this._map(t,e,!1)},vt.prototype.map=function(t,e){return void 0===e&&(e=1),this._map(t,e,!0)},vt.prototype._map=function(t,e,n){for(var r=0,o=this.inverted?2:1,i=this.inverted?1:2,s=0;s<this.ranges.length;s+=3){var a=this.ranges[s]-(this.inverted?r:0);if(a>t)break;var p=this.ranges[s+o],h=this.ranges[s+i],c=a+p;if(t<=c){var f=a+r+((p?t==a?-1:t==c?1:e:e)<0?0:h);if(n)return f;var u=t==(e<0?a:c)?null:s/3+(t-a)*lt;return new mt(f,e<0?t!=a:t!=c,u)}r+=h-p}return n?t+r:new mt(t+r)},vt.prototype.touches=function(t,e){for(var n=0,r=dt(e),o=this.inverted?2:1,i=this.inverted?1:2,s=0;s<this.ranges.length;s+=3){var a=this.ranges[s]-(this.inverted?n:0);if(a>t)break;var p=this.ranges[s+o];if(t<=a+p&&s==3*r)return!0;n+=this.ranges[s+i]-p}return!1},vt.prototype.forEach=function(t){for(var e=this.inverted?2:1,n=this.inverted?1:2,r=0,o=0;r<this.ranges.length;r+=3){var i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),p=this.ranges[r+e],h=this.ranges[r+n];t(s,s+p,a,a+h),o+=h-p}},vt.prototype.invert=function(){return new vt(this.ranges,!this.inverted)},vt.prototype.toString=function(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)},vt.offset=function(t){return 0==t?vt.empty:new vt(t<0?[0,-t,0]:[0,0,t])},vt.empty=new vt([]);var yt=function(t,e,n,r){this.maps=t||[],this.from=n||0,this.to=null==r?this.maps.length:r,this.mirror=e};function gt(t){var e=Error.call(this,t);return e.__proto__=gt.prototype,e}yt.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.maps.length),new yt(this.maps,this.mirror,t,e)},yt.prototype.copy=function(){return new yt(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)},yt.prototype.appendMap=function(t,e){this.to=this.maps.push(t),null!=e&&this.setMirror(this.maps.length-1,e)},yt.prototype.appendMapping=function(t){for(var e=0,n=this.maps.length;e<t.maps.length;e++){var r=t.getMirror(e);this.appendMap(t.maps[e],null!=r&&r<e?n+r:null)}},yt.prototype.getMirror=function(t){if(this.mirror)for(var e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]},yt.prototype.setMirror=function(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)},yt.prototype.appendMappingInverted=function(t){for(var e=t.maps.length-1,n=this.maps.length+t.maps.length;e>=0;e--){var r=t.getMirror(e);this.appendMap(t.maps[e].invert(),null!=r&&r>e?n-r-1:null)}},yt.prototype.invert=function(){var t=new yt;return t.appendMappingInverted(this),t},yt.prototype.map=function(t,e){if(void 0===e&&(e=1),this.mirror)return this._map(t,e,!0);for(var n=this.from;n<this.to;n++)t=this.maps[n].map(t,e);return t},yt.prototype.mapResult=function(t,e){return void 0===e&&(e=1),this._map(t,e,!1)},yt.prototype._map=function(t,e,n){for(var r=!1,o=this.from;o<this.to;o++){var i=this.maps[o].mapResult(t,e);if(null!=i.recover){var s=this.getMirror(o);if(null!=s&&s>o&&s<this.to){o=s,t=this.maps[s].recover(i.recover);continue}}i.deleted&&(r=!0),t=i.pos}return n?t:new mt(t,r)},gt.prototype=Object.create(Error.prototype),gt.prototype.constructor=gt,gt.prototype.name="TransformError";var wt=function(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new yt},xt={before:{configurable:!0},docChanged:{configurable:!0}};function kt(){throw new Error("Override me")}xt.before.get=function(){return this.docs.length?this.docs[0]:this.doc},wt.prototype.step=function(t){var e=this.maybeStep(t);if(e.failed)throw new gt(e.failed);return this},wt.prototype.maybeStep=function(t){var e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e},xt.docChanged.get=function(){return this.steps.length>0},wt.prototype.addStep=function(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e},Object.defineProperties(wt.prototype,xt);var St=Object.create(null),bt=function(){};bt.prototype.apply=function(t){return kt()},bt.prototype.getMap=function(){return vt.empty},bt.prototype.invert=function(t){return kt()},bt.prototype.map=function(t){return kt()},bt.prototype.merge=function(t){return null},bt.prototype.toJSON=function(){return kt()},bt.fromJSON=function(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=St[e.stepType];if(!n)throw new RangeError("No step type "+e.stepType+" defined");return n.fromJSON(t,e)},bt.jsonID=function(t,e){if(t in St)throw new RangeError("Duplicate use of step JSON ID "+t);return St[t]=e,e.prototype.jsonID=t,e};var Mt=function(t,e){this.doc=t,this.failed=e};Mt.ok=function(t){return new Mt(t,null)},Mt.fail=function(t){return new Mt(null,t)},Mt.fromReplace=function(t,e,n,r){try{return Mt.ok(t.replace(e,n,r))}catch(t){if(t instanceof c)return Mt.fail(t.message);throw t}};var Ot=function(t){function e(e,n,r,o){t.call(this),this.from=e,this.to=n,this.slice=r,this.structure=!!o}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){return this.structure&&Tt(t,this.from,this.to)?Mt.fail("Structure replace would overwrite content"):Mt.fromReplace(t,this.from,this.to,this.slice)},e.prototype.getMap=function(){return new vt([this.from,this.to-this.from,this.slice.size])},e.prototype.invert=function(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted?null:new e(n.pos,Math.max(n.pos,r.pos),this.slice)},e.prototype.merge=function(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;var n=this.slice.size+t.slice.size==0?f.empty:new f(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}var r=this.slice.size+t.slice.size==0?f.empty:new f(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),r,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new e(n.from,n.to,f.fromJSON(t,n.slice),!!n.structure)},e}(bt);bt.jsonID("replace",Ot);var Ct=function(t){function e(e,n,r,o,i,s,a){t.call(this),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=!!a}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){if(this.structure&&(Tt(t,this.from,this.gapFrom)||Tt(t,this.gapTo,this.to)))return Mt.fail("Structure gap-replace would overwrite content");var e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return Mt.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,e.content);return n?Mt.fromReplace(t,this.from,this.to,n):Mt.fail("Content does not fit in gap")},e.prototype.getMap=function(){return new vt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])},e.prototype.invert=function(t){var n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),o=t.map(this.gapFrom,-1),i=t.map(this.gapTo,1);return n.deleted&&r.deleted||o<n.pos||i>r.pos?null:new e(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to||"number"!=typeof n.gapFrom||"number"!=typeof n.gapTo||"number"!=typeof n.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new e(n.from,n.to,n.gapFrom,n.gapTo,f.fromJSON(t,n.slice),n.insert,!!n.structure)},e}(bt);function Tt(t,e,n){for(var r=t.resolve(e),o=n-e,i=r.depth;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0)for(var s=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}return!1}function Et(t,e,n){for(var r=[],i=0;i<t.childCount;i++){var s=t.child(i);s.content.size&&(s=s.copy(Et(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return o.fromArray(r)}bt.jsonID("replaceAround",Ct),wt.prototype.lift=function(t,e){for(var n=t.$from,r=t.$to,i=t.depth,s=n.before(i+1),a=r.after(i+1),p=s,h=a,c=o.empty,u=0,l=i,d=!1;l>e;l--)d||n.index(l)>0?(d=!0,c=o.from(n.node(l).copy(c)),u++):p--;for(var m=o.empty,v=0,y=i,g=!1;y>e;y--)g||r.after(y+1)<r.end(y)?(g=!0,m=o.from(r.node(y).copy(m)),v++):h++;return this.step(new Ct(p,h,s,a,new f(c.append(m),u,v),c.size-u,!0))},wt.prototype.wrap=function(t,e){for(var n=o.empty,r=e.length-1;r>=0;r--)n=o.from(e[r].type.create(e[r].attrs,n));var i=t.start,s=t.end;return this.step(new Ct(i,s,i,s,new f(n,0,0),e.length,!0))},wt.prototype.setBlockType=function(t,e,n,r){var i=this;if(void 0===e&&(e=t),!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var s=this.steps.length;return this.doc.nodesBetween(t,e,(function(t,e){if(t.isTextblock&&!t.hasMarkup(n,r)&&function(t,e,n){var r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(i.doc,i.mapping.slice(s).map(e),n)){i.clearIncompatible(i.mapping.slice(s).map(e,1),n);var a=i.mapping.slice(s),p=a.map(e,1),h=a.map(e+t.nodeSize,1);return i.step(new Ct(p,h,p+1,h-1,new f(o.from(n.create(r,null,t.marks)),0,0),1,!0)),!1}})),this},wt.prototype.setNodeMarkup=function(t,e,n,r){var i=this.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");e||(e=i.type);var s=e.create(n,null,r||i.marks);if(i.isLeaf)return this.replaceWith(t,t+i.nodeSize,s);if(!e.validContent(i.content))throw new RangeError("Invalid content for node type "+e.name);return this.step(new Ct(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new f(o.from(s),0,0),1,!0))},wt.prototype.split=function(t,e,n){void 0===e&&(e=1);for(var r=this.doc.resolve(t),i=o.empty,s=o.empty,a=r.depth,p=r.depth-e,h=e-1;a>p;a--,h--){i=o.from(r.node(a).copy(i));var c=n&&n[h];s=o.from(c?c.type.create(c.attrs,s):r.node(a).copy(s))}return this.step(new Ot(t,t,new f(i.append(s),e,e),!0))},wt.prototype.join=function(t,e){void 0===e&&(e=1);var n=new Ot(t-e,t+e,f.empty,!0);return this.step(n)};var Nt=function(t){function e(e,n,r){t.call(this),this.from=e,this.to=n,this.mark=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),r=t.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new f(Et(n.content,(function(t,n){return t.isAtom&&n.type.allowsMarkType(e.mark.type)?t.mark(e.mark.addToSet(t.marks)):t}),o),n.openStart,n.openEnd);return Mt.fromReplace(t,this.from,this.to,i)},e.prototype.invert=function(){return new zt(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(bt);bt.jsonID("addMark",Nt);var zt=function(t){function e(e,n,r){t.call(this),this.from=e,this.to=n,this.mark=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),r=new f(Et(n.content,(function(t){return t.mark(e.mark.removeFromSet(t.marks))})),n.openStart,n.openEnd);return Mt.fromReplace(t,this.from,this.to,r)},e.prototype.invert=function(){return new Nt(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(bt);function Rt(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}bt.jsonID("removeMark",zt),wt.prototype.addMark=function(t,e,n){var r=this,o=[],i=[],s=null,a=null;return this.doc.nodesBetween(t,e,(function(r,p,h){if(r.isInline){var c=r.marks;if(!n.isInSet(c)&&h.type.allowsMarkType(n.type)){for(var f=Math.max(p,t),u=Math.min(p+r.nodeSize,e),l=n.addToSet(c),d=0;d<c.length;d++)c[d].isInSet(l)||(s&&s.to==f&&s.mark.eq(c[d])?s.to=u:o.push(s=new zt(f,u,c[d])));a&&a.to==f?a.to=u:i.push(a=new Nt(f,u,n))}}})),o.forEach((function(t){return r.step(t)})),i.forEach((function(t){return r.step(t)})),this},wt.prototype.removeMark=function(t,e,n){var r=this;void 0===n&&(n=null);var o=[],i=0;return this.doc.nodesBetween(t,e,(function(r,s){if(r.isInline){i++;var a=null;if(n instanceof Q)for(var p,h=r.marks;p=n.isInSet(h);)(a||(a=[])).push(p),h=p.removeFromSet(h);else n?n.isInSet(r.marks)&&(a=[n]):a=r.marks;if(a&&a.length)for(var c=Math.min(s+r.nodeSize,e),f=0;f<a.length;f++){for(var u=a[f],l=void 0,d=0;d<o.length;d++){var m=o[d];m.step==i-1&&u.eq(o[d].style)&&(l=m)}l?(l.to=c,l.step=i):o.push({style:u,from:Math.max(s,t),to:c,step:i})}}})),o.forEach((function(t){return r.step(new zt(t.from,t.to,t.style))})),this},wt.prototype.clearIncompatible=function(t,e,n){void 0===n&&(n=e.contentMatch);for(var r=this.doc.nodeAt(t),i=[],s=t+1,a=0;a<r.childCount;a++){var p=r.child(a),h=s+p.nodeSize,c=n.matchType(p.type,p.attrs);if(c){n=c;for(var u=0;u<p.marks.length;u++)e.allowsMarkType(p.marks[u].type)||this.step(new zt(s,h,p.marks[u]))}else i.push(new Ot(s,h,f.empty));s=h}if(!n.validEnd){var l=n.fillBefore(o.empty,!0);this.replace(s,s,new f(l,0,0))}for(var d=i.length-1;d>=0;d--)this.step(i[d]);return this},wt.prototype.replace=function(t,e,n){void 0===e&&(e=t),void 0===n&&(n=f.empty);var r=function(t,e,n,r){if(void 0===n&&(n=e),void 0===r&&(r=f.empty),e==n&&!r.size)return null;var o=t.resolve(e),i=t.resolve(n);return Rt(o,i,r)?new Ot(e,n,r):new It(o,i,r).fit()}(this.doc,t,e,n);return r&&this.step(r),this},wt.prototype.replaceWith=function(t,e,n){return this.replace(t,e,new f(o.from(n),0,0))},wt.prototype.delete=function(t,e){return this.replace(t,e,f.empty)},wt.prototype.insert=function(t,e){return this.replaceWith(t,t,e)};var It=function(t,e,n){this.$to=e,this.$from=t,this.unplaced=n,this.frontier=[];for(var r=0;r<=t.depth;r++){var i=t.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(t.indexAfter(r))})}this.placed=o.empty;for(var s=t.depth;s>0;s--)this.placed=o.from(t.node(s).copy(this.placed))},At={depth:{configurable:!0}};function Ft(t,e,n){return 0==e?t.cutByIndex(n):t.replaceChild(0,t.firstChild.copy(Ft(t.firstChild.content,e-1,n)))}function Jt(t,e,n){return 0==e?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Jt(t.lastChild.content,e-1,n)))}function $t(t,e){for(var n=0;n<e;n++)t=t.firstChild.content;return t}function jt(t,e,n){if(e<=0)return t;var r=t.content;return e>1&&(r=r.replaceChild(0,jt(r.firstChild,e-1,1==r.childCount?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(o.empty,!0)))),t.copy(r)}function Bt(t,e,n,r,o){var i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;var a=r.fillBefore(i.content,!0,s);return a&&!function(t,e,n){for(var r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}(n,i.content,s)?a:null}function Pt(t,e,n,r,i){if(e<n){var s=t.firstChild;t=t.replaceChild(0,s.copy(Pt(s.content,e+1,n,r,s)))}if(e>r){var a=i.contentMatchAt(0),p=a.fillBefore(t).append(t);t=p.append(a.matchFragment(p).fillBefore(o.empty,!0))}return t}function Dt(t,e){for(var n=[],r=Math.min(t.depth,e.depth);r>=0;r--){var o=t.start(r);if(o<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;o==e.start(r)&&n.push(r)}return n}At.depth.get=function(){return this.frontier.length-1},It.prototype.fit=function(){for(;this.unplaced.size;){var t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}var e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;for(var i=this.placed,s=r.depth,a=o.depth;s&&a&&1==i.childCount;)i=i.firstChild.content,s--,a--;var p=new f(i,s,a);return e>-1?new Ct(r.pos,e,this.$to.pos,this.$to.end(),p,n):p.size||r.pos!=this.$to.pos?new Ot(r.pos,o.pos,p):void 0},It.prototype.findFittable=function(){for(var t=1;t<=2;t++)for(var e=this.unplaced.openStart;e>=0;e--)for(var n=void 0,r=(e?(n=$t(this.unplaced.content,e-1).firstChild).content:this.unplaced.content).firstChild,i=this.depth;i>=0;i--){var s=this.frontier[i],a=s.type,p=s.match,h=void 0,c=void 0;if(1==t&&(r?p.matchType(r.type)||(c=p.fillBefore(o.from(r),!1)):a.compatibleContent(n.type)))return{sliceDepth:e,frontierDepth:i,parent:n,inject:c};if(2==t&&r&&(h=p.findWrapping(r.type)))return{sliceDepth:e,frontierDepth:i,parent:n,wrap:h};if(n&&p.matchType(n.type))break}},It.prototype.openMore=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=$t(e,n);return!(!o.childCount||o.firstChild.isLeaf)&&(this.unplaced=new f(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)},It.prototype.dropNode=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=$t(e,n);if(o.childCount<=1&&n>0){var i=e.size-n<=n+o.size;this.unplaced=new f(Ft(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new f(Ft(e,n,1),n,r)},It.prototype.placeNodes=function(t){for(var e=t.sliceDepth,n=t.frontierDepth,r=t.parent,i=t.inject,s=t.wrap;this.depth>n;)this.closeFrontierNode();if(s)for(var a=0;a<s.length;a++)this.openFrontierNode(s[a]);var p=this.unplaced,h=r?r.content:p.content,c=p.openStart-e,u=0,l=[],d=this.frontier[n],m=d.match,v=d.type;if(i){for(var y=0;y<i.childCount;y++)l.push(i.child(y));m=m.matchFragment(i)}for(var g=h.size+e-(p.content.size-p.openEnd);u<h.childCount;){var w=h.child(u),x=m.matchType(w.type);if(!x)break;(++u>1||0==c||w.content.size)&&(m=x,l.push(jt(w.mark(v.allowedMarks(w.marks)),1==u?c:0,u==h.childCount?g:-1)))}var k=u==h.childCount;k||(g=-1),this.placed=Jt(this.placed,n,o.from(l)),this.frontier[n].match=m,k&&g<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var S=0,b=h;S<g;S++){var M=b.lastChild;this.frontier.push({type:M.type,match:M.contentMatchAt(M.childCount)}),b=M.content}this.unplaced=k?0==e?f.empty:new f(Ft(p.content,e-1,1),e-1,g<0?p.openEnd:e-1):new f(Ft(p.content,e,u),p.openStart,p.openEnd)},It.prototype.mustMoveInline=function(){if(!this.$to.parent.isTextblock||this.$to.end()==this.$to.pos)return-1;var t,e=this.frontier[this.depth];if(!e.type.isTextblock||!Bt(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;for(var n=this.$to.depth,r=this.$to.after(n);n>1&&r==this.$to.end(--n);)++r;return r},It.prototype.findCloseLevel=function(t){t:for(var e=Math.min(this.depth,t.depth);e>=0;e--){var n=this.frontier[e],r=n.match,o=n.type,i=e<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1)),s=Bt(t,e,o,r,i);if(s){for(var a=e-1;a>=0;a--){var p=this.frontier[a],h=p.match,c=Bt(t,a,p.type,h,!0);if(!c||c.childCount)continue t}return{depth:e,fit:s,move:i?t.doc.resolve(t.after(e+1)):t}}}},It.prototype.close=function(t){var e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=Jt(this.placed,e.depth,e.fit)),t=e.move;for(var n=e.depth+1;n<=t.depth;n++){var r=t.node(n),o=r.type.contentMatch.fillBefore(r.content,!0,t.index(n));this.openFrontierNode(r.type,r.attrs,o)}return t},It.prototype.openFrontierNode=function(t,e,n){var r=this.frontier[this.depth];r.match=r.match.matchType(t),this.placed=Jt(this.placed,this.depth,o.from(t.create(e,n))),this.frontier.push({type:t,match:t.contentMatch})},It.prototype.closeFrontierNode=function(){var t=this.frontier.pop().match.fillBefore(o.empty,!0);t.childCount&&(this.placed=Jt(this.placed,this.frontier.length,t))},Object.defineProperties(It.prototype,At),wt.prototype.replaceRange=function(t,e,n){if(!n.size)return this.deleteRange(t,e);var r=this.doc.resolve(t),o=this.doc.resolve(e);if(Rt(r,o,n))return this.step(new Ot(t,e,n));var i=Dt(r,this.doc.resolve(e));0==i[i.length-1]&&i.pop();var s=-(r.depth+1);i.unshift(s);for(var a=r.depth,p=r.pos-1;a>0;a--,p--){var h=r.node(a).type.spec;if(h.defining||h.isolating)break;i.indexOf(a)>-1?s=a:r.before(a)==p&&i.splice(1,0,-a)}for(var c=i.indexOf(s),u=[],l=n.openStart,d=n.content,m=0;;m++){var v=d.firstChild;if(u.push(v),m==n.openStart)break;d=v.content}l>0&&u[l-1].type.spec.defining&&r.node(c).type!=u[l-1].type?l-=1:l>=2&&u[l-1].isTextblock&&u[l-2].type.spec.defining&&r.node(c).type!=u[l-2].type&&(l-=2);for(var y=n.openStart;y>=0;y--){var g=(y+l+1)%(n.openStart+1),w=u[g];if(w)for(var x=0;x<i.length;x++){var k=i[(x+c)%i.length],S=!0;k<0&&(S=!1,k=-k);var b=r.node(k-1),M=r.index(k-1);if(b.canReplaceWith(M,M,w.type,w.marks))return this.replace(r.before(k),S?o.after(k):e,new f(Pt(n.content,0,n.openStart,g),g,n.openEnd))}}for(var O=this.steps.length,C=i.length-1;C>=0&&(this.replace(t,e,n),!(this.steps.length>O));C--){var T=i[C];C<0||(t=r.before(T),e=o.after(T))}return this},wt.prototype.replaceRangeWith=function(t,e,n){if(!n.isInline&&t==e&&this.doc.resolve(t).parent.content.size){var r=function(t,e,n){var r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(0==r.parentOffset)for(var o=r.depth-1;o>=0;o--){var i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(var s=r.depth-1;s>=0;s--){var a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,n))return r.after(s+1);if(a<r.node(s).childCount)return null}}(this.doc,t,n.type);null!=r&&(t=e=r)}return this.replaceRange(t,e,new f(o.from(n),0,0))},wt.prototype.deleteRange=function(t,e){for(var n=this.doc.resolve(t),r=this.doc.resolve(e),o=Dt(n,r),i=0;i<o.length;i++){var s=o[i],a=i==o.length-1;if(a&&0==s||n.node(s).type.contentMatch.validEnd)return this.delete(n.start(s),r.end(s));if(s>0&&(a||n.node(s-1).canReplace(n.index(s-1),r.indexAfter(s-1))))return this.delete(n.before(s),r.after(s))}for(var p=1;p<=n.depth&&p<=r.depth;p++)if(t-n.start(p)==n.depth-p&&e>n.end(p)&&r.end(p)-e!=r.depth-p)return this.delete(n.before(p),e);return this.delete(t,e)};var _t=Object.create(null),qt=function(t,e,n){this.ranges=n||[new Wt(t.min(e),t.max(e))],this.$anchor=t,this.$head=e},Lt={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};Lt.anchor.get=function(){return this.$anchor.pos},Lt.head.get=function(){return this.$head.pos},Lt.from.get=function(){return this.$from.pos},Lt.to.get=function(){return this.$to.pos},Lt.$from.get=function(){return this.ranges[0].$from},Lt.$to.get=function(){return this.ranges[0].$to},Lt.empty.get=function(){for(var t=this.ranges,e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0},qt.prototype.content=function(){return this.$from.node(0).slice(this.from,this.to,!0)},qt.prototype.replace=function(t,e){void 0===e&&(e=f.empty);for(var n=e.content.lastChild,r=null,o=0;o<e.openEnd;o++)r=n,n=n.lastChild;for(var i=t.steps.length,s=this.ranges,a=0;a<s.length;a++){var p=s[a],h=p.$from,c=p.$to,u=t.mapping.slice(i);t.replaceRange(u.map(h.pos),u.map(c.pos),a?f.empty:e),0==a&&Qt(t,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}},qt.prototype.replaceWith=function(t,e){for(var n=t.steps.length,r=this.ranges,o=0;o<r.length;o++){var i=r[o],s=i.$from,a=i.$to,p=t.mapping.slice(n),h=p.map(s.pos),c=p.map(a.pos);o?t.deleteRange(h,c):(t.replaceRangeWith(h,c,e),Qt(t,n,e.isInline?-1:1))}},qt.findFrom=function(t,e,n){var r=t.parent.inlineContent?new Vt(t):Ht(t.node(0),t.parent,t.pos,t.index(),e,n);if(r)return r;for(var o=t.depth-1;o>=0;o--){var i=e<0?Ht(t.node(0),t.node(o),t.before(o+1),t.index(o),e,n):Ht(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,n);if(i)return i}},qt.near=function(t,e){return void 0===e&&(e=1),this.findFrom(t,e)||this.findFrom(t,-e)||new Xt(t.node(0))},qt.atStart=function(t){return Ht(t,t,0,0,1)||new Xt(t)},qt.atEnd=function(t){return Ht(t,t,t.content.size,t.childCount,-1)||new Xt(t)},qt.fromJSON=function(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=_t[e.type];if(!n)throw new RangeError("No selection type "+e.type+" defined");return n.fromJSON(t,e)},qt.jsonID=function(t,e){if(t in _t)throw new RangeError("Duplicate use of selection JSON ID "+t);return _t[t]=e,e.prototype.jsonID=t,e},qt.prototype.getBookmark=function(){return Vt.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(qt.prototype,Lt),qt.prototype.visible=!0;var Wt=function(t,e){this.$from=t,this.$to=e},Vt=function(t){function e(e,n){void 0===n&&(n=e),t.call(this,e,n)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={$cursor:{configurable:!0}};return n.$cursor.get=function(){return this.$anchor.pos==this.$head.pos?this.$head:null},e.prototype.map=function(n,r){var o=n.resolve(r.map(this.head));if(!o.parent.inlineContent)return t.near(o);var i=n.resolve(r.map(this.anchor));return new e(i.parent.inlineContent?i:o,o)},e.prototype.replace=function(e,n){if(void 0===n&&(n=f.empty),t.prototype.replace.call(this,e,n),n==f.empty){var r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}},e.prototype.eq=function(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head},e.prototype.getBookmark=function(){return new Ut(this.anchor,this.head)},e.prototype.toJSON=function(){return{type:"text",anchor:this.anchor,head:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.anchor||"number"!=typeof n.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new e(t.resolve(n.anchor),t.resolve(n.head))},e.create=function(t,e,n){void 0===n&&(n=e);var r=t.resolve(e);return new this(r,n==e?r:t.resolve(n))},e.between=function(n,r,o){var i=n.pos-r.pos;if(o&&!i||(o=i>=0?1:-1),!r.parent.inlineContent){var s=t.findFrom(r,o,!0)||t.findFrom(r,-o,!0);if(!s)return t.near(r,o);r=s.$head}return n.parent.inlineContent||(0==i||(n=(t.findFrom(n,-o,!0)||t.findFrom(n,o,!0)).$anchor).pos<r.pos!=i<0)&&(n=r),new e(n,r)},Object.defineProperties(e.prototype,n),e}(qt);qt.jsonID("text",Vt);var Ut=function(t,e){this.anchor=t,this.head=e};Ut.prototype.map=function(t){return new Ut(t.map(this.anchor),t.map(this.head))},Ut.prototype.resolve=function(t){return Vt.between(t.resolve(this.anchor),t.resolve(this.head))};var Gt=function(t){function e(e){var n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);t.call(this,e,r),this.node=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.map=function(n,r){var o=r.mapResult(this.anchor),i=o.deleted,s=o.pos,a=n.resolve(s);return i?t.near(a):new e(a)},e.prototype.content=function(){return new f(o.from(this.node),0,0)},e.prototype.eq=function(t){return t instanceof e&&t.anchor==this.anchor},e.prototype.toJSON=function(){return{type:"node",anchor:this.anchor}},e.prototype.getBookmark=function(){return new Kt(this.anchor)},e.fromJSON=function(t,n){if("number"!=typeof n.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new e(t.resolve(n.anchor))},e.create=function(t,e){return new this(t.resolve(e))},e.isSelectable=function(t){return!t.isText&&!1!==t.type.spec.selectable},e}(qt);Gt.prototype.visible=!1,qt.jsonID("node",Gt);var Kt=function(t){this.anchor=t};Kt.prototype.map=function(t){var e=t.mapResult(this.anchor),n=e.deleted,r=e.pos;return n?new Ut(r,r):new Kt(r)},Kt.prototype.resolve=function(t){var e=t.resolve(this.anchor),n=e.nodeAfter;return n&&Gt.isSelectable(n)?new Gt(e):qt.near(e)};var Xt=function(t){function e(e){t.call(this,e.resolve(0),e.resolve(e.content.size))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.replace=function(e,n){if(void 0===n&&(n=f.empty),n==f.empty){e.delete(0,e.doc.content.size);var r=t.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else t.prototype.replace.call(this,e,n)},e.prototype.toJSON=function(){return{type:"all"}},e.fromJSON=function(t){return new e(t)},e.prototype.map=function(t){return new e(t)},e.prototype.eq=function(t){return t instanceof e},e.prototype.getBookmark=function(){return Yt},e}(qt);qt.jsonID("all",Xt);var Yt={map:function(){return this},resolve:function(t){return new Xt(t)}};function Ht(t,e,n,r,o,i){if(e.inlineContent)return Vt.create(t,n);for(var s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){var a=e.child(s);if(a.isAtom){if(!i&&Gt.isSelectable(a))return Gt.create(t,n-(o<0?a.nodeSize:0))}else{var p=Ht(t,a,n+o,o<0?a.childCount:0,o,i);if(p)return p}n+=a.nodeSize*o}}function Qt(t,e,n){var r=t.steps.length-1;if(!(r<e)){var o,i=t.steps[r];if(i instanceof Ot||i instanceof Ct)t.mapping.maps[r].forEach((function(t,e,n,r){null==o&&(o=r)})),t.setSelection(qt.near(t.doc.resolve(o),n))}}var Zt=function(t){function e(e){t.call(this,e.doc),this.time=Date.now(),this.curSelection=e.selection,this.curSelectionFor=0,this.storedMarks=e.storedMarks,this.updated=0,this.meta=Object.create(null)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={selection:{configurable:!0},selectionSet:{configurable:!0},storedMarksSet:{configurable:!0},isGeneric:{configurable:!0},scrolledIntoView:{configurable:!0}};return n.selection.get=function(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection},e.prototype.setSelection=function(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=-3&(1|this.updated),this.storedMarks=null,this},n.selectionSet.get=function(){return(1&this.updated)>0},e.prototype.setStoredMarks=function(t){return this.storedMarks=t,this.updated|=2,this},e.prototype.ensureMarks=function(t){return h.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this},e.prototype.addStoredMark=function(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))},e.prototype.removeStoredMark=function(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))},n.storedMarksSet.get=function(){return(2&this.updated)>0},e.prototype.addStep=function(e,n){t.prototype.addStep.call(this,e,n),this.updated=-3&this.updated,this.storedMarks=null},e.prototype.setTime=function(t){return this.time=t,this},e.prototype.replaceSelection=function(t){return this.selection.replace(this,t),this},e.prototype.replaceSelectionWith=function(t,e){var n=this.selection;return!1!==e&&(t=t.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||h.none))),n.replaceWith(this,t),this},e.prototype.deleteSelection=function(){return this.selection.replace(this),this},e.prototype.insertText=function(t,e,n){void 0===n&&(n=e);var r=this.doc.type.schema;if(null==e)return t?this.replaceSelectionWith(r.text(t),!0):this.deleteSelection();if(!t)return this.deleteRange(e,n);var o=this.storedMarks;if(!o){var i=this.doc.resolve(e);o=n==e?i.marks():i.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(e,n,r.text(t,o)),this.selection.empty||this.setSelection(qt.near(this.selection.$to)),this},e.prototype.setMeta=function(t,e){return this.meta["string"==typeof t?t:t.key]=e,this},e.prototype.getMeta=function(t){return this.meta["string"==typeof t?t:t.key]},n.isGeneric.get=function(){for(var t in this.meta)return!1;return!0},e.prototype.scrollIntoView=function(){return this.updated|=4,this},n.scrolledIntoView.get=function(){return(4&this.updated)>0},Object.defineProperties(e.prototype,n),e}(wt);function te(t,e){return e&&t?t.bind(e):t}var ee=function(t,e,n){this.name=t,this.init=te(e.init,n),this.apply=te(e.apply,n)},ne=[new ee("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new ee("selection",{init:function(t,e){return t.selection||qt.atStart(e.doc)},apply:function(t){return t.selection}}),new ee("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new ee("scrollToSelection",{init:function(){return 0},apply:function(t,e){return t.scrolledIntoView?e+1:e}})],re=function(t,e){var n=this;this.schema=t,this.fields=ne.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),e&&e.forEach((function(t){if(n.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");n.plugins.push(t),n.pluginsByKey[t.key]=t,t.spec.state&&n.fields.push(new ee(t.key,t.spec.state,t))}))},oe=function(t){this.config=t},ie={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};ie.schema.get=function(){return this.config.schema},ie.plugins.get=function(){return this.config.plugins},oe.prototype.apply=function(t){return this.applyTransaction(t).state},oe.prototype.filterTransaction=function(t,e){void 0===e&&(e=-1);for(var n=0;n<this.config.plugins.length;n++)if(n!=e){var r=this.config.plugins[n];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,t,this))return!1}return!0},oe.prototype.applyTransaction=function(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};for(var e=[t],n=this.applyInner(t),r=null;;){for(var o=!1,i=0;i<this.config.plugins.length;i++){var s=this.config.plugins[i];if(s.spec.appendTransaction){var a=r?r[i].n:0,p=r?r[i].state:this,h=a<e.length&&s.spec.appendTransaction.call(s,a?e.slice(a):e,p,n);if(h&&n.filterTransaction(h,i)){if(h.setMeta("appendedTransaction",t),!r){r=[];for(var c=0;c<this.config.plugins.length;c++)r.push(c<i?{state:n,n:e.length}:{state:this,n:0})}e.push(h),n=n.applyInner(h),o=!0}r&&(r[i]={state:n,n:e.length})}}if(!o)return{state:n,transactions:e}}},oe.prototype.applyInner=function(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");for(var e=new oe(this.config),n=this.config.fields,r=0;r<n.length;r++){var o=n[r];e[o.name]=o.apply(t,this[o.name],this,e)}for(var i=0;i<se.length;i++)se[i](this,t,e);return e},ie.tr.get=function(){return new Zt(this)},oe.create=function(t){for(var e=new re(t.doc?t.doc.type.schema:t.schema,t.plugins),n=new oe(e),r=0;r<e.fields.length;r++)n[e.fields[r].name]=e.fields[r].init(t,n);return n},oe.prototype.reconfigure=function(t){for(var e=new re(this.schema,t.plugins),n=e.fields,r=new oe(e),o=0;o<n.length;o++){var i=n[o].name;r[i]=this.hasOwnProperty(i)?this[i]:n[o].init(t,r)}return r},oe.prototype.toJSON=function(t){var e={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(e.storedMarks=this.storedMarks.map((function(t){return t.toJSON()}))),t&&"object"==typeof t)for(var n in t){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");var r=t[n],o=r.spec.state;o&&o.toJSON&&(e[n]=o.toJSON.call(r,this[r.key]))}return e},oe.fromJSON=function(t,e,n){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");var r=new re(t.schema,t.plugins),o=new oe(r);return r.fields.forEach((function(r){if("doc"==r.name)o.doc=I.fromJSON(t.schema,e.doc);else if("selection"==r.name)o.selection=qt.fromJSON(o.doc,e.selection);else if("storedMarks"==r.name)e.storedMarks&&(o.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(n)for(var i in n){var s=n[i],a=s.spec.state;if(s.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(e,i))return void(o[r.name]=a.fromJSON.call(s,t,e[i],o))}o[r.name]=r.init(t,o)}})),o},oe.addApplyListener=function(t){se.push(t)},oe.removeApplyListener=function(t){var e=se.indexOf(t);e>-1&&se.splice(e,1)},Object.defineProperties(oe.prototype,ie);var se=[];function ae(t,e,n){for(var r in t){var o=t[r];o instanceof Function?o=o.bind(e):"handleDOMEvents"==r&&(o=ae(o,e,{})),n[r]=o}return n}var pe=function(t){this.props={},t.props&&ae(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:function(t){if(t in he)return t+"$"+ ++he[t];return he[t]=0,t+"$"}("plugin")};pe.prototype.getState=function(t){return t[this.key]};var he=Object.create(null);var ce=function(t,e){var n=this;this.editorView=t,this.width=e.width||1,this.color=e.color||"black",this.class=e.class,this.cursorPos=null,this.element=null,this.timeout=null,this.handlers=["dragover","dragend","drop","dragleave"].map((function(e){var r=function(t){return n[e](t)};return t.dom.addEventListener(e,r),{name:e,handler:r}}))};ce.prototype.destroy=function(){var t=this;this.handlers.forEach((function(e){var n=e.name,r=e.handler;return t.editorView.dom.removeEventListener(n,r)}))},ce.prototype.update=function(t,e){null!=this.cursorPos&&e.doc!=t.state.doc&&this.updateOverlay()},ce.prototype.setCursor=function(t){t!=this.cursorPos&&(this.cursorPos=t,null==t?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())},ce.prototype.updateOverlay=function(){var t,e=this.editorView.state.doc.resolve(this.cursorPos);if(!e.parent.inlineContent){var n=e.nodeBefore,r=e.nodeAfter;if(n||r){var o=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0)).getBoundingClientRect(),i=n?o.bottom:o.top;n&&r&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),t={left:o.left,right:o.right,top:i-this.width/2,bottom:i+this.width/2}}}if(!t){var s=this.editorView.coordsAtPos(this.cursorPos);t={left:s.left-this.width/2,right:s.left+this.width/2,top:s.top,bottom:s.bottom}}var a,p,h=this.editorView.dom.offsetParent;if(this.element||(this.element=h.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none; background-color: "+this.color),!h||h==document.body&&"static"==getComputedStyle(h).position)a=-pageXOffset,p=-pageYOffset;else{var c=h.getBoundingClientRect();a=c.left-h.scrollLeft,p=c.top-h.scrollTop}this.element.style.left=t.left-a+"px",this.element.style.top=t.top-p+"px",this.element.style.width=t.right-t.left+"px",this.element.style.height=t.bottom-t.top+"px"},ce.prototype.scheduleRemoval=function(t){var e=this;clearTimeout(this.timeout),this.timeout=setTimeout((function(){return e.setCursor(null)}),t)},ce.prototype.dragover=function(t){if(this.editorView.editable){var e=this.editorView.posAtCoords({left:t.clientX,top:t.clientY});if(e){var n=e.pos;if(this.editorView.dragging&&this.editorView.dragging.slice&&null==(n=function(t,e,n){var r=t.resolve(e);if(!n.content.size)return e;for(var o=n.content,i=0;i<n.openStart;i++)o=o.firstChild.content;for(var s=1;s<=(0==n.openStart&&n.size?2:1);s++)for(var a=r.depth;a>=0;a--){var p=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,h=r.index(a)+(p>0?1:0);if(1==s?r.node(a).canReplace(h,h,o):r.node(a).contentMatchAt(h).findWrapping(o.firstChild.type))return 0==p?r.pos:p<0?r.before(a+1):r.after(a+1)}return null}(this.editorView.state.doc,n,this.editorView.dragging.slice)))return this.setCursor(null);this.setCursor(n),this.scheduleRemoval(5e3)}}},ce.prototype.dragend=function(){this.scheduleRemoval(20)},ce.prototype.drop=function(){this.scheduleRemoval(20)},ce.prototype.dragleave=function(t){t.target!=this.editorView.dom&&this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)};const fe=e.Extension.create({name:"dropCursor",defaultOptions:{color:"black",width:1,class:null},addProseMirrorPlugins(){return[(t=this.options,void 0===t&&(t={}),new pe({view:function(e){return new ce(e,t)}}))];var t}});t.Dropcursor=fe,t.default=fe,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
2
|
-
//# sourceMappingURL=tiptap-extension-dropcursor.bundle.umd.min.js.map
|