@dialpad/dialtone-vue 3.84.0 → 3.86.0
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/CHANGELOG.json +1 -1
- package/CHANGELOG.md +30 -0
- package/dist/component-documentation.json +1 -1
- package/dist/dialtone-vue.cjs +6 -6
- package/dist/dialtone-vue.js +1532 -1360
- package/dist/emoji-bd8527a3.cjs +25 -0
- package/dist/{emoji-3ed8aeab.js → emoji-c109b6ee.js} +9419 -9758
- package/dist/emoji.cjs +1 -1
- package/dist/emoji.js +112 -31
- package/dist/message_input.cjs +1 -1
- package/dist/message_input.js +2 -2
- package/dist/{notice-702ad033.js → notice-c5521e01.js} +98 -91
- package/dist/notice-f2b0212d.cjs +2 -0
- package/dist/style.css +1 -1
- package/dist/types/common/utils.d.ts +16 -0
- package/dist/types/common/utils.d.ts.map +1 -1
- package/dist/types/components/avatar/avatar.vue.d.ts +23 -2
- package/dist/types/components/avatar/avatar.vue.d.ts.map +1 -1
- package/dist/types/components/avatar/avatar_constants.d.ts +1 -1
- package/dist/types/components/avatar/avatar_constants.d.ts.map +1 -1
- package/dist/types/components/chip/chip.vue.d.ts +1 -1
- package/dist/types/components/notice/notice.vue.d.ts +1 -1
- package/dist/types/components/radio/radio.vue.d.ts +1 -1
- package/dist/types/components/toast/toast.vue.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue.d.ts +4 -2
- package/dist/types/recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue.d.ts.map +1 -1
- package/dist/types/recipes/leftbar/callbox/callbox.vue.d.ts +20 -1
- package/dist/types/recipes/leftbar/callbox/callbox.vue.d.ts.map +1 -1
- package/dist/types/recipes/list_items/contact_info/contact_info.vue.d.ts +21 -2
- package/dist/types/recipes/list_items/contact_info/contact_info.vue.d.ts.map +1 -1
- package/package.json +19 -21
- package/dist/emoji-9b6e4b5a.cjs +0 -25
- package/dist/emoji_text_wrapper-4fc20727.js +0 -86
- package/dist/emoji_text_wrapper-b1235087.cjs +0 -1
- package/dist/notice-119b7aa6.cjs +0 -2
package/dist/emoji.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./emoji-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./emoji-bd8527a3.cjs"),n=require("vue"),a={name:"DtEmojiTextWrapper",components:{DtEmoji:e.DtEmoji},inheritAttrs:!1,props:{elementType:{type:String,default:"div"},size:{type:String,default:"500",validator:t=>Object.keys(e.ICON_SIZE_MODIFIERS).includes(t)}},data(){return{loadingEmojiJson:!0}},async created(){this.loadingEmojiJson=!1},methods:{replaceDtEmojis(t,o){const i=new RegExp(`(${t.join("|")})`,"g");return o.split(i).map(r=>t.includes(r)?n.h(e.DtEmoji,{...this.$attrs,class:"d-mx4 d-d-inline-block",size:this.size,code:r}):r)},searchVNodes(t){var i;if(typeof t=="string")return this.searchCodes(t);if(typeof t.type=="symbol")return this.searchCodes(t.children);if((i=t.props)!=null&&i.innerHTML)return this.searchVNodes(t.props.innerHTML);const o=Array.isArray(t.children)?t.children:[t.children];return n.h(t.type,t.props,o.map(s=>this.searchVNodes(s)))},replaceVueComponentVNodeContent(t){},searchCodes(t){const o=e.findShortCodes(t),i=e.findEmojis(t),s=[...o,...i];return s.length===0?t:this.replaceDtEmojis(s,t)}},render(){const t=this.$slots.default?this.$slots.default():[];return n.h(this.elementType,{"data-qa":"emoji-text-wrapper",class:this.$attrs.class},this.loadingEmojiJson?t:t.map(o=>this.searchVNodes(o)))}};exports.CDN_URL=e.CDN_URL;exports.DtEmoji=e.DtEmoji;exports.DtEmojiPicker=e._sfc_main;exports.EMOJIS_PER_ROW=e.EMOJIS_PER_ROW;exports.EMOJI_CATEGORIES=e.EMOJI_CATEGORIES;exports.EMOJI_SKIN_TONE_MODIFIERS=e.EMOJI_SKIN_TONE_MODIFIERS;exports.codeToEmojiData=e.codeToEmojiData;Object.defineProperty(exports,"customEmojiAssetUrl",{enumerable:!0,get:()=>e.customEmojiAssetUrl});exports.defaultEmojiAssetUrl=e.defaultEmojiAssetUrl;Object.defineProperty(exports,"emojiFileExtensionLarge",{enumerable:!0,get:()=>e.emojiFileExtensionLarge});Object.defineProperty(exports,"emojiFileExtensionSmall",{enumerable:!0,get:()=>e.emojiFileExtensionSmall});Object.defineProperty(exports,"emojiImageUrlLarge",{enumerable:!0,get:()=>e.emojiImageUrlLarge});Object.defineProperty(exports,"emojiImageUrlSmall",{enumerable:!0,get:()=>e.emojiImageUrlSmall});exports.emojiJson=e.emojiJson;exports.emojiVersion=e.emojiVersion;exports.filterValidShortCodes=e.filterValidShortCodes;exports.findEmojis=e.findEmojis;exports.findShortCodes=e.findShortCodes;exports.getEmojiData=e.getEmojiData;exports.setCustomEmojiJson=e.setCustomEmojiJson;exports.setCustomEmojiUrl=e.setCustomEmojiUrl;exports.setEmojiAssetUrlLarge=e.setEmojiAssetUrlLarge;exports.setEmojiAssetUrlSmall=e.setEmojiAssetUrlSmall;exports.shortcodeToEmojiData=e.shortcodeToEmojiData;exports.stringToUnicode=e.stringToUnicode;exports.unicodeToString=e.unicodeToString;exports.validateCustomEmojiJson=e.validateCustomEmojiJson;exports.DtEmojiTextWrapper=a;
|
package/dist/emoji.js
CHANGED
|
@@ -1,33 +1,114 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as L } from "./
|
|
3
|
-
import "vue";
|
|
1
|
+
import { e as o, I as n, aj as l, ak as m } from "./emoji-c109b6ee.js";
|
|
2
|
+
import { af as j, m as u, ag as f, ai as g, ah as S, j as y, an as I, am as D, ar as T, ap as C, aq as _, ao as O, as as A, al as J, aB as U, at as x, ax as M, aw as R, av as L, au as $, s as k, aA as v, az as z, ay as F } from "./emoji-c109b6ee.js";
|
|
3
|
+
import { h as r } from "vue";
|
|
4
|
+
const d = {
|
|
5
|
+
name: "DtEmojiTextWrapper",
|
|
6
|
+
components: {
|
|
7
|
+
DtEmoji: o
|
|
8
|
+
},
|
|
9
|
+
inheritAttrs: !1,
|
|
10
|
+
props: {
|
|
11
|
+
/**
|
|
12
|
+
* Element type (tag name) to use for the wrapper.
|
|
13
|
+
*/
|
|
14
|
+
elementType: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: "div"
|
|
17
|
+
},
|
|
18
|
+
/**
|
|
19
|
+
* The icon size to render the emojis at: 100 to 800
|
|
20
|
+
*/
|
|
21
|
+
size: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: "500",
|
|
24
|
+
validator: (s) => Object.keys(n).includes(s)
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
data() {
|
|
28
|
+
return {
|
|
29
|
+
loadingEmojiJson: !0
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
async created() {
|
|
33
|
+
this.loadingEmojiJson = !1;
|
|
34
|
+
},
|
|
35
|
+
methods: {
|
|
36
|
+
/**
|
|
37
|
+
* Replaces the valid codes from the text content with a DtEmoji component.
|
|
38
|
+
* @returns {Array<VNode|string>}
|
|
39
|
+
*/
|
|
40
|
+
replaceDtEmojis(s, e) {
|
|
41
|
+
const a = new RegExp(`(${s.join("|")})`, "g");
|
|
42
|
+
return e.split(a).map((i) => s.includes(i) ? r(o, { ...this.$attrs, class: "d-mx4 d-d-inline-block", size: this.size, code: i }) : i);
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* Recursively search the Vue virtual DOM to find text
|
|
46
|
+
* @param VNode
|
|
47
|
+
* @returns {VNode|*}
|
|
48
|
+
*/
|
|
49
|
+
searchVNodes(s) {
|
|
50
|
+
var a;
|
|
51
|
+
if (typeof s == "string")
|
|
52
|
+
return this.searchCodes(s);
|
|
53
|
+
if (typeof s.type == "symbol")
|
|
54
|
+
return this.searchCodes(s.children);
|
|
55
|
+
if ((a = s.props) != null && a.innerHTML)
|
|
56
|
+
return this.searchVNodes(s.props.innerHTML);
|
|
57
|
+
const e = Array.isArray(s.children) ? s.children : [s.children];
|
|
58
|
+
return r(s.type, s.props, e.map((t) => this.searchVNodes(t)));
|
|
59
|
+
},
|
|
60
|
+
// TODO: Find a way to crawl vue components
|
|
61
|
+
replaceVueComponentVNodeContent(s) {
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* Find codes in text.
|
|
65
|
+
* @param textContent string
|
|
66
|
+
* @returns {Array<VNode|string>|string}
|
|
67
|
+
*/
|
|
68
|
+
searchCodes(s) {
|
|
69
|
+
const e = l(s), a = m(s), t = [...e, ...a];
|
|
70
|
+
return t.length === 0 ? s : this.replaceDtEmojis(t, s);
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
render() {
|
|
74
|
+
const s = this.$slots.default ? this.$slots.default() : [];
|
|
75
|
+
return r(
|
|
76
|
+
this.elementType,
|
|
77
|
+
{
|
|
78
|
+
"data-qa": "emoji-text-wrapper",
|
|
79
|
+
class: this.$attrs.class
|
|
80
|
+
},
|
|
81
|
+
this.loadingEmojiJson ? s : s.map((e) => this.searchVNodes(e))
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
4
85
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
86
|
+
j as CDN_URL,
|
|
87
|
+
o as DtEmoji,
|
|
88
|
+
u as DtEmojiPicker,
|
|
89
|
+
d as DtEmojiTextWrapper,
|
|
90
|
+
f as EMOJIS_PER_ROW,
|
|
91
|
+
g as EMOJI_CATEGORIES,
|
|
92
|
+
S as EMOJI_SKIN_TONE_MODIFIERS,
|
|
93
|
+
y as codeToEmojiData,
|
|
94
|
+
I as customEmojiAssetUrl,
|
|
95
|
+
D as defaultEmojiAssetUrl,
|
|
96
|
+
T as emojiFileExtensionLarge,
|
|
97
|
+
C as emojiFileExtensionSmall,
|
|
98
|
+
_ as emojiImageUrlLarge,
|
|
99
|
+
O as emojiImageUrlSmall,
|
|
100
|
+
A as emojiJson,
|
|
101
|
+
J as emojiVersion,
|
|
102
|
+
U as filterValidShortCodes,
|
|
103
|
+
m as findEmojis,
|
|
104
|
+
l as findShortCodes,
|
|
105
|
+
x as getEmojiData,
|
|
106
|
+
M as setCustomEmojiJson,
|
|
107
|
+
R as setCustomEmojiUrl,
|
|
108
|
+
L as setEmojiAssetUrlLarge,
|
|
109
|
+
$ as setEmojiAssetUrlSmall,
|
|
110
|
+
k as shortcodeToEmojiData,
|
|
111
|
+
v as stringToUnicode,
|
|
112
|
+
z as unicodeToString,
|
|
113
|
+
F as validateCustomEmojiJson
|
|
33
114
|
};
|
package/dist/message_input.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("./emoji-9b6e4b5a.cjs"),y=require("vue"),Dt=require("./notice-119b7aa6.cjs");function j(r){this.content=r}j.prototype={constructor:j,find:function(r){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===r)return e;return-1},get:function(r){var e=this.find(r);return e==-1?void 0:this.content[e+1]},update:function(r,e,t){var n=t&&t!=r?this.remove(t):this,i=n.find(r),s=n.content.slice();return i==-1?s.push(t||r,e):(s[i+1]=e,t&&(s[i]=t)),new j(s)},remove:function(r){var e=this.find(r);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new j(t)},addToStart:function(r,e){return new j([r,e].concat(this.remove(r).content))},addToEnd:function(r,e){var t=this.remove(r).content.slice();return t.push(r,e),new j(t)},addBefore:function(r,e,t){var n=this.remove(e),i=n.content.slice(),s=n.find(r);return i.splice(s==-1?i.length:s,0,e,t),new j(i)},forEach:function(r){for(var e=0;e<this.content.length;e+=2)r(this.content[e],this.content[e+1])},prepend:function(r){return r=j.from(r),r.size?new j(r.content.concat(this.subtract(r).content)):this},append:function(r){return r=j.from(r),r.size?new j(this.subtract(r).content.concat(r.content)):this},subtract:function(r){var e=this;r=j.from(r);for(var t=0;t<r.content.length;t+=2)e=e.remove(r.content[t]);return e},toObject:function(){var r={};return this.forEach(function(e,t){r[e]=t}),r},get size(){return this.content.length>>1}};j.from=function(r){if(r instanceof j)return r;var e=[];if(r)for(var t in r)e.push(t,r[t]);return new j(e)};function Si(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let i=r.child(n),s=e.child(n);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=Si(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function xi(r,e,t,n){for(let i=r.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:n};let o=r.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,n-=a;continue}if(!o.sameMarkup(l))return{a:t,b:n};if(o.isText&&o.text!=l.text){let c=0,d=Math.min(o.text.length,l.text.length);for(;c<d&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,n--;return{a:t,b:n}}if(o.content.size||l.content.size){let c=xi(o.content,l.content,t-1,n-1);if(c)return c}t-=a,n-=a}}class k{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,i=0,s){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&n(a,i+l,s||null,o)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),n,i+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{l.isText?(s+=l.text.slice(Math.max(e,a)-a,t-a),o=!n):l.isLeaf?(i?s+=typeof i=="function"?i(l):i:l.type.spec.leafText&&(s+=l.type.spec.leafText(l)),o=!n):!o&&l.isBlock&&(s+=n,o=!0)},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new k(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),n.push(l),i+=l.nodeSize),o=a}return new k(n,i)}cutByIndex(e,t){return e==t?k.empty:e==0&&t==this.content.length?this:new k(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new k(i,s)}addToStart(e){return new k([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new k(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let i=this.content[t];e(i,n,t),n+=i.nodeSize}}findDiffStart(e,t=0){return Si(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return xi(this,e,t,n)}findIndex(e,t=-1){if(e==0)return Et(0,e);if(e==this.size)return Et(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,i=0;;n++){let s=this.child(n),o=i+s.nodeSize;if(o>=e)return o==e||t>0?Et(n+1,o):Et(n,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return k.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new k(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return k.empty;let t,n=0;for(let i=0;i<e.length;i++){let s=e[i];n+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new k(t||e,n)}static from(e){if(!e)return k.empty;if(e instanceof k)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new k([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}k.empty=new k([],0);const on={index:0,offset:0};function Et(r,e){return on.index=r,on.offset=e,on}function It(r,e){if(r===e)return!0;if(!(r&&typeof r=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(r);if(Array.isArray(e)!=t)return!1;if(t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!It(r[n],e[n]))return!1}else{for(let n in r)if(!(n in e)||!It(r[n],e[n]))return!1;for(let n in e)if(!(n in r))return!1}return!0}let I=class Nn{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!n&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),n=!0),t&&t.push(s)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&It(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);return n.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Nn.none;if(e instanceof Nn)return[e];let t=e.slice();return t.sort((n,i)=>n.type.rank-i.type.rank),t}};I.none=[];class Pt extends Error{}class S{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Mi(this.content,e+this.openStart,t);return n&&new S(n,this.openStart,this.openEnd)}removeBetween(e,t){return new S(Ci(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return S.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new S(k.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)n++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new S(e,n,i)}}S.empty=new S(k.empty,0,0);function Ci(r,e,t){let{index:n,offset:i}=r.findIndex(e),s=r.maybeChild(n),{index:o,offset:l}=r.findIndex(t);if(i==e||s.isText){if(l!=t&&!r.child(o).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=o)throw new RangeError("Removing non-flat range");return r.replaceChild(n,s.copy(Ci(s.content,e-i-1,t-i-1)))}function Mi(r,e,t,n){let{index:i,offset:s}=r.findIndex(e),o=r.maybeChild(i);if(s==e||o.isText)return n&&!n.canReplace(i,i,t)?null:r.cut(0,e).append(t).append(r.cut(e));let l=Mi(o.content,e-s-1,t);return l&&r.replaceChild(i,o.copy(l))}function Zs(r,e,t){if(t.openStart>r.depth)throw new Pt("Inserted content deeper than insertion position");if(r.depth-t.openStart!=e.depth-t.openEnd)throw new Pt("Inconsistent open depths");return wi(r,e,t,0)}function wi(r,e,t,n){let i=r.index(n),s=r.node(n);if(i==e.index(n)&&n<r.depth-t.openStart){let o=wi(r,e,t,n+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&r.depth==n&&e.depth==n){let o=r.parent,l=o.content;return Re(o,l.cut(0,r.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Qs(t,r);return Re(s,Ei(r,o,l,e,n))}else return Re(s,Rt(r,e,n))}function Oi(r,e){if(!e.type.compatibleContent(r.type))throw new Pt("Cannot join "+e.type.name+" onto "+r.type.name)}function Tn(r,e,t){let n=r.node(t);return Oi(n,e.node(t)),n}function Pe(r,e){let t=e.length-1;t>=0&&r.isText&&r.sameMarkup(e[t])?e[t]=r.withText(e[t].text+r.text):e.push(r)}function ft(r,e,t,n){let i=(e||r).node(t),s=0,o=e?e.index(t):i.childCount;r&&(s=r.index(t),r.depth>t?s++:r.textOffset&&(Pe(r.nodeAfter,n),s++));for(let l=s;l<o;l++)Pe(i.child(l),n);e&&e.depth==t&&e.textOffset&&Pe(e.nodeBefore,n)}function Re(r,e){return r.type.checkContent(e),r.copy(e)}function Ei(r,e,t,n,i){let s=r.depth>i&&Tn(r,e,i+1),o=n.depth>i&&Tn(t,n,i+1),l=[];return ft(null,r,i,l),s&&o&&e.index(i)==t.index(i)?(Oi(s,o),Pe(Re(s,Ei(r,e,t,n,i+1)),l)):(s&&Pe(Re(s,Rt(r,e,i+1)),l),ft(e,t,i,l),o&&Pe(Re(o,Rt(t,n,i+1)),l)),ft(n,null,i,l),new k(l)}function Rt(r,e,t){let n=[];if(ft(null,r,t,n),r.depth>t){let i=Tn(r,e,t+1);Pe(Re(i,Rt(r,e,t+1)),n)}return ft(e,null,t,n),new k(n)}function Qs(r,e){let t=e.depth-r.openStart,i=e.node(t).copy(r.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(k.from(i));return{start:i.resolveNoCache(r.openStart+t),end:i.resolveNoCache(i.content.size-r.openEnd-t)}}class yt{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],i=e.child(t);return n?e.child(t).cut(n):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=n.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return I.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),i=e.maybeChild(t);if(!n){let l=n;n=i,i=l}let s=n.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<n.length;s++)n[s].type.spec.inclusive===!1&&(!i||!n[s].isInSet(i.marks))&&(n=n[s--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Bt(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(n.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new yt(t,n,s)}static resolveCached(e,t){for(let i=0;i<ln.length;i++){let s=ln[i];if(s.pos==t&&s.doc==e)return s}let n=ln[an]=yt.resolve(e,t);return an=(an+1)%eo,n}}let ln=[],an=0,eo=12;class Bt{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const to=Object.create(null);let Be=class Dn{constructor(e,t,n,i=I.none){this.type=e,this.attrs=t,this.marks=i,this.content=n||k.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,i=0){this.content.nodesBetween(e,t,n,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,i){return this.content.textBetween(e,t,n,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&It(this.attrs,t||e.defaultAttrs||to)&&I.sameSet(this.marks,n||I.none)}copy(e=null){return e==this.content?this:new Dn(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Dn(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return S.empty;let i=this.resolve(e),s=this.resolve(t),o=n?0:i.sharedDepth(t),l=i.start(o),c=i.node(o).content.cut(i.pos-l,s.pos-l);return new S(c,i.depth-o,s.depth-o)}replace(e,t,n){return Zs(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let i=this.content.child(t-1);return{node:i,index:t-1,offset:n-i.nodeSize}}resolve(e){return yt.resolveCached(this,e)}resolveNoCache(e){return yt.resolve(this,e)}rangeHasMark(e,t,n){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(n.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Ni(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=k.empty,i=0,s=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<s;a++)if(!this.type.allowsMarks(n.child(a).marks))return!1;return!0}canReplaceWith(e,t,n,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(n),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=I.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!I.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let i=k.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,n)}};Be.prototype.text=void 0;class Ft extends Be{constructor(e,t,n,i){if(super(e,t,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Ni(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ft(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ft(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Ni(r,e){for(let t=r.length-1;t>=0;t--)e=r[t].type.name+"("+e+")";return e}class Ve{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new no(e,t);if(n.next==null)return Ve.empty;let i=Ti(n);n.next&&n.err("Unexpected trailing text");let s=co(ao(i));return uo(s,n),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let i=this;for(let s=t;i&&s<n;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let i=[this];function s(o,l){let a=o.matchFragment(e,n);if(a&&(!t||a.validEnd))return k.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:d,next:u}=o.next[c];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let f=s(u,l.concat(d));if(f)return f}}return null}return s(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let i=n.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:a}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||a.validEnd)&&(n.push({match:l.contentMatch,type:l,via:i}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let i=0;i<n.next.length;i++)e.indexOf(n.next[i].next)==-1&&t(n.next[i].next)}return t(this),e.map((n,i)=>{let s=i+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)s+=(o?", ":"")+n.next[o].type.name+"->"+e.indexOf(n.next[o].next);return s}).join(`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("./emoji-bd8527a3.cjs"),y=require("vue"),Dt=require("./notice-f2b0212d.cjs");function j(r){this.content=r}j.prototype={constructor:j,find:function(r){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===r)return e;return-1},get:function(r){var e=this.find(r);return e==-1?void 0:this.content[e+1]},update:function(r,e,t){var n=t&&t!=r?this.remove(t):this,i=n.find(r),s=n.content.slice();return i==-1?s.push(t||r,e):(s[i+1]=e,t&&(s[i]=t)),new j(s)},remove:function(r){var e=this.find(r);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new j(t)},addToStart:function(r,e){return new j([r,e].concat(this.remove(r).content))},addToEnd:function(r,e){var t=this.remove(r).content.slice();return t.push(r,e),new j(t)},addBefore:function(r,e,t){var n=this.remove(e),i=n.content.slice(),s=n.find(r);return i.splice(s==-1?i.length:s,0,e,t),new j(i)},forEach:function(r){for(var e=0;e<this.content.length;e+=2)r(this.content[e],this.content[e+1])},prepend:function(r){return r=j.from(r),r.size?new j(r.content.concat(this.subtract(r).content)):this},append:function(r){return r=j.from(r),r.size?new j(this.subtract(r).content.concat(r.content)):this},subtract:function(r){var e=this;r=j.from(r);for(var t=0;t<r.content.length;t+=2)e=e.remove(r.content[t]);return e},toObject:function(){var r={};return this.forEach(function(e,t){r[e]=t}),r},get size(){return this.content.length>>1}};j.from=function(r){if(r instanceof j)return r;var e=[];if(r)for(var t in r)e.push(t,r[t]);return new j(e)};function Si(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let i=r.child(n),s=e.child(n);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=Si(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function xi(r,e,t,n){for(let i=r.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:n};let o=r.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,n-=a;continue}if(!o.sameMarkup(l))return{a:t,b:n};if(o.isText&&o.text!=l.text){let c=0,d=Math.min(o.text.length,l.text.length);for(;c<d&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,n--;return{a:t,b:n}}if(o.content.size||l.content.size){let c=xi(o.content,l.content,t-1,n-1);if(c)return c}t-=a,n-=a}}class k{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,i=0,s){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&n(a,i+l,s||null,o)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),n,i+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{l.isText?(s+=l.text.slice(Math.max(e,a)-a,t-a),o=!n):l.isLeaf?(i?s+=typeof i=="function"?i(l):i:l.type.spec.leafText&&(s+=l.type.spec.leafText(l)),o=!n):!o&&l.isBlock&&(s+=n,o=!0)},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new k(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),n.push(l),i+=l.nodeSize),o=a}return new k(n,i)}cutByIndex(e,t){return e==t?k.empty:e==0&&t==this.content.length?this:new k(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new k(i,s)}addToStart(e){return new k([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new k(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let i=this.content[t];e(i,n,t),n+=i.nodeSize}}findDiffStart(e,t=0){return Si(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return xi(this,e,t,n)}findIndex(e,t=-1){if(e==0)return Et(0,e);if(e==this.size)return Et(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,i=0;;n++){let s=this.child(n),o=i+s.nodeSize;if(o>=e)return o==e||t>0?Et(n+1,o):Et(n,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return k.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new k(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return k.empty;let t,n=0;for(let i=0;i<e.length;i++){let s=e[i];n+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new k(t||e,n)}static from(e){if(!e)return k.empty;if(e instanceof k)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new k([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}k.empty=new k([],0);const on={index:0,offset:0};function Et(r,e){return on.index=r,on.offset=e,on}function It(r,e){if(r===e)return!0;if(!(r&&typeof r=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(r);if(Array.isArray(e)!=t)return!1;if(t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!It(r[n],e[n]))return!1}else{for(let n in r)if(!(n in e)||!It(r[n],e[n]))return!1;for(let n in e)if(!(n in r))return!1}return!0}let I=class Nn{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!n&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),n=!0),t&&t.push(s)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&It(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);return n.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Nn.none;if(e instanceof Nn)return[e];let t=e.slice();return t.sort((n,i)=>n.type.rank-i.type.rank),t}};I.none=[];class Pt extends Error{}class S{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Mi(this.content,e+this.openStart,t);return n&&new S(n,this.openStart,this.openEnd)}removeBetween(e,t){return new S(Ci(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return S.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new S(k.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)n++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new S(e,n,i)}}S.empty=new S(k.empty,0,0);function Ci(r,e,t){let{index:n,offset:i}=r.findIndex(e),s=r.maybeChild(n),{index:o,offset:l}=r.findIndex(t);if(i==e||s.isText){if(l!=t&&!r.child(o).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=o)throw new RangeError("Removing non-flat range");return r.replaceChild(n,s.copy(Ci(s.content,e-i-1,t-i-1)))}function Mi(r,e,t,n){let{index:i,offset:s}=r.findIndex(e),o=r.maybeChild(i);if(s==e||o.isText)return n&&!n.canReplace(i,i,t)?null:r.cut(0,e).append(t).append(r.cut(e));let l=Mi(o.content,e-s-1,t);return l&&r.replaceChild(i,o.copy(l))}function Zs(r,e,t){if(t.openStart>r.depth)throw new Pt("Inserted content deeper than insertion position");if(r.depth-t.openStart!=e.depth-t.openEnd)throw new Pt("Inconsistent open depths");return wi(r,e,t,0)}function wi(r,e,t,n){let i=r.index(n),s=r.node(n);if(i==e.index(n)&&n<r.depth-t.openStart){let o=wi(r,e,t,n+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&r.depth==n&&e.depth==n){let o=r.parent,l=o.content;return Re(o,l.cut(0,r.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Qs(t,r);return Re(s,Ei(r,o,l,e,n))}else return Re(s,Rt(r,e,n))}function Oi(r,e){if(!e.type.compatibleContent(r.type))throw new Pt("Cannot join "+e.type.name+" onto "+r.type.name)}function Tn(r,e,t){let n=r.node(t);return Oi(n,e.node(t)),n}function Pe(r,e){let t=e.length-1;t>=0&&r.isText&&r.sameMarkup(e[t])?e[t]=r.withText(e[t].text+r.text):e.push(r)}function ft(r,e,t,n){let i=(e||r).node(t),s=0,o=e?e.index(t):i.childCount;r&&(s=r.index(t),r.depth>t?s++:r.textOffset&&(Pe(r.nodeAfter,n),s++));for(let l=s;l<o;l++)Pe(i.child(l),n);e&&e.depth==t&&e.textOffset&&Pe(e.nodeBefore,n)}function Re(r,e){return r.type.checkContent(e),r.copy(e)}function Ei(r,e,t,n,i){let s=r.depth>i&&Tn(r,e,i+1),o=n.depth>i&&Tn(t,n,i+1),l=[];return ft(null,r,i,l),s&&o&&e.index(i)==t.index(i)?(Oi(s,o),Pe(Re(s,Ei(r,e,t,n,i+1)),l)):(s&&Pe(Re(s,Rt(r,e,i+1)),l),ft(e,t,i,l),o&&Pe(Re(o,Rt(t,n,i+1)),l)),ft(n,null,i,l),new k(l)}function Rt(r,e,t){let n=[];if(ft(null,r,t,n),r.depth>t){let i=Tn(r,e,t+1);Pe(Re(i,Rt(r,e,t+1)),n)}return ft(e,null,t,n),new k(n)}function Qs(r,e){let t=e.depth-r.openStart,i=e.node(t).copy(r.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(k.from(i));return{start:i.resolveNoCache(r.openStart+t),end:i.resolveNoCache(i.content.size-r.openEnd-t)}}class yt{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],i=e.child(t);return n?e.child(t).cut(n):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=n.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return I.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),i=e.maybeChild(t);if(!n){let l=n;n=i,i=l}let s=n.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<n.length;s++)n[s].type.spec.inclusive===!1&&(!i||!n[s].isInSet(i.marks))&&(n=n[s--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Bt(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(n.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new yt(t,n,s)}static resolveCached(e,t){for(let i=0;i<ln.length;i++){let s=ln[i];if(s.pos==t&&s.doc==e)return s}let n=ln[an]=yt.resolve(e,t);return an=(an+1)%eo,n}}let ln=[],an=0,eo=12;class Bt{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const to=Object.create(null);let Be=class Dn{constructor(e,t,n,i=I.none){this.type=e,this.attrs=t,this.marks=i,this.content=n||k.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,i=0){this.content.nodesBetween(e,t,n,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,i){return this.content.textBetween(e,t,n,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&It(this.attrs,t||e.defaultAttrs||to)&&I.sameSet(this.marks,n||I.none)}copy(e=null){return e==this.content?this:new Dn(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Dn(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return S.empty;let i=this.resolve(e),s=this.resolve(t),o=n?0:i.sharedDepth(t),l=i.start(o),c=i.node(o).content.cut(i.pos-l,s.pos-l);return new S(c,i.depth-o,s.depth-o)}replace(e,t,n){return Zs(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let i=this.content.child(t-1);return{node:i,index:t-1,offset:n-i.nodeSize}}resolve(e){return yt.resolveCached(this,e)}resolveNoCache(e){return yt.resolve(this,e)}rangeHasMark(e,t,n){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(n.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Ni(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=k.empty,i=0,s=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<s;a++)if(!this.type.allowsMarks(n.child(a).marks))return!1;return!0}canReplaceWith(e,t,n,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(n),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=I.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!I.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let i=k.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,n)}};Be.prototype.text=void 0;class Ft extends Be{constructor(e,t,n,i){if(super(e,t,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Ni(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ft(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ft(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Ni(r,e){for(let t=r.length-1;t>=0;t--)e=r[t].type.name+"("+e+")";return e}class Ve{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new no(e,t);if(n.next==null)return Ve.empty;let i=Ti(n);n.next&&n.err("Unexpected trailing text");let s=co(ao(i));return uo(s,n),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let i=this;for(let s=t;i&&s<n;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let i=[this];function s(o,l){let a=o.matchFragment(e,n);if(a&&(!t||a.validEnd))return k.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:d,next:u}=o.next[c];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let f=s(u,l.concat(d));if(f)return f}}return null}return s(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let i=n.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:a}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||a.validEnd)&&(n.push({match:l.contentMatch,type:l,via:i}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let i=0;i<n.next.length;i++)e.indexOf(n.next[i].next)==-1&&t(n.next[i].next)}return t(this),e.map((n,i)=>{let s=i+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)s+=(o?", ":"")+n.next[o].type.name+"->"+e.indexOf(n.next[o].next);return s}).join(`
|
|
2
2
|
`)}}Ve.empty=new Ve(!0);class no{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Ti(r){let e=[];do e.push(ro(r));while(r.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function ro(r){let e=[];do e.push(io(r));while(r.next&&r.next!=")"&&r.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function io(r){let e=lo(r);for(;;)if(r.eat("+"))e={type:"plus",expr:e};else if(r.eat("*"))e={type:"star",expr:e};else if(r.eat("?"))e={type:"opt",expr:e};else if(r.eat("{"))e=so(r,e);else break;return e}function dr(r){/\D/.test(r.next)&&r.err("Expected number, got '"+r.next+"'");let e=Number(r.next);return r.pos++,e}function so(r,e){let t=dr(r),n=t;return r.eat(",")&&(r.next!="}"?n=dr(r):n=-1),r.eat("}")||r.err("Unclosed braced range"),{type:"range",min:t,max:n,expr:e}}function oo(r,e){let t=r.nodeTypes,n=t[e];if(n)return[n];let i=[];for(let s in t){let o=t[s];o.groups.indexOf(e)>-1&&i.push(o)}return i.length==0&&r.err("No node type or group '"+e+"' found"),i}function lo(r){if(r.eat("(")){let e=Ti(r);return r.eat(")")||r.err("Missing closing paren"),e}else if(/\W/.test(r.next))r.err("Unexpected token '"+r.next+"'");else{let e=oo(r,r.next).map(t=>(r.inline==null?r.inline=t.isInline:r.inline!=t.isInline&&r.err("Mixing inline and block content"),{type:"name",value:t}));return r.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function ao(r){let e=[[]];return i(s(r,0),t()),e;function t(){return e.push([])-1}function n(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;i(c,l=t())}else if(o.type=="star"){let a=t();return n(l,a),i(s(o.expr,a),a),[n(a)]}else if(o.type=="plus"){let a=t();return i(s(o.expr,l),a),i(s(o.expr,a),a),[n(a)]}else{if(o.type=="opt")return[n(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let d=t();i(s(o.expr,a),d),a=d}if(o.max==-1)i(s(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let d=t();n(a,d),i(s(o.expr,a),d),a=d}return[n(a)]}else{if(o.type=="name")return[n(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Di(r,e){return e-r}function ur(r,e){let t=[];return n(e),t.sort(Di);function n(i){let s=r[i];if(s.length==1&&!s[0].term)return n(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:l,to:a}=s[o];!l&&t.indexOf(a)==-1&&n(a)}}}function co(r){let e=Object.create(null);return t(ur(r,0));function t(n){let i=[];n.forEach(o=>{r[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let d=0;d<i.length;d++)i[d][0]==l&&(c=i[d][1]);ur(r,a).forEach(d=>{c||i.push([l,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let s=e[n.join(",")]=new Ve(n.indexOf(r.length-1)>-1);for(let o=0;o<i.length;o++){let l=i[o][1].sort(Di);s.next.push({type:i[o][0],next:e[l.join(",")]||t(l)})}return s}}function uo(r,e){for(let t=0,n=[r];t<n.length;t++){let i=n[t],s=!i.validEnd,o=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];o.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),n.indexOf(c)==-1&&n.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function vi(r){let e=Object.create(null);for(let t in r){let n=r[t];if(!n.hasDefault)return null;e[t]=n.default}return e}function Ai(r,e){let t=Object.create(null);for(let n in r){let i=e&&e[n];if(i===void 0){let s=r[n];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+n)}t[n]=i}return t}function Ii(r){let e=Object.create(null);if(r)for(let t in r)e[t]=new fo(r[t]);return e}let fr=class Pi{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=Ii(n.attrs),this.defaultAttrs=vi(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Ve.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Ai(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Be(this,this.computeAttrs(e),k.from(t),I.setFrom(n))}createChecked(e=null,t,n){return t=k.from(t),this.checkContent(t),new Be(this,this.computeAttrs(e),t,I.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=k.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(k.empty,!0);return s?new Be(this,e,t.append(s),I.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:I.none:e}static compile(e,t){let n=Object.create(null);e.forEach((s,o)=>n[s]=new Pi(s,t,o));let i=t.spec.topNode||"doc";if(!n[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let s in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};class fo{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class _t{constructor(e,t,n,i){this.name=e,this.rank=t,this.schema=n,this.spec=i,this.attrs=Ii(i.attrs),this.excluded=null;let s=vi(this.attrs);this.instance=s?new I(this,s):null}create(e=null){return!e&&this.instance?this.instance:new I(this,Ai(this.attrs,e))}static compile(e,t){let n=Object.create(null),i=0;return e.forEach((s,o)=>n[s]=new _t(s,i++,t,o)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}excludes(e){return this.excluded.indexOf(e)>-1}}class ho{constructor(e){this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=j.from(e.nodes),t.marks=j.from(e.marks||{}),this.nodes=fr.compile(this.spec.nodes,this),this.marks=_t.compile(this.spec.marks,this);let n=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",l=s.spec.marks;s.contentMatch=n[o]||(n[o]=Ve.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.markSet=l=="_"?null:l?hr(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:hr(this,o.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof fr){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,n,i)}text(e,t){let n=this.nodes.text;return new Ft(n,n.defaultAttrs,e,I.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return Be.fromJSON(this,e)}markFromJSON(e){return I.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function hr(r,e){let t=[];for(let n=0;n<e.length;n++){let i=e[n],s=r.marks[i],o=s;if(s)t.push(s);else for(let l in r.marks){let a=r.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[n]+"'")}return t}class Xe{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach(n=>{n.tag?this.tags.push(n):n.style&&this.styles.push(n)}),this.normalizeLists=!this.tags.some(n=>{if(!/^(ul|ol)\b/.test(n.tag)||!n.node)return!1;let i=e.nodes[n.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let n=new mr(this,t,!1);return n.addAll(e,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new mr(this,t,!0);return n.addAll(e,t.from,t.to),S.maxOpen(n.finish())}matchTag(e,t,n){for(let i=n?this.tags.indexOf(n)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(go(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,n,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!n.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function n(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{n(o=gr(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{n(o=gr(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Xe(e,Xe.schemaRules(e)))}}const Ri={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},po={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Bi={ol:!0,ul:!0},zt=1,Vt=2,ht=4;function pr(r,e,t){return e!=null?(e?zt:0)|(e==="full"?Vt:0):r&&r.whitespace=="pre"?zt|Vt:t&~ht}class Nt{constructor(e,t,n,i,s,o,l){this.type=e,this.attrs=t,this.marks=n,this.pendingMarks=i,this.solid=s,this.options=l,this.content=[],this.activeMarks=I.none,this.stashMarks=[],this.match=o||(l&ht?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(k.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let n=this.type.contentMatch,i;return(i=n.findWrapping(e.type))?(this.match=n,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&zt)){let n=this.content[this.content.length-1],i;if(n&&n.isText&&(i=/[ \t\r\n\u000c]+$/.exec(n.text))){let s=n;n.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=k.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(k.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,n=this.pendingMarks;t<n.length;t++){let i=n[t];(this.type?this.type.allowsMarkType(i.type):bo(i.type,e))&&!i.isInSet(this.activeMarks)&&(this.activeMarks=i.addToSet(this.activeMarks),this.pendingMarks=i.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Ri.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class mr{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0;let i=t.topNode,s,o=pr(null,t.preserveWhitespace,0)|(n?ht:0);i?s=new Nt(i.type,i.attrs,I.none,I.none,!0,t.topMatch||i.type.contentMatch,o):n?s=new Nt(null,null,I.none,I.none,!0,null,o):s=new Nt(e.schema.topNodeType,null,I.none,I.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){if(e.nodeType==3)this.addTextNode(e);else if(e.nodeType==1){let t=e.getAttribute("style");if(!t)this.addElement(e);else{let n=this.readStyles(yo(t));if(!n)return;let[i,s]=n,o=this.top;for(let l=0;l<s.length;l++)this.removePendingMark(s[l],o);for(let l=0;l<i.length;l++)this.addPendingMark(i[l]);this.addElement(e);for(let l=0;l<i.length;l++)this.removePendingMark(i[l],o);for(let l=0;l<s.length;l++)this.addPendingMark(s[l])}}}addTextNode(e){let t=e.nodeValue,n=this.top;if(n.options&Vt||n.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(n.options&zt)n.options&Vt?t=t.replace(/\r\n?/g,`
|
|
3
3
|
`):t=t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){let i=n.content[n.content.length-1],s=e.previousSibling;(!i||s&&s.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}addElement(e,t){let n=e.nodeName.toLowerCase(),i;Bi.hasOwnProperty(n)&&this.parser.normalizeLists&&mo(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,t));if(s?s.ignore:po.hasOwnProperty(n))this.findInside(e),this.ignoreFallback(e);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let o,l=this.top,a=this.needsBlock;if(Ri.hasOwnProperty(n))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),o=!0,l.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e);return}this.addAll(e),o&&this.sync(l),this.needsBlock=a}else this.addElementByRule(e,s,s.consuming===!1?i:void 0)}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
4
|
`))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=I.none,n=I.none;e:for(let i=0;i<e.length;i+=2)for(let s=void 0;;){let o=this.parser.matchStyle(e[i],e[i+1],this,s);if(!o)continue e;if(o.ignore)return null;if(o.clearMark?this.top.pendingMarks.forEach(l=>{o.clearMark(l)&&(n=l.addToSet(n))}):t=this.parser.schema.marks[o.mark].create(o.attrs).addToSet(t),o.consuming===!1)s=o;else break}return[t,n]}addElementByRule(e,t,n){let i,s,o;t.node?(s=this.parser.schema.nodes[t.node],s.isLeaf?this.insertNode(s.create(t.attrs))||this.leafFallback(e):i=this.enter(s,t.attrs||null,t.preserveWhitespace)):(o=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(o));let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(n)this.addElement(e,n);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a)}i&&this.sync(l)&&this.open--,o&&this.removePendingMark(o,l)}addAll(e,t,n){let i=t||0;for(let s=t?e.childNodes[t]:e.firstChild,o=n==null?null:e.childNodes[n];s!=o;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s);this.findAtPoint(e,i)}findPlace(e){let t,n;for(let i=this.open;i>=0;i--){let s=this.nodes[i],o=s.findWrapping(e);if(o&&(!t||t.length>o.length)&&(t=o,n=s,!o.length)||s.solid)break}if(!t)return!1;this.sync(n);for(let i=0;i<t.length;i++)this.enterInner(t[i],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&this.enterInner(t)}if(this.findPlace(e)){this.closeExtra();let t=this.top;t.applyPending(e.type),t.match&&(t.match=t.match.matchType(e.type));let n=t.activeMarks;for(let i=0;i<e.marks.length;i++)(!t.type||t.type.allowsMarkType(e.marks[i].type))&&(n=e.marks[i].addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n){let i=this.findPlace(e.create(t));return i&&this.enterInner(e,t,!0,n),i}enterInner(e,t=null,n=!1,i){this.closeExtra();let s=this.top;s.applyPending(e),s.match=s.match&&s.match.matchType(e);let o=pr(e,i,s.options);s.options&ht&&s.content.length==0&&(o|=ht),this.nodes.push(new Nt(e,t,s.activeMarks,s.pendingMarks,n,null,o)),this.open++}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let i=n.length-1;i>=0;i--)e+=n[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(n?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,i=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),s=-(n?n.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let d=a>0||a==0&&i?this.nodes[a].type:n&&a>=s?n.node(a-s).type:null;if(!d||d.name!=c&&d.groups.indexOf(c)==-1)return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let n=this.parser.schema.nodes[t];if(n.isTextblock&&n.defaultAttrs)return n}}addPendingMark(e){let t=ko(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let n=this.open;n>=0;n--){let i=this.nodes[n];if(i.pendingMarks.lastIndexOf(e)>-1)i.pendingMarks=e.removeFromSet(i.pendingMarks);else{i.activeMarks=e.removeFromSet(i.activeMarks);let o=i.popFromStashMark(e);o&&i.type&&i.type.allowsMarkType(o.type)&&(i.activeMarks=o.addToSet(i.activeMarks))}if(i==t)break}}}function mo(r){for(let e=r.firstChild,t=null;e;e=e.nextSibling){let n=e.nodeType==1?e.nodeName.toLowerCase():null;n&&Bi.hasOwnProperty(n)&&t?(t.appendChild(e),e=t):n=="li"?t=e:n&&(t=null)}}function go(r,e){return(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,e)}function yo(r){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,t,n=[];for(;t=e.exec(r);)n.push(t[1],t[2].trim());return n}function gr(r){let e={};for(let t in r)e[t]=r[t];return e}function bo(r,e){let t=e.schema.nodes;for(let n in t){let i=t[n];if(!i.allowsMarkType(r))continue;let s=[],o=l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:d}=l.edge(a);if(c==e||s.indexOf(d)<0&&o(d))return!0}};if(o(i.contentMatch))return!0}}function ko(r,e){for(let t=0;t<e.length;t++)if(r.eq(e[t]))return e[t]}class ce{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=cn(t).createDocumentFragment());let i=n,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let l=0,a=0;for(;l<s.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(s[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)i=s.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],d=this.serializeMark(c,o.isInline,t);d&&(s.push([c,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:i}=ce.renderSpec(cn(t),this.nodes[e.type.name](e));if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(n),n=s.dom)}return n}serializeMark(e,t,n={}){let i=this.marks[e.type.name];return i&&ce.renderSpec(cn(n),i(e,t))}static renderSpec(e,t,n=null){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],s=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));let o,l=n?e.createElementNS(n,i):e.createElement(i),a=t[1],c=1;if(a&&typeof a=="object"&&a.nodeType==null&&!Array.isArray(a)){c=2;for(let d in a)if(a[d]!=null){let u=d.indexOf(" ");u>0?l.setAttributeNS(d.slice(0,u),d.slice(u+1),a[d]):l.setAttribute(d,a[d])}}for(let d=c;d<t.length;d++){let u=t[d];if(u===0){if(d<t.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:h}=ce.renderSpec(e,u,n);if(l.appendChild(f),h){if(o)throw new RangeError("Multiple content holes");o=h}}}return{dom:l,contentDOM:o}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ce(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=yr(e.nodes);return t.text||(t.text=n=>n.text),t}static marksFromSchema(e){return yr(e.marks)}}function yr(r){let e={};for(let t in r){let n=r[t].spec.toDOM;n&&(e[t]=n)}return e}function cn(r){return r.document||window.document}const Fi=65535,zi=Math.pow(2,16);function So(r,e){return r+e*zi}function br(r){return r&Fi}function xo(r){return(r-(r&Fi))/zi}const Vi=1,Li=2,vt=4,ji=8;class vn{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&ji)>0}get deletedBefore(){return(this.delInfo&(Vi|vt))>0}get deletedAfter(){return(this.delInfo&(Li|vt))>0}get deletedAcross(){return(this.delInfo&vt)>0}}class ee{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&ee.empty)return ee.empty}recover(e){let t=0,n=br(e);if(!this.inverted)for(let i=0;i<n;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[n*3]+t+xo(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let c=this.ranges[l+s],d=this.ranges[l+o],u=a+c;if(e<=u){let f=c?e==a?-1:e==u?1:t:t,h=a+i+(f<0?0:d);if(n)return h;let p=e==(t<0?a:u)?null:So(l/3,e-a),m=e==a?Li:e==u?Vi:vt;return(t<0?e!=a:e!=u)&&(m|=ji),new vn(h,m,p)}i+=d-c}return n?e+i:new vn(e+i,0,null)}touches(e,t){let n=0,i=br(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?n:0);if(a>e)break;let c=this.ranges[l+s],d=a+c;if(e<=d&&l==i*3)return!0;n+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],l=o-(this.inverted?s:0),a=o+(this.inverted?0:s),c=this.ranges[i+t],d=this.ranges[i+n];e(l,l+c,a,a+d),s+=d-c}}invert(){return new ee(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?ee.empty:new ee(e<0?[0,-e,0]:[0,0,e])}}ee.empty=new ee([]);class pt{constructor(e=[],t,n=0,i=e.length){this.maps=e,this.mirror=t,this.from=n,this.to=i}slice(e=0,t=this.maps.length){return new pt(this.maps,this.mirror,e,t)}copy(){return new pt(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,n=this.maps.length;t<e.maps.length;t++){let i=e.getMirror(t);this.appendMap(e.maps[t],i!=null&&i<t?n+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this.maps.length+e.maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?n-i-1:void 0)}}invert(){let e=new pt;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this.maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let i=0;for(let s=this.from;s<this.to;s++){let o=this.maps[s],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(s);if(a!=null&&a>s&&a<this.to){s=a,e=this.maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return n?e:new vn(e,i,null)}}const dn=Object.create(null);class G{getMap(){return ee.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=dn[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in dn)throw new RangeError("Duplicate use of step JSON ID "+e);return dn[e]=t,t.prototype.jsonID=e,t}}class z{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new z(e,null)}static fail(e){return new z(null,e)}static fromReplace(e,t,n,i){try{return z.ok(e.replace(t,n,i))}catch(s){if(s instanceof Pt)return z.fail(s.message);throw s}}}function Kn(r,e,t){let n=[];for(let i=0;i<r.childCount;i++){let s=r.child(i);s.content.size&&(s=s.copy(Kn(s.content,e,s))),s.isInline&&(s=e(s,t,i)),n.push(s)}return k.fromArray(n)}class Se extends G{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),i=n.node(n.sharedDepth(this.to)),s=new S(Kn(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return z.fromReplace(e,this.from,this.to,s)}invert(){return new de(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Se(t.pos,n.pos,this.mark)}merge(e){return e instanceof Se&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Se(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Se(t.from,t.to,e.markFromJSON(t.mark))}}G.jsonID("addMark",Se);class de extends G{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new S(Kn(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return z.fromReplace(e,this.from,this.to,n)}invert(){return new Se(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new de(t.pos,n.pos,this.mark)}merge(e){return e instanceof de&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new de(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new de(t.from,t.to,e.markFromJSON(t.mark))}}G.jsonID("removeMark",de);class xe extends G{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return z.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return z.fromReplace(e,this.pos,this.pos+1,new S(k.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let n=this.mark.addToSet(t.marks);if(n.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(n))return new xe(this.pos,t.marks[i]);return new xe(this.pos,this.mark)}}return new Ze(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new xe(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new xe(t.pos,e.markFromJSON(t.mark))}}G.jsonID("addNodeMark",xe);class Ze extends G{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return z.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return z.fromReplace(e,this.pos,this.pos+1,new S(k.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new xe(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ze(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Ze(t.pos,e.markFromJSON(t.mark))}}G.jsonID("removeNodeMark",Ze);class q extends G{constructor(e,t,n,i=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=i}apply(e){return this.structure&&An(e,this.from,this.to)?z.fail("Structure replace would overwrite content"):z.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ee([this.from,this.to-this.from,this.slice.size])}invert(e){return new q(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new q(t.pos,Math.max(t.pos,n.pos),this.slice)}merge(e){if(!(e instanceof q)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?S.empty:new S(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new q(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?S.empty:new S(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new q(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new q(t.from,t.to,S.fromJSON(e,t.slice),!!t.structure)}}G.jsonID("replace",q);class V extends G{constructor(e,t,n,i,s,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=i,this.slice=s,this.insert=o,this.structure=l}apply(e){if(this.structure&&(An(e,this.from,this.gapFrom)||An(e,this.gapTo,this.to)))return z.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return z.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?z.fromReplace(e,this.from,this.to,n):z.fail("Content does not fit in gap")}getMap(){return new ee([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new V(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),i=e.map(this.gapFrom,-1),s=e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||i<t.pos||s>n.pos?null:new V(t.pos,n.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new V(t.from,t.to,t.gapFrom,t.gapTo,S.fromJSON(e,t.slice),t.insert,!!t.structure)}}G.jsonID("replaceAround",V);function An(r,e,t){let n=r.resolve(e),i=t-e,s=n.depth;for(;i>0&&s>0&&n.indexAfter(s)==n.node(s).childCount;)s--,i--;if(i>0){let o=n.node(s).maybeChild(n.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function Co(r,e,t,n){let i=[],s=[],o,l;r.doc.nodesBetween(e,t,(a,c,d)=>{if(!a.isInline)return;let u=a.marks;if(!n.isInSet(u)&&d.type.allowsMarkType(n.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,t),p=n.addToSet(u);for(let m=0;m<u.length;m++)u[m].isInSet(p)||(o&&o.to==f&&o.mark.eq(u[m])?o.to=h:i.push(o=new de(f,h,u[m])));l&&l.to==f?l.to=h:s.push(l=new Se(f,h,n))}}),i.forEach(a=>r.step(a)),s.forEach(a=>r.step(a))}function Mo(r,e,t,n){let i=[],s=0;r.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(n instanceof _t){let c=o.marks,d;for(;d=n.isInSet(c);)(a||(a=[])).push(d),c=d.removeFromSet(c)}else n?n.isInSet(o.marks)&&(a=[n]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let d=0;d<a.length;d++){let u=a[d],f;for(let h=0;h<i.length;h++){let p=i[h];p.step==s-1&&u.eq(i[h].style)&&(f=p)}f?(f.to=c,f.step=s):i.push({style:u,from:Math.max(l,e),to:c,step:s})}}}),i.forEach(o=>r.step(new de(o.from,o.to,o.style)))}function wo(r,e,t,n=t.contentMatch){let i=r.doc.nodeAt(e),s=[],o=e+1;for(let l=0;l<i.childCount;l++){let a=i.child(l),c=o+a.nodeSize,d=n.matchType(a.type);if(!d)s.push(new q(o,c,S.empty));else{n=d;for(let u=0;u<a.marks.length;u++)t.allowsMarkType(a.marks[u].type)||r.step(new de(o,c,a.marks[u]))}o=c}if(!n.validEnd){let l=n.fillBefore(k.empty,!0);r.replace(o,o,new S(l,0,0))}for(let l=s.length-1;l>=0;l--)r.step(s[l])}function Oo(r,e,t){return(e==0||r.canReplace(e,r.childCount))&&(t==r.childCount||r.canReplace(0,t))}function rt(r){let t=r.parent.content.cutByIndex(r.startIndex,r.endIndex);for(let n=r.depth;;--n){let i=r.$from.node(n),s=r.$from.index(n),o=r.$to.indexAfter(n);if(n<r.depth&&i.canReplace(s,o,t))return n;if(n==0||i.type.spec.isolating||!Oo(i,s,o))break}return null}function Eo(r,e,t){let{$from:n,$to:i,depth:s}=e,o=n.before(s+1),l=i.after(s+1),a=o,c=l,d=k.empty,u=0;for(let p=s,m=!1;p>t;p--)m||n.index(p)>0?(m=!0,d=k.from(n.node(p).copy(d)),u++):a--;let f=k.empty,h=0;for(let p=s,m=!1;p>t;p--)m||i.after(p+1)<i.end(p)?(m=!0,f=k.from(i.node(p).copy(f)),h++):c++;r.step(new V(a,c,o,l,new S(d.append(f),u,h),d.size-u,!0))}function Hi(r,e,t=null,n=r){let i=No(r,e),s=i&&To(n,e);return s?i.map(kr).concat({type:e,attrs:t}).concat(s.map(kr)):null}function kr(r){return{type:r,attrs:null}}function No(r,e){let{parent:t,startIndex:n,endIndex:i}=r,s=t.contentMatchAt(n).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(n,i,o)?s:null}function To(r,e){let{parent:t,startIndex:n,endIndex:i}=r,s=t.child(n),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=n;a&&c<i;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:o}function Do(r,e,t){let n=k.empty;for(let o=t.length-1;o>=0;o--){if(n.size){let l=t[o].type.contentMatch.matchFragment(n);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=k.from(t[o].type.create(t[o].attrs,n))}let i=e.start,s=e.end;r.step(new V(i,s,i,s,new S(n,0,0),t.length,!0))}function vo(r,e,t,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=r.steps.length;r.doc.nodesBetween(e,t,(o,l)=>{if(o.isTextblock&&!o.hasMarkup(n,i)&&Ao(r.doc,r.mapping.slice(s).map(l),n)){r.clearIncompatible(r.mapping.slice(s).map(l,1),n);let a=r.mapping.slice(s),c=a.map(l,1),d=a.map(l+o.nodeSize,1);return r.step(new V(c,d,c+1,d-1,new S(k.from(n.create(i,null,o.marks)),0,0),1,!0)),!1}})}function Ao(r,e,t){let n=r.resolve(e),i=n.index();return n.parent.canReplaceWith(i,i+1,t)}function Io(r,e,t,n,i){let s=r.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(n,null,i||s.marks);if(s.isLeaf)return r.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);r.step(new V(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new S(k.from(o),0,0),1,!0))}function Ue(r,e,t=1,n){let i=r.resolve(e),s=i.depth-t,o=n&&n[n.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,d=t-2;c>s;c--,d--){let u=i.node(c),f=i.index(c);if(u.type.spec.isolating)return!1;let h=u.content.cutByIndex(f,u.childCount),p=n&&n[d]||u;if(p!=u&&(h=h.replaceChild(0,p.type.create(p.attrs))),!u.canReplace(f+1,u.childCount)||!p.type.validContent(h))return!1}let l=i.indexAfter(s),a=n&&n[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function Po(r,e,t=1,n){let i=r.doc.resolve(e),s=k.empty,o=k.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){s=k.from(i.node(l).copy(s));let d=n&&n[c];o=k.from(d?d.type.create(d.attrs,o):i.node(l).copy(o))}r.step(new q(e,e,new S(s.append(o),t,t),!0))}function He(r,e){let t=r.resolve(e),n=t.index();return $i(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(n,n+1)}function $i(r,e){return!!(r&&e&&!r.isLeaf&&r.canAppend(e))}function qi(r,e,t=-1){let n=r.resolve(e);for(let i=n.depth;;i--){let s,o,l=n.index(i);if(i==n.depth?(s=n.nodeBefore,o=n.nodeAfter):t>0?(s=n.node(i+1),l++,o=n.node(i).maybeChild(l)):(s=n.node(i).maybeChild(l-1),o=n.node(i+1)),s&&!s.isTextblock&&$i(s,o)&&n.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?n.before(i):n.after(i)}}function Ro(r,e,t){let n=new q(e-t,e+t,S.empty,!0);r.step(n)}function Bo(r,e,t){let n=r.resolve(e);if(n.parent.canReplaceWith(n.index(),n.index(),t))return e;if(n.parentOffset==0)for(let i=n.depth-1;i>=0;i--){let s=n.index(i);if(n.node(i).canReplaceWith(s,s,t))return n.before(i+1);if(s>0)return null}if(n.parentOffset==n.parent.content.size)for(let i=n.depth-1;i>=0;i--){let s=n.indexAfter(i);if(n.node(i).canReplaceWith(s,s,t))return n.after(i+1);if(s<n.node(i).childCount)return null}return null}function Fo(r,e,t){let n=r.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=n.depth;o>=0;o--){let l=o==n.depth?0:n.pos<=(n.start(o+1)+n.end(o+1))/2?-1:1,a=n.index(o)+(l>0?1:0),c=n.node(o),d=!1;if(s==1)d=c.canReplace(a,a,i);else{let u=c.contentMatchAt(a).findWrapping(i.firstChild.type);d=u&&c.canReplaceWith(a,a,u[0])}if(d)return l==0?n.pos:l<0?n.before(o+1):n.after(o+1)}return null}function Jn(r,e,t=e,n=S.empty){if(e==t&&!n.size)return null;let i=r.resolve(e),s=r.resolve(t);return Wi(i,s,n)?new q(e,t,n):new zo(i,s,n).fit()}function Wi(r,e,t){return!t.openStart&&!t.openEnd&&r.start()==e.start()&&r.parent.canReplace(r.index(),e.index(),t.content)}class zo{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=k.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=k.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,i=this.close(e<0?this.$to:n.doc.resolve(e));if(!i)return null;let s=this.placed,o=n.depth,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new S(s,o,l);return e>-1?new V(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new q(n.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,i=this.unplaced.openEnd;n<e;n++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=n){e=n;break}t=s.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let i,s=null;n?(s=un(this.unplaced.content,n-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],d,u=null;if(t==1&&(o?c.matchType(o.type)||(u=c.fillBefore(k.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:n,frontierDepth:l,parent:s,inject:u};if(t==2&&o&&(d=c.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:l,parent:s,wrap:d};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=un(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new S(e,t+1,Math.max(n,i.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=un(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new S(ct(e,t-1,1),t-1,s?t-1:n)}else this.unplaced=new S(ct(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,l=n?n.content:o.content,a=o.openStart-e,c=0,d=[],{match:u,type:f}=this.frontier[t];if(i){for(let m=0;m<i.childCount;m++)d.push(i.child(m));u=u.matchFragment(i)}let h=l.size+e-(o.content.size-o.openEnd);for(;c<l.childCount;){let m=l.child(c),g=u.matchType(m.type);if(!g)break;c++,(c>1||a==0||m.content.size)&&(u=g,d.push(_i(m.mark(f.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=dt(this.placed,t,k.from(d)),this.frontier[t].match=u,p&&h<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m<h;m++){let b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=p?e==0?S.empty:new S(ct(o.content,e-1,1),e-1,h<0?o.openEnd:e-1):new S(ct(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!fn(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;let{depth:n}=this.$to,i=this.$to.after(n);for(;n>1&&i==this.$to.end(--n);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:i}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=fn(e,t,i,n,s);if(o){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],d=fn(e,l,c,a,!0);if(!d||d.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=dt(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let i=e.node(n),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(n));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,n){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=dt(this.placed,this.depth,k.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(k.empty,!0);t.childCount&&(this.placed=dt(this.placed,this.frontier.length,t))}}function ct(r,e,t){return e==0?r.cutByIndex(t,r.childCount):r.replaceChild(0,r.firstChild.copy(ct(r.firstChild.content,e-1,t)))}function dt(r,e,t){return e==0?r.append(t):r.replaceChild(r.childCount-1,r.lastChild.copy(dt(r.lastChild.content,e-1,t)))}function un(r,e){for(let t=0;t<e;t++)r=r.firstChild.content;return r}function _i(r,e,t){if(e<=0)return r;let n=r.content;return e>1&&(n=n.replaceChild(0,_i(n.firstChild,e-1,n.childCount==1?t-1:0))),e>0&&(n=r.type.contentMatch.fillBefore(n).append(n),t<=0&&(n=n.append(r.type.contentMatch.matchFragment(n).fillBefore(k.empty,!0)))),r.copy(n)}function fn(r,e,t,n,i){let s=r.node(e),o=i?r.indexAfter(e):r.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let l=n.fillBefore(s.content,!0,o);return l&&!Vo(t,s.content,o)?l:null}function Vo(r,e,t){for(let n=t;n<e.childCount;n++)if(!r.allowsMarks(e.child(n).marks))return!0;return!1}function Lo(r){return r.spec.defining||r.spec.definingForContent}function jo(r,e,t,n){if(!n.size)return r.deleteRange(e,t);let i=r.doc.resolve(e),s=r.doc.resolve(t);if(Wi(i,s,n))return r.step(new q(e,t,n));let o=Ji(i,r.doc.resolve(t));o[o.length-1]==0&&o.pop();let l=-(i.depth+1);o.unshift(l);for(let f=i.depth,h=i.pos-1;f>0;f--,h--){let p=i.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(f)>-1?l=f:i.before(f)==h&&o.splice(1,0,-f)}let a=o.indexOf(l),c=[],d=n.openStart;for(let f=n.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==n.openStart)break;f=p.content}for(let f=d-1;f>=0;f--){let h=c[f].type,p=Lo(h);if(p&&i.node(a).type!=h)d=f;else if(p||!h.isTextblock)break}for(let f=n.openStart;f>=0;f--){let h=(f+d+1)%(n.openStart+1),p=c[h];if(p)for(let m=0;m<o.length;m++){let g=o[(m+a)%o.length],b=!0;g<0&&(b=!1,g=-g);let M=i.node(g-1),O=i.index(g-1);if(M.canReplaceWith(O,O,p.type,p.marks))return r.replace(i.before(g),b?s.after(g):t,new S(Ki(n.content,0,n.openStart,h),h,n.openEnd))}}let u=r.steps.length;for(let f=o.length-1;f>=0&&(r.replace(e,t,n),!(r.steps.length>u));f--){let h=o[f];h<0||(e=i.before(h),t=s.after(h))}}function Ki(r,e,t,n,i){if(e<t){let s=r.firstChild;r=r.replaceChild(0,s.copy(Ki(s.content,e+1,t,n,s)))}if(e>n){let s=i.contentMatchAt(0),o=s.fillBefore(r).append(r);r=o.append(s.matchFragment(o).fillBefore(k.empty,!0))}return r}function Ho(r,e,t,n){if(!n.isInline&&e==t&&r.doc.resolve(e).parent.content.size){let i=Bo(r.doc,e,n.type);i!=null&&(e=t=i)}r.replaceRange(e,t,new S(k.from(n),0,0))}function $o(r,e,t){let n=r.doc.resolve(e),i=r.doc.resolve(t),s=Ji(n,i);for(let o=0;o<s.length;o++){let l=s[o],a=o==s.length-1;if(a&&l==0||n.node(l).type.contentMatch.validEnd)return r.delete(n.start(l),i.end(l));if(l>0&&(a||n.node(l-1).canReplace(n.index(l-1),i.indexAfter(l-1))))return r.delete(n.before(l),i.after(l))}for(let o=1;o<=n.depth&&o<=i.depth;o++)if(e-n.start(o)==n.depth-o&&t>n.end(o)&&i.end(o)-t!=i.depth-o)return r.delete(n.before(o),t);r.delete(e,t)}function Ji(r,e){let t=[],n=Math.min(r.depth,e.depth);for(let i=n;i>=0;i--){let s=r.start(i);if(s<r.pos-(r.depth-i)||e.end(i)>e.pos+(e.depth-i)||r.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==r.depth&&i==e.depth&&r.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class Ge extends G{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return z.fail("No node at attribute step's position");let n=Object.create(null);for(let s in t.attrs)n[s]=t.attrs[s];n[this.attr]=this.value;let i=t.type.create(n,null,t.marks);return z.fromReplace(e,this.pos,this.pos+1,new S(k.from(i),0,t.isLeaf?0:1))}getMap(){return ee.empty}invert(e){return new Ge(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ge(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ge(t.pos,t.attr,t.value)}}G.jsonID("attr",Ge);let Qe=class extends Error{};Qe=function r(e){let t=Error.call(this,e);return t.__proto__=r.prototype,t};Qe.prototype=Object.create(Error.prototype);Qe.prototype.constructor=Qe;Qe.prototype.name="TransformError";class Ui{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new pt}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Qe(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=S.empty){let i=Jn(this.doc,e,t,n);return i&&this.step(i),this}replaceWith(e,t,n){return this.replace(e,t,new S(k.from(n),0,0))}delete(e,t){return this.replace(e,t,S.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return jo(this,e,t,n),this}replaceRangeWith(e,t,n){return Ho(this,e,t,n),this}deleteRange(e,t){return $o(this,e,t),this}lift(e,t){return Eo(this,e,t),this}join(e,t=1){return Ro(this,e,t),this}wrap(e,t){return Do(this,e,t),this}setBlockType(e,t=e,n,i=null){return vo(this,e,t,n,i),this}setNodeMarkup(e,t,n=null,i){return Io(this,e,t,n,i),this}setNodeAttribute(e,t,n){return this.step(new Ge(e,t,n)),this}addNodeMark(e,t){return this.step(new xe(e,t)),this}removeNodeMark(e,t){if(!(t instanceof I)){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t=t.isInSet(n.marks),!t)return this}return this.step(new Ze(e,t)),this}split(e,t=1,n){return Po(this,e,t,n),this}addMark(e,t,n){return Co(this,e,t,n),this}removeMark(e,t,n){return Mo(this,e,t,n),this}clearIncompatible(e,t,n){return wo(this,e,t,n),this}}const hn=Object.create(null);class N{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new qo(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=S.empty){let n=t.content.lastChild,i=null;for(let l=0;l<t.openEnd;l++)i=n,n=n.lastChild;let s=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:c}=o[l],d=e.mapping.slice(s);e.replaceRange(d.map(a.pos),d.map(c.pos),l?S.empty:t),l==0&&Cr(e,s,(n?n.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:l}=i[s],a=e.mapping.slice(n),c=a.map(o.pos),d=a.map(l.pos);s?e.deleteRange(c,d):(e.replaceRangeWith(c,d,t),Cr(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let i=e.parent.inlineContent?new D(e):We(e.node(0),e.parent,e.pos,e.index(),t,n);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=t<0?We(e.node(0),e.node(s),e.before(s+1),e.index(s),t,n):We(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,n);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new se(e.node(0))}static atStart(e){return We(e,e,0,0,1)||new se(e)}static atEnd(e){return We(e,e,e.content.size,e.childCount,-1)||new se(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=hn[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in hn)throw new RangeError("Duplicate use of selection JSON ID "+e);return hn[e]=t,t.prototype.jsonID=e,t}getBookmark(){return D.between(this.$anchor,this.$head).getBookmark()}}N.prototype.visible=!0;class qo{constructor(e,t){this.$from=e,this.$to=t}}let Sr=!1;function xr(r){!Sr&&!r.parent.inlineContent&&(Sr=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+r.parent.type.name+")"))}class D extends N{constructor(e,t=e){xr(e),xr(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return N.near(n);let i=e.resolve(t.map(this.anchor));return new D(i.parent.inlineContent?i:n,n)}replace(e,t=S.empty){if(super.replace(e,t),t==S.empty){let n=this.$from.marksAcross(this.$to);n&&e.ensureMarks(n)}}eq(e){return e instanceof D&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Kt(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new D(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let i=e.resolve(t);return new this(i,n==t?i:e.resolve(n))}static between(e,t,n){let i=e.pos-t.pos;if((!n||i)&&(n=i>=0?1:-1),!t.parent.inlineContent){let s=N.findFrom(t,n,!0)||N.findFrom(t,-n,!0);if(s)t=s.$head;else return N.near(t,n)}return e.parent.inlineContent||(i==0?e=t:(e=(N.findFrom(e,-n,!0)||N.findFrom(e,n,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new D(e,t)}}N.jsonID("text",D);class Kt{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Kt(e.map(this.anchor),e.map(this.head))}resolve(e){return D.between(e.resolve(this.anchor),e.resolve(this.head))}}class w extends N{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:i}=t.mapResult(this.anchor),s=e.resolve(i);return n?N.near(s):new w(s)}content(){return new S(k.from(this.node),0,0)}eq(e){return e instanceof w&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Un(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new w(e.resolve(t.anchor))}static create(e,t){return new w(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}w.prototype.visible=!1;N.jsonID("node",w);class Un{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new Kt(n,n):new Un(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&w.isSelectable(n)?new w(t):N.near(t)}}class se extends N{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=S.empty){if(t==S.empty){e.delete(0,e.doc.content.size);let n=N.atStart(e.doc);n.eq(e.selection)||e.setSelection(n)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new se(e)}map(e){return new se(e)}eq(e){return e instanceof se}getBookmark(){return Wo}}N.jsonID("all",se);const Wo={map(){return this},resolve(r){return new se(r)}};function We(r,e,t,n,i,s=!1){if(e.inlineContent)return D.create(r,t);for(let o=n-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&w.isSelectable(l))return w.create(r,t-(i<0?l.nodeSize:0))}else{let a=We(r,l,t+i,i<0?l.childCount:0,i,s);if(a)return a}t+=l.nodeSize*i}return null}function Cr(r,e,t){let n=r.steps.length-1;if(n<e)return;let i=r.steps[n];if(!(i instanceof q||i instanceof V))return;let s=r.mapping.maps[n],o;s.forEach((l,a,c,d)=>{o==null&&(o=d)}),r.setSelection(N.near(r.doc.resolve(o),t))}const Mr=1,Tt=2,wr=4;class _o extends Ui{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){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}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Mr)&~Tt,this.storedMarks=null,this}get selectionSet(){return(this.updated&Mr)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Tt,this}ensureMarks(e){return I.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Tt)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Tt,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||I.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(n==null&&(n=t),n=n??t,!e)return this.deleteRange(t,n);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=n==t?o.marks():o.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,i.text(e,s)),this.selection.empty||this.setSelection(N.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=wr,this}get scrolledIntoView(){return(this.updated&wr)>0}}function Or(r,e){return!e||!r?r:r.bind(e)}class ut{constructor(e,t,n){this.name=e,this.init=Or(t.init,n),this.apply=Or(t.apply,n)}}const Ko=[new ut("doc",{init(r){return r.doc||r.schema.topNodeType.createAndFill()},apply(r){return r.doc}}),new ut("selection",{init(r,e){return r.selection||N.atStart(e.doc)},apply(r){return r.selection}}),new ut("storedMarks",{init(r){return r.storedMarks||null},apply(r,e,t,n){return n.selection.$cursor?r.storedMarks:null}}),new ut("scrollToSelection",{init(){return 0},apply(r,e){return r.scrolledIntoView?e+1:e}})];class pn{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Ko.slice(),t&&t.forEach(n=>{if(this.pluginsByKey[n.key])throw new RangeError("Adding different instances of a keyed plugin ("+n.key+")");this.plugins.push(n),this.pluginsByKey[n.key]=n,n.spec.state&&this.fields.push(new ut(n.key,n.spec.state,n))})}}class Ke{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let i=this.config.plugins[n];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let a=i?i[o].n:0,c=i?i[o].state:this,d=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,n);if(d&&n.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!i){i=[];for(let u=0;u<this.config.plugins.length;u++)i.push(u<o?{state:n,n:t.length}:{state:this,n:0})}t.push(d),n=n.applyInner(d),s=!0}i&&(i[o]={state:n,n:t.length})}}if(!s)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Ke(this.config),n=this.config.fields;for(let i=0;i<n.length;i++){let s=n[i];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new _o(this)}static create(e){let t=new pn(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new Ke(t);for(let i=0;i<t.fields.length;i++)n[t.fields[i].name]=t.fields[i].init(e,n);return n}reconfigure(e){let t=new pn(this.schema,e.plugins),n=t.fields,i=new Ke(t);for(let s=0;s<n.length;s++){let o=n[s].name;i[o]=this.hasOwnProperty(o)?this[o]:n[s].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(n=>n.toJSON())),e&&typeof e=="object")for(let n in e){if(n=="doc"||n=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[n],s=i.spec.state;s&&s.toJSON&&(t[n]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new pn(e.schema,e.plugins),s=new Ke(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Be.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=N.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let l in n){let a=n[l],c=a.spec.state;if(a.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){s[o.name]=c.fromJSON.call(a,e,t[l],s);return}}s[o.name]=o.init(e,s)}}),s}}function Gi(r,e,t){for(let n in r){let i=r[n];i instanceof Function?i=i.bind(e):n=="handleDOMEvents"&&(i=Gi(i,e,{})),t[n]=i}return t}class Y{constructor(e){this.spec=e,this.props={},e.props&&Gi(e.props,this,this.props),this.key=e.key?e.key.key:Yi("plugin")}getState(e){return e[this.key]}}const mn=Object.create(null);function Yi(r){return r in mn?r+"$"+ ++mn[r]:(mn[r]=0,r+"$")}class re{constructor(e="key"){this.key=Yi(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const X=function(r){for(var e=0;;e++)if(r=r.previousSibling,!r)return e},bt=function(r){let e=r.assignedSlot||r.parentNode;return e&&e.nodeType==11?e.host:e};let Er=null;const he=function(r,e,t){let n=Er||(Er=document.createRange());return n.setEnd(r,t??r.nodeValue.length),n.setStart(r,e||0),n},Le=function(r,e,t,n){return t&&(Nr(r,e,t,n,-1)||Nr(r,e,t,n,1))},Jo=/^(img|br|input|textarea|hr)$/i;function Nr(r,e,t,n,i){for(;;){if(r==t&&e==n)return!0;if(e==(i<0?0:ae(r))){let s=r.parentNode;if(!s||s.nodeType!=1||Go(r)||Jo.test(r.nodeName)||r.contentEditable=="false")return!1;e=X(r)+(i<0?0:1),r=s}else if(r.nodeType==1){if(r=r.childNodes[e+(i<0?-1:0)],r.contentEditable=="false")return!1;e=i<0?ae(r):0}else return!1}}function ae(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function Uo(r,e,t){for(let n=e==0,i=e==ae(r);n||i;){if(r==t)return!0;let s=X(r);if(r=r.parentNode,!r)return!1;n=n&&s==0,i=i&&s==ae(r)}}function Go(r){let e;for(let t=r;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==r||e.contentDOM==r)}const Jt=function(r){return r.focusNode&&Le(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)};function De(r,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=r,t.key=t.code=e,t}function Yo(r){let e=r.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Xo(r,e,t){if(r.caretPositionFromPoint)try{let n=r.caretPositionFromPoint(e,t);if(n)return{node:n.offsetNode,offset:n.offset}}catch{}if(r.caretRangeFromPoint){let n=r.caretRangeFromPoint(e,t);if(n)return{node:n.startContainer,offset:n.startOffset}}}const ue=typeof navigator<"u"?navigator:null,Tr=typeof document<"u"?document:null,Ne=ue&&ue.userAgent||"",In=/Edge\/(\d+)/.exec(Ne),Xi=/MSIE \d/.exec(Ne),Pn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ne),U=!!(Xi||Pn||In),Me=Xi?document.documentMode:Pn?+Pn[1]:In?+In[1]:0,oe=!U&&/gecko\/(\d+)/i.test(Ne);oe&&+(/Firefox\/(\d+)/.exec(Ne)||[0,0])[1];const Rn=!U&&/Chrome\/(\d+)/.exec(Ne),W=!!Rn,Zo=Rn?+Rn[1]:0,_=!U&&!!ue&&/Apple Computer/.test(ue.vendor),et=_&&(/Mobile\/\w+/.test(Ne)||!!ue&&ue.maxTouchPoints>2),Q=et||(ue?/Mac/.test(ue.platform):!1),Qo=ue?/Win/.test(ue.platform):!1,ie=/Android \d/.test(Ne),Ut=!!Tr&&"webkitFontSmoothing"in Tr.documentElement.style,el=Ut?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function tl(r){return{left:0,right:r.documentElement.clientWidth,top:0,bottom:r.documentElement.clientHeight}}function ye(r,e){return typeof r=="number"?r:r[e]}function nl(r){let e=r.getBoundingClientRect(),t=e.width/r.offsetWidth||1,n=e.height/r.offsetHeight||1;return{left:e.left,right:e.left+r.clientWidth*t,top:e.top,bottom:e.top+r.clientHeight*n}}function Dr(r,e,t){let n=r.someProp("scrollThreshold")||0,i=r.someProp("scrollMargin")||5,s=r.dom.ownerDocument;for(let o=t||r.dom;o;o=bt(o)){if(o.nodeType!=1)continue;let l=o,a=l==s.body,c=a?tl(s):nl(l),d=0,u=0;if(e.top<c.top+ye(n,"top")?u=-(c.top-e.top+ye(i,"top")):e.bottom>c.bottom-ye(n,"bottom")&&(u=e.bottom-c.bottom+ye(i,"bottom")),e.left<c.left+ye(n,"left")?d=-(c.left-e.left+ye(i,"left")):e.right>c.right-ye(n,"right")&&(d=e.right-c.right+ye(i,"right")),d||u)if(a)s.defaultView.scrollBy(d,u);else{let f=l.scrollLeft,h=l.scrollTop;u&&(l.scrollTop+=u),d&&(l.scrollLeft+=d);let p=l.scrollLeft-f,m=l.scrollTop-h;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}if(a)break}}function rl(r){let e=r.dom.getBoundingClientRect(),t=Math.max(0,e.top),n,i;for(let s=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=r.root.elementFromPoint(s,o);if(!l||l==r.dom||!r.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){n=l,i=a.top;break}}return{refDOM:n,refTop:i,stack:Zi(r.dom)}}function Zi(r){let e=[],t=r.ownerDocument;for(let n=r;n&&(e.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),r!=t);n=bt(n));return e}function il({refDOM:r,refTop:e,stack:t}){let n=r?r.getBoundingClientRect().top:0;Qi(t,n==0?0:n-e)}function Qi(r,e){for(let t=0;t<r.length;t++){let{dom:n,top:i,left:s}=r[t];n.scrollTop!=i+e&&(n.scrollTop=i+e),n.scrollLeft!=s&&(n.scrollLeft=s)}}let qe=null;function sl(r){if(r.setActive)return r.setActive();if(qe)return r.focus(qe);let e=Zi(r);r.focus(qe==null?{get preventScroll(){return qe={preventScroll:!0},!0}}:void 0),qe||(qe=!1,Qi(e,0))}function es(r,e){let t,n=2e8,i,s=0,o=e.top,l=e.top,a,c;for(let d=r.firstChild,u=0;d;d=d.nextSibling,u++){let f;if(d.nodeType==1)f=d.getClientRects();else if(d.nodeType==3)f=he(d).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=o&&p.bottom>=l){o=Math.max(p.bottom,o),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<n){t=d,n=m,i=m&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,d.nodeType==1&&m&&(s=u+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=d,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=u+1)}}return!t&&a&&(t=a,i=c,n=0),t&&t.nodeType==3?ol(t,i):!t||n&&t.nodeType==1?{node:r,offset:s}:es(t,i)}function ol(r,e){let t=r.nodeValue.length,n=document.createRange();for(let i=0;i<t;i++){n.setEnd(r,i+1),n.setStart(r,i);let s=be(n,1);if(s.top!=s.bottom&&Gn(e,s))return{node:r,offset:i+(e.left>=(s.left+s.right)/2?1:0)}}return{node:r,offset:0}}function Gn(r,e){return r.left>=e.left-1&&r.left<=e.right+1&&r.top>=e.top-1&&r.top<=e.bottom+1}function ll(r,e){let t=r.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<r.getBoundingClientRect().left?t:r}function al(r,e,t){let{node:n,offset:i}=es(e,t),s=-1;if(n.nodeType==1&&!n.firstChild){let o=n.getBoundingClientRect();s=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return r.docView.posFromDOM(n,i,s)}function cl(r,e,t,n){let i=-1;for(let s=e,o=!1;s!=r.dom;){let l=r.docView.nearestDesc(s,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent&&!o||!l.contentDOM)){let a=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&!o&&(o=!0,a.left>n.left||a.top>n.top?i=l.posBefore:(a.right<n.left||a.bottom<n.top)&&(i=l.posAfter)),!l.contentDOM&&i<0)return(l.node.isBlock?n.top<(a.top+a.bottom)/2:n.left<(a.left+a.right)/2)?l.posBefore:l.posAfter}s=l.dom.parentNode}return i>-1?i:r.docView.posFromDOM(e,t,-1)}function ts(r,e,t){let n=r.childNodes.length;if(n&&t.top<t.bottom)for(let i=Math.max(0,Math.min(n-1,Math.floor(n*(e.top-t.top)/(t.bottom-t.top))-2)),s=i;;){let o=r.childNodes[s];if(o.nodeType==1){let l=o.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(Gn(e,c))return ts(o,e,c)}}if((s=(s+1)%n)==i)break}return r}function dl(r,e){let t=r.dom.ownerDocument,n,i=0,s=Xo(t,e.left,e.top);s&&({node:n,offset:i}=s);let o=(r.root.elementFromPoint?r.root:t).elementFromPoint(e.left,e.top),l;if(!o||!r.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=r.dom.getBoundingClientRect();if(!Gn(e,c)||(o=ts(r.dom,e,c),!o))return null}if(_)for(let c=o;n&&c;c=bt(c))c.draggable&&(n=void 0);if(o=ll(o,e),n){if(oe&&n.nodeType==1&&(i=Math.min(i,n.childNodes.length),i<n.childNodes.length)){let c=n.childNodes[i],d;c.nodeName=="IMG"&&(d=c.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}n==r.dom&&i==n.childNodes.length-1&&n.lastChild.nodeType==1&&e.top>n.lastChild.getBoundingClientRect().bottom?l=r.state.doc.content.size:(i==0||n.nodeType!=1||n.childNodes[i-1].nodeName!="BR")&&(l=cl(r,n,i,e))}l==null&&(l=al(r,o,e));let a=r.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function vr(r){return r.top<r.bottom||r.left<r.right}function be(r,e){let t=r.getClientRects();if(t.length){let n=t[e<0?0:t.length-1];if(vr(n))return n}return Array.prototype.find.call(t,vr)||r.getBoundingClientRect()}const ul=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ns(r,e,t){let{node:n,offset:i,atom:s}=r.docView.domFromPos(e,t<0?-1:1),o=Ut||oe;if(n.nodeType==3)if(o&&(ul.test(n.nodeValue)||(t<0?!i:i==n.nodeValue.length))){let a=be(he(n,i,i),t);if(oe&&i&&/\s/.test(n.nodeValue[i-1])&&i<n.nodeValue.length){let c=be(he(n,i-1,i-1),-1);if(c.top==a.top){let d=be(he(n,i,i+1),-1);if(d.top!=a.top)return lt(d,d.left<c.left)}}return a}else{let a=i,c=i,d=t<0?1:-1;return t<0&&!i?(c++,d=-1):t>=0&&i==n.nodeValue.length?(a--,d=1):t<0?a--:c++,lt(be(he(n,a,c),d),d<0)}if(!r.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==ae(n))){let a=n.childNodes[i-1];if(a.nodeType==1)return gn(a.getBoundingClientRect(),!1)}if(s==null&&i<ae(n)){let a=n.childNodes[i];if(a.nodeType==1)return gn(a.getBoundingClientRect(),!0)}return gn(n.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==ae(n))){let a=n.childNodes[i-1],c=a.nodeType==3?he(a,ae(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return lt(be(c,1),!1)}if(s==null&&i<ae(n)){let a=n.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?he(a,0,o?0:1):a.nodeType==1?a:null:null;if(c)return lt(be(c,-1),!0)}return lt(be(n.nodeType==3?he(n):n,-t),t>=0)}function lt(r,e){if(r.width==0)return r;let t=e?r.left:r.right;return{top:r.top,bottom:r.bottom,left:t,right:t}}function gn(r,e){if(r.height==0)return r;let t=e?r.top:r.bottom;return{top:t,bottom:t,left:r.left,right:r.right}}function rs(r,e,t){let n=r.state,i=r.root.activeElement;n!=e&&r.updateState(e),i!=r.dom&&r.focus();try{return t()}finally{n!=e&&r.updateState(n),i!=r.dom&&i&&i.focus()}}function fl(r,e,t){let n=e.selection,i=t=="up"?n.$from:n.$to;return rs(r,e,()=>{let{node:s}=r.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=r.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=ns(r,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=he(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let d=a[c];if(d.bottom>d.top+1&&(t=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const hl=/[\u0590-\u08ac]/;function pl(r,e,t){let{$head:n}=e.selection;if(!n.parent.isTextblock)return!1;let i=n.parentOffset,s=!i,o=i==n.parent.content.size,l=r.domSelection();return!hl.test(n.parent.textContent)||!l.modify?t=="left"||t=="backward"?s:o:rs(r,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:d,anchorOffset:u}=r.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",t,"character");let h=n.depth?r.docView.domAfterPos(n.before()):r.dom,{focusNode:p,focusOffset:m}=r.domSelectionRange(),g=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(d,u),a&&(a!=d||c!=u)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),g})}let Ar=null,Ir=null,Pr=!1;function ml(r,e,t){return Ar==e&&Ir==t?Pr:(Ar=e,Ir=t,Pr=t=="up"||t=="down"?fl(r,e,t):pl(r,e,t))}const te=0,Rr=1,Ae=2,fe=3;class Mt{constructor(e,t,n,i){this.parent=e,this.children=t,this.dom=n,this.contentDOM=i,this.dirty=te,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let i=this.children[t];if(i==e)return n;n+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){let s,o;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>X(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(n&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))n=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let n=t;n;n=n.parent)if(n==this)return t}posFromDOM(e,t,n){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let i=this.children[t],s=n+i.size;if(n==e&&s!=n){for(;!i.border&&i.children.length;)i=i.children[0];return i}if(e<s)return i.descAt(e-n-i.border);n=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,i=0;for(let s=0;n<this.children.length;n++){let o=this.children[n],l=s+o.size;if(l>e||o instanceof ss){i=e-s;break}s=l}if(i)return this.children[n].domFromPos(i-this.children[n].border,t);for(let s;n&&!(s=this.children[n-1]).size&&s instanceof is&&s.side>=0;n--);if(t<=0){let s,o=!0;for(;s=n?this.children[n-1]:null,!(!s||s.dom.parentNode==this.contentDOM);n--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?X(s.dom)+1:0}}else{let s,o=!0;for(;s=n<this.children.length?this.children[n]:null,!(!s||s.dom.parentNode==this.contentDOM);n++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?X(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=n,l=0;;l++){let a=this.children[l],c=o+a.size;if(i==-1&&e<=c){let d=o+a.border;if(e>=d&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,d);e=o;for(let u=l;u>0;u--){let f=this.children[u-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=X(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(c>t||l==this.children.length-1)){t=c;for(let d=l+1;d<this.children.length;d++){let u=this.children[d];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){s=X(u.dom);break}t+=u.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(t.nodeType!=1||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,i=!1){let s=Math.min(e,t),o=Math.max(e,t);for(let f=0,h=0;f<this.children.length;f++){let p=this.children[f],m=h+p.size;if(s>h&&o<m)return p.setSelection(e-h-p.border,t-h-p.border,n,i);h=m}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=n.getSelection(),d=!1;if((oe||_)&&e==t){let{node:f,offset:h}=l;if(f.nodeType==3){if(d=!!(h&&f.nodeValue[h-1]==`
|
package/dist/message_input.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as rr, _ as Xt, e as Bi, f as xo, s as Mo, j as Fi, k as Co, l as wo, a as Oo, m as Eo, D as To, n as No, o as Do } from "./emoji-c109b6ee.js";
|
|
2
2
|
import { defineComponent as lt, ref as Zt, onMounted as zi, onBeforeUnmount as ir, h as Fe, getCurrentInstance as vo, watchEffect as Ao, nextTick as Io, unref as Po, Teleport as Ro, markRaw as Li, reactive as Vi, provide as Cr, customRef as Bo, resolveComponent as Y, openBlock as Oe, createBlock as Qt, withCtx as Q, createVNode as j, withDirectives as Fo, createElementBlock as zt, Fragment as ji, renderList as zo, normalizeClass as Rt, withModifiers as Hi, createElementVNode as ce, toDisplayString as zn, vShow as Lo, createTextVNode as Vo, createCommentVNode as wr, withKeys as jo, mergeProps as Ho, renderSlot as mn } from "vue";
|
|
3
|
-
import {
|
|
3
|
+
import { D as $o, a as qo, b as Wo, N as _o } from "./notice-c5521e01.js";
|
|
4
4
|
function L(r) {
|
|
5
5
|
this.content = r;
|
|
6
6
|
}
|