1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="a6ebcae8-a74a-ec68-1abb-899a2aca856b")}catch(e){}}(); 2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,522196,711379,800390,t=>{"use strict";function e(t){this.content=t}e.prototype={constructor:e,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return -1},get:function(t){var e=this.find(t);return -1==e?void 0:this.content[e+1]},update:function(t,n,r){var i=r&&r!=t?this.remove(r):this,s=i.find(t),o=i.content.slice();return -1==s?o.push(r||t,n):(o[s+1]=n,r&&(o[s]=r)),new e(o)},remove:function(t){var n=this.find(t);if(-1==n)return this;var r=this.content.slice();return r.splice(n,2),new e(r)},addToStart:function(t,n){return new e([t,n].concat(this.remove(t).content))},addToEnd:function(t,n){var r=this.remove(t).content.slice();return r.push(t,n),new e(r)},addBefore:function(t,n,r){var i=this.remove(n),s=i.content.slice(),o=i.find(t);return s.splice(-1==o?s.length:o,0,n,r),new e(s)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return(t=e.from(t)).size?new e(t.content.concat(this.subtract(t).content)):this},append:function(t){return(t=e.from(t)).size?new e(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var n=this;t=e.from(t);for(var r=0;r<t.content.length;r+=2)n=n.remove(t.content[r]);return n},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}},e.from=function(t){if(t instanceof e)return t;var n=[];if(t)for(var r in t)n.push(r,t[r]);return new e(n)};class n{nodesBetween(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4?arguments[4]:void 0;for(let s=0,o=0;o<e;s++){let l=this.content[s],h=o+l.nodeSize;if(h>t&&!1!==n(l,r+o,i||null,s)&&l.content.size){let i=o+1;l.nodesBetween(Math.max(0,t-i),Math.min(l.content.size,e-i),n,r+i)}o=h}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,e,n,r){let i="",s=!0;return this.nodesBetween(t,e,(o,l)=>{let h=o.isText?o.text.slice(Math.max(t,l)-l,e-l):o.isLeaf?r?"function"==typeof r?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&h||o.isTextblock)&&n&&(s?s=!1:i+=n),i+=h},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let e=this.lastChild,r=t.firstChild,i=this.content.slice(),s=0;for(e.isText&&e.sameMarkup(r)&&(i[i.length-1]=e.withText(e.text+r.text),s=1);s<t.content.length;s++)i.push(t.content[s]);return new n(i,this.size+t.size)}cut(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.size;if(0==t&&e==this.size)return this;let r=[],i=0;if(e>t)for(let n=0,s=0;s<e;n++){let o=this.content[n],l=s+o.nodeSize;l>t&&((s<t||l>e)&&(o=o.isText?o.cut(Math.max(0,t-s),Math.min(o.text.length,e-s)):o.cut(Math.max(0,t-s-1),Math.min(o.content.size,e-s-1))),r.push(o),i+=o.nodeSize),s=l}return new n(r,i)}cutByIndex(t,e){return t==e?n.empty:0==t&&e==this.content.length?this:new n(this.content.slice(t,e))}replaceChild(t,e){let r=this.content[t];if(r==e)return this;let i=this.content.slice(),s=this.size+e.nodeSize-r.nodeSize;return i[t]=e,new n(i,s)}addToStart(t){return new n([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new n(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))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(t){let e=this.content[t];if(!e)throw RangeError("Index "+t+" out of range for "+this);return e}maybeChild(t){return this.content[t]||null}forEach(t){for(let e=0,n=0;e<this.content.length;e++){let r=this.content[e];t(r,n,e),n+=r.nodeSize}}findDiffStart(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return function t(e,n,r){for(let i=0;;i++){if(i==e.childCount||i==n.childCount)return e.childCount==n.childCount?null:r;let s=e.child(i),o=n.child(i);if(s==o){r+=s.nodeSize;continue}if(!s.sameMarkup(o))return r;if(s.isText&&s.text!=o.text){for(let t=0;s.text[t]==o.text[t];t++)r++;return r}if(s.content.size||o.content.size){let e=t(s.content,o.content,r+1);if(null!=e)return e}r+=s.nodeSize}}(this,t,e)}findDiffEnd(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.size,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.size;return function t(e,n,r,i){for(let s=e.childCount,o=n.childCount;;
2){if(0==s||0==o)return s==o?null:{a:r,b:i};let l=e.child(--s),h=n.child(--o),a=l.nodeSize;if(l==h){r-=a,i-=a;continue}if(!l.sameMarkup(h))return{a:r,b:i};if(l.isText&&l.text!=h.text){let t=0,e=Math.min(l.text.length,h.text.length);for(;t<e&&l.text[l.text.length-t-1]==h.text[h.text.length-t-1];)t++,r--,i--;return{a:r,b:i}}if(l.content.size||h.content.size){let e=t(l.content,h.content,r-1,i-1);if(e)return e}r-=a,i-=a}}(this,t,e,n)}findIndex(t){if(0==t)return i(0,t);if(t==this.size)return i(this.content.length,t);if(t>this.size||t<0)throw RangeError("Position ".concat(t," outside of fragment (").concat(this,")"));for(let e=0,n=0;;e++){let r=n+this.child(e).nodeSize;if(r>=t){if(r==t)return i(e+1,r);return i(e,n)}n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,e){if(!e)return n.empty;if(!Array.isArray(e))throw RangeError("Invalid input for Fragment.fromJSON");return new n(e.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return n.empty;let e,r=0;for(let n=0;n<t.length;n++){let i=t[n];r+=i.nodeSize,n&&i.isText&&t[n-1].sameMarkup(i)?(e||(e=t.slice(0,n)),e[e.length-1]=i.withText(e[e.length-1].text+i.text)):e&&e.push(i)}return new n(e||t,r)}static from(t){if(!t)return n.empty;if(t instanceof n)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new n([t],t.nodeSize);throw RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}constructor(t,e){if(this.content=t,this.size=e||0,null==e)for(let e=0;e<t.length;e++)this.size+=t[e].nodeSize}}n.empty=new n([],0);let r={index:0,offset:0};function i(t,e){return r.index=t,r.offset=e,r}function s(t,e){if(t===e)return!0;if(!(t&&"object"==typeof t)||!(e&&"object"==typeof e))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!s(t[n],e[n]))return!1}else{for(let n in t)if(!(n in e)||!s(t[n],e[n]))return!1;for(let n in e)if(!(n in t))return!1}return!0}class o{addToSet(t){let e,n=!1;for(let r=0;r<t.length;r++){let i=t[r];if(this.eq(i))return t;if(this.type.excludes(i.type))e||(e=t.slice(0,r));else{if(i.type.excludes(this.type))return t;!n&&i.type.rank>this.type.rank&&(e||(e=t.slice(0,r)),e.push(this),n=!0),e&&e.push(i)}}return e||(e=t.slice()),n||e.push(this),e}removeFromSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t}isInSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1}eq(t){return this==t||this.type==t.type&&s(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,e){if(!e)throw RangeError("Invalid input for Mark.fromJSON");let n=t.marks[e.type];if(!n)throw RangeError("There is no mark type ".concat(e.type," in this schema"));let r=n.create(e.attrs);return n.checkAttrs(r.attrs),r}static sameSet(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].eq(e[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&0==t.length)return o.none;if(t instanceof o)return[t];let e=t.slice();return e.sort((t,e)=>t.type.rank-e.type.rank),e}constructor(t,e){this.type=t,this.attrs=e}}o.none=[];class l extends Error{}class h{get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,e){let n=function t(e,n,r,i){let{index:s,offset:o}=e.findIndex(n),l=e.maybeChild(s);if(o==n||l.isText)return i&&!i.canReplace(s,s,r)?null:e.cut(0,n).append(r).append(e.cut(n));let h=t(l.content,n-o-1,r,l);return h&&e.replaceChild(s,l.copy(h))}(this.content,t+this.openStart,e);return n&&new h(n,this.openStart,this.openEnd)}removeBetween(t,e){return new h(function t(e,n,r){let{index:i,offset:s}=e.findIndex(n),o=e.maybeChild(i),{index:l,offset:h}=e.findIndex(r);if(s==n||o.isText){if(h!=r&&!e.child(l).isText)throw RangeError("Removing non-flat range");return e.cut(0,n).append(e.cut(r))}if(i!=l)throw RangeError("Removing non-flat range");return e.replaceChild(i,o.copy(t(o.content,n-s-1,r-s-1)))}(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,e){if(!e)return h.empty;let r=e.openStart||0,i=e.openEnd||0;if("number"!=typeof r||"number"!=typeof i)throw RangeError("Invalid input for Slice.fromJSON");return new h(n.fromJSON(t,e.content),r,i)}static maxOpen(t){let e=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=0,r=0;for(let r=t.firstChild;r&&!r.isLeaf&&(e||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=t.lastChild;n&&!n.isLeaf&&(e||!n.type.spec.isolating);n=n.lastChild)r++;return new h(t,n,r)}constructor(t,e,n){this.content=t,this.openStart=e,this.openEnd=n}}function a(t,e){if(!e.type.compatibleContent(t.type))throw new l("Cannot join "+e.type.n
2ame+" onto "+t.type.name)}function c(t,e,n){let r=t.node(n);return a(r,e.node(n)),r}function p(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function d(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(p(t.nodeAfter,r),s++));for(let t=s;t<o;t++)p(i.child(t),r);e&&e.depth==n&&e.textOffset&&p(e.nodeBefore,r)}function u(t,e){return t.type.checkContent(e),t.copy(e)}function f(t,e,r){let i=[];return d(null,t,r,i),t.depth>r&&p(u(c(t,e,r+1),f(t,e,r+1)),i),d(e,null,r,i),new n(i)}h.empty=new h(n.empty,0,0);class m{resolveDepth(t){return null==t?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[3*this.resolveDepth(t)]}index(t){return this.path[3*this.resolveDepth(t)+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)}start(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(!(t=this.resolveDepth(t)))throw RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]}after(t){if(!(t=this.resolveDepth(t)))throw RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=t.child(e);return n?t.child(e).cut(n):r}get nodeBefore(){let t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)}posAtIndex(t,e){e=this.resolveDepth(e);let n=this.path[3*e],r=0==e?0:this.path[3*e-1]+1;for(let e=0;e<t;e++)r+=n.child(e).nodeSize;return r}marks(){let t=this.parent,e=this.index();if(0==t.content.size)return o.none;if(this.textOffset)return t.child(e).marks;let n=t.maybeChild(e-1),r=t.maybeChild(e);if(!n){let t=n;n=r,r=t}let i=n.marks;for(var s=0;s<i.length;s++)!1!==i[s].type.spec.inclusive||r&&i[s].isInSet(r.marks)||(i=i[s--].removeFromSet(i));return i}marksAcross(t){let e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;let n=e.marks,r=t.parent.maybeChild(t.index());for(var i=0;i<n.length;i++)!1!==n[i].type.spec.inclusive||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}sharedDepth(t){for(let e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0}blockRange(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this,e=arguments.length>1?arguments[1]:void 0;if(t.pos<this.pos)return t.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);n>=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new x(this,t,n);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset}static resolve(t,e){if(!(e>=0&&e<=t.content.size))throw RangeError("Position "+e+" out of range");let n=[],r=0,i=e;for(let e=t;;){let{index:t,offset:s}=e.content.findIndex(i),o=i-s;if(n.push(e,t,r+s),!o||(e=e.child(t)).isText)break;i=o-1,r+=s+1}return new m(e,n,i)}static resolveCached(t,e){let n=k.get(t);if(n)for(let t=0;t<n.elts.length;t++){let r=n.elts[t];if(r.pos==e)return r}else k.set(t,n=new g);let r=n.elts[n.i]=m.resolve(t,e);return n.i=(n.i+1)%y,r}constructor(t,e,n){this.pos=t,this.path=e,this.parentOffset=n,this.depth=e.length/3-1}}class g{constructor(){this.elts=[],this.i=0}}let y=12,k=new WeakMap;class x{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)}constructor(t,e,n){this.$from=t,this.$to=e,this.depth=n}}let w=Object.create(null);class v{get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;this.content.nodesBetween(t,e,n,r,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}
2textBetween(t,e,n,r){return this.content.textBetween(t,e,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,e,n){return this.type==t&&s(this.attrs,e||t.defaultAttrs||w)&&o.sameSet(this.marks,n||o.none)}copy(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return t==this.content?this:new v(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new v(this.type,this.attrs,this.content,t)}cut(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.content.size;return 0==t&&e==this.content.size?this:this.copy(this.content.cut(t,e))}slice(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.content.size,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t==e)return h.empty;let r=this.resolve(t),i=this.resolve(e),s=n?0:r.sharedDepth(e),o=r.start(s);return new h(r.node(s).content.cut(r.pos-o,i.pos-o),r.depth-s,i.depth-s)}replace(t,e,r){var i=this.resolve(t),s=this.resolve(e);if(r.openStart>i.depth)throw new l("Inserted content deeper than insertion position");if(i.depth-r.openStart!=s.depth-r.openEnd)throw new l("Inconsistent open depths");return function t(e,r,i,s){let o=e.index(s),l=e.node(s);if(o==r.index(s)&&s<e.depth-i.openStart){let n=t(e,r,i,s+1);return l.copy(l.content.replaceChild(o,n))}if(!i.content.size)return u(l,f(e,r,s));if(i.openStart||i.openEnd||e.depth!=s||r.depth!=s){let{start:t,end:o}=function(t,e){let r=e.depth-t.openStart,i=e.node(r).copy(t.content);for(let t=r-1;t>=0;t--)i=e.node(t).copy(n.from(i));return{start:i.resolveNoCache(t.openStart+r),end:i.resolveNoCache(i.content.size-t.openEnd-r)}}(i,e);return u(l,function t(e,r,i,s,o){let l=e.depth>o&&c(e,r,o+1),h=s.depth>o&&c(i,s,o+1),m=[];return d(null,e,o,m),l&&h&&r.index(o)==i.index(o)?(a(l,h),p(u(l,t(e,r,i,s,o+1)),m)):(l&&p(u(l,f(e,r,o+1)),m),d(r,i,o,m),h&&p(u(h,f(i,s,o+1)),m)),d(s,null,o,m),new n(m)}(e,t,o,r,s))}{let t=e.parent,n=t.content;return u(t,n.cut(0,e.parentOffset).append(i.content).append(n.cut(r.parentOffset)))}}(i,s,r,0)}nodeAt(t){for(let e=this;;){let{index:n,offset:r}=e.content.findIndex(t);if(!(e=e.maybeChild(n)))return null;if(r==t||e.isText)return e;t-=r+1}}childAfter(t){let{index:e,offset:n}=this.content.findIndex(t);return{node:this.content.maybeChild(e),index:e,offset:n}}childBefore(t){if(0==t)return{node:null,index:0,offset:0};let{index:e,offset:n}=this.content.findIndex(t);if(n<t)return{node:this.content.child(e),index:e,offset:n};let r=this.content.child(e-1);return{node:r,index:e-1,offset:n-r.nodeSize}}resolve(t){return m.resolveCached(this,t)}resolveNoCache(t){return m.resolve(this,t)}rangeHasMark(t,e,n){let r=!1;return e>t&&this.nodesBetween(t,e,t=>(n.isInSet(t.marks)&&(r=!0),!r)),r}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 t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),b(this.marks,t)}contentMatchAt(t){let e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw Error("Called contentMatchAt on a node with invalid content");return e}canReplace(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.empty,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:r.childCount,o=this.contentMatchAt(t).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,e);if(!l||!l.validEnd)return!1;for(let t=i;t<s;t++)if(!this.type.allowsMarks(r.child(t).marks))return!1;return!0}canReplaceWith(t,e,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(t).matchType(n),s=i&&i.matchFragment(this.content,e);return!!s&&s.validEnd}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=o.none;for(let e=0;e<this.marks.length;e++){let n=this.marks[e];n.type.checkAttrs(n.attrs),t=n.addToSet(t)}if(!o.sameSet(t,this.marks))throw RangeError("Invalid collection of marks for node ".concat(this.t
2ype.name,": ").concat(this.marks.map(t=>t.type.name)));this.content.forEach(t=>t.check())}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(t=>t.toJSON())),t}static fromJSON(t,e){let r;if(!e)throw RangeError("Invalid input for Node.fromJSON");if(e.marks){if(!Array.isArray(e.marks))throw RangeError("Invalid mark data for Node.fromJSON");r=e.marks.map(t.markFromJSON)}if("text"==e.type){if("string"!=typeof e.text)throw RangeError("Invalid text node in JSON");return t.text(e.text,r)}let i=n.fromJSON(t,e.content),s=t.nodeType(e.type).create(e.attrs,i,r);return s.type.checkAttrs(s.attrs),s}constructor(t,e,r,i=o.none){this.type=t,this.attrs=e,this.marks=i,this.content=r||n.empty}}v.prototype.text=void 0;class S extends v{toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):b(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,e){return this.text.slice(t,e)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new S(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new S(this.type,this.attrs,t,this.marks)}cut(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.text.length;return 0==t&&e==this.text.length?this:this.withText(this.text.slice(t,e))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}constructor(t,e,n,r){if(super(t,e,null,r),!n)throw RangeError("Empty text nodes are not allowed");this.text=n}}function b(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class M{static parse(t,e){var n;let r,i=new C(t,e);if(null==i.next)return M.empty;let s=function t(e){let n=[];do n.push(function(e){let n=[];do n.push(function(e){let n=function(e){if(e.eat("(")){let n=t(e);return e.eat(")")||e.err("Missing closing paren"),n}if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=(function(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let t in n){let r=n[t];r.isInGroup(e)&&i.push(r)}return 0==i.length&&t.err("No node type or group '"+e+"' found"),i})(e,e.next).map(t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t}));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}}(e);for(;;)if(e.eat("+"))n={type:"plus",expr:n};else if(e.eat("*"))n={type:"star",expr:n};else if(e.eat("?"))n={type:"opt",expr:n};else if(e.eat("{"))n=function(t,e){let n=O(t),r=n;return t.eat(",")&&(r="}"!=t.next?O(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}(e,n);else break;return n}(e));while(e.next&&")"!=e.next&&"|"!=e.next)return 1==n.length?n[0]:{type:"seq",exprs:n}}(e));while(e.eat("|"))return 1==n.length?n[0]:{type:"choice",exprs:n}}(i);i.next&&i.err("Unexpected trailing text");let o=(n=function(t){let e=[[]];return i(function t(e,s){if("choice"==e.type)return e.exprs.reduce((e,n)=>e.concat(t(n,s)),[]);if("seq"==e.type)for(let r=0;;r++){let o=t(e.exprs[r],s);if(r==e.exprs.length-1)return o;i(o,s=n())}else if("star"==e.type){let o=n();return r(s,o),i(t(e.expr,o),o),[r(o)]}else if("plus"==e.type){let o=n();return i(t(e.expr,s),o),i(t(e.expr,o),o),[r(o)]}else if("opt"==e.type)return[r(s)].concat(t(e.expr,s));else if("range"==e.type){let o=s;for(let r=0;r<e.min;r++){let r=n();i(t(e.expr,o),r),o=r}if(-1==e.max)i(t(e.expr,o),o);else for(let s=e.min;s<e.max;s++){let s=n();r(o,s),i(t(e.expr,o),s),o=s}return[r(o)]}else if("name"==e.type)return[r(s,void 0,e.value)];else throw Error("Unknown expr type")}(t,0),n()),e;function n(){return e.push([])-1}function r(t,n,r){let i={term:r,to:n};return e[t].push(i),i}function i(t,e){t.forEach(t=>t.to=e)}}(s),r=Object.create(null),function t(e){let i=[];e.forEach(t=>{n[t].forEach(t=>{let e,{term:r,to:s}=t;if(r){for(let t=0;t<i.length;t++)i[t][0]==r&&(e=i[t][1]);T(n,s).forEach(t=>{e||i.push([r,e=[]]),-1==e.indexOf(t)&&e.push(t)})}})});let s=r[e.join(",")]=new M(e.indexOf(n.length-1)>-1);for(let e=0;e<i.length;e++){let n=i[e][1].sort(N);s.next.push({type:i[e][0],next:r[n.join(",")]||t(n)})}return s}(T(n,0)));return function(t,e){for(let n=0,r=[t];n<r.length;n++){let t=r[n],i=!t.validEnd,s=[];for(let e=0;e<t.next.length;e++){let{type:n,next:o}=t.next[e];s.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),-1==r.indexOf(o)&&r.push(o)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,i),o}matchType(t){for(let e=0;e<this.next.length;e++)if(this.next[e].type==t)return this.next[e].next;return null}matchFragment(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.childCount,r=this;for(let i=e;r&&i<n;i++)r=r.matchType(t.child(i).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:e}=this.next[t];if(!(e.isText||e.hasRequiredAttrs()))return e}return null}compatible(t){for(let e=0;e<this.next.length;e++)for(let n=0;n<t.next.length;n++)if(this.next[e].type==t.next[n].type)return!0;return!1}fillBefore(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=[this];return function s(o,l){let h=o.matchFragment(t,r);
2if(h&&(!e||h.validEnd))return n.from(l.map(t=>t.createAndFill()));for(let t=0;t<o.next.length;t++){let{type:e,next:n}=o.next[t];if(!(e.isText||e.hasRequiredAttrs())&&-1==i.indexOf(n)){i.push(n);let t=s(n,l.concat(e));if(t)return t}}return null}(this,[])}findWrapping(t){for(let e=0;e<this.wrapCache.length;e+=2)if(this.wrapCache[e]==t)return this.wrapCache[e+1];let e=this.computeWrapping(t);return this.wrapCache.push(t,e),e}computeWrapping(t){let e=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(t)){let t=[];for(let e=r;e.type;e=e.via)t.push(e.type);return t.reverse()}for(let t=0;t<i.next.length;t++){let{type:s,next:o}=i.next[t];s.isLeaf||s.hasRequiredAttrs()||s.name in e||r.type&&!o.validEnd||(n.push({match:s.contentMatch,type:s,via:r}),e[s.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw RangeError("There's no ".concat(t,"th edge in this content match"));return this.next[t]}toString(){let t=[];return!function e(n){t.push(n);for(let r=0;r<n.next.length;r++)-1==t.indexOf(n.next[r].next)&&e(n.next[r].next)}(this),t.map((e,n)=>{let r=n+(e.validEnd?"*":" ")+" ";for(let n=0;n<e.next.length;n++)r+=(n?", ":"")+e.next[n].type.name+"->"+t.indexOf(e.next[n].next);return r}).join("\n")}constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}}M.empty=new M(!0);class C{get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw SyntaxError(t+" (in content expression '"+this.string+"')")}constructor(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}}function O(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function N(t,e){return e-t}function T(t,e){let n=[];return function e(r){let i=t[r];if(1==i.length&&!i[0].term)return e(i[0].to);n.push(r);for(let t=0;t<i.length;t++){let{term:r,to:s}=i[t];r||-1!=n.indexOf(s)||e(s)}}(e),n.sort(N)}function E(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function R(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(void 0===i){let e=t[r];if(e.hasDefault)i=e.default;else throw RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function A(t,e,n,r){for(let r in e)if(!(r in t))throw RangeError("Unsupported attribute ".concat(r," for ").concat(n," of type ").concat(r));for(let n in t){let r=t[n];r.validate&&r.validate(e[n])}}function I(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new J(t,r,e[r]);return n}class z{get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==M.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:R(this.attrs,t)}create(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;if(this.isText)throw Error("NodeType.create can't construct text nodes");return new v(this,this.computeAttrs(t),n.from(e),o.setFrom(r))}createChecked(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;return e=n.from(e),this.checkContent(e),new v(this,this.computeAttrs(t),e,o.setFrom(r))}createAndFill(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;if(t=this.computeAttrs(t),(e=n.from(e)).size){let t=this.contentMatch.fillBefore(e);if(!t)return null;e=t.append(e)}let i=this.contentMatch.matchFragment(e),s=i&&i.fillBefore(n.empty,!0);return s?new v(this,t,e.append(s),o.setFrom(r)):null}validContent(t){let e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(let e=0;e<t.childCount;e++)if(!this.allowsMarks(t.child(e).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw RangeError("Invalid content for node ".concat(this.name,": ").concat(t.toString().slice(0,50)))}checkAttrs(t){A(this.attrs,t,"node",this.name)}allowsMarkType(t){return null==this.markSet||this.markSet.indexOf(t)>-1}allowsMarks(t){if(null==this.markSet)return!0;for(let e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0}allowedMarks(t){let e;if(null==this.markSet)return t;for(let n=0;n<t.length;n++)this.allowsMarkType(t[n].type)?e&&e.push(t[n]):e||(e=t.slice(0,n));return e?e.length?e:o.none:t}static compile(t,e){let n=Object.create(null);t.forEach((t,r)=>n[t]=new z(t,e,r));let r=e.spec.topNode||"doc";if(!n[r])throw RangeError("Schema is missing its top node type ('"+r+"')");
2if(!n.text)throw RangeError("Every schema needs a 'text' type");for(let t in n.text.attrs)throw RangeError("The text node type should not have attributes");return n}constructor(t,e,n){this.name=t,this.schema=e,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=I(t,n.attrs),this.defaultAttrs=E(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==t),this.isText="text"==t}}class J{get isRequired(){return!this.hasDefault}constructor(t,e,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(t,e,n){let r=n.split("|");return n=>{let i=null===n?"null":typeof n;if(0>r.indexOf(i))throw RangeError("Expected value of type ".concat(r," for attribute ").concat(e," on type ").concat(t,", got ").concat(i))}}(t,e,n.validate):n.validate}}class F{create(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return!t&&this.instance?this.instance:new o(this,R(this.attrs,t))}static compile(t,e){let n=Object.create(null),r=0;return t.forEach((t,i)=>n[t]=new F(t,r++,e,i)),n}removeFromSet(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t}isInSet(t){for(let e=0;e<t.length;e++)if(t[e].type==this)return t[e]}checkAttrs(t){A(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}constructor(t,e,n,r){this.name=t,this.rank=e,this.schema=n,this.spec=r,this.attrs=I(t,r.attrs),this.excluded=null;let i=E(this.attrs);this.instance=i?new o(this,i):null}}function B(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let e in t.marks){let r=t.marks[e];("_"==i||r.spec.group&&r.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}class ${parse(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new L(this,e,!1);return n.addAll(t,o.none,e.from,e.to),n.finish()}parseSlice(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new L(this,e,!0);return n.addAll(t,o.none,e.from,e.to),h.maxOpen(n.finish())}matchTag(t,e,n){for(let s=n?this.tags.indexOf(n)+1:0;s<this.tags.length;s++){var r,i;let n=this.tags[s];if(r=t,i=n.tag,(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,i)&&(void 0===n.namespace||t.namespaceURI==n.namespace)&&(!n.context||e.matchesContext(n.context))){if(n.getAttrs){let e=n.getAttrs(t);if(!1===e)continue;n.attrs=e||void 0}return n}}}matchStyle(t,e,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],s=r.style;if(0==s.indexOf(t)&&(!r.context||n.matchesContext(r.context))&&(!(s.length>t.length)||61==s.charCodeAt(t.length)&&s.slice(t.length+1)==e)){if(r.getAttrs){let t=r.getAttrs(e);if(!1===t)continue;r.attrs=t||void 0}return r}}}static schemaRules(t){let e=[];function n(t){let n=null==t.priority?50:t.priority,r=0;for(;r<e.length;r++){let t=e[r];if((null==t.priority?50:t.priority)<n)break}e.splice(r,0,t)}for(let e in t.marks){let r=t.marks[e].spec.parseDOM;r&&r.forEach(t=>{n(t=_(t)),t.mark||t.ignore||t.clearMark||(t.mark=e)})}for(let e in t.nodes){let r=t.nodes[e].spec.parseDOM;r&&r.forEach(t=>{n(t=_(t)),t.node||t.ignore||t.mark||(t.node=e)})}return e}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new $(t,$.schemaRules(t)))}constructor(t,e){this.schema=t,this.rules=e,this.tags=[],this.styles=[];let n=this.matchedStyles=[];e.forEach(t=>{if(null!=t.tag)this.tags.push(t);else if(null!=t.style){let e=/[^=]*/.exec(t.style)[0];0>n.indexOf(e)&&n.push(e),this.styles.push(t)}}),this.normalizeLists=!this.tags.some(e=>{if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;let n=t.nodes[e.node];return n.contentMatch.matchType(n)})}}let D={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},j={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},W={ol:!0,ul:!0};function P(t,e,n){return null!=e?!!e|2*("full"===e):t&&"pre"==t.whitespace?3:-5&n}
2class q{findWrapping(t){if(!this.match){if(!this.type)return[];let e=this.type.contentMatch.fillBefore(n.from(t));if(e)this.match=this.type.contentMatch.matchFragment(e);else{let e=this.type.contentMatch,n;return(n=e.findWrapping(t.type))?(this.match=e,n):null}}return this.match.findWrapping(t.type)}finish(t){if(!(1&this.options)){let t=this.content[this.content.length-1],e;t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))&&(t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=t.withText(t.text.slice(0,t.text.length-e[0].length)))}let e=n.from(this.content);return!t&&this.match&&(e=e.append(this.match.fillBefore(n.empty,!0))),this.type?this.type.create(this.attrs,e,this.marks):e}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!D.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}constructor(t,e,n,r,i,s){this.type=t,this.attrs=e,this.marks=n,this.solid=r,this.options=s,this.content=[],this.activeMarks=o.none,this.match=i||(4&s?null:t.contentMatch)}}class L{get top(){return this.nodes[this.open]}addDOM(t,e){3==t.nodeType?this.addTextNode(t,e):1==t.nodeType&&this.addElement(t,e)}addTextNode(t,e){let n=t.nodeValue,r=this.top,i=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:s}=this.parser;if("full"===i||r.inlineContext(t)||/[^ \t\r\n\u000c]/.test(n)){if(i)if("full"===i)n=n.replace(/\r\n?/g,"\n");else if(s.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(s.linebreakReplacement.create())){let t=n.split(/\r?\n|\r/);for(let n=0;n<t.length;n++)n&&this.insertNode(s.linebreakReplacement.create(),e,!0),t[n]&&this.insertNode(s.text(t[n]),e,!/\S/.test(t[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let e=r.content[r.content.length-1],i=t.previousSibling;
2(!e||i&&"BR"==i.nodeName||e.isText&&/[ \t\r\n\u000c]$/.test(e.text))&&(n=n.slice(1))}n&&this.insertNode(s.text(n),e,!/\S/.test(n)),this.findInText(t)}else this.findInside(t)}addElement(t,e,n){let r=this.localPreserveWS,i=this.top;("PRE"==t.tagName||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=!0);let s=t.nodeName.toLowerCase(),o;W.hasOwnProperty(s)&&this.parser.normalizeLists&&function(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let t=1==e.nodeType?e.nodeName.toLowerCase():null;t&&W.hasOwnProperty(t)&&n?(n.appendChild(e),e=n):"li"==t?n=e:t&&(n=null)}}(t);let l=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(o=this.parser.matchTag(t,this,n));t:if(l?l.ignore:j.hasOwnProperty(s))this.findInside(t),this.ignoreFallback(t,e);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(t=l.skip);let n,r=this.needsBlock;if(D.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,e);break t}let o=l&&l.skip?e:this.readStyles(t,e);o&&this.addAll(t,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(t,e);n&&this.addElementByRule(t,l,n,!1===l.consuming?o:void 0)}this.localPreserveWS=r}leafFallback(t,e){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"),e)}ignoreFallback(t,e){"BR"!=t.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),e,!0)}readStyles(t,e){let n=t.style;if(n&&n.length)for(let t=0;t<this.parser.matchedStyles.length;t++){let r=this.parser.matchedStyles[t],i=n.getPropertyValue(r);if(i)for(let t;;){let n=this.parser.matchStyle(r,i,this,t);if(!n)break;if(n.ignore)return null;if(e=n.clearMark?e.filter(t=>!n.clearMark(t)):e.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1===n.consuming)t=n;else break}}return e}addElementByRule(t,e,n,r){let i,s;if(e.node)if((s=this.parser.schema.nodes[e.node]).isLeaf)this.insertNode(s.create(e.attrs),n,"BR"==t.nodeName)||this.leafFallback(t,n);else{let t=this.enter(s,e.attrs||null,n,e.preserveWhitespace);t&&(i=!0,n=t)}else{let t=this.parser.schema.marks[e.mark];n=n.concat(t.create(e.attrs))}let o=this.top;if(s&&s.isLeaf)this.findInside(t);else if(r)this.addElement(t,n,r);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach(t=>this.insertNode(t,n,!1));else{let r=t;"string"==typeof e.contentElement?r=t.querySelector(e.contentElement):"function"==typeof e.contentElement?r=e.contentElement(t):e.contentElement&&(r=e.contentElement),this.findAround(t,r,!0),this.addAll(r,n),this.findAround(t,r,!1)}i&&this.sync(o)&&this.open--}addAll(t,e,n,r){let i=n||0;for(let s=n?t.childNodes[n]:t.firstChild,o=null==r?null:t.childNodes[r];s!=o;s=s.nextSibling,++i)this.findAtPoint(t,i),this.addDOM(s,e);this.findAtPoint(t,i)}findPlace(t,e,n){let r,i;for(let e=this.open,s=0;e>=0;e--){let o=this.nodes[e],l=o.findWrapping(t);if(l&&(!r||r.length>l.length+s)&&(r=l,i=o,!l.length))break;if(o.solid){if(n)break;s+=2}}if(!r)return null;this.sync(i);for(let t=0;t<r.length;t++)e=this.enterInner(r[t],null,e,!1);return e}insertNode(t,e,n){if(t.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&(e=this.enterInner(t,null,e))}let r=this.findPlace(t,e,n);if(r){this.closeExtra();let e=this.top;e.match&&(e.match=e.match.matchType(t.type));let n=o.none;for(let i of r.concat(t.marks))(e.type?e.type.allowsMarkType(i.type):U(i.type,t.type))&&(n=i.addToSet(n));return e.content.push(t.mark(n)),!0}return!1}enter(t,e,n,r){let i=this.findPlace(t.create(e),n,!1);return i&&(i=this.enterInner(t,e,n,!0,r)),i}enterInner(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4?arguments[4]:void 0;this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(t);let l=P(t,i,s.options);4&s.options&&0==s.content.length&&(l|=4);let h=o.none;return n=n.filter(e=>(s.type?!s.type.allowsMarkType(e.type):!U(e.type,t))||(h=e.addToSet(h),!1)),this.nodes.push(new q(t,e,h,r,null,l)),this.open++,n}closeExtra(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(t){for(let e=this.open;e>=0;e--)if(this.nodes[e]==t)return this.open=e,!0;else this.localPreserveWS&&(this.nodes[e].options|=1);return!1}get currentPos(){this.closeExtra();let t=0;for(let e=this.open;e>=0;e--){let n=this.nodes[e].content;for(let e=n.length-1;e>=0;e--)t+=n[e].nodeSize;e&&t++}return t}findAtPoint(t,e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&this.find[n].offset==e&&(this.find[n].pos=this.currentPos)}findInside(t){if(this.find)for(let e=0;e<this.find.length;e++)null==this.find[e].pos&&1==t.nodeType&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)}findAround(t,e,n){if(t!=e&&this.find)for(let r=0;r<this.find.length;r++)null==this.find[r].pos&&1==t.nodeType&&t.contains(this.find[r].node)&&e.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let e=t.split("/"),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,s=(t,o)=>{for(;t>=0;t--){let l=e[t];if(""==l){if(t==e.length-1||0==t)continue;for(;o>=i;o--)if(s(t-1,o))return!0;return!1}
2{let t=o>0||0==o&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!t||t.name!=l&&!t.isInGroup(l))return!1;o--}}return!0};return s(e.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let e=t.depth;e>=0;e--){let n=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let e=this.parser.schema.nodes[t];if(e.isTextblock&&e.defaultAttrs)return e}}constructor(t,e,n){this.parser=t,this.options=e,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=e.topNode,i,s=P(null,e.preserveWhitespace,0)|4*!!n;i=r?new q(r.type,r.attrs,o.none,!0,e.topMatch||r.type.contentMatch,s):n?new q(null,null,o.none,!0,null,s):new q(t.schema.topNodeType,null,o.none,!0,null,s),this.nodes=[i],this.find=e.findPositions,this.needsBlock=!1}}function _(t){let e={};for(let n in t)e[n]=t[n];return e}function U(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=t=>{s.push(t);for(let n=0;n<t.edgeCount;n++){let{type:r,next:i}=t.edge(n);if(r==e||0>s.indexOf(i)&&o(i))return!0}};if(o(i.contentMatch))return!0}}class K{serializeFragment(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;n||(n=G(e).createDocumentFragment());let r=n,i=[];return t.forEach(t=>{if(i.length||t.marks.length){let n=0,s=0;for(;n<i.length&&s<t.marks.length;){let e=t.marks[s];if(!this.marks[e.type.name]){s++;continue}if(!e.eq(i[n][0])||!1===e.type.spec.spanning)break;n++,s++}for(;n<i.length;)r=i.pop()[1];for(;s<t.marks.length;){let n=t.marks[s++],o=this.serializeMark(n,t.isInline,e);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(t,e))}),n}serializeNodeInner(t,e){let{dom:n,contentDOM:r}=Q(G(e),this.nodes[t.type.name](t),null,t.attrs);if(r){if(t.isLeaf)throw RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,e,r)}return n}serializeNode(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.serializeNodeInner(t,e);for(let r=t.marks.length-1;r>=0;r--){let i=this.serializeMark(t.marks[r],t.isInline,e);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.marks[t.type.name];return r&&Q(G(n),r(t,e),null,t.attrs)}static renderSpec(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3?arguments[3]:void 0;return Q(t,e,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new K(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let e=V(t.nodes);return e.text||(e.text=t=>t.text),e}static marksFromSchema(t){return V(t.marks)}constructor(t,e){this.nodes=t,this.marks=e}}function V(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function G(t){return t.document||window.document}let H=new WeakMap;function Q(t,e,n,r){let i,s,o;if("string"==typeof e)return{dom:t.createTextNode(e)};if(null!=e.nodeType)return{dom:e};if(e.dom&&null!=e.dom.nodeType)return e;let l=e[0],h;if("string"!=typeof l)throw RangeError("Invalid array passed to renderSpec");if(r&&(void 0===(s=H.get(r))&&H.set(r,(o=null,!function t(e){if(e&&"object"==typeof e)if(Array.isArray(e))if("string"==typeof e[0])o||(o=[]),o.push(e);else for(let n=0;n<e.length;n++)t(e[n]);else for(let n in e)t(e[n])}(r),s=o)),h=s)&&h.indexOf(e)>-1)throw RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let a=l.indexOf(" ");a>0&&(n=l.slice(0,a),l=l.slice(a+1));let c=n?t.createElementNS(n,l):t.createElement(l),p=e[1],d=1;if(p&&"object"==typeof p&&null==p.nodeType&&!Array.isArray(p)){for(let t in d=2,p)if(null!=p[t]){let e=t.indexOf(" ");e>0?c.setAttributeNS(t.slice(0,e),t.slice(e+1),p[t]):"style"==t&&c.style?c.style.cssText=p[t]:c.setAttribute(t,p[t])}}for(let s=d;s<e.length;s++){let o=e[s];if(0===o){if(s<e.length-1||s>d)throw RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}{let{dom:e,contentDOM:s}=Q(t,o,n,r);if(c.appendChild(e),s){if(i)throw RangeError("Multiple content holes");i=s}}}return{dom:c,contentDOM:i}}t.s(["DOMParser",0,$,"DOMSerializer",0,K,"Fragment",0,n,"Mark",0,o,"MarkType",0,F,"Node",0,v,"NodeRange",0,x,"ReplaceError",0,l,"Schema",0,class{node(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if("string"==typeof t)t=this.nodeType(t);else if(t instanceof z){if(t.schema!=this)throw RangeError("Node type from different schema used ("+t.name+")")}else throw RangeError("Invalid node type: "+t);return t.createChecked(e,n,r)}text(t,e){let n=this.nodes.text;return new S(n,n.defaultAttrs,t,o.setFrom(e))}mark(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)}nodeType(t){let e=this.nodes[t];
2if(!e)throw RangeError("Unknown node type: "+t);return e}constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let e in t)n[e]=t[e];n.nodes=e.from(t.nodes),n.marks=e.from(t.marks||{}),this.nodes=z.compile(this.spec.nodes,this),this.marks=F.compile(this.spec.marks,this);let r=Object.create(null);for(let t in this.nodes){if(t in this.marks)throw RangeError(t+" can not be both a node and a mark");let e=this.nodes[t],n=e.spec.content||"",i=e.spec.marks;if(e.contentMatch=r[n]||(r[n]=M.parse(n,this.nodes)),e.inlineContent=e.contentMatch.inlineContent,e.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError("Multiple linebreak nodes defined");if(!e.isInline||!e.isLeaf)throw RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=e}e.markSet="_"==i?null:i?B(this,i.split(" ")):""!=i&&e.inlineContent?null:[]}for(let t in this.marks){let e=this.marks[t],n=e.spec.excludes;e.excluded=null==n?[e]:""==n?[]:B(this,n.split(" "))}this.nodeFromJSON=t=>v.fromJSON(this,t),this.markFromJSON=t=>o.fromJSON(this,t),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}},"Slice",0,h],711379);class X{get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}constructor(t,e,n){this.pos=t,this.delInfo=e,this.recover=n}}class Y{recover(t){let e=0,n=65535&t;if(!this.inverted)for(let t=0;t<n;t++)e+=this.ranges[3*t+2]-this.ranges[3*t+1];return this.ranges[3*n]+e+(t-(65535&t))/65536}mapResult(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(t,e,!1)}map(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(t,e,!0)}_map(t,e,n){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?r:0);if(l>t)break;let h=this.ranges[o+i],a=this.ranges[o+s],c=l+h;if(t<=c){let i=h?t==l?-1:t==c?1:e:e,s=l+r+(i<0?0:a);if(n)return s;let p=t==(e<0?l:c)?null:o/3+(t-l)*65536,d=t==l?2:t==c?1:4;return(e<0?t!=l:t!=c)&&(d|=8),new X(s,d,p)}r+=a-h}return n?t+r:new X(t+r,0,null)}touches(t,e){let n=0,r=65535&e,i=this.inverted?2:1,s=this.inverted?1:2;for(let e=0;e<this.ranges.length;e+=3){let o=this.ranges[e]-(this.inverted?n:0);if(o>t)break;let l=this.ranges[e+i];if(t<=o+l&&e==3*r)return!0;n+=this.ranges[e+s]-l}return!1}forEach(t){let e=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],o=s-(this.inverted?i:0),l=s+(this.inverted?0:i),h=this.ranges[r+e],a=this.ranges[r+n];t(o,o+h,l,l+a),i+=a-h}}invert(){return new Y(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return 0==t?Y.empty:new Y(t<0?[0,-t,0]:[0,0,t])}constructor(t,e=!1){if(this.ranges=t,this.inverted=e,!t.length&&Y.empty)return Y.empty}}Y.empty=new Y([]);class Z{get maps(){return this._maps}slice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.maps.length;return new Z(this._maps,this.mirror,t,e)}appendMap(t,e){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(t),null!=e&&this.setMirror(this._maps.length-1,e)}appendMapping(t){for(let e=0,n=this._maps.length;e<t._maps.length;e++){let r=t.getMirror(e);this.appendMap(t._maps[e],null!=r&&r<e?n+r:void 0)}}getMirror(t){if(this.mirror){for(let e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]}}setMirror(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)}appendMappingInverted(t){for(let e=t.maps.length-1,n=this._maps.length+t._maps.length;e>=0;e--){let r=t.getMirror(e);this.appendMap(t._maps[e].invert(),null!=r&&r>e?n-r-1:void 0)}}invert(){let t=new Z;return t.appendMappingInverted(this),t}map(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(this.mirror)return this._map(t,e,!0);for(let n=this.from;n<this.to;n++)t=this._maps[n].map(t,e);return t}mapResult(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(t,e,!1)}_map(t,e,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(t,e);if(null!=i.recover){let e=this.getMirror(n);if(null!=e&&e>n&&e<this.to){n=e,t=this._maps[e].recover(i.recover);continue}}r|=i.delInfo,t=i.pos}return n?t:new X(t,r,null)}constructor(t,e,n=0,r=t?t.length:0){this.mirror=e,this.from=n,this.to=r,this._maps=t||[],this.ownData=!(t||e)}}let tt=Object.create(null);class te{getMap(){return Y.empty}merge(t){return null}static fromJSON(t,e){if(!e||!e.stepType)throw RangeError("Invalid input for Step.fromJSON");let n=tt[e.stepType];if(!n)throw RangeError("No step type ".concat(e.stepType," defined"));return n.fromJSON(t,e)}static jsonID(t,e){if(t in tt)throw RangeError("Duplicate use of step JSON ID "+t);return tt[t]=e,e.prototype.jsonID=t,e}}class tn{static ok(t){return new tn(t,null)}static fail(t){return new tn(null,t)}static fromReplace(t,e,n,r){try{return tn.ok(t.replace(e,n,r))}catch(t){if(t instanceof l)return tn.fail(t.message);throw t}}constructor(t,e){this.doc=t,this.failed=e}}function tr(t,e,r){let i=[];for(let n=0;n<t.childCount;n++){let s=t.child(n);s.content.size&&(s=s.copy(tr(s.content,e,s))),s.isInline&&(s=e(s,r,n)),i.push(s)}return n.fromArray(i)}class ti extends te{apply(t){let e=t.slice(this.from,this.to),n=t.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new h(tr(e.content,(t,e)=>t.isAtom&&e.type.allowsMarkType(this.mark.type)?t.mark(this.mark.addToSet(t.marks)):t,r),e.openStart,e.openEnd);return tn.fromReplace(t,this.from,this.to,i)}invert(){return new ts(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return e.deleted&&n.deleted||e.pos>=n.pos?null:new ti(e.pos,n.pos,this.mark)}merge(t){return t instanceof ti&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new ti(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw RangeError("Invalid input for AddMarkStep.fromJSON");return new ti(e.from,e.to,t.markFromJSON(e.mark))}constructor(t,e,n){super(),this.from=t,this.to=e,this.mark=n}}te.jsonID("addMark",ti);class ts extends te{apply(t){let e=t.slice(this.from,this.to),n=new h(tr(e.content,t=>t.mark(this.mark.removeFromSet(t.marks)),t),e.openStart,e.openEnd);return tn.fromReplace(t,this.from,this.to,n)}invert(){return new ti(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return e.deleted&&n.deleted||e.pos>=n.pos?null:new ts(e.pos,n.pos,this.mark)}merge(t){return t instanceof ts&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new ts(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ts(e.from,e.to,t.markFromJSON(e.mark))}constructor(t,e,n){super(),this.from=t,this.to=e,this.mark=n}}te.jsonID("removeMark",ts);class to extends te{apply(t){let e=t.nodeAt(this.pos);if(!e)return tn.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return tn.fromReplace(t,this.pos,this.pos+1,new h(n.from(r),0,+!e.isLeaf))}invert(t){let e=t.nodeAt(this.pos);if(e){let t=this.mark.addToSet(e.marks);if(t.length==e.marks.length){for(let n=0;n<e.marks.length;n++)if(!e.marks[n].isInSet(t))return new to(this.pos,e.marks[n]);return new to(this.pos,this.mark)}}return new tl(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new to(e.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if("number"!=typeof e.pos)throw RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new to(e.pos,t.markFromJSON(e.mark))}constructor(t,e){super(),this.pos=t,this.mark=e}}te.jsonID("addNodeMark",to);class tl extends te{apply(t){let e=t.nodeAt(this.pos);if(!e)return tn.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.removeFromSet(e.marks));return tn.fromReplace(t,this.pos,this.pos+1,new h(n.from(r),0,+!e.isLeaf))}invert(t){let e=t.nodeAt(this.pos);return e&&this.mark.isInSet(e.marks)?new to(this.pos,this.mark):this}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new tl(e.pos,this.mark)}
2toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if("number"!=typeof e.pos)throw RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new tl(e.pos,t.markFromJSON(e.mark))}constructor(t,e){super(),this.pos=t,this.mark=e}}te.jsonID("removeNodeMark",tl);class th extends te{apply(t){return this.structure&&tc(t,this.from,this.to)?tn.fail("Structure replace would overwrite content"):tn.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Y([this.from,this.to-this.from,this.slice.size])}invert(t){return new th(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return e.deletedAcross&&n.deletedAcross?null:new th(e.pos,Math.max(e.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof th)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart)if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;else{let e=this.slice.size+t.slice.size==0?h.empty:new h(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new th(t.from,this.to,e,this.structure)}{let e=this.slice.size+t.slice.size==0?h.empty:new h(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new th(this.from,this.to+(t.to-t.from),e,this.structure)}}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw RangeError("Invalid input for ReplaceStep.fromJSON");return new th(e.from,e.to,h.fromJSON(t,e.slice),!!e.structure)}constructor(t,e,n,r=!1){super(),this.from=t,this.to=e,this.slice=n,this.structure=r}}te.jsonID("replace",th);class ta extends te{apply(t){if(this.structure&&(tc(t,this.from,this.gapFrom)||tc(t,this.gapTo,this.to)))return tn.fail("Structure gap-replace would overwrite content");let e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return tn.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,e.content);return n?tn.fromReplace(t,this.from,this.to,n):tn.fail("Content does not fit in gap")}getMap(){return new Y([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let e=this.gapTo-this.gapFrom;return new ta(this.from,this.from+this.slice.size+e,this.from+this.insert,this.from+this.insert+e,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1),r=this.from==this.gapFrom?e.pos:t.map(this.gapFrom,-1),i=this.to==this.gapTo?n.pos:t.map(this.gapTo,1);return e.deletedAcross&&n.deletedAcross||r<e.pos||i>n.pos?null:new ta(e.pos,n.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to||"number"!=typeof e.gapFrom||"number"!=typeof e.gapTo||"number"!=typeof e.insert)throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ta(e.from,e.to,e.gapFrom,e.gapTo,h.fromJSON(t,e.slice),e.insert,!!e.structure)}constructor(t,e,n,r,i,s,o=!1){super(),this.from=t,this.to=e,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=s,this.structure=o}}function tc(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let t=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!t||t.isLeaf)return!0;t=t.firstChild,i--}}return!1}function tp(t,e,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:r.contentMatch,s=!(arguments.length>4)||void 0===arguments[4]||arguments[4],o=t.doc.nodeAt(e),l=[],a=e+1;for(let e=0;e<o.childCount;e++){let c=o.child(e),p=a+c.nodeSize,d=i.matchType(c.type);if(d){i=d;for(let e=0;e<c.marks.length;e++)r.allowsMarkType(c.marks[e].type)||t.step(new ts(a,p,c.marks[e]));if(s&&c.isText&&"pre"!=r.whitespace){let t,e=/\r?\n|\r/g,i;for(;t=e.exec(c.text);)i||(i=new h(n.from(r.schema.text(" ",r.allowedMarks(c.marks))),0,0)),l.push(new th(a+t.index,a+t.index+t[0].length,i))}}else l.push(new th(a,p,h.empty));a=p}if(!i.validEnd){let e=i.fillBefore(n.empty,!0);t.replace(a,a,new h(e,0,0))}for(let e=l.length-1;e>=0;
2e--)t.step(l[e])}function td(t){return{type:t,attrs:null}}function tu(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let i=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(i,i+1,e.type.schema.linebreakReplacement.create())}}})}function tf(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let i=t.mapping.slice(r).map(n+1+s);t.replaceWith(i,i+1,e.type.schema.text("\n"))}})}function tm(t,e){return!!(t&&e&&!t.isLeaf&&function(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?t.type.schema.nodes.text:s.type;if(!(n=n.matchType(o))||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}(t,e))}function tg(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:h.empty;if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return ty(i,s,r)?new th(e,n,r):new tk(i,s,r).fit()}function ty(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}te.jsonID("replaceAround",ta);class tk{get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),e=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(t<0?this.$to:n.doc.resolve(t));if(!r)return null;let i=this.placed,s=n.depth,o=r.depth;for(;s&&o&&1==i.childCount;)i=i.firstChild.content,s--,o--;let l=new h(i,s,o);return t>-1?new ta(n.pos,t,this.$to.pos,this.$to.end(),l,e):l.size||n.pos!=this.$to.pos?new th(n.pos,r.pos,l):null}findFittable(){let t=this.unplaced.openStart;for(let e=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<t;n++){let i=e.firstChild;if(e.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){t=n;break}e=i.content}for(let e=1;e<=2;e++)for(let r=1==e?t:this.unplaced.openStart;r>=0;r--){let t=null,i=(r?(t=tv(this.unplaced.content,r-1).firstChild).content:this.unplaced.content).firstChild;for(let s=this.depth;s>=0;s--){let{type:o,match:l}=this.frontier[s],h,a=null;if(1==e&&(i?l.matchType(i.type)||(a=l.fillBefore(n.from(i),!1)):t&&o.compatibleContent(t.type)))return{sliceDepth:r,frontierDepth:s,parent:t,inject:a};if(2==e&&i&&(h=l.findWrapping(i.type)))return{sliceDepth:r,frontierDepth:s,parent:t,wrap:h};if(t&&l.matchType(t.type))break}}}openMore(){let{content:t,openStart:e,openEnd:n}=this.unplaced,r=tv(t,e);return!!r.childCount&&!r.firstChild.isLeaf&&(this.unplaced=new h(t,e+1,Math.max(n,r.size+e>=t.size-n?e+1:0)),!0)}dropNode(){let{content:t,openStart:e,openEnd:n}=this.unplaced,r=tv(t,e);if(r.childCount<=1&&e>0){let i=t.size-e<=e+r.size;this.unplaced=new h(tx(t,e-1,1),e-1,i?e-1:n)}else this.unplaced=new h(tx(t,e,1),e,n)}placeNodes(t){let{sliceDepth:e,frontierDepth:r,parent:i,inject:s,wrap:o}=t;for(;this.depth>r;)this.closeFrontierNode();if(o)for(let t=0;t<o.length;t++)this.openFrontierNode(o[t]);let l=this.unplaced,a=i?i.content:l.content,c=l.openStart-e,p=0,d=[],{match:u,type:f}=this.frontier[r];if(s){for(let t=0;t<s.childCount;t++)d.push(s.child(t));u=u.matchFragment(s)}let m=a.size+e-(l.content.size-l.openEnd);for(;p<a.childCount;){let t=a.child(p),e=u.matchType(t.type);if(!e)break;(++p>1||0==c||t.content.size)&&(u=e,d.push(function t(e,r,i){if(r<=0)return e;let s=e.content;return r>1&&(s=s.replaceChild(0,t(s.firstChild,r-1,1==s.childCount?i-1:0))),r>0&&(s=e.type.contentMatch.fillBefore(s).append(s),i<=0&&(s=s.append(e.type.contentMatch.matchFragment(s).fillBefore(n.empty,!0)))),e.copy(s)}(t.mark(f.allowedMarks(t.marks)),1==p?c:0,p==a.childCount?m:-1)))}let g=p==a.childCount;g||(m=-1),this.placed=tw(this.placed,r,n.from(d)),this.frontier[r].match=u,g&&m<0&&i&&i.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let t=0,e=a;t<m;t++){let t=e.lastChild;this.frontier.push({type:t.type,match:t.contentMatchAt(t.childCount)}),e=t.content}this.unplaced=g?0==e?h.empty:new h(tx(l.content,e-1,1),e-1,m<0?l.openEnd:e-1):new h(tx(l.content,e,p),l.openStart,l.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return -1;let t=this.frontier[this.depth],e;if(!t.type.isTextblock||!tS(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return -1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(t){e:for(let e=Math.min(this.depth,t.depth);e>=0;e--){let{match:n,type:r}=this.frontier[e],i=e<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1)),s=tS(t,e,r,n,i);if(s){for(let n=e-1;n>=0;n--){let{match:e,type:r}=this.frontier[n],i=tS(t,n,r,e,!0);if(!i||i.childCount)continue e}return{depth:e,fit:s,move:i?t.doc.resolve(t.after(e+1)):t}}}}close(t){let e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=tw(this.placed,e.depth,e.fit)),t=e.move;for(let n=e.depth+1;n<=t.depth;
2n++){let e=t.node(n),r=e.type.contentMatch.fillBefore(e.content,!0,t.index(n));this.openFrontierNode(e.type,e.attrs,r)}return t}openFrontierNode(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2?arguments[2]:void 0,i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=tw(this.placed,this.depth,n.from(t.create(e,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(n.empty,!0);t.childCount&&(this.placed=tw(this.placed,this.frontier.length,t))}constructor(t,e,r){this.$from=t,this.$to=e,this.unplaced=r,this.frontier=[],this.placed=n.empty;for(let e=0;e<=t.depth;e++){let n=t.node(e);this.frontier.push({type:n.type,match:n.contentMatchAt(t.indexAfter(e))})}for(let e=t.depth;e>0;e--)this.placed=n.from(t.node(e).copy(this.placed))}}function tx(t,e,n){return 0==e?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(tx(t.firstChild.content,e-1,n)))}function tw(t,e,n){return 0==e?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(tw(t.lastChild.content,e-1,n)))}function tv(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function tS(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,o);return l&&!function(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}(n,s.content,o)?l:null}function tb(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let r=t.start(i);if(r<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(r==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==r-1)&&n.push(i)}return n}class tM extends te{apply(t){let e=t.nodeAt(this.pos);if(!e)return tn.fail("No node at attribute step's position");let r=Object.create(null);for(let t in e.attrs)r[t]=e.attrs[t];r[this.attr]=this.value;let i=e.type.create(r,null,e.marks);return tn.fromReplace(t,this.pos,this.pos+1,new h(n.from(i),0,+!e.isLeaf))}getMap(){return Y.empty}invert(t){return new tM(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new tM(e.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,e){if("number"!=typeof e.pos||"string"!=typeof e.attr)throw RangeError("Invalid input for AttrStep.fromJSON");return new tM(e.pos,e.attr,e.value)}constructor(t,e,n){super(),this.pos=t,this.attr=e,this.value=n}}te.jsonID("attr",tM);class tC extends te{apply(t){let e=Object.create(null);for(let n in t.attrs)e[n]=t.attrs[n];e[this.attr]=this.value;let n=t.type.create(e,t.content,t.marks);return tn.ok(n)}getMap(){return Y.empty}invert(t){return new tC(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,e){if("string"!=typeof e.attr)throw RangeError("Invalid input for DocAttrStep.fromJSON");return new tC(e.attr,e.value)}constructor(t,e){super(),this.attr=t,this.value=e}}te.jsonID("docAttr",tC);let tO=class extends Error{};(tO=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n}).prototype=Object.create(Error.prototype),tO.prototype.constructor=tO,tO.prototype.name="TransformError";class tN{get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let e=this.maybeStep(t);if(e.failed)throw new tO(e.failed);return this}maybeStep(t){let e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e}get docChanged(){return this.steps.length>0}changedRange(){let t=1e9,e=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(t=r.map(t,1),e=r.map(e,-1)),r.forEach((n,r,i,s)=>{t=Math.min(t,i),e=Math.max(e,s)})}return 1e9==t?null:{from:t,to:e}}addStep(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e}replace(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:h.empty,r=tg(this.doc,t,e,n);return r&&this.step(r),this}replaceWith(t,e,r){return this.replace(t,e,new h(n.from(r),0,0))}delete(t,e){return this.replace(t,e,h.empty)}insert(t,e){return this.replaceWith(t,t,e)}replaceRange(t,e,r){return!function(t,e,r,i){if(!i.size)return t.deleteRange(e,r);let s=t.doc.resolve(e),o=t.doc.resolve(r);if(ty(s,o,i))return t.step(new th(e,r,i));let l=tb(s,o);0==l[l.length-1]&&l.pop();let a=-(s.depth+1);l.unshift(a);for(let t=s.depth,e=s.pos-1;t>0;t--,e--){let n=s.node(t).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;l.indexOf(t)>-1?a=t:s.before(t)==e&&l.splice(1,0,-t)}let c=l.indexOf(a),p=[],d=i.openStart;for(let t=i.content,e=0;;e++){let n=t.firstChild;if(p.push(n),e==i.openStart)break;t=n.content}for(let t=d-1;t>=0;t--){var u;let e=p[t],n=(u=e.type).spec.defining||u.spec.definingForContent;if(n&&!e.sameMarkup(s.node(Math.abs(a)-1)))d=t;else if(n||!e.type.isTextblock)break}for(let e=i.openStart;e>=0;e--){let a=(e+d+1)%(i.openStart+1),u=p[a];if(u)for(let e=0;e<l.length;e++){let p=l[(e+c)%l.length],d=!0;p<0&&(d=!1,p=-p);let f=s.node(p-1),m=s.index(p-1);if(f.canReplaceWith(m,m,u.type,u.marks))return t.replace(s.before(p),d?o.after(p):r,new h(function t(e,r,i,s,o){if(r<i){let n=e.firstChild;e=e.replaceChild(0,n.copy(t(n.content,r+1,i,s,n)))}if(r>
2s){let t=o.contentMatchAt(0),r=t.fillBefore(e).append(e);e=r.append(t.matchFragment(r).fillBefore(n.empty,!0))}return e}(i.content,0,i.openStart,a),a,i.openEnd))}}let f=t.steps.length;for(let n=l.length-1;n>=0&&(t.replace(e,r,i),!(t.steps.length>f));n--){let t=l[n];t<0||(e=s.before(t),r=o.after(t))}}(this,t,e,r),this}replaceRangeWith(t,e,r){var i=t,s=e;if(!r.isInline&&i==s&&this.doc.resolve(i).parent.content.size){let t=function(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(0==r.parentOffset)for(let t=r.depth-1;t>=0;t--){let e=r.index(t);if(r.node(t).canReplaceWith(e,e,n))return r.before(t+1);if(e>0)return null}if(r.parentOffset==r.parent.content.size)for(let t=r.depth-1;t>=0;t--){let e=r.indexAfter(t);if(r.node(t).canReplaceWith(e,e,n))return r.after(t+1);if(e<r.node(t).childCount)break}return null}(this.doc,i,r.type);null!=t&&(i=s=t)}return this.replaceRange(i,s,new h(n.from(r),0,0)),this}deleteRange(t,e){return!function(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=tb(r,i);for(let e=0;e<s.length;e++){let n=s[e],o=e==s.length-1;if(o&&0==n||r.node(n).type.contentMatch.validEnd)return t.delete(r.start(n),i.end(n));if(n>0&&(o||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return t.delete(r.before(n),i.after(n))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&i.end(s)-n!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}(this,t,e),this}lift(t,e){return!function(t,e,r){let{$from:i,$to:s,depth:o}=e,l=i.before(o+1),a=s.after(o+1),c=l,p=a,d=n.empty,u=0;for(let t=o,e=!1;t>r;t--)e||i.index(t)>0?(e=!0,d=n.from(i.node(t).copy(d)),u++):c--;let f=n.empty,m=0;for(let t=o,e=!1;t>r;t--)e||s.after(t+1)<s.end(t)?(e=!0,f=n.from(s.node(t).copy(f)),m++):p++;t.step(new ta(c,p,l,a,new h(d.append(f),u,m),d.size-u,!0))}(this,t,e),this}join(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return!function(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(i&&o.inlineContent){let t="pre"==o.whitespace,e=!!o.contentMatch.matchType(i);t&&!e?r=!1:!t&&e&&(r=!0)}let l=t.steps.length;if(!1===r){let r=t.doc.resolve(e+n);tf(t,r.node(),r.before(),l)}o.inlineContent&&tp(t,e+n-1,o,s.node().contentMatchAt(s.index()),null==r);let a=t.mapping.slice(l),c=a.map(e-n);if(t.step(new th(c,a.map(e+n,-1),h.empty,!0)),!0===r){let e=t.doc.resolve(c);tu(t,e.node(),e.before(),t.steps.length)}}(this,t,e),this}wrap(t,e){return!function(t,e,r){let i=n.empty;for(let t=r.length-1;t>=0;t--){if(i.size){let e=r[t].type.contentMatch.matchFragment(i);if(!e||!e.validEnd)throw RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=n.from(r[t].type.create(r[t].attrs,i))}let s=e.start,o=e.end;t.step(new ta(s,o,s,o,new h(i,0,0),r.length,!0))}(this,t,e),this}setBlockType(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;var s=this;if(!r.isTextblock)throw RangeError("Type given to setBlockType should be a textblock");let o=s.steps.length;return s.doc.nodesBetween(t,e,(t,e)=>{var l,a,c;let p,d,u="function"==typeof i?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,u)&&(l=s.doc,a=s.mapping.slice(o).map(e),c=r,d=(p=l.resolve(a)).index(),p.parent.canReplaceWith(d,d+1,c))){let i=null;if(r.schema.linebreakReplacement){let t="pre"==r.whitespace,e=!!r.contentMatch.matchType(r.schema.linebreakReplacement);t&&!e?i=!1:!t&&e&&(i=!0)}!1===i&&tf(s,t,e,o),tp(s,s.mapping.slice(o).map(e,1),r,void 0,null===i);let l=s.mapping.slice(o),a=l.map(e,1),c=l.map(e+t.nodeSize,1);return s.step(new ta(a,c,a+1,c-1,new h(n.from(r.create(u,null,t.marks)),0,0),1,!0)),!0===i&&tu(s,t,e,o),!1}}),this}setNodeMarkup(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3?arguments[3]:void 0;return!function(t,e,r,i,s){let o=t.doc.nodeAt(e);if(!o)throw RangeError("No node at given position");r||(r=o.type);let l=r.create(i,null,s||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,l);if(!r.validContent(o.content))throw RangeError("Invalid content for node type "+r.name);t.step(new ta(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new h(n.from(l),0,0),1,!0))}(this,t,e,r,i),this}setNodeAttribute(t,e,n){return this.step(new tM(t,e,n)),this}setDocAttribute(t,e){return this.step(new tC(t,e)),this}addNodeMark(t,e){return this.step(new to(t,e)),this}
2removeNodeMark(t,e){let n=this.doc.nodeAt(t);if(!n)throw RangeError("No node at position "+t);if(e instanceof o)e.isInSet(n.marks)&&this.step(new tl(t,e));else{let r=n.marks,i,s=[];for(;i=e.isInSet(r);)s.push(new tl(t,i)),r=i.removeFromSet(r);for(let t=s.length-1;t>=0;t--)this.step(s[t])}return this}split(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2?arguments[2]:void 0;return!function(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3?arguments[3]:void 0,s=t.doc.resolve(e),o=n.empty,l=n.empty;for(let t=s.depth,e=s.depth-r,h=r-1;t>e;t--,h--){o=n.from(s.node(t).copy(o));let e=i&&i[h];l=n.from(e?e.type.create(e.attrs,l):s.node(t).copy(l))}t.step(new th(e,e,new h(o.append(l),r,r),!0))}(this,t,e,r),this}addMark(t,e,n){var r;let i,s,o,l;return r=this,o=[],l=[],r.doc.nodesBetween(t,e,(r,h,a)=>{if(!r.isInline)return;let c=r.marks;if(!n.isInSet(c)&&a.type.allowsMarkType(n.type)){let a=Math.max(h,t),p=Math.min(h+r.nodeSize,e),d=n.addToSet(c);for(let t=0;t<c.length;t++)c[t].isInSet(d)||(i&&i.to==a&&i.mark.eq(c[t])?i.to=p:o.push(i=new ts(a,p,c[t])));s&&s.to==a?s.to=p:l.push(s=new ti(a,p,n))}}),o.forEach(t=>r.step(t)),l.forEach(t=>r.step(t)),this}removeMark(t,e,n){var r;let i,s;return r=this,i=[],s=0,r.doc.nodesBetween(t,e,(r,o)=>{if(!r.isInline)return;s++;let l=null;if(n instanceof F){let t=r.marks,e;for(;e=n.isInSet(t);)(l||(l=[])).push(e),t=e.removeFromSet(t)}else n?n.isInSet(r.marks)&&(l=[n]):l=r.marks;if(l&&l.length){let n=Math.min(o+r.nodeSize,e);for(let e=0;e<l.length;e++){let r=l[e],h;for(let t=0;t<i.length;t++){let e=i[t];e.step==s-1&&r.eq(i[t].style)&&(h=e)}h?(h.to=n,h.step=s):i.push({style:r,from:Math.max(o,t),to:n,step:s})}}}
2),i.forEach(t=>r.step(new ts(t.from,t.to,t.style))),this}clearIncompatible(t,e,n){return tp(this,t,e,n),this}constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new Z}}t.s(["Mapping",0,Z,"ReplaceAroundStep",0,ta,"ReplaceStep",0,th,"Transform",0,tN,"canJoin",0,function(t,e){let n=t.resolve(e),r=n.index();return tm(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)},"canSplit",0,function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0,i=t.resolve(e),s=i.depth-n,o=r&&r[r.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 t=i.depth-1,e=n-2;t>s;t--,e--){let n=i.node(t),s=i.index(t);if(n.type.spec.isolating)return!1;let o=n.content.cutByIndex(s,n.childCount),l=r&&r[e+1];l&&(o=o.replaceChild(0,l.type.create(l.attrs)));let h=r&&r[e]||n;if(!n.canReplace(s+1,n.childCount)||!h.type.validContent(o))return!1}let l=i.indexAfter(s),h=r&&r[0];return i.node(s).canReplaceWith(l,l,h?h.type:i.node(s+1).type)},"dropPoint",0,function(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let t=0;t<n.openStart;t++)i=i.firstChild.content;for(let t=1;t<=(0==n.openStart&&n.size?2:1);t++)for(let e=r.depth;e>=0;e--){let n=e==r.depth?0:r.pos<=(r.start(e+1)+r.end(e+1))/2?-1:1,s=r.index(e)+ +(n>0),o=r.node(e),l=!1;if(1==t)l=o.canReplace(s,s,i);else{let t=o.contentMatchAt(s).findWrapping(i.firstChild.type);l=t&&o.canReplaceWith(s,s,t[0])}if(l)return 0==n?r.pos:n<0?r.before(e+1):r.after(e+1)}return null},"findWrapping",0,function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t,i=function(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}(t,e),s=i&&function(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let t=r;l&&t<i;t++)l=l.matchType(n.child(t).type);return l&&l.validEnd?o:null}(r,e);return s?i.map(td).concat({type:e,attrs:n}).concat(s.map(td)):null},"joinPoint",0,function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=t.resolve(e);for(let t=r.depth;;t--){let i,s,o=r.index(t);if(t==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(t+1),o++,s=r.node(t).maybeChild(o)):(i=r.node(t).maybeChild(o-1),s=r.node(t+1)),i&&!i.isTextblock&&tm(i,s)&&r.node(t).canReplace(o,o+1))return e;if(0==t)break;e=n<0?r.before(t):r.after(t)}},"liftTarget",0,function(t){let e=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let n=t.depth,r=0,i=0;;--n){let s=t.$from.node(n),o=t.$from.index(n)+r,l=t.$to.indexAfter(n)-i;if(n<t.depth&&s.canReplace(o,l,e))return n;if(0==n||s.type.spec.isolating||!((0==o||s.canReplace(o,s.childCount))&&(l==s.childCount||s.canReplace(0,l))))break;o&&(r=1),l<s.childCount&&(i=1)}return null},"replaceStep",0,tg],800390);let tT=Object.create(null);class tE{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 t=this.ranges;for(let e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:h.empty,n=e.content.lastChild,r=null;for(let t=0;t<e.openEnd;t++)r=n,n=n.lastChild;let i=t.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:l,$to:a}=s[o],c=t.mapping.slice(i);t.replaceRange(c.map(l.pos),c.map(a.pos),o?h.empty:e),0==o&&tW(t,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(t,e){let n=t.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:o}=r[i],l=t.mapping.slice(n),h=l.map(s.pos),a=l.map(o.pos);i?t.deleteRange(h,a):(t.replaceRangeWith(h,a,e),tW(t,n,e.isInline?-1:1))}}static findFrom(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t.parent.inlineContent?new tz(t):tj(t.node(0),t.parent,t.pos,t.index(),e,n);if(r)return r;for(let r=t.depth-1;r>=0;r--){let i=e<0?tj(t.node(0),t.node(r),t.before(r+1),t.index(r),e,n):tj(t.node(0),t.node(r),t.after(r+1),t.index(r)+1,e,n);if(i)return i}return null}static near(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.findFrom(t,e)||this.findFrom(t,-e)||new t$(t.node(0))}static atStart(t){return tj(t,t,0,0,1)||new t$(t)}static atEnd(t){return tj(t,t,t.content.size,t.childCount,-1)||new t$(t)}static fromJSON(t,e){if(!e||!e.type)throw RangeError("Invalid input for Selection.fromJSON");let n=tT[e.type];if(!n)throw RangeError("No selection type ".concat(e.type," defined"));return n.fromJSON(t,e)}static jsonID(t,e){if(t in tT)throw RangeError("Duplicate use of selection JSON ID "+t);return tT[t]=e,e.prototype.jsonID=t,e}getBookmark(){return tz.between(this.$anchor,this.$head).getBookmark()}constructor(t,e,n){this.$anchor=t,this.$head=e,this.ranges=n||[new tR(t.min(e),t.max(e))]}}tE.prototype.visible=!0;class tR{constructor(t,e){this.$from=t,this.$to=e}}let tA=!1;function tI(t){tA||t.parent.inlineContent||(tA=!0,console.warn("TextSelection endpoint not pointing into a
2node with inline content ("+t.parent.type.name+")"))}class tz extends tE{get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,e){let n=t.resolve(e.map(this.head));if(!n.parent.inlineContent)return tE.near(n);let r=t.resolve(e.map(this.anchor));return new tz(r.parent.inlineContent?r:n,n)}replace(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:h.empty;if(super.replace(t,e),e==h.empty){let e=this.$from.marksAcross(this.$to);e&&t.ensureMarks(e)}}eq(t){return t instanceof tz&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new tJ(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,e){if("number"!=typeof e.anchor||"number"!=typeof e.head)throw RangeError("Invalid input for TextSelection.fromJSON");return new tz(t.resolve(e.anchor),t.resolve(e.head))}static create(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=t.resolve(e);return new this(r,n==e?r:t.resolve(n))}static between(t,e,n){let r=t.pos-e.pos;if((!n||r)&&(n=r>=0?1:-1),!e.parent.inlineContent){let t=tE.findFrom(e,n,!0)||tE.findFrom(e,-n,!0);if(!t)return tE.near(e,n);e=t.$head}return t.parent.inlineContent||(0==r?t=e:(t=(tE.findFrom(t,-n,!0)||tE.findFrom(t,n,!0)).$anchor).pos<e.pos!=r<0&&(t=e)),new tz(t,e)}constructor(t,e=t){tI(t),tI(e),super(t,e)}}tE.jsonID("text",tz);class tJ{map(t){return new tJ(t.map(this.anchor),t.map(this.head))}resolve(t){return tz.between(t.resolve(this.anchor),t.resolve(this.head))}constructor(t,e){this.anchor=t,this.head=e}}class tF extends tE{map(t,e){let{deleted:n,pos:r}=e.mapResult(this.anchor),i=t.resolve(r);return n?tE.near(i):new tF(i)}content(){return new h(n.from(this.node),0,0)}eq(t){return t instanceof tF&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new tB(this.anchor)}static fromJSON(t,e){if("number"!=typeof e.anchor)throw RangeError("Invalid input for NodeSelection.fromJSON");return new tF(t.resolve(e.anchor))}static create(t,e){return new tF(t.resolve(e))}static isSelectable(t){return!t.isText&&!1!==t.type.spec.selectable}constructor(t){let e=t.nodeAfter,n=t.node(0).resolve(t.pos+e.nodeSize);super(t,n),this.node=e}}tF.prototype.visible=!1,tE.jsonID("node",tF);class tB{map(t){let{deleted:e,pos:n}=t.mapResult(this.anchor);return e?new tJ(n,n):new tB(n)}resolve(t){let e=t.resolve(this.anchor),n=e.nodeAfter;return n&&tF.isSelectable(n)?new tF(e):tE.near(e)}constructor(t){this.anchor=t}}class t$ extends tE{replace(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:h.empty;if(e==h.empty){t.delete(0,t.doc.content.size);let e=tE.atStart(t.doc);e.eq(t.selection)||t.setSelection(e)}else super.replace(t,e)}toJSON(){return{type:"all"}}static fromJSON(t){return new t$(t)}map(t){return new t$(t)}eq(t){return t instanceof t$}getBookmark(){return tD}constructor(t){super(t.resolve(0),t.resolve(t.content.size))}}tE.jsonID("all",t$);let tD={map(){return this},resolve:t=>new t$(t)};function tj(t,e,n,r,i){let s=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(e.inlineContent)return tz.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let r=e.child(o);if(r.isAtom){if(!s&&tF.isSelectable(r))return tF.create(t,n-(i<0?r.nodeSize:0))}else{let e=tj(t,r,n+i,i<0?r.childCount:0,i,s);if(e)return e}n+=r.nodeSize*i}return null}function tW(t,e,n){let r,i=t.steps.length-1;if(i<e)return;let s=t.steps[i];(s instanceof th||s instanceof ta)&&(t.mapping.maps[i].forEach((t,e,n,i)=>{null==r&&(r=i)}),t.setSelection(tE.near(t.doc.resolve(r),n)))}class tP extends tN{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(t){if(t.$from.doc!=this.doc)throw RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=(1|this.updated)&-3,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=2,this}ensureMarks(t){return o.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(t,e){super.addStep(t,e),this.updated=-3&this.updated,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t){let e=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=this.selection;return e&&(t=t.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||o.none))),n.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,e,n){let r=this.doc.type.schema;if(null==e)return t?this.replaceSelectionWith(r.text(t),!0):this.deleteSelection();{if(null==n&&(n=e),n=null==n?e:n,!t)return this.deleteRange(e,n);let i=this.storedMarks;if(!i){let t=this.doc.resolve(e);i=n==e?t.marks():t.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(e,n,r.text(t,i)),this.selection.empty||this.setSelection(tE.near(this.selection.$to)),this}}setMeta(t,e){return this.meta["string"==typeof t?t:t.key]=e,this}getMeta(t){return this.meta["string"==typeof t?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}}function tq(t,e){return e&&t?t.bind(e):t}class tL{constructor(t,e,n){this.name=t,this.init=tq(e.init,n),this.apply=tq(e.apply,n)}}let t_=[new tL("doc",{init:t=>t.doc||t.schema.topNodeType.createAndFill(),apply:t=>t.doc}),new tL("selection",{init:(t,e)=>t.selection||tE.atStart(e.doc),apply:t=>t.selection}),new tL("storedMarks",{init:t=>t.storedMarks||null,apply:(t,e,n,r)=>r.selection.$cursor?t.storedMarks:null}),new tL("scrollToSelection",{init:()=>0,apply:(t,e)=>t.scrolledIntoView?e+1:e})];class tU{constructor(t,e){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=t_.slice(),e&&e.forEach(t=>{if(this.pluginsByKey[t.key])throw RangeError("Adding different instances of a keyed plugin ("+t.key+")");this.plugins.push(t),this.pluginsByKey[t.key]=t,t.spec.state&&this.fields.push(new tL(t.key,t.spec.state,t))})}}class tK{get schema(){return this.config.schema}get plugins(){return this.config.plugins}
2apply(t){return this.applyTransaction(t).state}filterTransaction(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;for(let n=0;n<this.config.plugins.length;n++)if(n!=e){let e=this.config.plugins[n];if(e.spec.filterTransaction&&!e.spec.filterTransaction.call(e,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let e=[t],n=this.applyInner(t),r=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let o=this.config.plugins[s];if(o.spec.appendTransaction){let l=r?r[s].n:0,h=r?r[s].state:this,a=l<e.length&&o.spec.appendTransaction.call(o,l?e.slice(l):e,h,n);if(a&&n.filterTransaction(a,s)){if(a.setMeta("appendedTransaction",t),!r){r=[];for(let t=0;t<this.config.plugins.length;t++)r.push(t<s?{state:n,n:e.length}:{state:this,n:0})}e.push(a),n=n.applyInner(a),i=!0}r&&(r[s]={state:n,n:e.length})}}if(!i)return{state:n,transactions:e}}}applyInner(t){if(!t.before.eq(this.doc))throw RangeError("Applying a mismatched transaction");let e=new tK(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let i=n[r];e[i.name]=i.apply(t,this[i.name],this,e)}return e}get tr(){return new tP(this)}static create(t){let e=new tU(t.doc?t.doc.type.schema:t.schema,t.plugins),n=new tK(e);for(let r=0;r<e.fields.length;r++)n[e.fields[r].name]=e.fields[r].init(t,n);return n}reconfigure(t){let e=new tU(this.schema,t.plugins),n=e.fields,r=new tK(e);for(let e=0;e<n.length;e++){let i=n[e].name;r[i]=this.hasOwnProperty(i)?this[i]:n[e].init(t,r)}return r}toJSON(t){let e={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(e.storedMarks=this.storedMarks.map(t=>t.toJSON())),t&&"object"==typeof t)for(let n in t){if("doc"==n||"selection"==n)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=t[n],i=r.spec.state;i&&i.toJSON&&(e[n]=i.toJSON.call(r,this[r.key]))}return e}static fromJSON(t,e,n){if(!e)throw RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw RangeError("Required config field 'schema' missing");let r=new tU(t.schema,t.plugins),i=new tK(r);return r.fields.forEach(r=>{if("doc"==r.name)i.doc=v.fromJSON(t.schema,e.doc);else if("selection"==r.name)i.selection=tE.fromJSON(i.doc,e.selection);else if("storedMarks"==r.name)e.storedMarks&&(i.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(n)for(let s in n){let o=n[s],l=o.spec.state;if(o.key==r.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(e,s)){i[r.name]=l.fromJSON.call(o,t,e[s],i);return}}i[r.name]=r.init(t,i)}}),i}constructor(t){this.config=t}}let tV=Object.create(null);function tG(t){return t in tV?t+"$"+ ++tV[t]:(tV[t]=0,t+"$")}t.s(["AllSelection",0,t$,"EditorState",0,tK,"NodeSelection",0,tF,"Plugin",0,class{getState(t){return t[this.key]}constructor(t){this.spec=t,this.props={},t.props&&function t(e,n,r){for(let i in e){let s=e[i];s instanceof Function?s=s.bind(n):"handleDOMEvents"==i&&(s=t(s,n,{})),r[i]=s}return r}(t.props,this,this.props),this.key=t.key?t.key.key:tG("plugin")}},"PluginKey",0,class{get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}constructor(t="key"){this.key=tG(t)}},"Selection",0,tE,"SelectionRange",0,tR,"TextSelection",0,tz],522196)}]); 3 4//# debugId=a6ebcae8-a74a-ec68-1abb-899a2aca856b 5//# sourceMappingURL=0diq7cdk4awjp.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.