(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,545773,47091,e=>{"use strict";function t(e){this.content=e}t.prototype={constructor:t,find:function(e){for(var t=0;t>1}},t.from=function(e){if(e instanceof t)return e;var n=[];if(e)for(var r in e)n.push(r,e[r]);return new t(n)};class n{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;te&&!1!==n(l,r+s,i||null,o)&&l.content.size){let i=s+1;l.nodesBetween(Math.max(0,e-i),Math.min(l.content.size,t-i),n,r+i)}s=a}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i="",o=!0;return this.nodesBetween(e,t,(s,l)=>{let a=s.isText?s.text.slice(Math.max(e,l)-l,t-l):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&a||s.isTextblock)&&n&&(o?o=!1:i+=n),i+=a},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),o=1);oe)for(let n=0,o=0;oe&&((ot)&&(s=s.isText?s.cut(Math.max(0,e-o),Math.min(s.text.length,t-o)):s.cut(Math.max(0,e-o-1),Math.min(s.content.size,t-o-1))),r.push(s),i+=s.nodeSize),o=l}return new n(r,i)}cutByIndex(e,t){return e==t?n.empty:0==e&&t==this.content.length?this:new n(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new n(i,o)}addToStart(e){return new n([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new n(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;tthis.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=n+this.child(t).nodeSize;if(r>=e){if(r==e)return i(t+1,r);return i(t,n)}n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return n.empty;if(!Array.isArray(t))throw RangeError("Invalid input for Fragment.fromJSON");return new n(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return n.empty;let t,r=0;for(let n=0;nthis.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(i)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;te.type.rank-t.type.rank),t}}s.none=[];class l extends Error{}class a{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=function e(t,n,r,i){let{index:o,offset:s}=t.findIndex(n),l=t.maybeChild(o);if(s==n||l.isText)return i&&!i.canReplace(o,o,r)?null:t.cut(0,n).append(r).append(t.cut(n));let a=e(l.content,n-s-1,r,l);return a&&t.replaceChild(o,l.copy(a))}(this.content,e+this.openStart,t);return n&&new a(n,this.openStart,this.openEnd)}removeBetween(e,t){return new a(function e(t,n,r){let{index:i,offset:o}=t.findIndex(n),s=t.maybeChild(i),{index:l,offset:a}=t.findIndex(r);if(o==n||s.isText){if(a!=r&&!t.child(l).isText)throw RangeError("Removing non-flat range");return t.cut(0,n).append(t.cut(r))}if(i!=l)throw RangeError("Removing non-flat range");return t.replaceChild(i,s.copy(e(s.content,n-o-1,r-o-1)))}(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return a.empty;let r=t.openStart||0,i=t.openEnd||0;if("number"!=typeof r||"number"!=typeof i)throw RangeError("Invalid input for Slice.fromJSON");return new a(n.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let n=0,r=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)r++;return new a(e,n,r)}}function d(e,t){if(!t.type.compatibleContent(e.type))throw new l("Cannot join "+t.type.name+" onto "+e.type.name)}function c(e,t,n){let r=e.node(n);return d(r,t.node(n)),r}function h(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function p(e,t,n,r){let i=(t||e).node(n),o=0,s=t?t.index(n):i.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(h(e.nodeAfter,r),o++));for(let e=o;er&&h(u(c(e,t,r+1),f(e,t,r+1)),i),p(t,null,r,i),new n(i)}a.empty=new a(n.empty,0,0);class m{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let t=0;t0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new k(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&t<=e.content.size))throw RangeError("Position "+t+" out of range");let n=[],r=0,i=t;for(let t=e;;){let{index:e,offset:o}=t.content.findIndex(i),s=i-o;if(n.push(t,e,r+o),!s||(t=t.child(e)).isText)break;i=s-1,r+=o+1}return new m(t,n,i)}static resolveCached(e,t){let n=b.get(e);if(n)for(let e=0;ei.depth)throw new l("Inserted content deeper than insertion position");if(i.depth-r.openStart!=o.depth-r.openEnd)throw new l("Inconsistent open depths");return function e(t,r,i,o){let s=t.index(o),l=t.node(o);if(s==r.index(o)&&o=0;e--)i=t.node(e).copy(n.from(i));return{start:i.resolveNoCache(e.openStart+r),end:i.resolveNoCache(i.content.size-e.openEnd-r)}}(i,t);return u(l,function e(t,r,i,o,s){let l=t.depth>s&&c(t,r,s+1),a=o.depth>s&&c(i,o,s+1),m=[];return p(null,t,s,m),l&&a&&r.index(s)==i.index(s)?(d(l,a),h(u(l,e(t,r,i,o,s+1)),m)):(l&&h(u(l,f(t,r,s+1)),m),p(r,i,s,m),a&&h(u(a,f(i,o,s+1)),m)),p(o,null,s,m),new n(m)}(t,e,s,r,o))}{let e=t.parent,n=e.content;return u(e,n.cut(0,t.parentOffset).append(i.content).append(n.cut(r.parentOffset)))}}(i,o,r,0)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(!(t=t.maybeChild(n)))return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(ne&&this.nodesBetween(e,t,e=>(n.isInSet(e.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 e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),x(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=n.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let e=i;ee.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){let r;if(!t)throw RangeError("Invalid input for Node.fromJSON");if(t.marks){if(!Array.isArray(t.marks))throw RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=n.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,i,r);return o.type.checkAttrs(o.attrs),o}}w.prototype.text=void 0;class S extends w{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):x(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new S(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new S(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function x(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class M{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){var n;let r,i=new C(e,t);if(null==i.next)return M.empty;let o=function e(t){let n=[];do n.push(function(t){let n=[];do n.push(function(t){let n=function(t){if(t.eat("(")){let n=e(t);return t.eat(")")||t.err("Missing closing paren"),n}if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=(function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return 0==i.length&&e.err("No node type or group '"+t+"' found"),i})(t,t.next).map(e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}}(t);for(;;)if(t.eat("+"))n={type:"plus",expr:n};else if(t.eat("*"))n={type:"star",expr:n};else if(t.eat("?"))n={type:"opt",expr:n};else if(t.eat("{"))n=function(e,t){let n=T(e),r=n;return e.eat(",")&&(r="}"!=e.next?T(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}(t,n);else break;return n}(t));while(t.next&&")"!=t.next&&"|"!=t.next)return 1==n.length?n[0]:{type:"seq",exprs:n}}(t));while(t.eat("|"))return 1==n.length?n[0]:{type:"choice",exprs:n}}(i);i.next&&i.err("Unexpected trailing text");let s=(n=function(e){let t=[[]];return i(function e(t,o){if("choice"==t.type)return t.exprs.reduce((t,n)=>t.concat(e(n,o)),[]);if("seq"==t.type)for(let r=0;;r++){let s=e(t.exprs[r],o);if(r==t.exprs.length-1)return s;i(s,o=n())}else if("star"==t.type){let s=n();return r(o,s),i(e(t.expr,s),s),[r(s)]}else if("plus"==t.type){let s=n();return i(e(t.expr,o),s),i(e(t.expr,s),s),[r(s)]}else if("opt"==t.type)return[r(o)].concat(e(t.expr,o));else if("range"==t.type){let s=o;for(let r=0;re.to=t)}}(o),r=Object.create(null),function e(t){let i=[];t.forEach(e=>{n[e].forEach(({term:e,to:t})=>{let r;if(e){for(let t=0;t{r||i.push([e,r=[]]),-1==r.indexOf(t)&&r.push(t)})}})});let o=r[t.join(",")]=new M(t.indexOf(n.length-1)>-1);for(let t=0;te.createAndFill()));for(let e=0;e=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return!function t(n){e.push(n);for(let r=0;r{let r=n+(t.validEnd?"*":" ")+" ";for(let n=0;n"+e.indexOf(t.next[n].next);return r}).join("\n")}}M.empty=new M(!0);class C{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+" (in content expression '"+this.string+"')")}}function T(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function N(e,t){return t-e}function E(e,t){let n=[];return function t(r){let i=e[r];if(1==i.length&&!i[0].term)return t(i[0].to);n.push(r);for(let e=0;e-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:A(this.attrs,e)}create(e=null,t,r){if(this.isText)throw Error("NodeType.create can't construct text nodes");return new w(this,this.computeAttrs(e),n.from(t),s.setFrom(r))}createChecked(e=null,t,r){return t=n.from(t),this.checkContent(t),new w(this,this.computeAttrs(e),t,s.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),(t=n.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(n.empty,!0);return o?new w(this,e,t.append(o),s.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;tn[e]=new I(e,t,r));let r=t.spec.topNode||"doc";if(!n[r])throw RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw RangeError("Every schema needs a 'text' type");for(let e in n.text.attrs)throw RangeError("The text node type should not have attributes");return n}}class P{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,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 ${r} for attribute ${t} on type ${e}, got ${i}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class L{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=R(e,r.attrs),this.excluded=null;let i=O(this.attrs);this.instance=i?new s(this,i):null}create(e=null){return!e&&this.instance?this.instance:new s(this,A(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,i)=>n[e]=new L(e,r++,t,i)),n}removeFromSet(e){for(var t=0;t-1}}class z{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let t in e)n[t]=e[t];n.nodes=t.from(e.nodes),n.marks=t.from(e.marks||{}),this.nodes=I.compile(this.spec.nodes,this),this.marks=L.compile(this.spec.marks,this);let r=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],n=t.spec.content||"",i=t.spec.marks;if(t.contentMatch=r[n]||(r[n]=M.parse(n,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError("Multiple linebreak nodes defined");if(!t.isInline||!t.isLeaf)throw RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=t}t.markSet="_"==i?null:i?B(this,i.split(" ")):""!=i&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:B(this,n.split(" "))}this.nodeFromJSON=e=>w.fromJSON(this,e),this.markFromJSON=e=>s.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else if(e instanceof I){if(e.schema!=this)throw RangeError("Node type from different schema used ("+e.name+")")}else throw RangeError("Invalid node type: "+e);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new S(n,n.defaultAttrs,e,s.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError("Unknown node type: "+e);return t}}function B(e,t){let n=[];for(let r=0;r-1)&&n.push(s=r)}if(!s)throw SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class ${constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(null!=e.tag)this.tags.push(e);else if(null!=e.style){let t=/[^=]*/.exec(e.style)[0];0>n.indexOf(t)&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new _(this,t,!1);return n.addAll(e,s.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new _(this,t,!0);return n.addAll(e,s.none,t.from,t.to),a.maxOpen(n.finish())}matchTag(e,t,n){for(let o=n?this.tags.indexOf(n)+1:0;oe.length)||61==o.charCodeAt(e.length)&&o.slice(e.length+1)==t)){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r{n(e=q(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=q(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new $(e,$.schemaRules(e)))}}let j={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},F={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},V={ol:!0,ul:!0};function H(e,t,n){return null!=t?!!t|2*("full"===t):e&&"pre"==e.whitespace?3:-5&n}class W{constructor(e,t,n,r,i,o){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=o,this.content=[],this.activeMarks=s.none,this.match=i||(4&o?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(n.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e=this.content[this.content.length-1],t;e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))&&(e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=e.withText(e.text.slice(0,e.text.length-t[0].length)))}let t=n.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(n.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!j.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class _{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,o=H(null,t.preserveWhitespace,0)|4*!!n;i=r?new W(r.type,r.attrs,s.none,!0,t.topMatch||r.type.contentMatch,o):n?new W(null,null,s.none,!0,null,o):new W(e.schema.topNodeType,null,s.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:o}=this.parser;if("full"===i||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(i)if("full"===i)n=n.replace(/\r\n?/g,"\n");else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1===n.consuming)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,o;if(t.node)if((o=this.parser.schema.nodes[t.node]).isLeaf)this.insertNode(o.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(o,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let s=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;"string"==typeof t.contentElement?r=e.querySelector(t.contentElement):"function"==typeof t.contentElement?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(s)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let o=n?e.childNodes[n]:e.firstChild,s=null==r?null:e.childNodes[r];o!=s;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,o=0;t>=0;t--){let s=this.nodes[t],l=s.findWrapping(e);if(l&&(!r||r.length>l.length+o)&&(r=l,i=s,!l.length))break;if(s.solid){if(n)break;o+=2}}if(!r)return null;this.sync(i);for(let e=0;e(o.type?!o.type.allowsMarkType(t.type):!K(t.type,e))||(a=t.addToSet(a),!1)),this.nodes.push(new W(e,t,a,r,null,l)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=1);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,o=(e,s)=>{for(;e>=0;e--){let l=t[e];if(""==l){if(e==t.length-1||0==e)continue;for(;s>=i;s--)if(o(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=i?n.node(s-i).type:null;if(!e||e.name!=l&&!e.isInGroup(l))return!1;s--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}}function q(e){let t={};for(let n in e)t[n]=e[n];return t}function K(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let o=[],s=e=>{o.push(e);for(let n=0;no.indexOf(i)&&s(i))return!0}};if(s(i.contentMatch))return!0}}class U{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=G(t).createDocumentFragment());let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,o=0;for(;n=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Q(G(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return Q(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new U(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=J(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return J(e.marks)}}function J(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function G(e){return e.document||window.document}let Y=new WeakMap;function Q(e,t,n,r){let i,o,s;if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let l=t[0],a;if("string"!=typeof l)throw RangeError("Invalid array passed to renderSpec");if(r&&(void 0===(o=Y.get(r))&&Y.set(r,(s=null,!function e(t){if(t&&"object"==typeof t)if(Array.isArray(t))if("string"==typeof t[0])s||(s=[]),s.push(t);else for(let n=0;n-1)throw RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let d=l.indexOf(" ");d>0&&(n=l.slice(0,d),l=l.slice(d+1));let c=n?e.createElementNS(n,l):e.createElement(l),h=t[1],p=1;if(h&&"object"==typeof h&&null==h.nodeType&&!Array.isArray(h)){for(let e in p=2,h)if(null!=h[e]){let t=e.indexOf(" ");t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),h[e]):"style"==e&&c.style?c.style.cssText=h[e]:c.setAttribute(e,h[e])}}for(let o=p;op)throw RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}{let{dom:t,contentDOM:o}=Q(e,s,n,r);if(c.appendChild(t),o){if(i)throw RangeError("Multiple content holes");i=o}}}return{dom:c,contentDOM:i}}e.s(["DOMParser",()=>$,"DOMSerializer",()=>U,"Fragment",()=>n,"Mark",()=>s,"MarkType",()=>L,"Node",()=>w,"NodeRange",()=>k,"ReplaceError",()=>l,"Schema",()=>z,"Slice",()=>a],47091);class X{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}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}}class Z{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Z.empty)return Z.empty}recover(e){let t=0,n=65535&e;if(!this.inverted)for(let e=0;ee)break;let a=this.ranges[s+i],d=this.ranges[s+o],c=l+a;if(e<=c){let i=a?e==l?-1:e==c?1:t:t,o=l+r+(i<0?0:d);if(n)return o;let h=e==(t<0?l:c)?null:s/3+(e-l)*65536,p=e==l?2:e==c?1:4;return(t<0?e!=l:e!=c)&&(p|=8),new X(o,p,h)}r+=d-a}return n?e+r:new X(e+r,0,null)}touches(e,t){let n=0,r=65535&t,i=this.inverted?2:1,o=this.inverted?1:2;for(let t=0;te)break;let l=this.ranges[t+i];if(e<=s+l&&t==3*r)return!0;n+=this.ranges[t+o]-l}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new ee;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;nn&&te.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,r),t.openStart,t.openEnd);return er.fromReplace(e,this.from,this.to,i)}invert(){return new es(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new eo(t.pos,n.pos,this.mark)}merge(e){return e instanceof eo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new eo(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for AddMarkStep.fromJSON");return new eo(t.from,t.to,e.markFromJSON(t.mark))}}en.jsonID("addMark",eo);class es extends en{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new a(ei(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return er.fromReplace(e,this.from,this.to,n)}invert(){return new eo(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new es(t.pos,n.pos,this.mark)}merge(e){return e instanceof es&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new es(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for RemoveMarkStep.fromJSON");return new es(t.from,t.to,e.markFromJSON(t.mark))}}en.jsonID("removeMark",es);class el extends en{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return er.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return er.fromReplace(e,this.pos,this.pos+1,new a(n.from(r),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;nn.pos?null:new ec(t.pos,n.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ec(t.from,t.to,t.gapFrom,t.gapTo,a.fromJSON(e,t.slice),t.insert,!!t.structure)}}function eh(e,t,n){let r=e.resolve(t),i=n-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let e=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function ep(e,t,r,i=r.contentMatch,o=!0){let s=e.doc.nodeAt(t),l=[],d=t+1;for(let t=0;t=0;t--)e.step(l[t])}function eu(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let o=e.$from.node(n),s=e.$from.index(n)+r,l=e.$to.indexAfter(n)-i;if(n{if(i.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(i.text);){let i=e.mapping.slice(r).map(n+1+o+s.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function ey(e,t,n,r){t.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+o);e.replaceWith(i,i+1,t.type.schema.text("\n"))}})}function eb(e,t,n=1,r){let i=e.resolve(t),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>o;e--,t--){let n=i.node(e),o=i.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(o,n.childCount),l=r&&r[t+1];l&&(s=s.replaceChild(0,l.type.create(l.attrs)));let a=r&&r[t]||n;if(!n.canReplace(o+1,n.childCount)||!a.type.validContent(s))return!1}let l=i.indexAfter(o),a=r&&r[0];return i.node(o).canReplaceWith(l,l,a?a.type:i.node(o+1).type)}function ek(e,t){let n=e.resolve(t),r=n.index();return ev(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function ev(e,t){return!!(e&&t&&!e.isLeaf&&function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i0?(i=r.node(e+1),s++,o=r.node(e).maybeChild(s)):(i=r.node(e).maybeChild(s-1),o=r.node(e+1)),i&&!i.isTextblock&&ev(i,o)&&r.node(e).canReplace(s,s+1))return t;if(0==e)break;t=n<0?r.before(e):r.after(e)}}function eS(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,o=r.index(t)+ +(n>0),s=r.node(t),l=!1;if(1==e)l=s.canReplace(o,o,i);else{let e=s.contentMatchAt(o).findWrapping(i.firstChild.type);l=e&&s.canReplaceWith(o,o,e[0])}if(l)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function ex(e,t,n=t,r=a.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),o=e.resolve(n);return eM(i,o,r)?new ed(t,n,r):new eC(i,o,r).fit()}function eM(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}en.jsonID("replaceAround",ec);class eC{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=n.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=n.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,o=n.depth,s=r.depth;for(;o&&s&&1==i.childCount;)i=i.firstChild.content,o--,s--;let l=new a(i,o,s);return e>-1?new ec(n.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||n.pos!=this.$to.pos?new ed(n.pos,r.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let r=1==t?e:this.unplaced.openStart;r>=0;r--){let e=null,i=(r?(e=eE(this.unplaced.content,r-1).firstChild).content:this.unplaced.content).firstChild;for(let o=this.depth;o>=0;o--){let{type:s,match:l}=this.frontier[o],a,d=null;if(1==t&&(i?l.matchType(i.type)||(d=l.fillBefore(n.from(i),!1)):e&&s.compatibleContent(e.type)))return{sliceDepth:r,frontierDepth:o,parent:e,inject:d};if(2==t&&i&&(a=l.findWrapping(i.type)))return{sliceDepth:r,frontierDepth:o,parent:e,wrap:a};if(e&&l.matchType(e.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=eE(e,t);return!!r.childCount&&!r.firstChild.isLeaf&&(this.unplaced=new a(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=eE(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new a(eT(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new a(eT(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let e=0;e1||0==d||e.content.size)&&(p=t,h.push(function e(t,r,i){if(r<=0)return t;let o=t.content;return r>1&&(o=o.replaceChild(0,e(o.firstChild,r-1,1==o.childCount?i-1:0))),r>0&&(o=t.type.contentMatch.fillBefore(o).append(o),i<=0&&(o=o.append(t.type.contentMatch.matchFragment(o).fillBefore(n.empty,!0)))),t.copy(o)}(e.mark(u.allowedMarks(e.marks)),1==c?d:0,c==l.childCount?f:-1)))}let m=c==l.childCount;m||(f=-1),this.placed=eN(this.placed,t,n.from(h)),this.frontier[t].match=p,m&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=l;e1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){t:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t=0;n--){let{match:t,type:r}=this.frontier[n],i=eO(e,n,r,t,!0);if(!i||i.childCount)continue t}return{depth:t,fit:o,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=eN(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=eN(this.placed,this.depth,n.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(n.empty,!0);e.childCount&&(this.placed=eN(this.placed,this.frontier.length,e))}}function eT(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(eT(e.firstChild.content,t-1,n)))}function eN(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(eN(e.lastChild.content,t-1,n)))}function eE(e,t){for(let n=0;n=0;i--){let r=e.start(i);if(rt.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}class eD extends en{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return er.fail("No node at attribute step's position");let r=Object.create(null);for(let e in t.attrs)r[e]=t.attrs[e];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return er.fromReplace(e,this.pos,this.pos+1,new a(n.from(i),0,+!t.isLeaf))}getMap(){return Z.empty}invert(e){return new eD(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new eD(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw RangeError("Invalid input for AttrStep.fromJSON");return new eD(t.pos,t.attr,t.value)}}en.jsonID("attr",eD);class eR extends en{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return er.ok(n)}getMap(){return Z.empty}invert(e){return new eR(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw RangeError("Invalid input for DocAttrStep.fromJSON");return new eR(t.attr,t.value)}}en.jsonID("docAttr",eR);let eI=class extends Error{};(eI=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n}).prototype=Object.create(Error.prototype),eI.prototype.constructor=eI,eI.prototype.name="TransformError";class eP{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ee}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new eI(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n{e=Math.min(e,i),t=Math.max(t,o)})}return 1e9==e?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=a.empty){let r=ex(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,r){return this.replace(e,t,new a(n.from(r),0,0))}delete(e,t){return this.replace(e,t,a.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return!function(e,t,r,i){if(!i.size)return e.deleteRange(t,r);let o=e.doc.resolve(t),s=e.doc.resolve(r);if(eM(o,s,i))return e.step(new ed(t,r,i));let l=eA(o,s);0==l[l.length-1]&&l.pop();let d=-(o.depth+1);l.unshift(d);for(let e=o.depth,t=o.pos-1;e>0;e--,t--){let n=o.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;l.indexOf(e)>-1?d=e:o.before(e)==t&&l.splice(1,0,-e)}let c=l.indexOf(d),h=[],p=i.openStart;for(let e=i.content,t=0;;t++){let n=e.firstChild;if(h.push(n),t==i.openStart)break;e=n.content}for(let e=p-1;e>=0;e--){var u;let t=h[e],n=(u=t.type).spec.defining||u.spec.definingForContent;if(n&&!t.sameMarkup(o.node(Math.abs(d)-1)))p=e;else if(n||!t.type.isTextblock)break}for(let t=i.openStart;t>=0;t--){let d=(t+p+1)%(i.openStart+1),u=h[d];if(u)for(let t=0;to){let e=s.contentMatchAt(0),r=e.fillBefore(t).append(t);t=r.append(e.matchFragment(r).fillBefore(n.empty,!0))}return t}(i.content,0,i.openStart,d),d,i.openEnd))}}let f=e.steps.length;for(let n=l.length-1;n>=0&&(e.replace(t,r,i),!(e.steps.length>f));n--){let e=l[n];e<0||(t=o.before(e),r=s.after(e))}}(this,e,t,r),this}replaceRangeWith(e,t,r){var i=e,o=t;if(!r.isInline&&i==o&&this.doc.resolve(i).parent.content.size){let e=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t0&&(s||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(t-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return e.delete(r.before(o),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return!function(e,t,r){let{$from:i,$to:o,depth:s}=t,l=i.before(s+1),d=o.after(s+1),c=l,h=d,p=n.empty,u=0;for(let e=s,t=!1;e>r;e--)t||i.index(e)>0?(t=!0,p=n.from(i.node(e).copy(p)),u++):c--;let f=n.empty,m=0;for(let e=s,t=!1;e>r;e--)t||o.after(e+1)=0;e--){if(i.size){let t=r[e].type.contentMatch.matchFragment(i);if(!t||!t.validEnd)throw RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=n.from(r[e].type.create(r[e].attrs,i))}let o=t.start,s=t.end;e.step(new ec(o,s,o,s,new a(i,0,0),r.length,!0))}(this,e,t),this}setBlockType(e,t=e,r,i=null){var o=this;if(!r.isTextblock)throw RangeError("Type given to setBlockType should be a textblock");let s=o.steps.length;return o.doc.nodesBetween(e,t,(e,t)=>{var l,d,c;let h,p,u="function"==typeof i?i(e):i;if(e.isTextblock&&!e.hasMarkup(r,u)&&(l=o.doc,d=o.mapping.slice(s).map(t),c=r,p=(h=l.resolve(d)).index(),h.parent.canReplaceWith(p,p+1,c))){let i=null;if(r.schema.linebreakReplacement){let e="pre"==r.whitespace,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}!1===i&&ey(o,e,t,s),ep(o,o.mapping.slice(s).map(t,1),r,void 0,null===i);let l=o.mapping.slice(s),d=l.map(t,1),c=l.map(t+e.nodeSize,1);return o.step(new ec(d,c,d+1,c-1,new a(n.from(r.create(u,null,e.marks)),0,0),1,!0)),!0===i&&eg(o,e,t,s),!1}}),this}setNodeMarkup(e,t,r=null,i){return!function(e,t,r,i,o){let s=e.doc.nodeAt(t);if(!s)throw RangeError("No node at given position");r||(r=s.type);let l=r.create(i,null,o||s.marks);if(s.isLeaf)return e.replaceWith(t,t+s.nodeSize,l);if(!r.validContent(s.content))throw RangeError("Invalid content for node type "+r.name);e.step(new ec(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new a(n.from(l),0,0),1,!0))}(this,e,t,r,i),this}setNodeAttribute(e,t,n){return this.step(new eD(e,t,n)),this}setDocAttribute(e,t){return this.step(new eR(e,t)),this}addNodeMark(e,t){return this.step(new el(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError("No node at position "+e);if(t instanceof s)t.isInSet(n.marks)&&this.step(new ea(e,t));else{let r=n.marks,i,o=[];for(;i=t.isInSet(r);)o.push(new ea(e,i)),r=i.removeFromSet(r);for(let e=o.length-1;e>=0;e--)this.step(o[e])}return this}split(e,t=1,r){return!function(e,t,r=1,i){let o=e.doc.resolve(t),s=n.empty,l=n.empty;for(let e=o.depth,t=o.depth-r,a=r-1;e>t;e--,a--){s=n.from(o.node(e).copy(s));let t=i&&i[a];l=n.from(t?t.type.create(t.attrs,l):o.node(e).copy(l))}e.step(new ed(t,t,new a(s.append(l),r,r),!0))}(this,e,t,r),this}addMark(e,t,n){var r;let i,o,s,l;return r=this,s=[],l=[],r.doc.nodesBetween(e,t,(r,a,d)=>{if(!r.isInline)return;let c=r.marks;if(!n.isInSet(c)&&d.type.allowsMarkType(n.type)){let d=Math.max(a,e),h=Math.min(a+r.nodeSize,t),p=n.addToSet(c);for(let e=0;er.step(e)),l.forEach(e=>r.step(e)),this}removeMark(e,t,n){var r;let i,o;return r=this,i=[],o=0,r.doc.nodesBetween(e,t,(r,s)=>{if(!r.isInline)return;o++;let l=null;if(n instanceof L){let e=r.marks,t;for(;t=n.isInSet(e);)(l||(l=[])).push(t),e=t.removeFromSet(e)}else n?n.isInSet(r.marks)&&(l=[n]):l=r.marks;if(l&&l.length){let n=Math.min(s+r.nodeSize,t);for(let t=0;tr.step(new es(e.from,e.to,e.style))),this}clearIncompatible(e,t,n){return ep(this,e,t,n),this}}e.s(["Mapping",()=>ee,"RemoveMarkStep",()=>es,"ReplaceAroundStep",()=>ec,"ReplaceStep",()=>ed,"Transform",()=>eP,"canJoin",()=>ek,"canSplit",()=>eb,"dropPoint",()=>eS,"findWrapping",()=>ef,"joinPoint",()=>ew,"liftTarget",()=>eu,"replaceStep",()=>ex],545773)},111092,e=>{"use strict";var t=e.i(47091),n=e.i(545773);let r=Object.create(null);class i{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new o(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t=0;r--){let i=t<0?f(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):f(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new p(e.node(0))}static atStart(e){return f(e,e,0,0,1)||new p(e)}static atEnd(e){return f(e,e,e.content.size,e.childCount,-1)||new p(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError("Invalid input for Selection.fromJSON");let n=r[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in r)throw RangeError("Duplicate use of selection JSON ID "+e);return r[e]=t,t.prototype.jsonID=e,t}getBookmark(){return a.between(this.$anchor,this.$head).getBookmark()}}i.prototype.visible=!0;class o{constructor(e,t){this.$from=e,this.$to=t}}let s=!1;function l(e){s||e.parent.inlineContent||(s=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class a extends i{constructor(e,t=e){l(e),l(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return i.near(n);let r=e.resolve(t.map(this.anchor));return new a(r.parent.inlineContent?r:n,n)}replace(e,n=t.Slice.empty){if(super.replace(e,n),n==t.Slice.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof a&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new d(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw RangeError("Invalid input for TextSelection.fromJSON");return new a(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if((!n||r)&&(n=r>=0?1:-1),!t.parent.inlineContent){let e=i.findFrom(t,n,!0)||i.findFrom(t,-n,!0);if(!e)return i.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r?e=t:(e=(i.findFrom(e,-n,!0)||i.findFrom(e,n,!0)).$anchor).posnew p(e)};function f(e,t,n,r,i,o=!1){if(t.inlineContent)return a.create(e,n);for(let s=r-(i>0?0:1);i>0?s=0;s+=i){let r=t.child(s);if(r.isAtom){if(!o&&c.isSelectable(r))return c.create(e,n-(i<0?r.nodeSize:0))}else{let t=f(e,r,n+i,i<0?r.childCount:0,i,o);if(t)return t}n+=r.nodeSize*i}return null}function m(e,t,r){let o,s=e.steps.length-1;if(s{null==o&&(o=r)}),e.setSelection(i.near(e.doc.resolve(o),r)))}class g extends n.Transform{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return t.Mark.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||t.Mark.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),!e)return this.deleteRange(t,n);let o=this.storedMarks;if(!o){let e=this.doc.resolve(t);o=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,o)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(i.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function y(e,t){return t&&e?e.bind(t):e}class b{constructor(e,t,n){this.name=e,this.init=y(t.init,n),this.apply=y(t.apply,n)}}let k=[new b("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new b("selection",{init:(e,t)=>e.selection||i.atStart(t.doc),apply:e=>e.selection}),new b("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new b("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class v{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=k.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new b(e.key,e.spec.state,e))})}}class w{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;ne.toJSON())),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,n,r){if(!n)throw RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw RangeError("Required config field 'schema' missing");let o=new v(e.schema,e.plugins),s=new w(o);return o.fields.forEach(o=>{if("doc"==o.name)s.doc=t.Node.fromJSON(e.schema,n.doc);else if("selection"==o.name)s.selection=i.fromJSON(s.doc,n.selection);else if("storedMarks"==o.name)n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let t in r){let i=r[t],l=i.spec.state;if(i.key==o.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(n,t)){s[o.name]=l.fromJSON.call(i,e,n[t],s);return}}s[o.name]=o.init(e,s)}}),s}}class S{constructor(e){this.spec=e,this.props={},e.props&&function e(t,n,r){for(let i in t){let o=t[i];o instanceof Function?o=o.bind(n):"handleDOMEvents"==i&&(o=e(o,n,{})),r[i]=o}return r}(e.props,this,this.props),this.key=e.key?e.key.key:M("plugin")}getState(e){return e[this.key]}}let x=Object.create(null);function M(e){return e in x?e+"$"+ ++x[e]:(x[e]=0,e+"$")}class C{constructor(e="key"){this.key=M(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}e.s(["AllSelection",()=>p,"EditorState",()=>w,"NodeSelection",()=>c,"Plugin",()=>S,"PluginKey",()=>C,"Selection",()=>i,"SelectionRange",()=>o,"TextSelection",()=>a])},675993,e=>{"use strict";var t=e.i(111092),n=e.i(47091),r=e.i(545773);let i=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},o=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},s=null,l=function(e,t,n){let r=s||(s=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},a=function(){s=null},d=function(e,t,n,r){return n&&(h(e,t,n,r,-1)||h(e,t,n,r,1))},c=/^(img|br|input|textarea|hr)$/i;function h(e,t,n,r,o){for(var s;;){if(e==n&&t==r)return!0;if(t==(o<0?0:p(e))){let n=e.parentNode;if(!n||1!=n.nodeType||u(e)||c.test(e.nodeName)||"false"==e.contentEditable)return!1;t=i(e)+(o<0?0:1),e=n}else{if(1!=e.nodeType)return!1;let n=e.childNodes[t+(o<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable)if(null==(s=n.pmViewDesc)||!s.ignoreForSelection)return!1;else t+=o;else e=n,t=o<0?p(e):0}}}function p(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function u(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}let f=function(e){return e.focusNode&&d(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function m(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}let g="u">typeof navigator?navigator:null,y="u">typeof document?document:null,b=g&&g.userAgent||"",k=/Edge\/(\d+)/.exec(b),v=/MSIE \d/.exec(b),w=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(b),S=!!(v||w||k),x=v?document.documentMode:w?+w[1]:k?+k[1]:0,M=!S&&/gecko\/(\d+)/i.test(b);M&&(/Firefox\/(\d+)/.exec(b)||[0,0])[1];let C=!S&&/Chrome\/(\d+)/.exec(b),T=!!C,N=C?+C[1]:0,E=!S&&!!g&&/Apple Computer/.test(g.vendor),O=E&&(/Mobile\/\w+/.test(b)||!!g&&g.maxTouchPoints>2),A=O||!!g&&/Mac/.test(g.platform),D=!!g&&/Win/.test(g.platform),R=/Android \d/.test(b),I=!!y&&"webkitFontSmoothing"in y.documentElement.style,P=I?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function L(e,t){return"number"==typeof e?e:e[t]}function z(e,t,n){let r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,s=e.dom.ownerDocument;for(let l=n||e.dom;l;){if(1!=l.nodeType){l=o(l);continue}let e=l,n=e==s.body,a=n?function(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}(s):function(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}(e),d=0,c=0;if(t.topa.bottom-L(r,"bottom")&&(c=t.bottom-t.top>a.bottom-a.top?t.top+L(i,"top")-a.top:t.bottom-a.bottom+L(i,"bottom")),t.lefta.right-L(r,"right")&&(d=t.right-a.right+L(i,"right")),d||c)if(n)s.defaultView.scrollBy(d,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),d&&(e.scrollLeft+=d);let i=e.scrollLeft-n,o=e.scrollTop-r;t={left:t.left-i,top:t.top-o,right:t.right-i,bottom:t.bottom-o}}let h=n?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(h))break;l="absolute"==h?l.offsetParent:o(l)}}function B(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=o(r));return t}function $(e,t){for(let n=0;n=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function V(e){return e.top=0&&i==r.nodeValue.length?(e--,o=1):n<0?e--:t++,q(H(l(r,e,t),o),o<0)}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(null==o&&i&&(n<0||i==p(r))){let e=r.childNodes[i-1];if(1==e.nodeType)return K(e.getBoundingClientRect(),!1)}if(null==o&&i=0)}if(null==o&&i&&(n<0||i==p(r))){let e=r.childNodes[i-1],t=3==e.nodeType?l(e,p(e)-!s):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return q(H(t,1),!1)}if(null==o&&i=0)}function q(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function K(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function U(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}let J=/[\u0590-\u08ac]/,G=null,Y=null,Q=!1;class X{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;ti(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),o;if(i&&(!t||i.node))if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;else n=!1}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return -1}descAt(e){for(let t=0,n=0;te||i instanceof eo){r=e-t;break}t=o}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof Z&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;(e=n?this.children[n-1]:null)&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?i(e.dom)+1:0}}{let e,r=!0;for(;(e=n=o&&t<=a-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,o);e=s;for(let t=l;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=i(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(a>t||l==this.children.length-1)){t=a;for(let e=l+1;el&&st){let e=l;l=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r=n:en){let r=n+i.border,s=o-i.border;if(e>=r&&t<=s){this.dirty=e==n||t==o?2:1,e==r&&t==s&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=3:i.markDirty(e-r,t-r);return}i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}n=o}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirtyi?i.parent?i.parent.posBeforeChild(i):void 0:r)),!t.type.spec.raw){if(1!=o.nodeType){let e=document.createElement("span");e.appendChild(o),o=e}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class ee extends X{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class et extends X{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(e,t,r,i){let o=i.nodeViews[t.type.name],s=o&&o(t,i,r);return s&&s.dom||(s=n.DOMSerializer.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new et(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty0&&(i=eg(i,0,e,n));for(let e=0;ea?a.parent?a.parent.posBeforeChild(a):void 0:s,r,i),c=d&&d.dom,h=d&&d.contentDOM;if(t.isText)if(c){if(3!=c.nodeType)throw RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text);else if(!c){let e=n.DOMSerializer.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:c,contentDOM:h}=e)}h||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let p=c;return(c=eh(c,r,t),d)?a=new es(e,t,r,i,c,h||null,p,d,o,s+1):t.isText?new ei(e,t,r,i,c,p,o):new en(e,t,r,i,c,h||null,p,o,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>n.Fragment.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&ep(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let r=this.node.inlineContent,i=t,o=e.composing?this.localCompositionInfo(e,t):null,s=o&&o.pos>-1?o:null,l=o&&o.pos<0,a=new ef(this,s&&s.node,e);(function(e,t,n,r){let i=t.locals(e),o=0;if(0==i.length){for(let n=0;no;)l.push(i[s++]);let f=o+p.nodeSize;if(p.isText){let e=f;s!e.inline):l.slice();r(p,m,t.forChild(o,p),u),o=f}})(this.node,this.innerDeco,(t,o,s)=>{t.spec.marks?a.syncToMarks(t.spec.marks,r,e,o):t.type.side>=0&&!s&&a.syncToMarks(o==this.node.childCount?n.Mark.none:this.node.child(o).marks,r,e,o),a.placeWidget(t,e,i)},(t,n,s,d)=>{let c;a.syncToMarks(t.marks,r,e,d),a.findNodeMatch(t,n,s,d)||l&&e.state.selection.from>i&&e.state.selection.to-1&&a.updateNodeAt(t,n,s,c,e)||a.updateNextNode(t,n,s,e,d,i)||a.addNode(t,n,s,e,i),i+=t.nodeSize}),a.syncToMarks([],r,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(s&&this.protectLocalComposition(e,s),function e(t,n,r){let i=t.firstChild,o=!1;for(let s=0;sn+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(!this.node.inlineContent)return{node:o,pos:-1,text:""};{let e=o.nodeValue,t=function(e,t,n,r){for(let i=0,o=0;i=n){if(o>=r&&a.slice(r-t.length-l,r-l)==t)return r-t.length;let e=l=0&&e+t.length+l>=n)return l+e;if(n==r&&a.length>=r+t.length-l&&a.slice(r-l,r-l+t.length)==t)return r}}return -1}(this.node.content,e,r-n,i-n);return t<0?null:{node:o,pos:t,text:e}}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new ee(this,i,t,r);e.input.compositionNodes.push(o),this.children=eg(this.children,n,n+r.length,e,o)}update(e,t,n,r){return 3!=this.dirty&&!!e.sameMarkup(this.node)&&(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(ep(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=ec(this.dom,this.nodeDOM,ed(this.outerDeco,this.node,t),ed(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function er(e,t,n,r,i){eh(r,t,e);let o=new en(void 0,e,t,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class ei extends en{constructor(e,t,n,r,i,o,s){super(e,t,n,r,i,null,o,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return 3!=this.dirty&&(0==this.dirty||!!this.inParent())&&!!e.sameMarkup(this.node)&&(this.updateOuterDeco(t),(0!=this.dirty||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),i=document.createTextNode(r.text);return new ei(this.parent,r,this.outerDeco,this.innerDeco,i,i,n)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(0==e||t==this.nodeDOM.nodeValue.length)&&(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class eo extends X{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class es extends en{constructor(e,t,n,r,i,o,s,l,a,d){super(e,t,n,r,i,o,s,a,d),this.spec=l}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}return(!!this.contentDOM||!!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}let el=function(e){e&&(this.nodeName=e)};el.prototype=Object.create(null);let ea=[new el];function ed(e,t,n){if(0==e.length)return ea;let r=n?ea[0]:new el,i=[r];for(let o=0;o0;){let l;for(;;)if(r){let e=n.children[r-1];if(e instanceof et)n=e,r=e.children.length;else{l=e,r--;break}}else if(n==t)break n;else r=n.parent.children.indexOf(n),n=n.parent;let a=l.node;if(a){if(a!=e.child(i-1))break;--i,o.set(l,i),s.push(l)}}return{index:i,matched:o,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n>1,s=Math.min(o,e.length);for(;i-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=et.create(this.top,e[o],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,n,r){let i=-1,o;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let r=this.index,o=Math.min(this.top.children.length,r+5);r=n||c<=t?o.push(a):(dn&&o.push(a.slice(n-d,a.size,r)))}return o}function ey(e,n=null){let r=e.domSelectionRange(),o=e.state.doc;if(!r.focusNode)return null;let s=e.docView.nearestDesc(r.focusNode),l=s&&0==s.size,a=e.docView.posFromDOM(r.focusNode,r.focusOffset,1);if(a<0)return null;let d=o.resolve(a),c,h;if(f(r)){for(c=a;s&&!s.node;)s=s.parent;let e=s.node;if(s&&e.isAtom&&t.NodeSelection.isSelectable(e)&&s.parent&&!(e.isInline&&function(e,t,n){for(let r=0==t,o=t==p(e);r||o;){if(e==n)return!0;let t=i(e);if(!(e=e.parentNode))return!1;r=r&&0==t,o=o&&t==p(e)}}(r.focusNode,r.focusOffset,s.dom))){let e=s.posBefore;h=new t.NodeSelection(a==e?d:o.resolve(e))}}else{if(r instanceof e.dom.ownerDocument.defaultView.Selection&&r.rangeCount>1){let t=a,n=a;for(let i=0;i{(s.anchorNode!=l||s.anchorOffset!=a)&&(i.removeEventListener("selectionchange",o.input.hideSelectionGuard),setTimeout(()=>{(!eb(o)||o.state.selection.visible)&&o.dom.classList.remove("ProseMirror-hideselection")},20))})))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}let ev=E||T&&N<63;function ew(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=rt(e,n,r))||t.TextSelection.between(n,r,i)}function eN(e){return(!e.editable||!!e.hasFocus())&&eE(e)}function eE(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function eO(e,n){let{$anchor:r,$head:i}=e.selection,o=n>0?r.max(i):r.min(i),s=o.parent.inlineContent?o.depth?e.doc.resolve(n>0?o.after():o.before()):null:o;return s&&t.Selection.findFrom(s,n)}function eA(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function eD(e,n,r){let i=e.state.selection;if(i instanceof t.TextSelection){if(r.indexOf("s")>-1){let{$head:r}=i,o=r.textOffset?null:n<0?r.nodeBefore:r.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=e.state.doc.resolve(r.pos+o.nodeSize*(n<0?-1:1));return eA(e,new t.TextSelection(i.$anchor,s))}else if(!i.empty)return!1;else if(e.endOfTextblock(n>0?"forward":"backward")){let r=eO(e.state,n);return!!r&&r instanceof t.NodeSelection&&eA(e,r)}else if(!(A&&r.indexOf("m")>-1)){let r=i.$head,o=r.textOffset?null:n<0?r.nodeBefore:r.nodeAfter,s;if(!o||o.isText)return!1;let l=n<0?r.pos-o.nodeSize:r.pos;return!!(o.isAtom||(s=e.docView.descAt(l))&&!s.contentDOM)&&(t.NodeSelection.isSelectable(o)?eA(e,new t.NodeSelection(n<0?e.state.doc.resolve(r.pos-o.nodeSize):r)):!!I&&eA(e,new t.TextSelection(e.state.doc.resolve(n<0?l:l+o.nodeSize))))}}else{if(i instanceof t.NodeSelection&&i.node.isInline)return eA(e,new t.TextSelection(n>0?i.$to:i.$from));let r=eO(e.state,n);return!!r&&eA(e,r)}}function eR(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function eI(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function eP(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,s,l=!1;for(M&&1==n.nodeType&&r0)if(1!=n.nodeType)break;else{let e=n.childNodes[r-1];if(eI(e,-1))o=n,s=--r;else if(3==e.nodeType)r=(n=e).nodeValue.length;else break}else if(eL(n))break;else{let t=n.previousSibling;for(;t&&eI(t,-1);)o=n.parentNode,s=i(t),t=t.previousSibling;if(t)r=eR(n=t);else{if((n=n.parentNode)==e.dom)break;r=0}}l?ez(e,n,r):o&&ez(e,o,s)}(e):function(e){let t,n,r=e.domSelectionRange(),o=r.focusNode,s=r.focusOffset;if(!o)return;let l=eR(o);for(;;)if(s{e.state==o&&ek(e)},50)}function eB(e,t){let n=e.state.doc.resolve(t);if(!(T||D)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i1)return n.leftr.top&&i1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function e$(e,n,r){let i=e.state.selection;if(i instanceof t.TextSelection&&!i.empty||r.indexOf("s")>-1||A&&r.indexOf("m")>-1)return!1;let{$from:o,$to:s}=i;if(!o.parent.inlineContent||e.endOfTextblock(n<0?"up":"down")){let r=eO(e.state,n);if(r&&r instanceof t.NodeSelection)return eA(e,r)}if(!o.parent.inlineContent){let r=n<0?o:s,l=i instanceof t.AllSelection?t.Selection.near(r,n):t.Selection.findFrom(r,n);return!!l&&eA(e,l)}return!1}function ej(e,n){if(!(e.state.selection instanceof t.TextSelection))return!0;let{$head:r,$anchor:i,empty:o}=e.state.selection;if(!r.sameParent(i))return!0;if(!o)return!1;if(e.endOfTextblock(n>0?"forward":"backward"))return!0;let s=!r.textOffset&&(n<0?r.nodeBefore:r.nodeAfter);if(s&&!s.isText){let t=e.state.tr;return n<0?t.delete(r.pos-s.nodeSize,r.pos):t.delete(r.pos,r.pos+s.nodeSize),e.dispatch(t),!0}return!1}function eF(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function eV(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let r=[],{content:i,openStart:o,openEnd:s}=t;for(;o>1&&s>1&&1==i.childCount&&1==i.firstChild.childCount;){o--,s--;let e=i.firstChild;r.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),i=e.content}let l=e.someProp("clipboardSerializer")||n.DOMSerializer.fromSchema(e.state.schema),a=eG(),d=a.createElement("div");d.appendChild(l.serializeFragment(i,{document:a}));let c=d.firstChild,h,p=0;for(;c&&1==c.nodeType&&(h=eU[c.nodeName.toLowerCase()]);){for(let e=h.length-1;e>=0;e--){let t=a.createElement(h[e]);for(;d.firstChild;)t.appendChild(d.firstChild);d.appendChild(t),p++}c=d.firstChild}return c&&1==c.nodeType&&c.setAttribute("data-pm-slice",`${o} ${s}${p?` -${p}`:""} ${JSON.stringify(r)}`),{dom:d,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function eH(e,t,r,i,o){let s,l,a=o.parent.type.spec.code;if(!r&&!t)return null;let d=!!t&&(i||a||!r);if(d){if(e.someProp("transformPastedText",n=>{t=n(t,a||i,e)}),a)return l=new n.Slice(n.Fragment.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{l=t(l,e,!0)}),l;let r=e.someProp("clipboardTextParser",n=>n(t,o,i,e));if(r)l=r;else{let r=o.marks(),{schema:i}=e.state,l=n.DOMSerializer.fromSchema(i);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=s.appendChild(document.createElement("p"));e&&t.appendChild(l.serializeNode(i.text(e,r)))})}}else e.someProp("transformPastedHTML",t=>{r=t(r,e)}),s=function(e){var t;let n,r=/^(\s*]*>)*/.exec(e);r&&(e=e.slice(r[0].length));let i=eG().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e),s;if((s=o&&eU[o[1].toLowerCase()])&&(e=s.map(e=>"<"+e+">").join("")+e+s.map(e=>"").reverse().join("")),i.innerHTML=(t=e,(n=window.trustedTypes)?(eY||(eY=n.defaultPolicy||n.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})),eY.createHTML(t)):t),s)for(let e=0;e0;e--){let e=s.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;s=e}if(l||(l=(e.someProp("clipboardParser")||e.someProp("domParser")||n.DOMParser.fromSchema(e.state.schema)).parseSlice(s,{preserveWhitespace:!!(d||h),context:o,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||eW.test(e.parentNode.nodeName)?null:{ignore:!0}})),h)l=function(e,t){if(!e.size)return e;let r=e.content.firstChild.type.schema,i;try{i=JSON.parse(t)}catch(t){return e}let{content:o,openStart:s,openEnd:l}=e;for(let e=i.length-2;e>=0;e-=2){let t=r.nodes[i[e]];if(!t||t.hasRequiredAttrs())break;o=n.Fragment.from(t.create(i[e+1],o)),s++,l++}return new n.Slice(o,s,l)}(eK(l,+h[1],+h[2]),h[4]);else if((l=n.Slice.maxOpen(function(e,t){if(e.childCount<2)return e;for(let r=t.depth;r>=0;r--){let i=t.node(r).contentMatchAt(t.index(r)),o,s=[];if(e.forEach(e=>{if(!s)return;let t=i.findWrapping(e.type),r;if(!t)return s=null;if(r=s.length&&o.length&&function e(t,r,i,o,s){if(s{l=t(l,e,d)}),l}let eW=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function e_(e,t,r=0){for(let i=t.length-1;i>=r;i--)e=t[i].create(null,n.Fragment.from(e));return e}function eq(e,t,r,i,o,s){let l=t<0?e.firstChild:e.lastChild,a=l.content;return e.childCount>1&&(s=0),o=r&&(a=t<0?l.contentMatchAt(0).fillBefore(a,s<=o).append(a):a.append(l.contentMatchAt(l.childCount).fillBefore(n.Fragment.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,l.copy(a))}function eK(e,t,r){return t{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>e3(e,t))})}function e3(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function e4(e){return{left:e.clientX,top:e.clientY}}function e5(e,t,n,r,i){if(-1==r)return!1;let o=e.state.doc.resolve(r);for(let r=o.depth+1;r>0;r--)if(e.someProp(t,t=>r>o.depth?t(e,n,o.nodeAfter,o.before(r),i,!0):t(e,n,o.node(r),o.before(r),i,!1)))return!0;return!1}function e6(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}eX.keydown=(e,t)=>{if((e.input.shiftKey=16==t.keyCode||t.shiftKey,!e8(e,t))&&(e.input.lastKeyCode=t.keyCode,e.input.lastKeyCodeTime=Date.now(),!R||!T||13!=t.keyCode))if(229!=t.keyCode&&e.domObserver.forceFlush(),!O||13!=t.keyCode||t.ctrlKey||t.altKey||t.metaKey)e.someProp("handleKeyDown",n=>n(e,t))||function(e,t){let n,r=t.keyCode,i=(n="",t.ctrlKey&&(n+="c"),t.metaKey&&(n+="m"),t.altKey&&(n+="a"),t.shiftKey&&(n+="s"),n);if(8==r||A&&72==r&&"c"==i)return ej(e,-1)||eP(e,-1);if(46==r&&!t.shiftKey||A&&68==r&&"c"==i)return ej(e,1)||eP(e,1);if(13==r||27==r)return!0;if(37==r||A&&66==r&&"c"==i){let t=37==r?"ltr"==eB(e,e.state.selection.from)?-1:1:-1;return eD(e,t,i)||eP(e,t)}if(39==r||A&&70==r&&"c"==i){let t=39==r?"ltr"==eB(e,e.state.selection.from)?1:-1:1;return eD(e,t,i)||eP(e,t)}else if(38==r||A&&80==r&&"c"==i)return e$(e,-1,i)||eP(e,-1);else if(40==r||A&&78==r&&"c"==i)return function(e){if(!E||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;eF(e,n,"true"),setTimeout(()=>eF(e,n,"false"),20)}return!1}(e)||e$(e,1,i)||eP(e,1);else if(i==(A?"m":"c")&&(66==r||73==r||89==r||90==r))return!0;return!1}(e,t)?t.preventDefault():e1(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,m(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},eX.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},eX.keypress=(e,n)=>{if(e8(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||A&&n.metaKey)return;if(e.someProp("handleKeyPress",t=>t(e,n)))return void n.preventDefault();let r=e.state.selection;if(!(r instanceof t.TextSelection)||!r.$from.sameParent(r.$to)){let t=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(t).scrollIntoView();/[\r\n]/.test(t)||e.someProp("handleTextInput",n=>n(e,r.$from.pos,r.$to.pos,t,i))||e.dispatch(i()),n.preventDefault()}};let e9=A?"metaKey":"ctrlKey";eQ.mousedown=(e,n)=>{var r;let i,o;e.input.shiftKey=n.shiftKey;let s=tr(e),l=Date.now(),a="singleClick";l-e.input.lastClick.time<500&&(i=(r=e.input.lastClick).x-n.clientX)*i+(o=r.y-n.clientY)*o<100&&!n[e9]&&e.input.lastClick.button==n.button&&("singleClick"==e.input.lastClick.type?a="doubleClick":"doubleClick"==e.input.lastClick.type&&(a="tripleClick")),e.input.lastClick={time:l,x:n.clientX,y:n.clientY,type:a,button:n.button};let d=e.posAtCoords(e4(n));d&&("singleClick"==a?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new e7(e,d,n,!!s)):("doubleClick"==a?function(e,t,n,r){return e5(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}:function(e,n,r,i){return e5(e,"handleTripleClickOn",n,r,i)||e.someProp("handleTripleClick",t=>t(e,n,i))||function(e,n,r){if(0!=r.button)return!1;let i=e.state.doc;if(-1==n)return!!i.inlineContent&&(e6(e,t.TextSelection.create(i,0,i.content.size),"pointer"),!0);let o=i.resolve(n);for(let n=o.depth+1;n>0;n--){let r=n>o.depth?o.nodeAfter:o.node(n),s=o.before(n);if(r.inlineContent)e6(e,t.TextSelection.create(i,s+1,s+1+r.content.size),"pointer");else{if(!t.NodeSelection.isSelectable(r))continue;e6(e,t.NodeSelection.create(i,s),"pointer")}return!0}}(e,r,i)})(e,d.pos,d.inside,n)?n.preventDefault():e1(e,"pointer"))};class e7{constructor(e,n,r,i){let o,s;if(this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[e9],this.allowDefault=r.shiftKey,n.inside>-1)o=e.state.doc.nodeAt(n.inside),s=n.inside;else{let t=e.state.doc.resolve(n.pos);o=t.parent,s=t.depth?t.before():0}const l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&1==a.nodeDOM.nodeType?a.nodeDOM:null;let{selection:d}=e.state;(0==r.button&&o.type.spec.draggable&&!1!==o.type.spec.selectable||d instanceof t.NodeSelection&&d.from<=s&&d.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&M&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),e1(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>ek(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;if(this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(e4(e))),this.updateAllowDefault(e),this.allowDefault||!n)e1(this.view,"pointer");else{var r,i,o,s;(r=this.view,i=n.pos,o=n.inside,s=this.selectNode,e5(r,"handleClickOn",i,o,e)||r.someProp("handleClick",t=>t(r,i,e))||(s?function(e,n){if(-1==n)return!1;let r=e.state.selection,i,o;r instanceof t.NodeSelection&&(i=r.node);let s=e.state.doc.resolve(n);for(let e=s.depth+1;e>0;e--){let n=e>s.depth?s.nodeAfter:s.node(e);if(t.NodeSelection.isSelectable(n)){o=i&&r.$from.depth>0&&e>=r.$from.depth&&s.before(r.$from.depth+1)==r.$from.pos?s.before(r.$from.depth):s.before(e);break}}return null!=o&&(e6(e,t.NodeSelection.create(e.state.doc,o),"pointer"),!0)}(r,o):function(e,n){if(-1==n)return!1;let r=e.state.doc.resolve(n),i=r.nodeAfter;return!!(i&&i.isAtom&&t.NodeSelection.isSelectable(i))&&(e6(e,new t.NodeSelection(r),"pointer"),!0)}(r,o)))?e.preventDefault():0==e.button&&(this.flushed||E&&this.mightDrag&&!this.mightDrag.node.isAtom||T&&!this.view.state.selection.visible&&2>=Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to)))?(e6(this.view,t.Selection.near(this.view.state.doc.resolve(n.pos)),"pointer"),e.preventDefault()):e1(this.view,"pointer")}}move(e){this.updateAllowDefault(e),e1(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function e8(e,t){return!!e.composing||!!(E&&500>Math.abs(t.timeStamp-e.input.compositionEndedAt))&&(e.input.compositionEndedAt=-2e8,!0)}eQ.touchstart=e=>{e.input.lastTouch=Date.now(),tr(e),e1(e,"pointer")},eQ.touchmove=e=>{e.input.lastTouch=Date.now(),e1(e,"pointer")},eQ.contextmenu=e=>tr(e);let te=R?5e3:-1;function tt(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>tr(e),t))}function tn(e){let t;for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=((t=document.createEvent("Event")).initEvent("event",!0,!0),t.timeStamp));e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function tr(e,t=!1){if(!R||!(e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),tn(e),t||e.docView&&e.docView.dirty){let n=ey(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}eX.compositionstart=eX.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:n}=e,r=n.selection.$to;if(n.selection instanceof t.TextSelection&&(n.storedMarks||!r.textOffset&&r.parentOffset&&r.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||T&&D&&function(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||1!=t.nodeType||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}(e)))e.markCursor=e.state.storedMarks||r.marks(),tr(e,!0),e.markCursor=null;else if(tr(e,!n.selection.empty),M&&n.selection.empty&&r.parentOffset&&!r.textOffset&&r.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}tt(e,te)},eX.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,tt(e,20))};let ti=S&&x<15||O&&P<604;function to(e,t,r,i,o){let s=eH(e,t,r,i,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,o,s||n.Slice.empty)))return!0;if(!s)return!1;let l=0==s.openStart&&0==s.openEnd&&1==s.content.childCount?s.content.firstChild:null,a=l?e.state.tr.replaceSelectionWith(l,i):e.state.tr.replaceSelection(s);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ts(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}eQ.copy=eX.cut=(e,t)=>{let n=e.state.selection,r="cut"==t.type;if(n.empty)return;let i=ti?null:t.clipboardData,{dom:o,text:s}=eV(e,n.content());i?(t.preventDefault(),i.clearData(),i.setData("text/html",o.innerHTML),i.setData("text/plain",s)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}(e,o),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},eX.paste=(e,t)=>{if(e.composing&&!R)return;let n=ti?null:t.clipboardData,r=e.input.shiftKey&&45!=e.input.lastKeyCode;n&&to(e,ts(n),n.getData("text/html"),r,t)?t.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?to(e,r.value,null,i,t):to(e,r.textContent,r.innerHTML,i,t)},50)}(e,t)};class tl{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}let ta=A?"altKey":"ctrlKey";function td(e,t){let n=e.someProp("dragCopies",e=>!e(t));return null!=n?n:!t[ta]}for(let e in eQ.dragstart=(e,n)=>{let r,i=e.input.mouseDown;if(i&&i.done(),!n.dataTransfer)return;let o=e.state.selection,s=o.empty?null:e.posAtCoords(e4(n));if(s&&s.pos>=o.from&&s.pos<=(o instanceof t.NodeSelection?o.to-1:o.to));else if(i&&i.mightDrag)r=t.NodeSelection.create(e.state.doc,i.mightDrag.pos);else if(n.target&&1==n.target.nodeType){let i=e.docView.nearestDesc(n.target,!0);i&&i.node.type.spec.draggable&&i!=e.docView&&(r=t.NodeSelection.create(e.state.doc,i.posBefore))}let l=(r||e.state.selection).content(),{dom:a,text:d,slice:c}=eV(e,l);n.dataTransfer.files.length&&T&&!(N>120)||n.dataTransfer.clearData(),n.dataTransfer.setData(ti?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",ti||n.dataTransfer.setData("text/plain",d),e.dragging=new tl(c,td(e,n),r)},eQ.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},eX.dragover=eX.dragenter=(e,t)=>t.preventDefault(),eX.drop=(e,i)=>{try{!function(e,i,o){if(!i.dataTransfer)return;let s=e.posAtCoords(e4(i));if(!s)return;let l=e.state.doc.resolve(s.pos),a=o&&o.slice;a?e.someProp("transformPasted",t=>{a=t(a,e,!1)}):a=eH(e,ts(i.dataTransfer),ti?null:i.dataTransfer.getData("text/html"),!1,l);let d=!!(o&&td(e,i));if(e.someProp("handleDrop",t=>t(e,i,a||n.Slice.empty,d)))return i.preventDefault();if(!a)return;i.preventDefault();let c=a?(0,r.dropPoint)(e.state.doc,l.pos,a):l.pos;null==c&&(c=l.pos);let h=e.state.tr;if(d){let{node:e}=o;e?e.replace(h):h.deleteSelection()}let p=h.mapping.map(c),u=0==a.openStart&&0==a.openEnd&&1==a.content.childCount,f=h.doc;if(u?h.replaceRangeWith(p,p,a.content.firstChild):h.replaceRange(p,p,a),h.doc.eq(f))return;let m=h.doc.resolve(p);if(u&&t.NodeSelection.isSelectable(a.content.firstChild)&&m.nodeAfter&&m.nodeAfter.sameMarkup(a.content.firstChild))h.setSelection(new t.NodeSelection(m));else{let t=h.mapping.map(c);h.mapping.maps[h.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),h.setSelection(eT(e,m,h.doc.resolve(t)))}e.focus(),e.dispatch(h.setMeta("uiEvent","drop"))}(e,i,e.dragging)}finally{e.dragging=null}},eQ.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&ek(e)},20))},eQ.blur=(e,t)=>{e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),t.relatedTarget&&e.dom.contains(t.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},eQ.beforeinput=(e,t)=>{if(T&&R&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,m(8,"Backspace")))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}},eX)eQ[e]=eX[e];function tc(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class th{constructor(e,t){this.toDOM=e,this.spec=t||tg,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:o}=e.mapResult(t.from+r,this.side<0?-1:1);return o?null:new tf(i-n,i-n,this)}valid(){return!0}eq(e){return this==e||e instanceof th&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&tc(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class tp{constructor(e,t){this.attrs=e,this.spec=t||tg}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=o?null:new tf(i,o,this)}valid(e,t){return t.from=e&&(!i||i(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let o=0;oe){let s=this.children[o]+1;this.children[o+2].findInner(e-s,t-s,n,r+s,i)}}map(e,t,n){return this==tb||0==e.maps.length?this:this.mapInner(e,t,0,0,n||tg)}mapInner(e,t,n,r,i){let o;for(let s=0;s{let s=o-i-(n-e);for(let i=0;io+t-r)continue;let a=l[i]+t-r;n>=a?l[i+1]=e<=a?-2:-1:e>=t&&s&&(l[i]+=s,l[i+1]+=s)}r+=s}),t=n.maps[e].map(t,-1)}let a=!1;for(let t=0;t=r.content.size){a=!0;continue}let h=n.map(e[t+1]+o,-1)-i,{index:p,offset:u}=r.content.findIndex(c),f=r.maybeChild(p);if(f&&u==c&&u+f.nodeSize==h){let r=l[t+2].mapInner(n,f,d+1,e[t]+o+1,s);r!=tb?(l[t]=c,l[t+1]=h,l[t+2]=r):(l[t+1]=-2,a=!0)}else a=!0}if(a){let a=tx(function(e,t,n,r,i,o,s){for(let l=0;l{let s=o+n,l;if(l=tw(t,e,s)){for(r||(r=this.children.slice());io&&n.to=e){this.children[t]==e&&(n=this.children[t+2]);break}let i=e+1,o=i+t.content.size;for(let e=0;ei&&t.type instanceof tp){let e=Math.max(i,t.from)-i,n=Math.min(o,t.to)-i;en.map(e,t,tg));return tk.from(n)}forChild(e,t){if(t.isLeaf)return ty.empty;let n=[];for(let r=0;re instanceof ty)?e:e.reduce((e,t)=>e.concat(t instanceof ty?t:t.members),[]))}}forEachSet(e){for(let t=0;tn&&o.to{let l=tw(e,t,s+n);if(l){o=!0;let e=tx(l,t,n+s+1,r);e!=tb&&i.push(s,s+t.nodeSize,e)}});let s=tv(o?tS(e):e,-n).sort(tM);for(let e=0;e0;)t++;e.splice(t,0,n)}function tN(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=tb&&t.push(r)}),e.cursorWrapper&&t.push(ty.create(e.state.doc,[e.cursorWrapper.deco])),tk.from(t)}let tE={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},tO=S&&x<=11;class tA{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class tD{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new tA,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():E&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),tO&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,tE)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;tthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(eN(this.view)){if(this.suppressingSelectionUpdates)return ek(this.view);if(S&&x<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&d(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=o(n))t.add(n);for(let r=e.anchorNode;r;r=o(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:"selection",target:3==n.nodeType?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){var e;let{view:n}=this;if(!n.docView||this.flushingSoon>-1)return;let r=this.pendingRecords();r.length&&(this.queue=[]);let i=n.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(i)&&eN(n)&&!this.ignoreSelectionChange(i),s=-1,l=-1,a=!1,d=[];if(n.editable)for(let e=0;e"BR"==e.nodeName);if(2==e.length){let[t,n]=e;t.parentNode&&t.parentNode.parentNode==n.parentNode?n.remove():t.remove()}else{let{focusNode:t}=this.currentSelection;for(let r of e){let e=r.parentNode;e&&"LI"==e.nodeName&&(!t||function(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}(n,t)!=e)&&r.remove()}}}else if((T||E)&&d.some(e=>"BR"==e.nodeName)&&(8==n.input.lastKeyCode||46==n.input.lastKeyCode)){for(let e of d)if("BR"==e.nodeName&&e.parentNode){let t=e.nextSibling;t&&1==t.nodeType&&"false"==t.contentEditable&&e.parentNode.removeChild(e)}}let c=null;s<0&&o&&n.input.lastFocus>Date.now()-200&&Math.max(n.input.lastTouch,n.input.lastClick.time)-1||o)&&(s>-1&&(n.docView.markDirty(s,l),e=n,!tR.has(e)&&(tR.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))&&(e.requiresGeckoHackNode=M,tI||(console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),tI=!0))),n.input.badSafariComposition&&(n.input.badSafariComposition=!1,function(e,t){var n;let{focusNode:r,focusOffset:i}=e.domSelectionRange();for(let o of t)if((null==(n=o.parentNode)?void 0:n.nodeName)=="TR"){let t=o.nextSibling;for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.nextSibling;if(t){let n=t;for(;;){let e=n.firstChild;if(!e||1!=e.nodeType||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;n=e}n.insertBefore(o,n.firstChild),r==o&&e.domSelection().collapse(o,i)}else o.parentNode.removeChild(o)}}(n,d)),this.handleDOMChange(s,l,a,d),n.docView&&n.docView.dirty?n.updateState(n.state):this.currentSelection.eq(i)||ek(n),this.currentSelection.set(i))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;nArray.prototype.indexOf.call(e.addedNodes,n))&&(r=n),(!i||0>Array.prototype.indexOf.call(e.addedNodes,i))&&(o=i)}let s=r&&r.parentNode==e.target?i(r)+1:0,l=n.localPosFromDOM(e.target,s,-1),a=o&&o.parentNode==e.target?i(o):e.target.childNodes.length;return{from:l,to:n.localPosFromDOM(e.target,a,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let tR=new WeakMap,tI=!1;function tP(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,o=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return d(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function tL(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(E&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}else if(e.parentNode.lastChild==e||E&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}let tz=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function tB(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:eT(e,t.resolve(n.anchor),t.resolve(n.head))}function t$(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function tj(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class tF{constructor(e,r){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new e0,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=r,this.state=r.state,this.directPlugins=r.plugins||[],this.directPlugins.forEach(tq),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=tW(this),tH(this),this.nodeViews=t_(this),this.docView=er(this.state.doc,tV(this),tN(this),this.dom,this),this.domObserver=new tD(this,(e,r,i,o)=>(function(e,r,i,o,s){let l,a,d,c=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,r<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=ey(e,t);if(n&&!e.state.selection.eq(n)){if(T&&R&&13===e.input.lastKeyCode&&Date.now()-100t(e,m(13,"Enter"))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),c&&r.setMeta("composition",c),e.dispatch(r)}return}let h=e.state.doc.resolve(r),p=h.sharedDepth(i);r=h.before(p+1),i=e.state.doc.resolve(i).after(p+1);let u=e.state.selection,g=function(e,t,r){let i,{node:o,fromOffset:s,toOffset:l,from:a,to:d}=e.docView.parseRange(t,r),c=e.domSelectionRange(),h=c.anchorNode;if(h&&e.dom.contains(1==h.nodeType?h:h.parentNode)&&(i=[{node:h,offset:c.anchorOffset}],f(c)||i.push({node:c.focusNode,offset:c.focusOffset})),T&&8===e.input.lastKeyCode)for(let e=l;e>s;e--){let t=o.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){l=e;break}if(!n||n.size)break}let p=e.state.doc,u=e.someProp("domParser")||n.DOMParser.fromSchema(e.state.schema),m=p.resolve(a),g=null,y=u.parse(o,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:s,to:l,preserveWhitespace:"pre"!=m.parent.type.whitespace||"full",findPositions:i,ruleFromNode:tL,context:m});if(i&&null!=i[0].pos){let e=i[0].pos,t=i[1]&&i[1].pos;null==t&&(t=e),g={anchor:e+a,head:t+a}}return{doc:y,sel:g,from:a,to:d}}(e,r,i),y=e.state.doc,b=y.slice(g.from,g.to);8===e.input.lastKeyCode&&Date.now()-100=s?o-r:0;(o-=e)&&o=l?o-r:0;(o-=t)&&oDate.now()-225||R)&&s.some(e=>1==e.nodeType&&!tz.test(e.nodeName))&&(!k||k.endA>=k.endB)&&e.someProp("handleKeyDown",t=>t(e,m(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!k)if(o&&u instanceof t.TextSelection&&!u.empty&&u.$head.sameParent(u.$anchor)&&!e.composing&&!(g.sel&&g.sel.anchor!=g.sel.head))k={start:u.from,endA:u.to,endB:u.to};else{if(g.sel){let t=tB(e,e.state.doc,g.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);c&&n.setMeta("composition",c),e.dispatch(n)}}return}e.state.selection.frome.state.selection.from&&k.start<=e.state.selection.from+2&&e.state.selection.from>=g.from?k.start=e.state.selection.from:k.endA=e.state.selection.to-2&&e.state.selection.to<=g.to&&(k.endB+=e.state.selection.to-k.endA,k.endA=e.state.selection.to)),S&&x<=11&&k.endB==k.start+1&&k.endA==k.start&&k.start>g.from&&"  "==g.doc.textBetween(k.start-g.from-1,k.start-g.from+1)&&(k.start--,k.endA--,k.endB--);let v=g.doc.resolveNoCache(k.start-g.from),w=g.doc.resolveNoCache(k.endB-g.from),M=y.resolve(k.start),C=v.sameParent(w)&&v.parent.inlineContent&&M.end()>=k.endA;if((O&&e.input.lastIOSEnter>Date.now()-225&&(!C||s.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!C&&v.post(e,m(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>k.start&&function(e,t,n,r,i){if(n-t<=i.pos-r.pos||t$(r,!0,!1)n||t$(s,!0,!1)t(e,m(8,"Backspace")))){R&&T&&e.domObserver.suppressSelectionUpdates();return}T&&k.endB==k.start&&(e.input.lastChromeDelete=Date.now()),R&&!C&&v.start()!=w.start()&&0==w.parentOffset&&v.depth==w.depth&&g.sel&&g.sel.anchor==g.sel.head&&g.sel.head==k.endA&&(k.endB-=2,w=g.doc.resolveNoCache(k.endB-g.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,m(13,"Enter"))})},20));let N=k.start,E=k.endA,A=t=>{let n=t||e.state.tr.replace(N,E,g.doc.slice(k.start-g.from,k.endB-g.from));if(g.sel){let t=tB(e,n.doc,g.sel);t&&!(T&&e.composing&&t.empty&&(k.start!=k.endB||e.input.lastChromeDeleteek(e),20));let t=A(e.state.tr.delete(N,E)),n=y.resolve(k.start).marksAcross(y.resolve(k.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(k.endA==k.endB&&(d=function(e,t){let r=e.firstChild.marks,i=t.firstChild.marks,o=r,s=i,l,a,d;for(let e=0;ee.mark(a.addToSet(e.marks));else{if(0!=o.length||1!=s.length)return null;a=s[0],l="remove",d=e=>e.mark(a.removeFromSet(e.marks))}let c=[];for(let e=0;eA(e.state.tr.insertText(t,N,E));e.someProp("handleTextInput",r=>r(e,N,E,t,n))||e.dispatch(n())}else e.dispatch(A());else e.dispatch(A())})(this,e,r,i,o)),this.domObserver.start(),function(e){for(let t in eQ){let n=eQ[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,t)||e3(e,t)||!e.editable&&t.type in eX||n(e,t)},eZ[t]?{passive:!0}:void 0)}E&&e.dom.addEventListener("input",()=>null),e2(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;for(let t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&e2(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(tq),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];for(let n in t.state=this.state,e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n,r,o;let s=this.state,l=!1,a=!1;e.storedMarks&&this.composing&&(tn(this),a=!0),this.state=e;let c=s.plugins!=e.plugins||this._props.plugins!=t.plugins;if(c||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=t_(this);(function(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,l=!0)}(c||t.handleDOMEvents!=this._props.handleDOMEvents)&&e2(this),this.editable=tW(this),tH(this);let h=tN(this),f=tV(this),m=s.plugins==e.plugins||s.doc.eq(e.doc)?e.scrollToSelection>s.scrollToSelection?"to selection":"preserve":"reset",g=l||!this.docView.matchesNode(e.doc,f,h);(g||!e.selection.eq(s.selection))&&(a=!0);let y="preserve"==m&&a&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top);for(let o=(r.left+r.right)/2,s=i+1;s=i-20){t=r,n=l.top;break}}return{refDOM:t,refTop:n,stack:B(e.dom)}}(this);if(a){let t,n,a;this.domObserver.stop();let c=g&&(S||T)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&(r=s.selection,o=e.selection,a=Math.min(r.$anchor.sharedDepth(r.head),o.$anchor.sharedDepth(o.head)),r.$anchor.start(a)!=o.$anchor.start(a));if(g){let t=T?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=p(e=e.childNodes[t-1])}else{if(!e.parentNode||u(e))return null;t=i(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&te(this)));else if(this.state.selection instanceof t.NodeSelection){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&z(this,t.getBoundingClientRect(),e)}else z(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t0&&this.state.doc.nodeAt(e))==r.node&&(i=e)}this.dragging=new tl(e.slice,e.move,i<0?void 0:t.NodeSelection.create(this.state.doc,i))}someProp(e,t){let n=this._props&&this._props[e],r;if(null!=n&&(r=t?t(n):n))return r;for(let n=0;ne.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return function(e,t){var n;let r,i,s=e.dom.ownerDocument,a,d=0,c=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(p(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(p(r.startContainer),r.startOffset)}}}(s,t.left,t.top);c&&({node:a,offset:d}=c);let h=(e.root.elementFromPoint?e.root:s).elementFromPoint(t.left,t.top);if(!h||!e.dom.contains(1!=h.nodeType?h.parentNode:h)){let n=e.dom.getBoundingClientRect();if(!F(t,n)||!(h=function e(t,n,r){let i=t.childNodes.length;if(i&&r.topt.top&&d++}I&&d&&1==a.nodeType&&1==(n=a.childNodes[d-1]).nodeType&&"false"==n.contentEditable&&n.getBoundingClientRect().top>=t.top&&d--,a==e.dom&&d==a.childNodes.length-1&&1==a.lastChild.nodeType&&t.top>a.lastChild.getBoundingClientRect().bottom?i=e.state.doc.content.size:(0==d||1!=a.nodeType||"BR"!=a.childNodes[d-1].nodeName)&&(i=function(e,t,n,r){let i=-1;for(let n=t,o=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),s;if(!t)return null;if(1==t.dom.nodeType&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((s=t.dom.getBoundingClientRect()).width||s.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!o&&s.left>r.left||s.top>r.top?i=t.posBefore:(!o&&s.right-1?i:e.docView.posFromDOM(t,n,-1)}(e,a,d,t))}null==i&&(i=function(e,t,n){let{node:r,offset:i}=function e(t,n){let r,i,o,s=2e8,a,d=0,c=n.top,h=n.top;for(let e=t.firstChild,p=0;e;e=e.nextSibling,p++){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=l(e).getClientRects()}for(let l=0;l=h){c=Math.max(u.bottom,c),h=Math.min(u.top,h);let t=u.left>n.left?u.left-n.left:u.right=(u.left+u.right)/2));continue}}else u.top>n.top&&!r&&u.left<=n.left&&u.right>=n.left&&(r=e,i={left:Math.max(u.left,Math.min(u.right,n.left)),top:u.top});!o&&(n.left>=u.right&&n.top>=u.top||n.left>=u.left&&n.top>=u.bottom)&&(d=p+1)}}return(!o&&r&&(o=r,a=i,s=0),o&&3==o.nodeType)?function(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let o=0;o=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}(o,a):!o||s&&1==o.nodeType?{node:t,offset:d}:e(o,a)}(t,n),o=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();o=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,o)}(e,h,t));let u=e.docView.nearestDesc(h,!0);return{pos:i,inside:u?u.posAtStart-u.border:-1}}(this,e)}coordsAtPos(e,t=1){return _(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return function(e,t,n){let r,i;return G==t&&Y==n?Q:(G=t,Y=n,Q="up"==n||"down"==n?(r=t.selection,i="up"==n?r.$from:r.$to,U(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=_(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=l(e,0,e.nodeValue.length).getClientRects()}for(let e=0;ei.top+1&&("up"==n?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=i==r.parent.content.size,s=e.domSelection();return s?J.test(r.parent.textContent)&&s.modify?U(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:o,anchorOffset:l}=e.domSelectionRange(),a=s.caretBidiLevel;s.modify("move",n,"character");let d=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:c,focusOffset:h}=e.domSelectionRange(),p=c&&!d.contains(1==c.nodeType?c:c.parentNode)||t==c&&i==h;try{s.collapse(o,l),t&&(t!=o||i!=l)&&s.extend&&s.extend(t,i)}catch(e){}return null!=a&&(s.caretBidiLevel=a),p}):"left"==n||"backward"==n?!i:o:r.pos==r.start()||r.pos==r.end()}(e,t,n))}(this,t||this.state,e)}pasteHTML(e,t){return to(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return to(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return eV(this,e)}destroy(){if(this.docView){for(let e in this.domObserver.stop(),this.input.eventHandlers)this.dom.removeEventListener(e,this.input.eventHandlers[e]);clearTimeout(this.input.composingTimeout),clearTimeout(this.input.lastIOSEnterFallbackTimeout),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],tN(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,a()}}get isDestroyed(){return null==this.docView}dispatchEvent(e){!e3(this,e)&&eQ[e.type]&&(this.editable||!(e.type in eX))&&eQ[e.type](this,e)}domSelectionRange(){let e=this.domSelection();return e?E&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){let n;if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return tP(e,n)}function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?tP(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function tV(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))}),t.translate||(t.translate="no"),[tf.node(0,e.state.doc.content.size,t)]}function tH(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:tf.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function tW(e){return!e.someProp("editable",t=>!1===t(e.state))}function t_(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function tq(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError("Plugins passed directly to the view must not have a state component")}tF.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))},e.s(["Decoration",()=>tf,"DecorationSet",()=>ty,"EditorView",()=>tF])},202008,e=>{"use strict";for(var t={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},n={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},r="u">typeof navigator&&/Mac/.test(navigator.platform),i="u">typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),o=0;o<10;o++)t[48+o]=t[96+o]=String(o);for(var o=1;o<=24;o++)t[o+111]="F"+o;for(var o=65;o<=90;o++)t[o]=String.fromCharCode(o+32),n[o]=String.fromCharCode(o);for(var s in t)n.hasOwnProperty(s)||(n[s]=t[s]);var l=e.i(111092);let a="u">typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),d="u">typeof navigator&&/Win/.test(navigator.platform);function c(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function h(e){return new l.Plugin({props:{handleKeyDown:p(e)}})}function p(e){let o=function(e){let t=Object.create(null);for(let n in e)t[function(e){let t,n,r,i,o=e.split(/-(?!$)/),s=o[o.length-1];"Space"==s&&(s=" ");for(let e=0;ep,"keymap",()=>h],202008)},445794,e=>{"use strict";var t=e.i(545773),n=e.i(47091),r=e.i(111092);let i=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function o(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("backward",e):!(n.parentOffset>0))?n:null}let s=(e,i,s)=>{let l=o(e,s);if(!l)return!1;let a=p(l);if(!a){let n=l.blockRange(),r=n&&(0,t.liftTarget)(n);return null!=r&&(i&&i(e.tr.lift(n,r).scrollIntoView()),!0)}let d=a.nodeBefore;if(T(e,a,i,-1))return!0;if(0==l.parent.content.size&&(c(d,"end")||r.NodeSelection.isSelectable(d)))for(let o=l.depth;;o--){let s=(0,t.replaceStep)(e.doc,l.before(o),l.after(o),n.Slice.empty);if(s&&s.slice.size1)break}return!!d.isAtom&&a.depth==l.depth-1&&(i&&i(e.tr.delete(a.pos-d.nodeSize,a.pos).scrollIntoView()),!0)},l=(e,t,n)=>{let r=o(e,n);if(!r)return!1;let i=p(r);return!!i&&d(e,i,t)},a=(e,t,n)=>{let r=u(e,n);if(!r)return!1;let i=g(r);return!!i&&d(e,i,t)};function d(e,i,o){let s=i.nodeBefore,l=i.pos-1;for(;!s.isTextblock;l--){if(s.type.spec.isolating)return!1;let e=s.lastChild;if(!e)return!1;s=e}let a=i.nodeAfter,d=i.pos+1;for(;!a.isTextblock;d++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let c=(0,t.replaceStep)(e.doc,l,d,n.Slice.empty);if(!c||c.from!=l||c instanceof t.ReplaceStep&&c.slice.size>=d-l)return!1;if(o){let t=e.tr.step(c);t.setSelection(r.TextSelection.create(t.doc,l)),o(t.scrollIntoView())}return!0}function c(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)break}return!1}let h=(e,t,n)=>{let{$head:i,empty:o}=e.selection,s=i;if(!o)return!1;if(i.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):i.parentOffset>0)return!1;s=p(i)}let l=s&&s.nodeBefore;return!!l&&!!r.NodeSelection.isSelectable(l)&&(t&&t(e.tr.setSelection(r.NodeSelection.create(e.doc,s.pos-l.nodeSize)).scrollIntoView()),!0)};function p(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function u(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("forward",e):!(n.parentOffset{let s=u(e,o);if(!s)return!1;let l=g(s);if(!l)return!1;let a=l.nodeAfter;if(T(e,l,i,1))return!0;if(0==s.parent.content.size&&(c(a,"start")||r.NodeSelection.isSelectable(a))){let o=(0,t.replaceStep)(e.doc,s.before(),s.after(),n.Slice.empty);if(o&&o.slice.size{let{$head:i,empty:o}=e.selection,s=i;if(!o)return!1;if(i.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):i.parentOffset=0;t--){let n=e.node(t);if(e.index(t)+1{let i=e.selection,o=i instanceof r.NodeSelection,s;if(o){if(i.node.isTextblock||!(0,t.canJoin)(e.doc,i.from))return!1;s=i.from}else if(null==(s=(0,t.joinPoint)(e.doc,i.from,-1)))return!1;if(n){let t=e.tr.join(s);o&&t.setSelection(r.NodeSelection.create(t.doc,s-e.doc.resolve(s).nodeBefore.nodeSize)),n(t.scrollIntoView())}return!0},b=(e,n)=>{let i=e.selection,o;if(i instanceof r.NodeSelection){if(i.node.isTextblock||!(0,t.canJoin)(e.doc,i.to))return!1;o=i.to}else if(null==(o=(0,t.joinPoint)(e.doc,i.to,1)))return!1;return n&&n(e.tr.join(o).scrollIntoView()),!0},k=(e,n)=>{let{$from:r,$to:i}=e.selection,o=r.blockRange(i),s=o&&(0,t.liftTarget)(o);return null!=s&&(n&&n(e.tr.lift(o,s).scrollIntoView()),!0)},v=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!!n.parent.type.spec.code&&!!n.sameParent(r)&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)};function w(e){for(let t=0;t{let{$head:n,$anchor:i}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(i))return!1;let o=n.node(-1),s=n.indexAfter(-1),l=w(o.contentMatchAt(s));if(!l||!o.canReplaceWith(s,s,l))return!1;if(t){let i=n.after(),o=e.tr.replaceWith(i,i,l.createAndFill());o.setSelection(r.Selection.near(o.doc.resolve(i),1)),t(o.scrollIntoView())}return!0},x=(e,t)=>{let n=e.selection,{$from:i,$to:o}=n;if(n instanceof r.AllSelection||i.parent.inlineContent||o.parent.inlineContent)return!1;let s=w(o.parent.contentMatchAt(o.indexAfter()));if(!s||!s.isTextblock)return!1;if(t){let n=(!i.parentOffset&&o.index(){let{$cursor:r}=e.selection;if(!r||r.parent.content.size)return!1;if(r.depth>1&&r.after()!=r.end(-1)){let i=r.before();if((0,t.canSplit)(e.doc,i))return n&&n(e.tr.split(i).scrollIntoView()),!0}let i=r.blockRange(),o=i&&(0,t.liftTarget)(i);return null!=o&&(n&&n(e.tr.lift(i,o).scrollIntoView()),!0)},C=(e,t)=>{let{$from:n,to:i}=e.selection,o,s=n.sharedDepth(i);return 0!=s&&(o=n.before(s),t&&t(e.tr.setSelection(r.NodeSelection.create(e.doc,o))),!0)};function T(e,i,o,s){let l,a,d,h=i.nodeBefore,p=i.nodeAfter,u,f,m=h.type.spec.isolating||p.type.spec.isolating;if(!m&&(l=i.nodeBefore,a=i.nodeAfter,d=i.index(),l&&a&&l.type.compatibleContent(a.type)&&(!l.content.size&&i.parent.canReplace(d-1,d)?(o&&o(e.tr.delete(i.pos-l.nodeSize,i.pos).scrollIntoView()),!0):!!i.parent.canReplace(d,d+1)&&!!(a.isTextblock||(0,t.canJoin)(e.doc,i.pos))&&(o&&o(e.tr.join(i.pos).scrollIntoView()),!0))))return!0;let g=!m&&i.parent.canReplace(i.index(),i.index()+1);if(g&&(u=(f=h.contentMatchAt(h.childCount)).findWrapping(p.type))&&f.matchType(u[0]||p.type).validEnd){if(o){let r=i.pos+p.nodeSize,s=n.Fragment.empty;for(let e=u.length-1;e>=0;e--)s=n.Fragment.from(u[e].create(null,s));s=n.Fragment.from(h.copy(s));let l=e.tr.step(new t.ReplaceAroundStep(i.pos-1,r,i.pos,r,new n.Slice(s,1,0),u.length,!0)),a=l.doc.resolve(r+2*u.length);a.nodeAfter&&a.nodeAfter.type==h.type&&(0,t.canJoin)(l.doc,a.pos)&&l.join(a.pos),o(l.scrollIntoView())}return!0}let y=p.type.spec.isolating||s>0&&m?null:r.Selection.findFrom(i,1),b=y&&y.$from.blockRange(y.$to),k=b&&(0,t.liftTarget)(b);if(null!=k&&k>=i.depth)return o&&o(e.tr.lift(b,k).scrollIntoView()),!0;if(g&&c(p,"start",!0)&&c(h,"end")){let r=h,s=[];for(;s.push(r),!r.isTextblock;)r=r.lastChild;let l=p,a=1;for(;!l.isTextblock;l=l.firstChild)a++;if(r.canReplace(r.childCount,r.childCount,l.content)){if(o){let r=n.Fragment.empty;for(let e=s.length-1;e>=0;e--)r=n.Fragment.from(s[e].copy(r));o(e.tr.step(new t.ReplaceAroundStep(i.pos-s.length,i.pos+p.nodeSize,i.pos+a,i.pos+p.nodeSize-a,new n.Slice(r,s.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function N(e){return function(t,n){let i=t.selection,o=e<0?i.$from:i.$to,s=o.depth;for(;o.node(s).isInline;){if(!s)return!1;s--}return!!o.node(s).isTextblock&&(n&&n(t.tr.setSelection(r.TextSelection.create(t.doc,e<0?o.start(s):o.end(s)))),!0)}}let E=N(-1),O=N(1);function A(e,n=null){return function(r,i){let{$from:o,$to:s}=r.selection,l=o.blockRange(s),a=l&&(0,t.findWrapping)(l,e,n);return!!a&&(i&&i(r.tr.wrap(l,a).scrollIntoView()),!0)}}function D(e,t=null){return function(n,r){let i=!1;for(let r=0;r{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(o),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r{let{$from:i,$to:o}=e.selection;if(e.selection instanceof r.NodeSelection&&e.selection.node.isBlock)return!!i.parentOffset&&!!(0,t.canSplit)(e.doc,i.pos)&&(n&&n(e.tr.split(i.pos).scrollIntoView()),!0);if(!i.depth)return!1;let s=[],l,a,d=!1,c=!1;for(let e=i.depth;;e--){if(i.node(e).isBlock){let t;d=i.end(e)==i.pos+(i.depth-e),c=i.start(e)==i.pos-(i.depth-e),a=w(i.node(e-1).contentMatchAt(i.indexAfter(e-1)));s.unshift(t||(d&&a?{type:a}:null)),l=e;break}if(1==e)return!1;s.unshift(null)}let h=e.tr;(e.selection instanceof r.TextSelection||e.selection instanceof r.AllSelection)&&h.deleteSelection();let p=h.mapping.map(i.pos),u=(0,t.canSplit)(h.doc,p,s.length,s);if(u||(s[0]=a?{type:a}:null,u=(0,t.canSplit)(h.doc,p,s.length,s)),!u)return!1;if(h.split(p,s.length,s),!d&&c&&i.node(l).type!=a){let e=h.mapping.map(i.before(l)),t=h.doc.resolve(e);a&&i.node(l-1).canReplaceWith(t.index(),t.index()+1,a)&&h.setNodeMarkup(h.mapping.map(i.before(l)),a)}return n&&n(h.scrollIntoView()),!0}),"Mod-Enter":S,Backspace:I,"Mod-Backspace":I,"Shift-Backspace":I,Delete:P,"Mod-Delete":P,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new r.AllSelection(e.doc))),!0)},z={"Ctrl-h":L.Backspace,"Alt-Backspace":L["Mod-Backspace"],"Ctrl-d":L.Delete,"Ctrl-Alt-Backspace":L["Mod-Delete"],"Alt-Delete":L["Mod-Delete"],"Alt-d":L["Mod-Delete"],"Ctrl-a":E,"Ctrl-e":O};for(let e in L)z[e]=L[e];"u">typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"u">typeof os&&os.platform&&os.platform(),e.s(["createParagraphNear",()=>x,"deleteSelection",()=>i,"exitCode",()=>S,"joinBackward",()=>s,"joinDown",()=>b,"joinForward",()=>f,"joinTextblockBackward",()=>l,"joinTextblockForward",()=>a,"joinUp",()=>y,"lift",()=>k,"liftEmptyBlock",()=>M,"newlineInCode",()=>v,"selectNodeBackward",()=>h,"selectNodeForward",()=>m,"selectParentNode",()=>C,"selectTextblockEnd",()=>O,"selectTextblockStart",()=>E,"setBlockType",()=>D,"wrapIn",()=>A])},929126,e=>{"use strict";var t=e.i(545773),n=e.i(47091);function r(e,i=null){return function(r,o){let{$from:s,$to:l}=r.selection,a=s.blockRange(l);if(!a)return!1;let d=o?r.tr:null;return!!function(e,r,i,o=null){let s=!1,l=r,a=r.$from.doc;if(r.depth>=2&&r.$from.node(r.depth-1).type.compatibleContent(i)&&0==r.startIndex){if(0==r.$from.index(r.depth-1))return!1;let e=a.resolve(r.start-2);l=new n.NodeRange(e,e,r.depth),r.endIndex=0;e--)l=n.Fragment.from(i[e].type.create(i[e].attrs,l));e.step(new t.ReplaceAroundStep(r.start-2*!!o,r.end,r.start,r.end,new n.Slice(l,0,0),i.length,!0));let a=0;for(let e=0;et.childCount>0&&t.firstChild.type==e);return!!l&&(!i||(o.node(l.depth-1).type==e?function(e,r,i,o){let s=e.tr,l=o.end,a=o.$to.end(o.depth);ln;t--)e-=s.child(t).nodeSize,o.delete(e-1,e+1);let l=o.doc.resolve(i.start),a=l.nodeAfter;if(o.mapping.map(i.end)!=i.start+l.nodeAfter.nodeSize)return!1;let d=0==i.startIndex,c=i.endIndex==s.childCount,h=l.node(-1),p=l.index(-1);if(!h.canReplace(p+ +!d,p+1,a.content.append(c?n.Fragment.empty:n.Fragment.from(s))))return!1;let u=l.pos,f=u+a.nodeSize;return o.step(new t.ReplaceAroundStep(u-!!d,f+ +!!c,u+1,f-1,new n.Slice((d?n.Fragment.empty:n.Fragment.from(s.copy(n.Fragment.empty))).append(c?n.Fragment.empty:n.Fragment.from(s.copy(n.Fragment.empty))),+!d,+!c),+!d)),r(o.scrollIntoView()),!0}(r,i,l)))}}function o(e){return function(r,i){let{$from:o,$to:s}=r.selection,l=o.blockRange(s,t=>t.childCount>0&&t.firstChild.type==e);if(!l)return!1;let a=l.startIndex;if(0==a)return!1;let d=l.parent,c=d.child(a-1);if(c.type!=e)return!1;if(i){let o=c.lastChild&&c.lastChild.type==d.type,s=n.Fragment.from(o?e.create():null),a=new n.Slice(n.Fragment.from(e.create(null,n.Fragment.from(d.type.create(null,s)))),o?3:1,0),h=l.start,p=l.end;i(r.tr.step(new t.ReplaceAroundStep(h-(o?3:1),p,h,p,a,1,!0)).scrollIntoView())}return!0}}e.i(111092),e.s(["liftListItem",()=>i,"sinkListItem",()=>o,"wrapInList",()=>r])},569372,e=>{"use strict";e.s([])},118859,e=>{"use strict";e.s([])},608469,894176,275849,e=>{"use strict";e.s([],608469),e.s([],894176),e.s([],275849)},979748,e=>{"use strict";e.s([])},993489,e=>{"use strict";e.s([])},673654,e=>{"use strict";e.i(569372);var t=e.i(545773);e.i(118859);var n=e.i(445794);e.i(608469);var r=e.i(111092);e.i(894176);var i=e.i(47091);e.i(275849);var o=e.i(929126);e.i(979748);var s=e.i(675993);e.i(993489);var l=e.i(202008),a=Object.defineProperty,d=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})};function c(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}var h=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,o=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(o);return i.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s=[],l=!!e,a=e||i.tr,d=()=>(l||!t||a.getMeta("preventDispatch")||this.hasCustomState||o.dispatch(a),s.every(e=>!0===e)),c={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(a,t),i=n(...e)(r);return s.push(i),c}])),run:d};return c}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s={tr:e,editor:r,view:o,state:c({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(s)]))}};return s}},p={};d(p,{blur:()=>u,clearContent:()=>f,clearNodes:()=>m,command:()=>g,createParagraphNear:()=>y,cut:()=>b,deleteCurrentNode:()=>k,deleteNode:()=>w,deleteRange:()=>S,deleteSelection:()=>x,enter:()=>M,exitCode:()=>C,extendMarkRange:()=>R,first:()=>I,focus:()=>j,forEach:()=>F,insertContent:()=>V,insertContentAt:()=>q,joinBackward:()=>J,joinDown:()=>U,joinForward:()=>G,joinItemBackward:()=>Y,joinItemForward:()=>Q,joinTextblockBackward:()=>X,joinTextblockForward:()=>Z,joinUp:()=>K,keyboardShortcut:()=>et,lift:()=>er,liftEmptyBlock:()=>ei,liftListItem:()=>eo,newlineInCode:()=>es,resetAttributes:()=>ed,scrollIntoView:()=>ec,selectAll:()=>eh,selectNodeBackward:()=>ep,selectNodeForward:()=>eu,selectParentNode:()=>ef,selectTextblockEnd:()=>em,selectTextblockStart:()=>eg,setContent:()=>eb,setMark:()=>e1,setMeta:()=>e2,setNode:()=>e3,setNodeSelection:()=>e4,setTextDirection:()=>e5,setTextSelection:()=>e6,sinkListItem:()=>e9,splitBlock:()=>e8,splitListItem:()=>te,toggleList:()=>tr,toggleMark:()=>ti,toggleNode:()=>to,toggleWrap:()=>ts,undoInputRule:()=>tl,unsetAllMarks:()=>ta,unsetMark:()=>td,unsetTextDirection:()=>tc,updateAttributes:()=>th,wrapIn:()=>tp,wrapInList:()=>tu});var u=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),f=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),m=()=>({state:e,tr:n,dispatch:r})=>{let{selection:i}=n,{ranges:o}=i;return!r||(o.forEach(({$from:r,$to:i})=>{e.doc.nodesBetween(r.pos,i.pos,(e,r)=>{if(e.type.isText)return;let{doc:i,mapping:o}=n,s=i.resolve(o.map(r)),l=i.resolve(o.map(r+e.nodeSize)),a=s.blockRange(l);if(!a)return;let d=(0,t.liftTarget)(a);if(e.type.isTextblock){let{defaultType:e}=s.parent.contentMatchAt(s.index());n.setNodeMarkup(a.start,e)}(d||0===d)&&n.lift(a,d)})}),!0)},g=e=>t=>e(t),y=()=>({state:e,dispatch:t})=>(0,n.createParagraphNear)(e,t),b=(e,t)=>({editor:n,tr:i})=>{let{state:o}=n,s=o.doc.slice(e.from,e.to);i.deleteRange(e.from,e.to);let l=i.mapping.map(t);return i.insert(l,s.content),i.setSelection(new r.TextSelection(i.doc.resolve(Math.max(l-1,0)))),!0},k=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;n-=1)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function v(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var w=e=>({tr:t,state:n,dispatch:r})=>{let i=v(e,n.schema),o=t.selection.$anchor;for(let e=o.depth;e>0;e-=1)if(o.node(e).type===i){if(r){let n=o.before(e),r=o.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},S=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},x=()=>({state:e,dispatch:t})=>(0,n.deleteSelection)(e,t),M=()=>({commands:e})=>e.keyboardShortcut("Enter"),C=()=>({state:e,dispatch:t})=>(0,n.exitCode)(e,t);function T(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function N(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:T(t[r])?t[r].test(e[r]):t[r]===e[r])}function E(e,t,n={}){return e.find(e=>e.type===t&&N(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function O(e,t,n={}){return!!E(e,t,n)}function A(e,t,n){var r;if(!e||!t)return;let i=e.parent.childAfter(e.parentOffset);if(i.node&&i.node.marks.some(e=>e.type===t)||(i=e.parent.childBefore(e.parentOffset)),!i.node||!i.node.marks.some(e=>e.type===t)||(n=n||(null==(r=i.node.marks[0])?void 0:r.attrs),!E([...i.node.marks],t,n)))return;let o=i.index,s=e.start()+i.offset,l=o+1,a=s+i.node.nodeSize;for(;o>0&&O([...e.parent.child(o-1).marks],t,n);)o-=1,s-=e.parent.child(o).nodeSize;for(;l({tr:n,state:i,dispatch:o})=>{let s=D(e,i.schema),{doc:l,selection:a}=n,{$from:d,from:c,to:h}=a;if(o){let e=A(d,s,t);if(e&&e.from<=c&&e.to>=h){let t=r.TextSelection.create(l,e.from,e.to);n.setSelection(t)}}return!0},I=e=>t=>{let n="function"==typeof e?e(t):e;for(let e=0;e({editor:n,view:r,tr:i,dispatch:o})=>{t={scrollIntoView:!0,...t};let s=()=>{($()||B())&&r.dom.focus(),"u">typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!$()&&!B()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{!n.isDestroyed&&(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&null===e||!1===e)return!0}catch{return!1}if(o&&null===e&&!P(n.state.selection))return s(),!0;let l=z(i.doc,e)||n.state.selection,a=n.state.selection.eq(l);return o&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},F=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),V=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),H=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){let r=t[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&H(r)}return e};function W(e){if("u"${e}`;return H(new window.DOMParser().parseFromString(t,"text/html").body)}function _(e,t,n){if(e instanceof i.Node||e instanceof i.Fragment)return e;n={slice:!0,parseOptions:{},...n};let r="object"==typeof e&&null!==e,o="string"==typeof e;if(r)try{if(Array.isArray(e)&&e.length>0)return i.Fragment.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),_("",t,n)}if(o){if(n.errorOnInvalidContent){let r=!1,o="",s=new i.Schema({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(r=!0,o="string"==typeof e?e:e.outerHTML,null)}]}})});if(n.slice?i.DOMParser.fromSchema(s).parseSlice(W(e),n.parseOptions):i.DOMParser.fromSchema(s).parse(W(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error("[tiptap error]: Invalid HTML content",{cause:Error(`Invalid element found: ${o}`)})}let r=i.DOMParser.fromSchema(t);return n.slice?r.parseSlice(W(e),n.parseOptions).content:r.parse(W(e),n.parseOptions)}return _("",t,n)}var q=(e,n,o)=>({tr:s,dispatch:l,editor:a})=>{var d;if(l){let l,c;o={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...o};let h=e=>{a.emit("contentError",{editor:a,error:e,disableCollaboration:()=>{"collaboration"in a.storage&&"object"==typeof a.storage.collaboration&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},p={preserveWhitespace:"full",...o.parseOptions};if(!o.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{_(n,a.schema,{parseOptions:p,errorOnInvalidContent:!0})}catch(e){h(e)}try{l=_(n,a.schema,{parseOptions:p,errorOnInvalidContent:null!=(d=o.errorOnInvalidContent)?d:a.options.enableContentCheck})}catch(e){return h(e),!1}let{from:u,to:f}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},m=!0,g=!0;if((!("type"in l)?l:[l]).forEach(e=>{e.check(),m=!!m&&e.isText&&0===e.marks.length,g=!!g&&e.isBlock}),u===f&&g){let{parent:e}=s.doc.resolve(u);!e.isTextblock||e.type.spec.code||e.childCount||(u-=1,f+=1)}if(m){if(Array.isArray(n))c=n.map(e=>e.text||"").join("");else if(n instanceof i.Fragment){let e="";n.forEach(t=>{t.text&&(e+=t.text)}),c=e}else c="object"==typeof n&&n&&n.text?n.text:n;s.insertText(c,u,f)}else{c=l;let e=s.doc.resolve(u),t=e.node(),n=0===e.parentOffset,r=t.isText||t.isTextblock,i=t.content.size>0;n&&r&&i&&(u=Math.max(0,u-1)),s.replaceWith(u,f,c)}o.updateSelection&&function(e,n,i){let o=e.steps.length-1;if(o{0===a&&(a=r)}),e.setSelection(r.Selection.near(e.doc.resolve(a),-1))}(s,s.steps.length-1,0),o.applyInputRules&&s.setMeta("applyInputRules",{from:u,text:c}),o.applyPasteRules&&s.setMeta("applyPasteRules",{from:u,text:c})}return!0},K=()=>({state:e,dispatch:t})=>(0,n.joinUp)(e,t),U=()=>({state:e,dispatch:t})=>(0,n.joinDown)(e,t),J=()=>({state:e,dispatch:t})=>(0,n.joinBackward)(e,t),G=()=>({state:e,dispatch:t})=>(0,n.joinForward)(e,t),Y=()=>({state:e,dispatch:n,tr:r})=>{try{let i=(0,t.joinPoint)(e.doc,e.selection.$from.pos,-1);if(null==i)return!1;return r.join(i,2),n&&n(r),!0}catch{return!1}},Q=()=>({state:e,dispatch:n,tr:r})=>{try{let i=(0,t.joinPoint)(e.doc,e.selection.$from.pos,1);if(null==i)return!1;return r.join(i,2),n&&n(r),!0}catch{return!1}},X=()=>({state:e,dispatch:t})=>(0,n.joinTextblockBackward)(e,t),Z=()=>({state:e,dispatch:t})=>(0,n.joinTextblockForward)(e,t);function ee(){return"u">typeof navigator&&/Mac/.test(navigator.platform)}var et=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let o=(function(e){let t,n,r,i,o=e.split(/-(?!$)/),s=o[o.length-1];"Space"===s&&(s=" ");for(let e=0;e!["Alt","Ctrl","Meta","Shift"].includes(e)),l=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),a=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,l))});return null==a||a.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function en(e,t,n={}){let{from:r,to:i,empty:o}=e.selection,s=t?v(t,e.schema):null,l=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),o=Math.min(i,t+e.nodeSize);l.push({node:e,from:n,to:o})});let a=i-r,d=l.filter(e=>!s||s.name===e.node.type.name).filter(e=>N(e.node.attrs,n,{strict:!1}));return o?!!d.length:d.reduce((e,t)=>e+t.to-t.from,0)>=a}var er=(e,t={})=>({state:r,dispatch:i})=>{let o=v(e,r.schema);return!!en(r,o,t)&&(0,n.lift)(r,i)},ei=()=>({state:e,dispatch:t})=>(0,n.liftEmptyBlock)(e,t),eo=e=>({state:t,dispatch:n})=>{let r=v(e,t.schema);return(0,o.liftListItem)(r)(t,n)},es=()=>({state:e,dispatch:t})=>(0,n.newlineInCode)(e,t);function el(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function ea(e,t){let n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var ed=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,l=el("string"==typeof e?e:e.name,r.schema);if(!l)return!1;"node"===l&&(o=v(e,r.schema)),"mark"===l&&(s=D(e,r.schema));let a=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{o&&o===e.type&&(a=!0,i&&n.setNodeMarkup(r,void 0,ea(e.attrs,t))),s&&e.marks.length&&e.marks.forEach(o=>{s===o.type&&(a=!0,i&&n.addMark(r,r+e.nodeSize,s.create(ea(o.attrs,t))))})})}),a},ec=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),eh=()=>({tr:e,dispatch:t})=>{if(t){let t=new r.AllSelection(e.doc);e.setSelection(t)}return!0},ep=()=>({state:e,dispatch:t})=>(0,n.selectNodeBackward)(e,t),eu=()=>({state:e,dispatch:t})=>(0,n.selectNodeForward)(e,t),ef=()=>({state:e,dispatch:t})=>(0,n.selectParentNode)(e,t),em=()=>({state:e,dispatch:t})=>(0,n.selectTextblockEnd)(e,t),eg=()=>({state:e,dispatch:t})=>(0,n.selectTextblockStart)(e,t);function ey(e,t,n={},r={}){return _(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var eb=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:o,dispatch:s,commands:l})=>{let{doc:a}=o;if("full"!==r.preserveWhitespace){let l=ey(e,i.schema,r,{errorOnInvalidContent:null!=t?t:i.options.enableContentCheck});return s&&o.replaceWith(0,a.content.size,l).setMeta("preventUpdate",!n),!0}return s&&o.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=t?t:i.options.enableContentCheck})};function ek(e,t){let n=D(t,e.schema),{from:r,to:i,empty:o}=e.selection,s=[];o?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{s.push(...e.marks)});let l=s.find(e=>e.type.name===n.name);return l?{...l.attrs}:{}}function ev(e,n){let r=new t.Transform(e);return n.forEach(e=>{e.steps.forEach(e=>{r.step(e)})}),r}function ew(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function eS(e){return t=>(function(e,t){for(let n=e.depth;n>0;n-=1){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}})(t.$from,e)}function ex(e,t,n){return void 0===e.config[t]&&e.parent?ex(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind({...n,parent:e.parent?ex(e.parent,t,n):null}):e.config[t]}function eM(e){return e.map(e=>{let t={name:e.name,options:e.options,storage:e.storage},n=ex(e,"addExtensions",t);return n?[e,...eM(n())]:e}).flat(10)}function eC(e,t){let n=i.DOMSerializer.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function eT(e){return"function"==typeof e}function eN(e,t,...n){return eT(e)?t?e.bind(t)(...n):e(...n):e}function eE(e){let t=e.filter(e=>"extension"===e.type);return{baseExtensions:t,nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function eO(e){let t=[],{nodeExtensions:n,markExtensions:r}=eE(e),i=[...n,...r],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=n.filter(e=>"text"!==e.name).map(e=>e.name),l=r.map(e=>e.name),a=[...s,...l];return e.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage,extensions:i},r=ex(e,"addGlobalAttributes",n);r&&r().forEach(e=>{(Array.isArray(e.types)?e.types:"*"===e.types?a:"nodes"===e.types?s:"marks"===e.types?l:[]).forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...o,...r}})})})})}),i.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage},r=ex(e,"addAttributes",n);r&&Object.entries(r()).forEach(([n,r])=>{let i={...o,...r};"function"==typeof(null==i?void 0:i.default)&&(i.default=i.default()),(null==i?void 0:i.isRequired)&&(null==i?void 0:i.default)===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function eA(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(!n[e]){n[e]=t;return}if("class"===e){let r=t?String(t).split(" "):[],i=n[e]?n[e].split(" "):[],o=r.filter(e=>!i.includes(e));n[e]=[...i,...o].join(" ")}else if("style"===e){let r=t?t.split(";").map(e=>e.trim()).filter(Boolean):[],i=n[e]?n[e].split(";").map(e=>e.trim()).filter(Boolean):[],o=new Map;i.forEach(e=>{let[t,n]=e.split(":").map(e=>e.trim());o.set(t,n)}),r.forEach(e=>{let[t,n]=e.split(":").map(e=>e.trim());o.set(t,n)}),n[e]=Array.from(o.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t}),n},{})}function eD(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>eA(e,t),{})}function eR(e,t){return"style"in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;let i=t.reduce((e,t)=>{var r;let i=t.attribute.parseHTML?t.attribute.parseHTML(n):"string"!=typeof(r=n.getAttribute(t.name))?r:r.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(r):"true"===r||"false"!==r&&r;return null==i?e:{...e,[t.name]:i}},{});return{...r,...i}}}}function eI(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>!("attrs"===e&&function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t))}function eP(e){var t,n;let r={};return!(null==(t=null==e?void 0:e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(r.default=e.attribute.default),(null==(n=null==e?void 0:e.attribute)?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function eL(e){return e.sort((e,t)=>{let n=ex(e,"priority")||100,r=ex(t,"priority")||100;return n>r?-1:+(ne.name)).filter((e,n)=>t.indexOf(e)!==n)));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),n}function eB(e,t,n){let{from:r,to:i}=t,{blockSeparator:o="\n\n",textSerializers:s={}}=n||{},l="";return e.nodesBetween(r,i,(e,n,a,d)=>{var c;e.isBlock&&n>r&&(l+=o);let h=null==s?void 0:s[e.type.name];if(h)return a&&(l+=h({node:e,pos:n,parent:a,index:d,range:t})),!1;e.isText&&(l+=null==(c=null==e?void 0:e.text)?void 0:c.slice(Math.max(r,n)-n,i-n))}),l}function e$(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function ej(e,t){let n=el("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){let n=v(t,e.schema),{from:r,to:i}=e.selection,o=[];e.doc.nodesBetween(r,i,e=>{o.push(e)});let s=o.reverse().find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}(e,t):"mark"===n?ek(e,t):{}}function eF(e){let t,{mapping:n,steps:r}=e,i=[];return n.maps.forEach((e,t)=>{let o=[];if(e.ranges.length)e.forEach((e,t)=>{o.push({from:e,to:t})});else{let{from:e,to:n}=r[t];if(void 0===e||void 0===n)return;o.push({from:e,to:n})}o.forEach(({from:e,to:r})=>{let o=n.slice(t).map(e,-1),s=n.slice(t).map(r),l=n.invert().map(o,-1),a=n.invert().map(s);i.push({oldRange:{from:l,to:a},newRange:{from:o,to:s}})})}),1===(t=function(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}(i)).length?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function eV(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=A(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{e&&(null==e?void 0:e.nodeSize)!==void 0&&r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}var eH=(e,t,n,r=20)=>{let i=e.doc.resolve(n),o=r,s=null;for(;o>0&&null===s;){let e=i.node(o);(null==e?void 0:e.type.name)===t?s=e:o-=1}return[s,o]};function eW(e,t){return t.nodes[e]||t.marks[e]||null}function e_(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return!!r&&r.attribute.keepOnSplit}))}function eq(e,t,n={}){let{empty:r,ranges:i}=e.selection,o=t?D(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!o||o.name===e.type.name).find(e=>N(e.attrs,n,{strict:!1}));let s=0,l=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(o&&e.inlineContent&&!e.type.allowsMarkType(o))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s+=a-n,l.push(...e.marks.map(e=>({mark:e,from:n,to:a})))})}),0===s)return!1;let a=l.filter(e=>!o||o.name===e.mark.type.name).filter(e=>N(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),d=l.filter(e=>!o||e.mark.type!==o&&e.mark.type.excludes(o)).reduce((e,t)=>e+t.to-t.from,0);return(a>0?a+d:a)>=s}var eK=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=eS(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0)&&t.pos===n.pos};function eJ(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function eG(e,t){let{nodeExtensions:n}=eE(t),r=n.find(t=>t.name===e);if(!r)return!1;let i={name:r.name,options:r.options,storage:r.storage},o=eN(ex(r,"group",i));return"string"==typeof o&&o.split(" ").includes("list")}function eY(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if("hardBreak"===e.type.name)return!0;if(e.isText)return/^\s*$/m.test(null!=(r=e.text)?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(t){let r=!0;return e.content.forEach(e=>{!1!==r&&(eY(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function eQ(e){return e instanceof r.NodeSelection}var eX=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function eZ(e,t){let n=t.mapping.mapResult(e.position);return{position:new eX(n.pos),mapResult:n}}function e0(e){return new eX(e)}var e1=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:o}=n,{empty:s,ranges:l}=o,a=D(e,r.schema);if(i)if(s){let e=ek(r,a);n.addStoredMark(a.create({...e,...t}))}else l.forEach(e=>{let i=e.$from.pos,o=e.$to.pos;r.doc.nodesBetween(i,o,(e,r)=>{let s=Math.max(r,i),l=Math.min(r+e.nodeSize,o);e.marks.find(e=>e.type===a)?e.marks.forEach(e=>{a===e.type&&n.addMark(s,l,a.create({...e.attrs,...t}))}):n.addMark(s,l,a.create(t))})});return function(e,t,n){var r;let{selection:i}=t,o=null;if(P(i)&&(o=i.$cursor),o){let t=null!=(r=e.storedMarks)?r:o.marks();return o.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:s}=i;return s.some(({$from:t,$to:r})=>{let i=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),o=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&o}return!i}),i})}(r,n,a)},e2=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),e3=(e,t={})=>({state:r,dispatch:i,chain:o})=>{let s,l=v(e,r.schema);return(r.selection.$anchor.sameParent(r.selection.$head)&&(s=r.selection.$anchor.parent.attrs),l.isTextblock)?o().command(({commands:e})=>!!(0,n.setBlockType)(l,{...s,...t})(r)||e.clearNodes()).command(({state:e})=>(0,n.setBlockType)(l,{...s,...t})(e,i)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},e4=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,i=L(e,0,n.content.size),o=r.NodeSelection.create(n,i);t.setSelection(o)}return!0},e5=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o,s,{selection:l}=r;return"number"==typeof t?(o=t,s=t):t&&"from"in t&&"to"in t?(o=t.from,s=t.to):(o=l.from,s=l.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},e6=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:i,to:o}="number"==typeof e?{from:e,to:e}:e,s=r.TextSelection.atStart(n).from,l=r.TextSelection.atEnd(n).to,a=L(i,s,l),d=L(o,s,l),c=r.TextSelection.create(n,a,d);t.setSelection(c)}return!0},e9=e=>({state:t,dispatch:n})=>{let r=v(e,t.schema);return(0,o.sinkListItem)(r)(t,n)};function e7(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}var e8=({keepMarks:e=!0}={})=>({tr:n,state:i,dispatch:o,editor:s})=>{let{selection:l,doc:a}=n,{$from:d,$to:c}=l,h=e_(s.extensionManager.attributes,d.node().type.name,d.node().attrs);if(l instanceof r.NodeSelection&&l.node.isBlock)return!!d.parentOffset&&!!(0,t.canSplit)(a,d.pos)&&(o&&(e&&e7(i,s.extensionManager.splittableMarks),n.split(d.pos).scrollIntoView()),!0);if(!d.parent.isBlock)return!1;let p=c.parentOffset===c.parent.content.size,u=0===d.depth?void 0:function(e){for(let t=0;t({tr:o,state:s,dispatch:l,editor:a})=>{var d;let c=v(e,s.schema),{$from:h,$to:p}=s.selection,u=s.selection.node;if(u&&u.isBlock||h.depth<2||!h.sameParent(p))return!1;let f=h.node(-1);if(f.type!==c)return!1;let m=a.extensionManager.attributes;if(0===h.parent.content.size&&h.node(-1).childCount===h.indexAfter(-1)){if(2===h.depth||h.node(-3).type!==c||h.index(-2)!==h.node(-2).childCount-1)return!1;if(l){let e=i.Fragment.empty,t=h.index(-1)?1:h.index(-2)?2:3;for(let n=h.depth-t;n>=h.depth-3;n-=1)e=i.Fragment.from(h.node(n).copy(e));let s=h.indexAfter(-1){if(u>-1)return!1;e.isTextblock&&0===e.content.size&&(u=t+1)}),u>-1&&o.setSelection(r.TextSelection.near(o.doc.resolve(u))),o.scrollIntoView()}return!0}let g=p.pos===h.end()?f.contentMatchAt(0).defaultType:null,y={...e_(m,f.type.name,f.attrs),...n},b={...e_(m,h.node().type.name,h.node().attrs),...n};o.delete(h.pos,p.pos);let k=g?[{type:c,attrs:y},{type:g,attrs:b}]:[{type:c,attrs:y}];if(!(0,t.canSplit)(o.doc,h.pos,2))return!1;if(l){let{selection:e,storedMarks:t}=s,{splittableMarks:n}=a.extensionManager,r=t||e.$to.parentOffset&&e.$from.marks();if(o.split(h.pos,2,k).scrollIntoView(),!r||!l)return!0;let i=r.filter(e=>n.includes(e.type.name));o.ensureMarks(i)}return!0},tt=(e,n)=>{let r=eS(e=>e.type===n)(e.selection);if(!r)return!0;let i=e.doc.resolve(Math.max(0,r.pos-1)).before(r.depth);if(void 0===i)return!0;let o=e.doc.nodeAt(i);return!(r.node.type===(null==o?void 0:o.type)&&(0,t.canJoin)(e.doc,r.pos))||(e.join(r.pos),!0)},tn=(e,n)=>{let r=eS(e=>e.type===n)(e.selection);if(!r)return!0;let i=e.doc.resolve(r.start).after(r.depth);if(void 0===i)return!0;let o=e.doc.nodeAt(i);return!(r.node.type===(null==o?void 0:o.type)&&(0,t.canJoin)(e.doc,i))||(e.join(i),!0)},tr=(e,t,n,r={})=>({editor:i,tr:o,state:s,dispatch:l,chain:a,commands:d,can:c})=>{let{extensions:h,splittableMarks:p}=i.extensionManager,u=v(e,s.schema),f=v(t,s.schema),{selection:m,storedMarks:g}=s,{$from:y,$to:b}=m,k=y.blockRange(b),w=g||m.$to.parentOffset&&m.$from.marks();if(!k)return!1;let S=eS(e=>eG(e.type.name,h))(m);if(k.depth>=1&&S&&k.depth-S.depth<=1){if(S.node.type===u)return d.liftListItem(f);if(eG(S.node.type.name,h)&&u.validContent(S.node.content)&&l)return a().command(()=>(o.setNodeMarkup(S.pos,u),!0)).command(()=>tt(o,u)).command(()=>tn(o,u)).run()}return n&&w&&l?a().command(()=>{let e=c().wrapInList(u,r),t=w.filter(e=>p.includes(e.type.name));return o.ensureMarks(t),!!e||d.clearNodes()}).wrapInList(u,r).command(()=>tt(o,u)).command(()=>tn(o,u)).run():a().command(()=>!!c().wrapInList(u,r)||d.clearNodes()).wrapInList(u,r).command(()=>tt(o,u)).command(()=>tn(o,u)).run()},ti=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:o=!1}=n,s=D(e,r.schema);return eq(r,s,t)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,t)},to=(e,t,n={})=>({state:r,commands:i})=>{let o,s=v(e,r.schema),l=v(t,r.schema),a=en(r,s,n);return(r.selection.$anchor.sameParent(r.selection.$head)&&(o=r.selection.$anchor.parent.attrs),a)?i.setNode(l,o):i.setNode(s,{...o,...n})},ts=(e,t={})=>({state:n,commands:r})=>{let i=v(e,n.schema);return en(n,i,t)?r.lift(i):r.wrapIn(i,t)},tl=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(i.text){let n=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,n))}else t.delete(i.from,i.to)}return!0}}return!1},ta=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,{empty:r,ranges:i}=n;return!!r||(t&&i.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0)},td=(e,t={})=>({tr:n,state:r,dispatch:i})=>{var o;let{extendEmptyMarkRange:s=!1}=t,{selection:l}=n,a=D(e,r.schema),{$from:d,empty:c,ranges:h}=l;if(!i)return!0;if(c&&s){let{from:e,to:t}=l,r=null==(o=d.marks().find(e=>e.type===a))?void 0:o.attrs,i=A(d,a,r);i&&(e=i.from,t=i.to),n.removeMark(e,t,a)}else h.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,a)});return n.removeStoredMark(a),!0},tc=e=>({tr:t,state:n,dispatch:r})=>{let i,o,{selection:s}=n;return"number"==typeof e?(i=e,o=e):e&&"from"in e&&"to"in e?(i=e.from,o=e.to):(i=s.from,o=s.to),r&&t.doc.nodesBetween(i,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},th=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,l=el("string"==typeof e?e:e.name,r.schema);if(!l)return!1;"node"===l&&(o=v(e,r.schema)),"mark"===l&&(s=D(e,r.schema));let a=!1;return n.selection.ranges.forEach(e=>{let l,d,c,h,p=e.$from.pos,u=e.$to.pos;n.selection.empty?r.doc.nodesBetween(p,u,(e,t)=>{o&&o===e.type&&(a=!0,c=Math.max(t,p),h=Math.min(t+e.nodeSize,u),l=t,d=e)}):r.doc.nodesBetween(p,u,(e,r)=>{r=p&&r<=u&&(o&&o===e.type&&(a=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),s&&e.marks.length&&e.marks.forEach(o=>{if(s===o.type&&(a=!0,i)){let i=Math.max(r,p),l=Math.min(r+e.nodeSize,u);n.addMark(i,l,s.create({...o.attrs,...t}))}}))}),d&&(void 0!==l&&i&&n.setNodeMarkup(l,void 0,{...d.attrs,...t}),s&&d.marks.length&&d.marks.forEach(e=>{s===e.type&&i&&n.addMark(c,h,s.create({...e.attrs,...t}))}))}),a},tp=(e,t={})=>({state:r,dispatch:i})=>{let o=v(e,r.schema);return(0,n.wrapIn)(o,t)(r,i)},tu=(e,t={})=>({state:n,dispatch:r})=>{let i=v(e,n.schema);return(0,o.wrapInList)(i,t)(n,r)},tf=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},tm=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function tg(e){var t;let{editor:n,from:r,to:i,text:o,rules:s,plugin:l}=e,{view:a}=n;if(a.composing)return!1;let d=a.state.doc.resolve(r);if(d.parent.type.spec.code||(null==(t=d.nodeBefore||d.nodeAfter)?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let p=!1,u=((e,t=500)=>{let n="",r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,o)=>{var s,l;let a=(null==(l=(s=e.type.spec).toText)?void 0:l.call(s,{node:e,pos:t,parent:i,index:o}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?a:a.slice(0,Math.max(0,r-t))}),n})(d)+o;return s.forEach(e=>{if(p)return;let t=((e,t)=>{if(T(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r})(u,e.find);if(!t)return;let s=a.state.tr,d=c({state:a.state,transaction:s}),f={from:r-(t[0].length-o.length),to:i},{commands:m,chain:g,can:y}=new h({editor:n,state:d});null!==e.handler({state:d,range:f,match:t,commands:m,chain:g,can:y})&&s.steps.length&&(e.undoable&&s.setMeta(l,{transform:s,from:r,to:i,text:o}),a.dispatch(s),p=!0)}),p}function ty(e){return"Object"===Object.prototype.toString.call(e).slice(8,-1)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}var tb=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...eN(ex(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...eN(ex(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>(function e(t,n){let r={...t};return ty(t)&&ty(n)&&Object.keys(n).forEach(i=>{ty(n[i])&&ty(t[i])?r[i]=e(t[i],n[i]):r[i]=n[i]}),r})(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},tk=class e extends tb{constructor(){super(...arguments),this.type="mark"}static create(t={}){return new e("function"==typeof t?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>(null==e?void 0:e.type.name)===t.name))return!1;let o=i.find(e=>(null==e?void 0:e.type.name)===t.name);return o&&n.removeStoredMark(o),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},tv=class{constructor(e){this.find=e.find,this.handler=e.handler}},tw=null,tS=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=ez(e),this.schema=function(e,t){var n;let r=eO(e),{nodeExtensions:o,markExtensions:s}=eE(e),l=null==(n=o.find(e=>ex(e,"topNode")))?void 0:n.name,a=Object.fromEntries(o.map(n=>{let i=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:t},s=eI({...e.reduce((e,t)=>{let r=ex(t,"extendNodeSchema",o);return{...e,...r?r(n):{}}},{}),content:eN(ex(n,"content",o)),marks:eN(ex(n,"marks",o)),group:eN(ex(n,"group",o)),inline:eN(ex(n,"inline",o)),atom:eN(ex(n,"atom",o)),selectable:eN(ex(n,"selectable",o)),draggable:eN(ex(n,"draggable",o)),code:eN(ex(n,"code",o)),whitespace:eN(ex(n,"whitespace",o)),linebreakReplacement:eN(ex(n,"linebreakReplacement",o)),defining:eN(ex(n,"defining",o)),isolating:eN(ex(n,"isolating",o)),attrs:Object.fromEntries(i.map(eP))}),l=eN(ex(n,"parseHTML",o));l&&(s.parseDOM=l.map(e=>eR(e,i)));let a=ex(n,"renderHTML",o);a&&(s.toDOM=e=>a({node:e,HTMLAttributes:eD(e,i)}));let d=ex(n,"renderText",o);return d&&(s.toText=d),[n.name,s]})),d=Object.fromEntries(s.map(n=>{let i=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:t},s=eI({...e.reduce((e,t)=>{let r=ex(t,"extendMarkSchema",o);return{...e,...r?r(n):{}}},{}),inclusive:eN(ex(n,"inclusive",o)),excludes:eN(ex(n,"excludes",o)),group:eN(ex(n,"group",o)),spanning:eN(ex(n,"spanning",o)),code:eN(ex(n,"code",o)),attrs:Object.fromEntries(i.map(eP))}),l=eN(ex(n,"parseHTML",o));l&&(s.parseDOM=l.map(e=>eR(e,i)));let a=ex(n,"renderHTML",o);return a&&(s.toDOM=e=>a({mark:e,HTMLAttributes:eD(e,i)})),[n.name,s]}));return new i.Schema({topNode:l,nodes:a,marks:d})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:eW(t.name,this.schema)},r=ex(t,"addCommands",n);return r?{...e,...r()}:e},{})}get plugins(){let{editor:e}=this;return eL([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:eW(t.name,this.schema)},o=[],s=ex(t,"addKeyboardShortcuts",n),a={};if("mark"===t.type&&ex(t,"exitable",n)&&(a.ArrowRight=()=>tk.handleExit({editor:e,mark:t})),s){let t=Object.fromEntries(Object.entries(s()).map(([t,n])=>[t,()=>n({editor:e})]));a={...a,...t}}let d=(0,l.keymap)(a);o.push(d);let p=ex(t,"addInputRules",n);if(eJ(t,e.options.enableInputRules)&&p){let t=p();if(t&&t.length){let n=function(e){let{editor:t,rules:n}=e,o=new r.Plugin({state:{init:()=>null,apply(e,r,s){let l=e.getMeta(o);if(l)return l;let a=e.getMeta("applyInputRules");return a&&setTimeout(()=>{let{text:e}=a;"string"==typeof e||(e=eC(i.Fragment.from(e),s.schema));let{from:r}=a,l=r+e.length;tg({editor:t,from:r,to:l,text:e,rules:n,plugin:o})}),e.selectionSet||e.docChanged?null:r}},props:{handleTextInput:(e,r,i,s)=>tg({editor:t,from:r,to:i,text:s,rules:n,plugin:o}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:r}=e.state.selection;r&&tg({editor:t,from:r.pos,to:r.pos,text:"",rules:n,plugin:o})}),!1)},handleKeyDown(e,r){if("Enter"!==r.key)return!1;let{$cursor:i}=e.state.selection;return!!i&&tg({editor:t,from:i.pos,to:i.pos,text:"\n",rules:n,plugin:o})}},isInputRules:!0});return o}({editor:e,rules:t}),s=Array.isArray(n)?n:[n];o.push(...s)}}let u=ex(t,"addPasteRules",n);if(eJ(t,e.options.enablePasteRules)&&u){let t=u();if(t&&t.length){let n=function(e){let t,{editor:n,rules:o}=e,s=null,l=!1,a=!1,d="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}let p=({state:e,from:r,to:i,rule:o,pasteEvt:s})=>{let l=e.tr;if(function(e){let{editor:t,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:l}=e,{commands:a,chain:d,can:c}=new h({editor:t,state:n}),p=[];return n.doc.nodesBetween(r,i,(e,t)=>{var h,u,f,m,g;if((null==(u=null==(h=e.type)?void 0:h.spec)?void 0:u.code)||!(e.isText||e.isTextblock||e.isInline))return;let y=null!=(g=null!=(m=null==(f=e.content)?void 0:f.size)?m:e.nodeSize)?g:0,b=Math.max(r,t),k=Math.min(i,t+y);b>=k||((e,t,n)=>{if(T(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n}):[]})(e.isText?e.text||"":e.textBetween(b-t,k-t,void 0,""),o.find,s).forEach(e=>{if(void 0===e.index)return;let t=b+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},h=o.handler({state:n,range:i,match:e,commands:a,chain:d,can:c,pasteEvent:s,dropEvent:l});p.push(h)})}),p.every(e=>null!==e)}({editor:n,state:c({state:e,transaction:l}),from:Math.max(r-1,0),to:i.b-1,rule:o,pasteEvent:s,dropEvent:t})&&l.steps.length){try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}return d="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null,l}};return o.map(e=>new r.Plugin({view(e){let t=t=>{var r;(s=(null==(r=e.dom.parentElement)?void 0:r.contains(t.target))?e.dom.parentElement:null)&&(tw=n)},r=()=>{tw&&(tw=null)};return window.addEventListener("dragstart",t),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",t),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(e,n)=>{if(a=s===e.dom.parentElement,t=n,!a){let e=tw;(null==e?void 0:e.isEditable)&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{var n;let r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return d=t,l=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{let o=t[0],s="paste"===o.getMeta("uiEvent")&&!l,c="drop"===o.getMeta("uiEvent")&&!a,h=o.getMeta("applyPasteRules"),u=!!h;if(!s&&!c&&!u)return;if(u){var f,m;let t,{text:n}=h;"string"==typeof n||(n=eC(i.Fragment.from(n),r.schema));let{from:o}=h,s=o+n.length;return p({rule:e,state:r,from:o,to:{b:s},pasteEvt:(f=n,null==(m=(t=new ClipboardEvent("paste",{clipboardData:new DataTransfer})).clipboardData)||m.setData("text/html",f),t)})}let g=n.doc.content.findDiffStart(r.doc.content),y=n.doc.content.findDiffEnd(r.doc.content);if("number"==typeof g&&y&&g!==y.b)return p({rule:e,state:r,from:g,to:y,pasteEvt:d})}}))}({editor:e,rules:t});o.push(...n)}}let f=ex(t,"addProseMirrorPlugins",n);if(f){let e=f();o.push(...e)}return o})}get attributes(){return eO(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=eE(this.extensions);return Object.fromEntries(t.filter(e=>!!ex(e,"addNodeView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:v(t.name,this.schema)},i=ex(t,"addNodeView",r);if(!i)return[];let o=i();return o?[t.name,(r,i,s,l,a)=>{let d=eD(r,n);return o({node:r,view:i,getPos:s,decorations:l,innerDecorations:a,editor:e,extension:t,HTMLAttributes:d})}]:[]}))}dispatchTransaction(e){let{editor:t}=this;return eL([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:eW(n.name,this.schema)},i=ex(n,"dispatchTransaction",r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return eL([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:eW(n.name,this.schema)},i=ex(n,"transformPastedHTML",r);return i?(t,n)=>{let o=e(t,n);return i.call(r,o)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=eE(this.extensions);return Object.fromEntries(t.filter(e=>!!ex(e,"addMarkView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:D(t.name,this.schema)},i=ex(t,"addMarkView",r);return i?[t.name,(r,o,s)=>{let l=eD(r,n);return i()({mark:r,view:o,inline:s,editor:e,extension:t,HTMLAttributes:l,updateAttributes:t=>{t0(r,e,t)}})}]:[]}))}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{var t;let n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:eW(e.name,this.schema)};"mark"===e.type&&(null==(t=eN(ex(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name);let r=ex(e,"onBeforeCreate",n),i=ex(e,"onCreate",n),o=ex(e,"onUpdate",n),s=ex(e,"onSelectionUpdate",n),l=ex(e,"onTransaction",n),a=ex(e,"onFocus",n),d=ex(e,"onBlur",n),c=ex(e,"onDestroy",n);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),o&&this.editor.on("update",o),s&&this.editor.on("selectionUpdate",s),l&&this.editor.on("transaction",l),a&&this.editor.on("focus",a),d&&this.editor.on("blur",d),c&&this.editor.on("destroy",c)})}};tS.resolve=ez,tS.sort=eL,tS.flatten=eM;var tx={};d(tx,{ClipboardTextSerializer:()=>tC,Commands:()=>tT,Delete:()=>tN,Drop:()=>tE,Editable:()=>tO,FocusEvents:()=>tD,Keymap:()=>tR,Paste:()=>tI,Tabindex:()=>tP,TextDirection:()=>tL,focusEventsPluginKey:()=>tA});var tM=class e extends tb{constructor(){super(...arguments),this.type="extension"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},tC=tM.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new r.Plugin({key:new r.PluginKey("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,{ranges:o}=i,s=Math.min(...o.map(e=>e.$from.pos)),l=Math.max(...o.map(e=>e.$to.pos)),a=e$(n);return eB(r,{from:s,to:l},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),tT=tM.create({name:"commands",addCommands:()=>({...p})}),tN=tM.create({name:"delete",onUpdate({transaction:e,appendedTransactions:n}){var r,i,o;let s=()=>{var r,i,o,s;if(null!=(s=null==(o=null==(i=null==(r=this.editor.options.coreExtensionOptions)?void 0:r.delete)?void 0:i.filterTransaction)?void 0:o.call(i,e))?s:e.getMeta("y-sync$"))return;let l=ev(e.before,[e,...n]);eF(l).forEach(t=>{l.mapping.mapResult(t.oldRange.from).deletedAfter&&l.mapping.mapResult(t.oldRange.to).deletedBefore&&l.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{let i=r+n.nodeSize-2,o=t.oldRange.from<=r&&i<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:i,newFrom:l.mapping.map(r),newTo:l.mapping.map(i),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:l})})});let a=l.mapping;l.steps.forEach((n,r)=>{var i,o;if(n instanceof t.RemoveMarkStep){let t=a.slice(r).map(n.from,-1),s=a.slice(r).map(n.to),d=a.invert().map(t,-1),c=a.invert().map(s),h=null==(i=l.doc.nodeAt(t-1))?void 0:i.marks.some(e=>e.eq(n.mark)),p=null==(o=l.doc.nodeAt(s))?void 0:o.marks.some(e=>e.eq(n.mark));this.editor.emit("delete",{type:"mark",mark:n.mark,from:n.from,to:n.to,deletedRange:{from:d,to:c},newRange:{from:t,to:s},partial:!!(p||h),editor:this.editor,transaction:e,combinedTransform:l})}})};null==(o=null==(i=null==(r=this.editor.options.coreExtensionOptions)?void 0:r.delete)?void 0:i.async)||o?setTimeout(s,0):s()}}),tE=tM.create({name:"drop",addProseMirrorPlugins(){return[new r.Plugin({key:new r.PluginKey("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),tO=tM.create({name:"editable",addProseMirrorPlugins(){return[new r.Plugin({key:new r.PluginKey("editable"),props:{editable:()=>this.editor.options.editable}})]}}),tA=new r.PluginKey("focusEvents"),tD=tM.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;return[new r.Plugin({key:tA,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),tR=tM.create({name:"keymap",addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:i}=t,{empty:o,$anchor:s}=n,{pos:l,parent:a}=s,d=s.parent.isTextblock&&l>0?t.doc.resolve(l-1):s,c=d.parent.type.spec.isolating,h=s.pos-s.parentOffset,p=c&&1===d.parent.childCount?h===s.pos:r.Selection.atStart(i).from===l;return!!o&&!!a.type.isTextblock&&!a.textContent.length&&!!p&&(!p||"paragraph"!==s.parent.type.name)&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},i={...n},o={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return $()||ee()?o:i},addProseMirrorPlugins(){return[new r.Plugin({key:new r.PluginKey("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta("composition")))return;let i=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),o=e.some(e=>e.getMeta("preventClearDocument"));if(!i||o)return;let{empty:s,from:l,to:a}=t.selection,d=r.Selection.atStart(t.doc).from,p=r.Selection.atEnd(t.doc).to;if(s||l!==d||a!==p||!eY(n.doc))return;let u=n.tr,f=c({state:n,transaction:u}),{commands:m}=new h({editor:this.editor,state:f});if(m.clearNodes(),u.steps.length)return u}})]}}),tI=tM.create({name:"paste",addProseMirrorPlugins(){return[new r.Plugin({key:new r.PluginKey("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),tP=tM.create({name:"tabindex",addProseMirrorPlugins(){return[new r.Plugin({key:new r.PluginKey("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),tL=tM.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=eE(this.extensions);return[{types:e.filter(e=>"text"!==e.name).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute("dir");return t&&("ltr"===t||"rtl"===t||"auto"===t)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new r.Plugin({key:new r.PluginKey("textDirection"),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),tz=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(0===this.depth)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,s=n.isInline,l=this.pos+r+ +!o;if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;let a=this.resolvedPos.doc.resolve(l);if(!i&&!s&&a.depth<=this.depth)return;let d=new e(a,this.editor,i,i||s?n:null);i&&(d.actualDepth=this.depth+1),t.push(d)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r{n&&r.length>0||(o.node.type.name===e&&i.every(e=>t[e]===o.node.attrs[e])&&r.push(o),n&&r.length>0||(r=r.concat(o.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},tB=`.ProseMirror { position: relative; } .ProseMirror { word-wrap: break-word; white-space: pre-wrap; white-space: break-spaces; -webkit-font-variant-ligatures: none; font-variant-ligatures: none; font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ } .ProseMirror [contenteditable="false"] { white-space: normal; } .ProseMirror [contenteditable="false"] [contenteditable="true"] { white-space: pre-wrap; } .ProseMirror pre { white-space: pre-wrap; } img.ProseMirror-separator { display: inline !important; border: none !important; margin: 0 !important; width: 0 !important; height: 0 !important; } .ProseMirror-gapcursor { display: none; pointer-events: none; position: absolute; margin: 0; } .ProseMirror-gapcursor:after { content: ""; display: block; position: absolute; top: -2px; width: 20px; border-top: 1px solid black; animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; } @keyframes ProseMirror-cursor-blink { to { visibility: hidden; } } .ProseMirror-hideselection *::selection { background: transparent; } .ProseMirror-hideselection *::-moz-selection { background: transparent; } .ProseMirror-hideselection * { caret-color: transparent; } .ProseMirror-focused .ProseMirror-gapcursor { display: block; }`,t$=class extends tf{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:"u">typeof document?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:eZ,createMappablePosition:e0},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on("paste",({event:e,slice:t})=>this.options.onPaste(e,t)),this.on("delete",this.options.onDelete);const t=this.createDoc(),n=z(t,this.options.autofocus);this.editorState=r.EditorState.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if("u"{this.isDestroyed||(!1!==this.options.autofocus&&null!==this.options.autofocus&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){let e=this.editorView.dom;(null==e?void 0:e.editor)&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{"function"==typeof this.css.remove?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&"u">typeof document&&(this.css=function(e,t,n){let r=document.querySelector("style[data-tiptap-style]");if(null!==r)return r;let i=document.createElement("style");return t&&i.setAttribute("nonce",t),i.setAttribute("data-tiptap-style",""),i.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(i),i}(tB,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if("state"===t)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=eT(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t="string"==typeof e?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;let n=[...this.options.enableCoreExtensions?[tO,tC.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),tT,tD,tR,tP,tE,tI,tN,tL.configure({direction:this.options.textDirection})].filter(e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name]):[],...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new tS(n,this)}createCommandManager(){this.commandManager=new h({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=ey(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&"object"==typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>"collaboration"!==e.name),this.createExtensionManager()}}),e=ey(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,o=t.transformPastedHTML,l=this.extensionManager.transformPastedHTML(o);this.editorView=new s.EditorView(e,{...t,attributes:{role:"textbox",...null==t?void 0:t.attributes},dispatchTransaction:i,transformPastedHTML:l,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS(),this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>{var t;return null==(t=this.capturedTransaction)?void 0:t.step(e)});return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});let s=n.findLast(e=>e.getMeta("focus")||e.getMeta("blur")),l=null==s?void 0:s.getMeta("focus"),a=null==s?void 0:s.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:s}),a&&this.emit("blur",{editor:this,event:a.event,transaction:s}),e.getMeta("preventUpdate")||!n.some(e=>e.docChanged)||o.doc.eq(t.doc)||this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return ej(this.state,e)}isActive(e,t){let n="string"==typeof e?e:null,r="string"==typeof e?t:e;return function(e,t,n={}){if(!t)return en(e,null,n)||eq(e,null,n);let r=el(t,e.schema);return"node"===r?en(e,t,n):"mark"===r&&eq(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return eC(this.state.doc.content,this.schema)}getText(e){var t,n;let r,{blockSeparator:i="\n\n",textSerializers:o={}}=e||{};return t=this.state.doc,n={blockSeparator:i,textSerializers:{...e$(this.schema),...o}},r={from:0,to:t.content.size},eB(t,r,n)}get isEmpty(){return eY(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return null==(t=null==(e=this.editorView)?void 0:e.isDestroyed)||t}$node(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelectorAll(e,t))||null}$pos(e){return new tz(this.state.doc.resolve(e),this)}get $doc(){return this.$pos(0)}};function tj(e){return new tm({find:e.find,handler:({state:t,range:n,match:r})=>{let i=eN(e.getAttributes,void 0,r);if(!1===i||null===i)return null;let{tr:o}=t,s=r[r.length-1],l=r[0];if(s){let r=l.search(/\S/),a=n.from+l.indexOf(s),d=a+s.length;if(eV(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>a).length)return null;dn.from&&o.delete(n.from+r,a);let c=n.from+r+s.length;o.addMark(n.from+r,c,e.type.create(i||{})),o.removeStoredMark(e.type)}},undoable:e.undoable})}function tF(e){return new tm({find:e.find,handler:({state:t,range:n,match:r})=>{let i=eN(e.getAttributes,void 0,r)||{},{tr:o}=t,s=n.from,l=n.to,a=e.type.create(i);if(r[1]){let e=s+r[0].lastIndexOf(r[1]);e>l?e=l:l=e+r[1].length;let t=r[0][r[0].length-1];o.insertText(t,s+r[0].length-1),o.replaceWith(e,l,a)}else if(r[0]){let t=e.type.isInline?s:s-1;o.insert(t,e.type.create(i)).delete(o.mapping.map(s),o.mapping.map(l))}o.scrollIntoView()},undoable:e.undoable})}function tV(e){return new tm({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),o=eN(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,o)},undoable:e.undoable})}function tH(e){return new tm({find:e.find,handler:({state:n,range:r,match:i,chain:o})=>{let s=eN(e.getAttributes,void 0,i)||{},l=n.tr.delete(r.from,r.to),a=l.doc.resolve(r.from).blockRange(),d=a&&(0,t.findWrapping)(a,e.type,s);if(!d)return null;if(l.wrap(a,d),e.keepMarks&&e.editor){let{selection:t,storedMarks:r}=n,{splittableMarks:i}=e.editor.extensionManager,o=r||t.$to.parentOffset&&t.$from.marks();if(o){let e=o.filter(e=>i.includes(e.type.name));l.ensureMarks(e)}}if(e.keepAttributes){let t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";o().updateAttributes(t,s).run()}let c=l.doc.resolve(r.from-1).nodeBefore;c&&c.type===e.type&&(0,t.canJoin)(l.doc,r.from-1)&&(!e.joinPredicate||e.joinPredicate(i,c))&&l.join(r.from-1)},undoable:e.undoable})}function tW(e,t){let{selection:n}=e,{$from:i}=n;if(n instanceof r.NodeSelection){let e=i.index();return i.parent.canReplaceWith(e,e+1,t)}let o=i.depth;for(;o>=0;){let e=i.index(o);if(i.node(o).contentMatchAt(e).matchType(t))return!0;o-=1}return!1}function t_(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function tq(e){if(!(null==e?void 0:e.trim()))return{};let t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);i&&(t.class=i.map(e=>e.trim().slice(1)).join(" "));let o=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);o&&(t.id=o[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{var i;let o=n[parseInt((null==(i=r.match(/__QUOTED_(\d+)__/))?void 0:i[1])||"0",10)];o&&(t[e]=o.slice(1,-1))});let s=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return s&&s.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function tK(e){if(!e||0===Object.keys(e).length)return"";let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{"class"!==e&&"id"!==e&&(!0===n?t.push(e):!1!==n&&null!=n&&t.push(`${e}="${String(n)}"`))}),t.join(" ")}function tU(e){let{nodeName:t,name:n,parseAttributes:r=tq,serializeAttributes:i=tK,defaultAttributes:o={},requiredAttributes:s=[],allowedAttributes:l}=e,a=n||t;return{parseMarkdown:(e,n)=>{let r={...o,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:"block",start(e){var t;let n=RegExp(`^:::${a}(?:\\s|$)`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,i){let o=RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),l=e.match(o);if(!l)return;let d=r(l[1]||"");if(!s.find(e=>!(e in d)))return{type:t,raw:l[0],attributes:d}}},renderMarkdown:e=>{let t=i((e=>{if(!l)return e;let t={};return l.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{})),n=t?` {${t}}`:"";return`:::${a}${n} :::`}}}function tJ(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=tq,serializeAttributes:o=tK,defaultAttributes:s={},content:l="block",allowedAttributes:a}=e,d=n||t;return{parseMarkdown:(e,n)=>{let i;if(r){let t=r(e);i="string"==typeof t?[{type:"text",text:t}]:t}else i="block"===l?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);let o={...s,...e.attributes};return n.createNode(t,o,i)},markdownTokenizer:{name:t,level:"block",start(e){var t;let n=RegExp(`^:::${d}`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,r){var o;let s=RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),a=e.match(s);if(!a)return;let[c,h=""]=a,p=i(h),u=1,f=c.length,m="",g=/^:::([\w-]*)(\s.*)?/gm,y=e.slice(f);for(g.lastIndex=0;;){let n=g.exec(y);if(null===n)break;let i=n.index,s=n[1];if(null==(o=n[2])||!o.endsWith(":::")){if(s)u+=1;else if(0==(u-=1)){let o=y.slice(0,i);m=o.trim();let s=e.slice(0,f+i+n[0].length),a=[];if(m)if("block"===l)for((a=r.blockTokens(o)).forEach(e=>{e.text&&(!e.tokens||0===e.tokens.length)&&(e.tokens=r.inlineTokens(e.text))});a.length>0;){let e=a[a.length-1];if("paragraph"!==e.type||e.text&&""!==e.text.trim())break;a.pop()}else a=r.inlineTokens(m);return{type:t,raw:s,attributes:p,content:m,tokens:a}}}}}},renderMarkdown:(e,t)=>{let n=o((e=>{if(!a)return e;let t={};return a.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{})),r=n?` {${n}}`:"",i=t.renderChildren(e.content||[],"\n\n");return`:::${d}${r} ${i} :::`}}}function tG(e){if(!e.trim())return{};let t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;null!==r;){let[,i,o,s]=r;t[i]=o||s,r=n.exec(e)}return t}function tY(e){return Object.entries(e).filter(([,e])=>null!=e).map(([e,t])=>`${e}="${t}"`).join(" ")}function tQ(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=tG,serializeAttributes:o=tY,defaultAttributes:s={},selfClosing:l=!1,allowedAttributes:a}=e,d=n||t,c=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(e,n)=>{let i={...s,...e.attributes};if(l)return n.createNode(t,i);let o=r?r(e):e.content||"";return o?n.createNode(t,i,[n.createTextNode(o)]):n.createNode(t,i,[])},markdownTokenizer:{name:t,level:"inline",start(e){let t=l?RegExp(`\\[${c}\\s*[^\\]]*\\]`):RegExp(`\\[${c}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${c}\\]`),n=e.match(t),r=null==n?void 0:n.index;return void 0!==r?r:-1},tokenize(e,n,r){let o=l?RegExp(`^\\[${c}\\s*([^\\]]*)\\]`):RegExp(`^\\[${c}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${c}\\]`),s=e.match(o);if(!s)return;let a="",d="";if(l){let[,e]=s;d=e}else{let[,e,t]=s;d=e,a=t||""}let h=i(d.trim());return{type:t,raw:s[0],content:a.trim(),attributes:h}}},renderMarkdown:e=>{let t="";r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>"text"===e.type).map(e=>e.text).join(""));let n=o((e=>{if(!a)return e;let t={};return a.forEach(n=>{let r="string"==typeof n?n:n.name,i="string"==typeof n?void 0:n.skipIfDefault;if(r in e){let n=e[r];if(void 0!==i&&n===i)return;t[r]=n}}),t})(e.attrs||{})),i=n?` ${n}`:"";return l?`[${d}${i}]`:`[${d}${i}]${t}[/${d}]`}}}function tX(e,t,n){var r,i,o,s;let l=e.split("\n"),a=[],d="",c=0,h=t.baseIndentSize||2;for(;c0)break;else{if(""!==p.trim())return;c+=1,d=`${d}${p} `;continue}let f=t.extractItemData(u),{indentLevel:m,mainContent:g}=f;d=`${d}${p} `;let y=[g];for(c+=1;c""!==e.trim());if(-1===t)break;if(((null==(i=null==(r=l[c+1+t].match(/^(\s*)/))?void 0:r[1])?void 0:i.length)||0)>m){y.push(e),d=`${d}${e} `,c+=1;continue}break}if(((null==(s=null==(o=e.match(/^(\s*)/))?void 0:o[1])?void 0:s.length)||0)>m)y.push(e),d=`${d}${e} `,c+=1;else break}let b=y.slice(1);if(b.length>0){let r=b.map(e=>e.slice(m+h)).join("\n");r.trim()&&(e=t.customNestedParser?t.customNestedParser(r):n.blockTokens(r))}let k=t.createToken(f,e);a.push(k)}if(0!==a.length)return{items:a,raw:d}}function tZ(e,t,n,r){if(!e||!Array.isArray(e.content))return"";let i="function"==typeof n?n(r):n,[o,...s]=e.content,l=t.renderChildren([o]),a=[`${i}${l}`];return s&&s.length>0&&s.forEach(e=>{let n=t.renderChildren([e]);if(n){let e=n.split("\n").map(e=>e?t.indent(e):"").join("\n");a.push(e)}}),a.join("\n")}function t0(e,t,n={}){let{state:r}=t,{doc:i,tr:o}=r;i.descendants((t,r)=>{let i=o.mapping.map(r),s=o.mapping.map(r)+t.nodeSize,l=null;if(t.marks.forEach(t=>{if(t!==e)return!1;l=t}),!l)return;let a=!1;if(Object.keys(n).forEach(e=>{n[e]!==l.attrs[e]&&(a=!0)}),a){let t=e.type.create({...e.attrs,...n});o.removeMark(i,s,e.type),o.addMark(i,s,t)}}),o.docChanged&&t.view.dispatch(o)}d({},{createAtomBlockMarkdownSpec:()=>tU,createBlockMarkdownSpec:()=>tJ,createInlineMarkdownSpec:()=>tQ,parseAttributes:()=>tq,parseIndentedBlocks:()=>tX,renderNestedMarkdownContent:()=>tZ,serializeAttributes:()=>tK});var t1=class{constructor(e,t,n){this.component=e,this.editor=t.editor,this.options={...n},this.mark=t.mark,this.HTMLAttributes=t.HTMLAttributes}get dom(){return this.editor.view.dom}get contentDOM(){return null}updateAttributes(e,t){t0(t||this.mark,this.editor,e)}ignoreMutation(e){return!this.dom||!this.contentDOM||("function"==typeof this.options.ignoreMutation?this.options.ignoreMutation({mutation:e}):!("selection"===e.type||this.dom.contains(e.target)&&"childList"===e.type&&($()||B())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable))&&(this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target)))}},t2=class e extends tb{constructor(){super(...arguments),this.type="node"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},t3=class{constructor(e,t,n){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t,n,i,o,s,l,a;let{view:d}=this.editor,c=e.target,h=3===c.nodeType?null==(t=c.parentElement)?void 0:t.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(null==(n=this.contentDOM)?void 0:n.contains(c))||!h)return;let p=0,u=0;if(this.dom!==h){let t=this.dom.getBoundingClientRect(),n=h.getBoundingClientRect(),r=null!=(o=e.offsetX)?o:null==(i=e.nativeEvent)?void 0:i.offsetX,a=null!=(l=e.offsetY)?l:null==(s=e.nativeEvent)?void 0:s.offsetY;p=n.x-t.x+r,u=n.y-t.y+a}let f=this.dom.cloneNode(!0);try{let e=this.dom.getBoundingClientRect();f.style.width=`${Math.round(e.width)}px`,f.style.height=`${Math.round(e.height)}px`,f.style.boxSizing="border-box",f.style.pointerEvents="none"}catch{}let m=null;try{(m=document.createElement("div")).style.position="absolute",m.style.top="-9999px",m.style.left="-9999px",m.style.pointerEvents="none",m.appendChild(f),document.body.appendChild(m),null==(a=e.dataTransfer)||a.setDragImage(f,p,u)}finally{m&&setTimeout(()=>{try{null==m||m.remove()}catch{}},0)}let g=this.getPos();if("number"!=typeof g)return;let y=r.NodeSelection.create(d.state.doc,g),b=d.state.tr.setSelection(y);d.dispatch(b)}stopEvent(e){var t;if(!this.dom)return!1;if("function"==typeof this.options.stopEvent)return this.options.stopEvent({event:e});let n=e.target;if(!(this.dom.contains(n)&&!(null==(t=this.contentDOM)?void 0:t.contains(n))))return!1;let i=e.type.startsWith("drag"),o="drop"===e.type;if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!o&&!i)return!0;let{isEditable:s}=this.editor,{isDragging:l}=this,a=!!this.node.type.spec.draggable,d=r.NodeSelection.isSelectable(this.node),c="copy"===e.type,h="paste"===e.type,p="cut"===e.type,u="mousedown"===e.type;if(!a&&d&&i&&e.target===this.dom&&e.preventDefault(),a&&i&&!l&&e.target===this.dom)return e.preventDefault(),!1;if(a&&s&&!l&&u){let e=n.closest("[data-drag-handle]");e&&(this.dom===e||this.dom.contains(e))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!l&&!o&&!c&&!h&&!p&&(!u||!d)}ignoreMutation(e){return!this.dom||!this.contentDOM||("function"==typeof this.options.ignoreMutation?this.options.ignoreMutation({mutation:e}):!!this.node.isLeaf||!!this.node.isAtom||!("selection"===e.type||this.dom.contains(e.target)&&"childList"===e.type&&($()||B())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable))&&(this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target)))}updateAttributes(e){this.editor.commands.command(({tr:t})=>{let n=this.getPos();return"number"==typeof n&&(t.setNodeMarkup(n,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){let e=this.getPos();if("number"!=typeof e)return;let t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function t4(e){return new tv({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let o=eN(e.getAttributes,void 0,r,i);if(!1===o||null===o)return null;let{tr:s}=t,l=r[r.length-1],a=r[0],d=n.to;if(l){let r=a.search(/\S/),i=n.from+a.indexOf(l),c=i+l.length;if(eV(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>i).length)return null;cn.from&&s.delete(n.from+r,i),d=n.from+r+l.length,s.addMark(n.from+r,d,e.type.create(o||{})),s.removeStoredMark(e.type)}}})}e.s(["Editor",()=>t$,"Extension",()=>tM,"Mark",()=>tk,"MarkView",()=>t1,"Node",()=>t2,"NodeView",()=>t3,"callOrReturn",()=>eN,"canInsertNode",()=>tW,"combineTransactionSteps",()=>ev,"createInlineMarkdownSpec",()=>tQ,"escapeForRegEx",()=>t_,"extensions",()=>tx,"findChildrenInRange",()=>ew,"getAttributes",()=>ej,"getChangedRanges",()=>eF,"getExtensionField",()=>ex,"getHTMLFromFragment",()=>eC,"getMarksBetween",()=>eV,"getNodeAtPosition",()=>eH,"getNodeType",()=>v,"getRenderedAttributes",()=>eD,"isAtEndOfNode",()=>eK,"isAtStartOfNode",()=>eU,"isNodeActive",()=>en,"isNodeEmpty",()=>eY,"isNodeSelection",()=>eQ,"markInputRule",()=>tj,"markPasteRule",()=>t4,"mergeAttributes",()=>eA,"nodeInputRule",()=>tF,"parseIndentedBlocks",()=>tX,"renderNestedMarkdownContent",()=>tZ,"textblockTypeInputRule",()=>tV,"wrappingInputRule",()=>tH])},853025,589430,e=>{"use strict";var t=e.i(673654);e.i(608469);var n=e.i(111092),r=e.i(545773);class i{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!=(n=t.width)?n:1,this.color=!1===t.color?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t,n=this.editorView.state.doc.resolve(this.cursorPos),r=!n.parent.inlineContent,i,o=this.editorView.dom,s=o.getBoundingClientRect(),l=s.width/o.offsetWidth,a=s.height/o.offsetHeight;if(r){let e=n.nodeBefore,t=n.nodeAfter;if(e||t){let n=this.editorView.nodeDOM(this.cursorPos-(e?e.nodeSize:0));if(n){let r=n.getBoundingClientRect(),o=e?r.bottom:r.top;e&&t&&(o=(o+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*a;i={left:r.left,right:r.right,top:o-s,bottom:o+s}}}}if(!i){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*l;i={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let d=this.editorView.dom.offsetParent;if(!this.element&&(this.element=d.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",r),this.element.classList.toggle("prosemirror-dropcursor-inline",!r),d&&(d!=document.body||"static"!=getComputedStyle(d).position)){let n=d.getBoundingClientRect(),r=n.width/d.offsetWidth,i=n.height/d.offsetHeight;e=n.left-d.scrollLeft*r,t=n.top-d.scrollTop*i}else e=-pageXOffset,t=-pageYOffset;this.element.style.left=(i.left-e)/l+"px",this.element.style.top=(i.top-t)/a+"px",this.element.style.width=(i.right-i.left)/l+"px",this.element.style.height=(i.bottom-i.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=n&&n.type.spec.disableDropCursor,o="function"==typeof i?i(this.editorView,t,e):i;if(t&&!o){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=(0,r.dropPoint)(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=t&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}e.i(979748);var o=e.i(675993),s=e.i(202008),l=n,a=e.i(47091);class d extends l.Selection{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return d.valid(n)?new d(n):l.Selection.near(n)}content(){return a.Slice.empty}eq(e){return e instanceof d&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for GapCursor.fromJSON");return new d(e.resolve(t.pos))}getBookmark(){return new c(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0==n){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||h(e.type))return!0;if(e.inlineContent)return!1}}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||h(e.type))return!0;if(e.inlineContent)return!1}}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){r:for(;;){if(!n&&d.valid(e))return e;let r=e.pos,i=null;for(let n=e.depth;;n--){let o=e.node(n);if(t>0?e.indexAfter(n)0){i=o.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let s=e.doc.resolve(r);if(d.valid(s))return s}for(;;){let o=t>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!l.NodeSelection.isSelectable(i)){e=e.doc.resolve(r+i.nodeSize*t),n=!1;continue r}break}i=o,r+=t;let s=e.doc.resolve(r);if(d.valid(s))return s}return null}}}d.prototype.visible=!1,d.findFrom=d.findGapCursorFrom,l.Selection.jsonID("gapcursor",d);class c{constructor(e){this.pos=e}map(e){return new c(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return d.valid(t)?new d(t):l.Selection.near(t)}}function h(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}let p=(0,s.keydownHandler)({ArrowLeft:u("horiz",-1),ArrowRight:u("horiz",1),ArrowUp:u("vert",-1),ArrowDown:u("vert",1)});function u(e,t){let n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,i){let o=e.selection,s=t>0?o.$to:o.$from,a=o.empty;if(o instanceof l.TextSelection){if(!i.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=e.doc.resolve(t>0?s.after():s.before())}let c=d.findGapCursorFrom(s,t,a);return!!c&&(r&&r(e.tr.setSelection(new d(c))),!0)}}function f(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!d.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return!(i&&i.inside>-1&&l.NodeSelection.isSelectable(e.state.doc.nodeAt(i.inside)))&&(e.dispatch(e.state.tr.setSelection(new d(r))),!0)}function m(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof d))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=a.Fragment.empty;for(let e=r.length-1;e>=0;e--)i=a.Fragment.from(r[e].createAndFill(null,i));let o=e.state.tr.replace(n.pos,n.pos,new a.Slice(i,0,0));return o.setSelection(l.TextSelection.near(o.doc.resolve(n.pos+1))),e.dispatch(o),!1}function g(e){if(!(e.selection instanceof d))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",o.DecorationSet.create(e.doc,[o.Decoration.widget(e.selection.head,t,{key:"gapcursor"})])}var y=function(){};y.prototype.append=function(e){return e.length?(e=y.from(e),!this.length&&e||e.length<200&&this.leafAppend(e)||this.length<200&&e.leafPrepend(this)||this.appendInner(e)):this},y.prototype.prepend=function(e){return e.length?y.from(e).append(this):this},y.prototype.appendInner=function(e){return new k(this,e)},y.prototype.slice=function(e,t){return(void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t)?y.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},y.prototype.get=function(e){if(!(e<0)&&!(e>=this.length))return this.getInner(e)},y.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},y.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},y.from=function(e){return e instanceof y?e:e&&e.length?new b(e):y.empty};var b=function(e){function t(t){e.call(this),this.values=t}t.__proto__=e,t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i=n;i--)if(!1===e(this.values[i],r+i))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=200)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=200)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(y);y.empty=new b([]);var k=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return t.__proto__=e,t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return ei&&!1===this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&!1===this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)||n=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(y);class v{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){let n,r,i,o;if(0==this.eventCount)return null;let s=this.items.length;for(;;s--)if(this.items.get(s-1).selection){--s;break}t&&(r=(n=this.remapping(s,this.items.length)).maps.length);let l=e.tr,a=[],d=[];return this.items.forEach((e,t)=>{if(!e.step){n||(r=(n=this.remapping(s,t+1)).maps.length),r--,d.push(e);return}if(n){d.push(new w(e.map));let t=e.step.map(n.slice(r)),i;t&&l.maybeStep(t).doc&&(i=l.mapping.maps[l.mapping.maps.length-1],a.push(new w(i,void 0,void 0,a.length+d.length))),r--,i&&n.appendMap(i,r)}else l.maybeStep(e.step);if(e.selection)return i=n?e.selection.map(n.slice(r)):e.selection,o=new v(this.items.slice(0,s).append(d.reverse().concat(a)),this.eventCount-1),!1},this.items.length,0),{remaining:o,transform:l,selection:i}}addTransform(e,t,n,r){var i,o;let s,l=[],a=this.eventCount,d=this.items,c=!r&&d.length?d.get(d.length-1):null;for(let n=0;nx&&(i=d,o=h,i.forEach((e,t)=>{if(e.selection&&0==o--)return s=t,!1}),d=i.slice(s),a-=h),new v(d.append(l),a)}remapping(e,t){let n=new r.Mapping;return this.items.forEach((t,r)=>{let i=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(e){return 0==this.eventCount?this:new v(this.items.append(e.map(e=>new w(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),i=e.mapping,o=e.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},r);let l=t;this.items.forEach(t=>{let r=i.getMirror(--l);if(null==r)return;o=Math.min(o,r);let a=i.maps[r];if(t.step){let o=e.steps[r].invert(e.docs[r]),d=t.selection&&t.selection.map(i.slice(l+1,r));d&&s++,n.push(new w(a,o,d))}else n.push(new w(a))},r);let a=[];for(let e=t;e500&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{!t.step&&e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],i=0;return this.items.forEach((o,s)=>{if(s>=e)r.push(o),o.selection&&i++;else if(o.step){let e=o.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let l=o.selection&&o.selection.map(t.slice(n));l&&i++;let a=new w(s.invert(),e,l),d,c=r.length-1;(d=r.length&&r[c].merge(a))?r[c]=d:r.push(a)}}else o.map&&n--},this.items.length,0),new v(y.from(r.reverse()),i)}}v.empty=new v(y.empty,0);class w{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new w(t.getMap().invert(),t,this.selection)}}}class S{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}}let x=20;function M(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function C(e,t){if(!e)return null;let n=[];for(let r=0;r{let i=O.getState(n);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(r){let o=function(e,t,n){let r=E(t),i=O.get(t).spec.config,o=(n?e.undone:e.done).popEvent(t,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(n?e.done:e.undone).addTransform(o.transform,t.selection.getBookmark(),i,r),a=new S(n?l:o.remaining,n?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(O,{redo:n,historyState:a})}(i,n,e);o&&r(t?o.scrollIntoView():o)}return!0}}let R=D(!1,!0),I=D(!0,!0);D(!1,!1),D(!0,!1),t.Extension.create({name:"characterCount",addOptions:()=>({limit:null,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(e=>""!==e).length}),addStorage:()=>({characters:()=>0,words:()=>0}),onBeforeCreate(){this.storage.characters=e=>{let t=(null==e?void 0:e.node)||this.editor.state.doc;if("textSize"===((null==e?void 0:e.mode)||this.options.mode)){let e=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=(null==e?void 0:e.node)||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new n.Plugin({key:new n.PluginKey("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit;if(null==i||0===i){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let t=r.tr.deleteRange(0,o-i);return e=!0,t}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||0===n||null==n)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta("paste"))return!1;let o=e.selection.$head.pos;return e.deleteRange(o-(i-n),o),!(this.storage.characters({node:e.doc})>n)}})]}});var P=t.Extension.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[function(e={}){return new n.Plugin({view:t=>new i(t,e)})}(this.options)]}});t.Extension.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new n.Plugin({key:new n.PluginKey("focus"),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,s=[];if(!n||!r)return o.DecorationSet.create(e,[]);let l=0;"deepest"===this.options.mode&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;l+=1}});let a=0;return e.descendants((e,t)=>!e.isText&&!!(i>=t&&i<=t+e.nodeSize-1)&&((a+=1,"deepest"===this.options.mode&&l-a>0||"shallowest"===this.options.mode&&a>1)?"deepest"===this.options.mode:void s.push(o.Decoration.node(t,t+e.nodeSize,{class:this.options.className})))),o.DecorationSet.create(e,s)}}})]}});var L=t.Extension.create({name:"gapCursor",addProseMirrorPlugins:()=>[new l.Plugin({props:{decorations:g,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&d.valid(n)?new d(n):null,handleClick:f,handleKeyDown:p,handleDOMEvents:{beforeinput:m}}})],extendNodeSchema(e){var n;let r={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:null!=(n=(0,t.callOrReturn)((0,t.getExtensionField)(e,"allowGapCursor",r)))?n:null}}}),z="placeholder",B=t.Extension.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:z,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){let e=this.options.dataAttribute?`data-${this.options.dataAttribute.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}`:`data-${z}`;return[new n.Plugin({key:new n.PluginKey("placeholder"),props:{decorations:({doc:n,selection:r})=>{let i=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:s}=r,l=[];if(!i)return null;let a=this.editor.isEmpty;return n.descendants((n,r)=>{let i=s>=r&&s<=r+n.nodeSize,d=!n.isLeaf&&(0,t.isNodeEmpty)(n);if((i||!this.options.showOnlyCurrent)&&d){let t=[this.options.emptyNodeClass];a&&t.push(this.options.emptyEditorClass);let s=o.Decoration.node(r,r+n.nodeSize,{class:t.join(" "),[e]:"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:n,pos:r,hasAnchor:i}):this.options.placeholder});l.push(s)}return this.options.includeChildren}),o.DecorationSet.create(n,l)}}})]}});function $({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(null==t?void 0:t.type)===e}t.Extension.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){let{editor:e,options:r}=this;return[new n.Plugin({key:new n.PluginKey("selection"),props:{decorations:n=>n.selection.empty||e.isFocused||!e.isEditable||(0,t.isNodeSelection)(n.selection)||e.view.dragging?null:o.DecorationSet.create(n.doc,[o.Decoration.inline(n.selection.from,n.selection.to,{class:r.className})])}})]}});var j=t.Extension.create({name:"trailingNode",addOptions:()=>({node:void 0,notAfter:[]}),addProseMirrorPlugins(){var e;let t=new n.PluginKey(this.name),r=this.options.node||(null==(e=this.editor.schema.topNodeType.contentMatch.defaultType)?void 0:e.name)||"paragraph",i=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(r).includes(e.name));return[new n.Plugin({key:t,appendTransaction:(e,n,i)=>{let{doc:o,tr:s,schema:l}=i,a=t.getState(i),d=o.content.size,c=l.nodes[r];if(a)return s.insert(d,c.create())},state:{init:(e,t)=>!$({node:t.tr.doc.lastChild,types:i}),apply:(e,t)=>!e.docChanged||e.getMeta("__uniqueIDTransaction")?t:!$({node:e.doc.lastChild,types:i})}})]}}),F=t.Extension.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:t})=>R(e,t),redo:()=>({state:e,dispatch:t})=>I(e,t)}),addProseMirrorPlugins(){return[function(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new n.Plugin({key:O,state:{init:()=>new S(v.empty,v.empty,null,0,-1),apply:(t,n,r)=>(function(e,t,n,r){let i=n.getMeta(O),o;if(i)return i.historyState;n.getMeta(A)&&(e=new S(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(O))if(s.getMeta(O).redo)return new S(e.done.addTransform(n,void 0,r,E(t)),e.undone,M(n.mapping.maps),e.prevTime,e.prevComposition);else return new S(e.done,e.undone.addTransform(n,void 0,r,E(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))if(o=n.getMeta("rebased"))return new S(e.done.rebased(n,o),e.undone.rebased(n,o),C(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new S(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),C(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let i=n.getMeta("composition"),o=0==e.prevTime||!s&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i=t[i]&&(n=!0)}),n}(n,e.prevRanges)),l=s?C(e.prevRanges,n.mapping):M(n.mapping.maps);return new S(e.done.addTransform(n,o?t.selection.getBookmark():void 0,r,E(t)),v.empty,l,n.time,null==i?e.prevComposition:i)}})(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?R:"historyRedo"==n?I:null;return!!r&&!!e.editable&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}});e.s(["Dropcursor",()=>P,"Gapcursor",()=>L,"Placeholder",()=>B,"TrailingNode",()=>j,"UndoRedo",()=>F],589430),e.s(["default",()=>B],853025)},616777,e=>{"use strict";e.i(23741);var t=e.i(358379),n=e.i(111558),r=e.i(536379),i=e.i(462214),o=e.i(673654);let{getOwnPropertyNames:s,getOwnPropertySymbols:l}=Object,{hasOwnProperty:a}=Object.prototype;function d(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function c(e){return function(t,n,r){if(!t||!n||"object"!=typeof t||"object"!=typeof n)return e(t,n,r);let{cache:i}=r,o=i.get(t),s=i.get(n);if(o&&s)return o===n&&s===t;i.set(t,n),i.set(n,t);let l=e(t,n,r);return i.delete(t),i.delete(n),l}}function h(e){return s(e).concat(l(e))}let p=Object.hasOwn||((e,t)=>a.call(e,t));function u(e,t){return e===t||!e&&!t&&e!=e&&t!=t}let{getOwnPropertyDescriptor:f,keys:m}=Object;function g(e,t){return e.byteLength===t.byteLength&&E(new Uint8Array(e),new Uint8Array(t))}function y(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function b(e,t){return e.byteLength===t.byteLength&&E(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function k(e,t){return u(e.getTime(),t.getTime())}function v(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function w(e,t){return e===t}function S(e,t,n){let r,i,o=e.size;if(o!==t.size)return!1;if(!o)return!0;let s=Array(o),l=e.entries(),a=0;for(;(r=l.next())&&!r.done;){let o=t.entries(),l=!1,d=0;for(;(i=o.next())&&!i.done;){if(s[d]){d++;continue}let o=r.value,c=i.value;if(n.equals(o[0],c[0],a,d,e,t,n)&&n.equals(o[1],c[1],o[0],c[0],e,t,n)){l=s[d]=!0;break}d++}if(!l)return!1;a++}return!0}function x(e,t,n){let r=m(e),i=r.length;if(m(t).length!==i)return!1;for(;i-- >0;)if(!A(e,t,n,r[i]))return!1;return!0}function M(e,t,n){let r,i,o,s=h(e),l=s.length;if(h(t).length!==l)return!1;for(;l-- >0;)if(!A(e,t,n,r=s[l])||(i=f(e,r),o=f(t,r),(i||o)&&(!i||!o||i.configurable!==o.configurable||i.enumerable!==o.enumerable||i.writable!==o.writable)))return!1;return!0}function C(e,t){return u(e.valueOf(),t.valueOf())}function T(e,t){return e.source===t.source&&e.flags===t.flags}function N(e,t,n){let r,i,o=e.size;if(o!==t.size)return!1;if(!o)return!0;let s=Array(o),l=e.values();for(;(r=l.next())&&!r.done;){let o=t.values(),l=!1,a=0;for(;(i=o.next())&&!i.done;){if(!s[a]&&n.equals(r.value,i.value,r.value,i.value,e,t,n)){l=s[a]=!0;break}a++}if(!l)return!1}return!0}function E(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function O(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function A(e,t,n,r){return("_owner"===r||"__o"===r||"__v"===r)&&(!!e.$$typeof||!!t.$$typeof)||p(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}let D={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},R=Object.prototype.toString,I=P();function P(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,o=function({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:o,areMapsEqual:s,areNumbersEqual:l,areObjectsEqual:a,arePrimitiveWrappersEqual:d,areRegExpsEqual:c,areSetsEqual:h,areTypedArraysEqual:p,areUrlsEqual:u,unknownTagComparators:f}){return function(m,g,y){if(m===g)return!0;if(null==m||null==g)return!1;let b=typeof m;if(b!==typeof g)return!1;if("object"!==b)return"number"===b?l(m,g,y):"function"===b&&o(m,g,y);let k=m.constructor;if(k!==g.constructor)return!1;if(k===Object)return a(m,g,y);if(Array.isArray(m))return t(m,g,y);if(k===Date)return r(m,g,y);if(k===RegExp)return c(m,g,y);if(k===Map)return s(m,g,y);if(k===Set)return h(m,g,y);let v=R.call(m);if("[object Date]"===v)return r(m,g,y);if("[object RegExp]"===v)return c(m,g,y);if("[object Map]"===v)return s(m,g,y);if("[object Set]"===v)return h(m,g,y);if("[object Object]"===v)return"function"!=typeof m.then&&"function"!=typeof g.then&&a(m,g,y);if("[object URL]"===v)return u(m,g,y);if("[object Error]"===v)return i(m,g,y);if("[object Arguments]"===v)return a(m,g,y);if(D[v])return p(m,g,y);if("[object ArrayBuffer]"===v)return e(m,g,y);if("[object DataView]"===v)return n(m,g,y);if("[object Boolean]"===v||"[object Number]"===v||"[object String]"===v)return d(m,g,y);if(f){let e=f[v];if(!e){let t=null!=m?m[Symbol.toStringTag]:void 0;t&&(e=f[t])}if(e)return e(m,g,y)}return!1}}(function({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:g,areArraysEqual:n?M:y,areDataViewsEqual:b,areDatesEqual:k,areErrorsEqual:v,areFunctionsEqual:w,areMapsEqual:n?d(S,M):S,areNumbersEqual:u,areObjectsEqual:n?M:x,arePrimitiveWrappersEqual:C,areRegExpsEqual:T,areSetsEqual:n?d(N,M):N,areTypedArraysEqual:n?d(E,M):E,areUrlsEqual:O,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=c(r.areArraysEqual),t=c(r.areMapsEqual),n=c(r.areObjectsEqual),i=c(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}(e)),s=n?n(o):function(e,t,n,r,i,s,l){return o(e,t,l)};return function({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(o,s){let{cache:l=e?new WeakMap:void 0,meta:a}=n();return t(o,s,{cache:l,equals:r,meta:a,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let o={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,o)}}({circular:t,comparator:o,createState:r,equals:s,strict:i})}P({strict:!0}),P({circular:!0}),P({circular:!0,strict:!0}),P({createInternalComparator:()=>u}),P({strict:!0,createInternalComparator:()=>u}),P({circular:!0,createInternalComparator:()=>u}),P({circular:!0,createInternalComparator:()=>u,strict:!0});var L=e.i(670986),z=({contentComponent:e})=>{let t=(0,r.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,i.jsx)(i.Fragment,{children:Object.values(t)})},B=class extends t.default.Component{constructor(e){var n;super(e),this.editorContentRef=t.default.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(null==(n=e.editor)?void 0:n.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;let t=this.props.editor;if(t&&!t.isDestroyed&&(null==(e=t.view.dom)?void 0:e.parentNode)){let e,r;if(t.contentComponent)return;let i=this.editorContentRef.current;i.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:i}),e=new Set,r={},t.contentComponent={subscribe:t=>(e.add(t),()=>{e.delete(t)}),getSnapshot:()=>r,getServerSnapshot:()=>r,setRenderer(t,i){r={...r,[t]:n.default.createPortal(i.reactElement,i.element,t)},e.forEach(e=>e())},removeRenderer(t){let n={...r};delete n[t],r=n,e.forEach(e=>e())}},this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(e=>e.hasContentComponentInitialized?e:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var e;let t=this.props.editor;if(t){this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null;try{if(!(null==(e=t.view.dom)?void 0:e.parentNode))return;let n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{ref:((...e)=>t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})})(t,this.editorContentRef),...n}),(null==e?void 0:e.contentComponent)&&(0,i.jsx)(z,{contentComponent:e.contentComponent})]})}},$=(0,t.forwardRef)((e,n)=>{let r=t.default.useMemo(()=>Math.floor(0xffffffff*Math.random()).toString(),[e.editor]);return t.default.createElement(B,{key:r,innerRef:n,...e})}),j=t.default.memo($),F="u">typeof window?t.useLayoutEffect:t.useEffect,V=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber||(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber}),this.lastSnapshot}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}};function H(e){var n;let[r]=(0,t.useState)(()=>new V(e.editor)),i=(0,L.useSyncExternalStoreWithSelector)(r.subscribe,r.getSnapshot,r.getServerSnapshot,e.selector,null!=(n=e.equalityFn)?n:I);return F(()=>r.watch(e.editor),[e.editor,r]),(0,t.useDebugValue)(i),i}var W="u"typeof window&&window.next),q=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){return void 0===this.options.current.immediatelyRender?W||_?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender)?this.createEditor():null}createEditor(){let e={...this.options.current,onBeforeCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBeforeCreate)?void 0:n.call(t,...e)},onBlur:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBlur)?void 0:n.call(t,...e)},onCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onCreate)?void 0:n.call(t,...e)},onDestroy:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDestroy)?void 0:n.call(t,...e)},onFocus:(...e)=>{var t,n;return null==(n=(t=this.options.current).onFocus)?void 0:n.call(t,...e)},onSelectionUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onSelectionUpdate)?void 0:n.call(t,...e)},onTransaction:(...e)=>{var t,n;return null==(n=(t=this.options.current).onTransaction)?void 0:n.call(t,...e)},onUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onUpdate)?void 0:n.call(t,...e)},onContentError:(...e)=>{var t,n;return null==(n=(t=this.options.current).onContentError)?void 0:n.call(t,...e)},onDrop:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDrop)?void 0:n.call(t,...e)},onPaste:(...e)=>{var t,n;return null==(n=(t=this.options.current).onPaste)?void 0:n.call(t,...e)},onDelete:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDelete)?void 0:n.call(t,...e)}};return new o.Editor(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>!!["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)||("extensions"===n&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,n)=>{var r;return e===(null==(r=t.extensions)?void 0:r[n])}):e[n]===t[n]))}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===t.length?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(null===this.previousDeps){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function K(e={},n=[]){let i=(0,t.useRef)(e);i.current=e;let[o]=(0,t.useState)(()=>new q(i)),s=(0,r.useSyncExternalStore)(o.subscribe,o.getEditor,o.getServerSnapshot);return(0,t.useDebugValue)(s),(0,t.useEffect)(o.onRender(n)),H({editor:s,selector:({transactionNumber:t})=>!1===e.shouldRerenderOnTransaction||void 0===e.shouldRerenderOnTransaction?null:e.immediatelyRender&&0===t?0:t+1}),s}var U=(0,t.createContext)({editor:null});U.Consumer;var J=(0,t.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),G=t.default.forwardRef((e,n)=>{let{onDragStart:r}=(0,t.useContext)(J),o=e.as||"div";return(0,i.jsx)(o,{...e,ref:n,"data-node-view-wrapper":"",onDragStart:r,style:{whiteSpace:"normal",...e.style}})});function Y(e){return!!("function"==typeof e&&e.prototype&&e.prototype.isReactComponent)}function Q(e){return!!("object"==typeof e&&e.$$typeof&&("Symbol(react.forward_ref)"===e.$$typeof.toString()||"react.forward_ref"===e.$$typeof.description))}var X=class{constructor(e,{editor:t,props:r={},as:i="div",className:o=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(0xffffffff*Math.random()).toString(),this.component=e,this.editor=t,this.props=r,this.element=document.createElement(i),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),this.editor.isInitialized?(0,n.flushSync)(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;let n=this.component,r=this.props,o=this.editor,s=function(){try{if(t.version)return parseInt(t.version.split(".")[0],10)>=19}catch{}return!1}(),l=function(e){if(Y(e)||Q(e))return!0;if("object"==typeof e&&e.$$typeof&&("Symbol(react.memo)"===e.$$typeof.toString()||"react.memo"===e.$$typeof.description)){let t=e.type;if(t)return Y(t)||Q(t)}return!1}(n),a={...r};a.ref&&!(s||l)&&delete a.ref,!a.ref&&(s||l)&&(a.ref=e=>{this.ref=e}),this.reactElement=(0,i.jsx)(n,{...a}),null==(e=null==o?void 0:o.contentComponent)||e.setRenderer(this.id,this)}updateProps(e={}){this.destroyed||(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0;let t=this.editor;null==(e=null==t?void 0:t.contentComponent)||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};t.default.createContext({markViewContentRef:()=>{}}),o.MarkView;var Z=class extends o.NodeView{constructor(e,t,n){if(super(e,t,n),this.selectionRafId=null,this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const e=this.dom.querySelector("[data-node-view-content]");if(!e)return;e.appendChild(this.contentDOMElement)}}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){let e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(n,r,i){var o;return"storage"===r?null!=(o=e.storage[t.name])?o:{}:Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){let e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e),deleteNode:()=>this.deleteNode(),ref:(0,t.createRef)()};if(!this.component.displayName){let e;this.component.displayName=(e=this.extension.name).charAt(0).toUpperCase()+e.substring(1)}let n={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:e=>{e&&this.contentDOMElement&&e.firstChild!==this.contentDOMElement&&(e.hasAttribute("data-node-view-wrapper")&&e.removeAttribute("data-node-view-wrapper"),e.appendChild(this.contentDOMElement))}},r=this.component,o=(0,t.memo)(e=>(0,i.jsx)(J.Provider,{value:n,children:(0,t.createElement)(r,e)}));o.displayName="ReactNodeView";let s=this.node.isInline?"span":"div";this.options.as&&(s=this.options.as);let{className:l=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new X(o,{editor:this.editor,props:e,as:s,className:`node-${this.node.type.name} ${l}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var e;if(this.renderer.element.firstElementChild&&!(null==(e=this.renderer.element.firstElementChild)?void 0:e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;let{from:e,to:t}=this.editor.state.selection,n=this.getPos();if("number"==typeof n)if(e<=n&&t>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(e,t,n){let r=e=>{this.renderer.updateProps(e),"function"==typeof this.options.attrs&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if("function"==typeof this.options.update){let i=this.node,o=this.decorations,s=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.options.update({oldNode:i,oldDecorations:o,newNode:e,newDecorations:t,oldInnerDecorations:s,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}return e===this.node&&this.decorations===t&&this.innerDecorations===n||(this.node=e,this.decorations=t,this.innerDecorations=n,r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage}),!0)}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let e={};if("function"==typeof this.options.attrs){let t=this.editor.extensionManager.attributes,n=(0,o.getRenderedAttributes)(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:n})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}};function ee(e,t){return n=>n.editor.contentComponent?new Z(e,n,t):{}}var et=(0,t.createContext)({get editor(){throw Error("useTiptap must be used within a provider")}});function en({editor:e,instance:n,children:r}){let o=null!=e?e:n;if(!o)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let s=(0,t.useMemo)(()=>({editor:o}),[o]),l=(0,t.useMemo)(()=>({editor:o}),[o]);return(0,i.jsx)(U.Provider,{value:l,children:(0,i.jsx)(et.Provider,{value:s,children:r})})}function er({...e}){let{editor:n}=(0,t.useContext)(et);return(0,i.jsx)(j,{editor:n,...e})}et.displayName="TiptapContext",en.displayName="Tiptap",er.displayName="Tiptap.Content",Object.assign(en,{Content:er}),e.s(["EditorContent",()=>j,"NodeViewWrapper",()=>G,"ReactNodeViewRenderer",()=>ee,"ReactRenderer",()=>X,"useEditor",()=>K,"useEditorState",()=>H],616777)},999445,e=>{"use strict";var t=e.i(673654),n=(e,t)=>{if("slot"===e)return 0;if(e instanceof Function)return e(t);let{children:n,...r}=null!=t?t:{};if("svg"===e)throw Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,r,n]},r=/^\s*>\s$/,i=t.Node.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return n("blockquote",{...(0,t.mergeAttributes)(this.options.HTMLAttributes,e),children:n("slot",{})})},parseMarkdown:(e,t)=>t.createNode("blockquote",void 0,t.parseChildren(e.tokens||[])),renderMarkdown:(e,t)=>{if(!e.content)return"";let n=[];return e.content.forEach(e=>{let r=t.renderChildren([e]).split("\n").map(e=>""===e.trim()?">":`> ${e}`);n.push(r.join("\n"))}),n.join(` > `)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[(0,t.wrappingInputRule)({find:r,type:this.type})]}}),o=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,s=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,l=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,a=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,d=t.Mark.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return n("strong",{...(0,t.mergeAttributes)(this.options.HTMLAttributes,e),children:n("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[(0,t.markInputRule)({find:o,type:this.type}),(0,t.markInputRule)({find:l,type:this.type})]},addPasteRules(){return[(0,t.markPasteRule)({find:s,type:this.type}),(0,t.markPasteRule)({find:a,type:this.type})]}}),c=/(^|[^`])`([^`]+)`(?!`)$/,h=/(^|[^`])`([^`]+)`(?!`)/g,p=t.Mark.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",(0,t.mergeAttributes)(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[(0,t.markInputRule)({find:c,type:this.type})]},addPasteRules(){return[(0,t.markPasteRule)({find:h,type:this.type})]}});e.i(608469);var u=e.i(111092),f=/^```([a-z]+)?[\s\n]$/,m=/^~~~([a-z]+)?[\s\n]$/,g=t.Node.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;let{languageClassPrefix:n}=this.options;if(!n)return null;let r=[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter(e=>e.startsWith(n)).map(e=>e.replace(n,""))[0];return r||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:n}){return["pre",(0,t.mergeAttributes)(this.options.HTMLAttributes,n),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n;return(null==(n=e.raw)?void 0:n.startsWith("```"))===!1&&"indented"!==e.codeBlockStyle?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let r=(null==(n=e.attrs)?void 0:n.language)||"";return e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join("\n"):`\`\`\`${r} \`\`\``},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!!e&&t.parent.type.name===this.name&&(!!n||!t.parent.textContent.length)&&this.editor.commands.clearNodes()},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;let n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:i}=r,{$from:o,empty:s}=i;if(o.parent.type!==this.type)return!1;let l=" ".repeat(n);return s?e.commands.insertContent(l):e.commands.command(({tr:e})=>{let{from:t,to:n}=i,o=r.doc.textBetween(t,n,"\n","\n").split("\n").map(e=>l+e).join("\n");return e.replaceWith(t,n,r.schema.text(o)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;let n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:i}=r,{$from:o,empty:s}=i;return o.parent.type===this.type&&(s?e.commands.command(({tr:e})=>{var t;let{pos:i}=o,s=o.start(),l=o.end(),a=r.doc.textBetween(s,l,"\n","\n").split("\n"),d=0,c=0,h=i-s;for(let e=0;e=h){d=e;break}c+=a[e].length+1}let p=Math.min(((null==(t=a[d].match(/^ */))?void 0:t[0])||"").length,n);if(0===p)return!0;let f=s;for(let e=0;e{let{from:t,to:o}=i,s=r.doc.textBetween(t,o,"\n","\n").split("\n").map(e=>{var t;let r=Math.min(((null==(t=e.match(/^ */))?void 0:t[0])||"").length,n);return e.slice(r)}).join("\n");return e.replaceWith(t,o,r.schema.text(s)),!0}))},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith("\n\n");return!!o&&!!s&&e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let s=i.after();return void 0!==s&&(r.nodeAt(s)?e.commands.command(({tr:e})=>(e.setSelection(u.Selection.near(r.resolve(s))),!0)):e.commands.exitCode())}}},addInputRules(){return[(0,t.textblockTypeInputRule)({find:f,type:this.type,getAttributes:e=>({language:e[1]})}),(0,t.textblockTypeInputRule)({find:m,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new u.Plugin({key:new u.PluginKey("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=null==i?void 0:i.mode;if(!n||!o)return!1;let{tr:s,schema:l}=e.state,a=l.text(n.replace(/\r\n?/g,"\n"));return s.replaceSelectionWith(this.type.create({language:o},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(u.TextSelection.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),e.dispatch(s),!0}}})]}}),y=t.Node.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n\n"):""}),b=t.Node.create({name:"hardBreak",markdownTokenName:"br",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",(0,t.mergeAttributes)(this.options.HTMLAttributes,e)]},renderText:()=>"\n",renderMarkdown:()=>` `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:o}=this.options,{splittableMarks:s}=r.extensionManager,l=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&l&&o){let t=l.filter(e=>s.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),k=t.Node.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:n}){let r=this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0];return[`h${r}`,(0,t.mergeAttributes)(this.options.HTMLAttributes,n),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var n;let r=(null==(n=e.attrs)?void 0:n.level)?parseInt(e.attrs.level,10):1,i="#".repeat(r);return e.content?`${i} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.setNode(this.name,e),toggleHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,...{[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}}),{})},addInputRules(){return this.options.levels.map(e=>(0,t.textblockTypeInputRule)({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),v=t.Node.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{},nextNodeType:"paragraph"}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",(0,t.mergeAttributes)(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:n})=>{if(!(0,t.canInsertNode)(n,n.schema.nodes[this.name]))return!1;let{selection:r}=n,{$to:i}=r,o=e();return(0,t.isNodeSelection)(r)?o.insertContentAt(i.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(u.TextSelection.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(u.NodeSelection.create(t.doc,n.pos)):t.setSelection(u.TextSelection.create(t.doc,n.pos));else{let i=e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType,o=null==i?void 0:i.create();o&&(t.insert(r,o),t.setSelection(u.TextSelection.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[(0,t.nodeInputRule)({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),w=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,S=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,x=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,M=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,C=t.Mark.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",(0,t.mergeAttributes)(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[(0,t.markInputRule)({find:w,type:this.type}),(0,t.markInputRule)({find:x,type:this.type})]},addPasteRules(){return[(0,t.markPasteRule)({find:S,type:this.type}),(0,t.markPasteRule)({find:M,type:this.type})]}});let T="numeric",N="ascii",E="alpha",O="asciinumeric",A="alphanumeric",D="domain",R="emoji",I="whitespace";function P(e,t,n){for(let r in t[T]&&(t[O]=!0,t[A]=!0),t[N]&&(t[O]=!0,t[E]=!0),t[O]&&(t[A]=!0),t[E]&&(t[A]=!0),t[A]&&(t[D]=!0),t[R]&&(t[D]=!0),t){let t=(r in n||(n[r]=[]),n[r]);0>t.indexOf(e)&&t.push(e)}}function L(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}L.groups={},L.prototype={accepts(){return!!this.t},go(e){let t=this.j[e];if(t)return t;for(let t=0;t=0&&(n[r]=!0);return n}(i.t,r),n),r):n&&P(t,n,r)),i.t=t),this.j[e]=i,i}};let z=(e,t,n,r,i)=>e.ta(t,n,r,i),B=(e,t,n,r,i)=>e.tr(t,n,r,i),$=(e,t,n,r,i)=>e.ts(t,n,r,i),j=(e,t,n,r,i)=>e.tt(t,n,r,i),F="WORD",V="UWORD",H="ASCIINUMERICAL",W="ALPHANUMERICAL",_="LOCALHOST",q="UTLD",K="SCHEME",U="SLASH_SCHEME",J="OPENBRACE",G="CLOSEBRACE",Y="OPENBRACKET",Q="CLOSEBRACKET",X="OPENPAREN",Z="CLOSEPAREN",ee="OPENANGLEBRACKET",et="CLOSEANGLEBRACKET",en="FULLWIDTHLEFTPAREN",er="FULLWIDTHRIGHTPAREN",ei="LEFTCORNERBRACKET",eo="RIGHTCORNERBRACKET",es="LEFTWHITECORNERBRACKET",el="RIGHTWHITECORNERBRACKET",ea="FULLWIDTHLESSTHAN",ed="FULLWIDTHGREATERTHAN",ec="AMPERSAND",eh="APOSTROPHE",ep="ASTERISK",eu="BACKSLASH",ef="BACKTICK",em="CARET",eg="COLON",ey="COMMA",eb="DOLLAR",ek="EQUALS",ev="EXCLAMATION",ew="HYPHEN",eS="PERCENT",ex="PIPE",eM="PLUS",eC="POUND",eT="QUERY",eN="QUOTE",eE="FULLWIDTHMIDDLEDOT",eO="SEMI",eA="SLASH",eD="TILDE",eR="UNDERSCORE",eI="EMOJI";var eP=Object.freeze({__proto__:null,ALPHANUMERICAL:W,AMPERSAND:ec,APOSTROPHE:eh,ASCIINUMERICAL:H,ASTERISK:ep,AT:"AT",BACKSLASH:eu,BACKTICK:ef,CARET:em,CLOSEANGLEBRACKET:et,CLOSEBRACE:G,CLOSEBRACKET:Q,CLOSEPAREN:Z,COLON:eg,COMMA:ey,DOLLAR:eb,DOT:"DOT",EMOJI:eI,EQUALS:ek,EXCLAMATION:ev,FULLWIDTHGREATERTHAN:ed,FULLWIDTHLEFTPAREN:en,FULLWIDTHLESSTHAN:ea,FULLWIDTHMIDDLEDOT:eE,FULLWIDTHRIGHTPAREN:er,HYPHEN:ew,LEFTCORNERBRACKET:ei,LEFTWHITECORNERBRACKET:es,LOCALHOST:_,NL:"NL",NUM:"NUM",OPENANGLEBRACKET:ee,OPENBRACE:J,OPENBRACKET:Y,OPENPAREN:X,PERCENT:eS,PIPE:ex,PLUS:eM,POUND:eC,QUERY:eT,QUOTE:eN,RIGHTCORNERBRACKET:eo,RIGHTWHITECORNERBRACKET:el,SCHEME:K,SEMI:eO,SLASH:eA,SLASH_SCHEME:U,SYM:"SYM",TILDE:eD,TLD:"TLD",UNDERSCORE:eR,UTLD:q,UWORD:V,WORD:F,WS:"WS"});let eL=/[a-z]/,ez=/\p{L}/u,eB=/\p{Emoji}/u,e$=/\d/,ej=/\s/,eF=null,eV=null;function eH(e,t){let n=function(e){let t=[],n=e.length,r=0;for(;r56319||r+1===n||(i=e.charCodeAt(r+1))<56320||i>57343?e[r]:e.slice(r,r+2);t.push(s),r+=s.length}return t}(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],o=0,s=0;for(;s=0&&(h+=n[s].length,p++),d+=n[s].length,o+=n[s].length,s++;o-=h,s-=p,d-=h,i.push({t:c.t,v:t.slice(o-d,o),s:o-d,e:o})}return i}function eW(e,t,n,r,i){let o,s=t.length;for(let n=0;n=0;)i++;if(i>0){t.push(n.join(""));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}let eq={defaultProtocol:"http",events:null,format:eU,formatHref:eU,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function eK(e,t=null){let n=Object.assign({},eq);e&&(n=Object.assign(n,e instanceof eK?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;ee,check(e){return this.get("validate",e.toString(),e)},get(e,t,n){let r=null!=t,i=this.o[e];return i&&("object"==typeof i?"function"==typeof(i=n.t in i?i[n.t]:eq[e])&&r&&(i=i(t,n)):"function"==typeof i&&r&&(i=i(t,n.t,n))),i},getObj(e,t,n){let r=this.o[e];return"function"==typeof r&&null!=t&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}},eJ.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=eq.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){let t=this.toHref(e.get("defaultProtocol")),n=e.get("formatHref",t,this),r=e.get("tagName",t,this),i=this.toFormattedString(e),o={},s=e.get("className",t,this),l=e.get("target",t,this),a=e.get("rel",t,this),d=e.getObj("attributes",t,this),c=e.getObj("events",t,this);return o.href=n,s&&(o.class=s),l&&(o.target=l),a&&(o.rel=a),d&&Object.assign(o,d),{tagName:r,attributes:o,content:i,eventListeners:c}}};let eY=eG("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),eQ=eG("text"),eX=eG("nl"),eZ=eG("url",{isLink:!0,toHref(e=eq.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==_&&e[1].t===eg}}),e0=e=>new L(e);function e1(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}let e2="u">typeof console&&console&&console.warn||(()=>{}),e3={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function e4(e,t=!1){if(e3.initialized&&e2(`linkifyjs: already initialized - will not register custom scheme "${e}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format. 1. Must only contain digits, lowercase ASCII letters or "-" 2. Cannot start or end with "-" 3. "-" cannot repeat`);e3.customSchemes.push([e,t])}function e5(e){return e3.initialized||function(){e3.scanner=function(e=[]){let t={};L.groups=t;let n=new L;null==eF&&(eF=e_("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==eV&&(eV=e_("ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2")),j(n,"'",eh),j(n,"{",J),j(n,"}",G),j(n,"[",Y),j(n,"]",Q),j(n,"(",X),j(n,")",Z),j(n,"<",ee),j(n,">",et),j(n,"(",en),j(n,")",er),j(n,"「",ei),j(n,"」",eo),j(n,"『",es),j(n,"』",el),j(n,"<",ea),j(n,">",ed),j(n,"&",ec),j(n,"*",ep),j(n,"@","AT"),j(n,"`",ef),j(n,"^",em),j(n,":",eg),j(n,",",ey),j(n,"$",eb),j(n,".","DOT"),j(n,"=",ek),j(n,"!",ev),j(n,"-",ew),j(n,"%",eS),j(n,"|",ex),j(n,"+",eM),j(n,"#",eC),j(n,"?",eT),j(n,'"',eN),j(n,"/",eA),j(n,";",eO),j(n,"~",eD),j(n,"_",eR),j(n,"\\",eu),j(n,"・",eE);let r=B(n,e$,"NUM",{[T]:!0});B(r,e$,r);let i=B(r,eL,H,{[O]:!0}),o=B(r,ez,W,{[A]:!0}),s=B(n,eL,F,{[N]:!0});B(s,e$,i),B(s,eL,s),B(i,e$,i),B(i,eL,i);let l=B(n,ez,V,{[E]:!0});B(l,eL),B(l,e$,o),B(l,ez,l),B(o,e$,o),B(o,eL),B(o,ez,o);let a=j(n,"\n","NL",{[I]:!0}),d=j(n,"\r","WS",{[I]:!0}),c=B(n,ej,"WS",{[I]:!0});j(n,"",c),j(d,"\n",a),j(d,"",c),B(d,ej,c),j(c,"\r"),j(c,"\n"),B(c,ej,c),j(c,"",c);let h=B(n,eB,eI,{[R]:!0});j(h,"#"),B(h,eB,h),j(h,"️",h);let p=j(h,"‍");j(p,"#"),B(p,eB,h);let u=[[eL,s],[e$,i]],f=[[eL,null],[ez,l],[e$,o]];for(let e=0;ee[0]>t[0]?1:-1);for(let t=0;t=0?i[D]=!0:eL.test(r)?e$.test(r)?i[O]=!0:i[N]=!0:i[T]=!0,$(n,r,r,i)}return $(n,"localhost",_,{ascii:!0}),n.jd=new L("SYM"),{start:n,tokens:Object.assign({groups:t},eP)}}(e3.customSchemes);for(let e=0;e=0&&p++,i++,c++;if(p<0)(i-=c)0&&(o.push(e1(eQ,t,s)),s=[]),i-=p,c-=p;let e=h.t,r=n.slice(i-c,i);o.push(e1(e,t,r))}}return s.length>0&&o.push(e1(eQ,t,s)),o}(e3.parser.start,e,eH(e3.scanner.start,e))}function e6(e,t=null,n=null){if(t&&"object"==typeof t){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new eK(n),i=e5(e),o=[];for(let e=0;e{let t="string"==typeof e?e:e.scheme;t&&n.push(t)}),!e||e.replace(te,"").match(RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var tn=t.Mark.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{"string"==typeof e?e4(e):e4(e.scheme,e.optionalSlashes)})},onDestroy(){L.groups={},e3.scanner=null,e3.parser=null,e3.tokenQueue=[],e3.pluginQueue=[],e3.customSchemes=[],e3.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!tt(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes("@"))return!0;let r=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!/^\d{1,3}(\.\d{1,3}){3}$/.test(r)&&!!/\./.test(r)}}),addAttributes(){return{href:{default:null,parseHTML:e=>e.getAttribute("href")},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{let t=e.getAttribute("href");return!!t&&!!this.options.isAllowedUri(t,{defaultValidate:e=>!!tt(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!tt(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",(0,t.mergeAttributes)(this.options.HTMLAttributes,e),0]:["a",(0,t.mergeAttributes)(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var n,r,i,o;let s=null!=(r=null==(n=e.attrs)?void 0:n.href)?r:"",l=null!=(o=null==(i=e.attrs)?void 0:i.title)?o:"",a=t.renderChildren(e);return l?`[${a}](${s} "${l}")`:`[${a}](${s})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return!!this.options.isAllowedUri(n,{defaultValidate:e=>!!tt(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&t().setMark(this.name,e).setMeta("preventAutolink",!0).run()},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return(!n||!!this.options.isAllowedUri(n,{defaultValidate:e=>!!tt(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[(0,t.markPasteRule)({find:e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,i=e6(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!tt(e,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>{var t;return{href:null==(t=e.data)?void 0:t.href}}})]},addProseMirrorPlugins(){var e,n,r;let i=[],{protocols:o,defaultProtocol:s}=this.options;return this.options.autolink&&i.push((e={type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!tt(e,o),protocols:o,defaultProtocol:s}),shouldAutoLink:this.options.shouldAutoLink},new u.Plugin({key:new u.PluginKey("autolink"),appendTransaction:(n,r,i)=>{let o=n.some(e=>e.docChanged)&&!r.doc.eq(i.doc),s=n.some(e=>e.getMeta("preventAutolink"));if(!o||s)return;let{tr:l}=i,a=(0,t.combineTransactionSteps)(r.doc,[...n]);if((0,t.getChangedRanges)(a).forEach(({newRange:n})=>{let r,o,s=(0,t.findChildrenInRange)(i.doc,n,e=>e.isTextblock);if(s.length>1)r=s[0],o=i.doc.textBetween(r.pos,r.pos+r.node.nodeSize,void 0," ");else if(s.length){let e=i.doc.textBetween(n.from,n.to," "," ");if(!e8.test(e))return;r=s[0],o=i.doc.textBetween(r.pos,n.to,void 0," ")}if(r&&o){let n=o.split(e7).filter(Boolean);if(n.length<=0)return!1;let s=n[n.length-1],a=r.pos+o.lastIndexOf(s);if(!s)return!1;let d=e5(s).map(t=>t.toObject(e.defaultProtocol));if(!(1===d.length?d[0].isLink:3===d.length&&!!d[1].isLink&&["()","[]"].includes(d[0].value+d[2].value)))return!1;d.filter(e=>e.isLink).map(e=>({...e,from:a+e.start+1,to:a+e.end+1})).filter(e=>!i.schema.marks.code||!i.doc.rangeHasMark(e.from,e.to,i.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(n=>{(0,t.getMarksBetween)(n.from,n.to,i.doc).some(t=>t.mark.type===e.type)||l.addMark(n.from,n.to,e.type.create({href:n.href}))})}}),l.steps.length)return l}}))),i.push((n={type:this.type,editor:this.editor,openOnClick:"whenNotEditable"===this.options.openOnClick||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection},new u.Plugin({key:new u.PluginKey("handleClickLink"),props:{handleClick:(e,r,i)=>{var o,s;if(0!==i.button||!e.editable)return!1;let l=null;if(i.target instanceof HTMLAnchorElement)l=i.target;else{let e=i.target;if(!e)return!1;let t=n.editor.view.dom;(l=e.closest("a"))&&!t.contains(l)&&(l=null)}if(!l)return!1;let a=!1;if(n.enableClickSelection&&(a=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){let r=(0,t.getAttributes)(e.state,n.type.name),i=null!=(o=l.href)?o:r.href,d=null!=(s=l.target)?s:r.target;i&&(window.open(i,d),a=!0)}return a}}}))),this.options.linkOnPaste&&i.push((r={editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink},new u.Plugin({key:new u.PluginKey("handlePasteLink"),props:{handlePaste:(e,t,n)=>{let{shouldAutoLink:i}=r,{state:o}=e,{selection:s}=o,{empty:l}=s;if(l)return!1;let a="";n.content.forEach(e=>{a+=e.textContent});let d=e6(a,{defaultProtocol:r.defaultProtocol}).find(e=>e.isLink&&e.value===a);return!!a&&!!d&&(void 0===i||!!i(d.value))&&r.editor.commands.setMark(r.type,{href:d.href})}}}))),i}}),tr=Object.defineProperty,ti="textStyle",to=/^\s*([-+*])\s$/,ts=t.Node.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",(0,t.mergeAttributes)(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>"list"!==e.type||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(ti)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=(0,t.wrappingInputRule)({find:to,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=(0,t.wrappingInputRule)({find:to,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(ti),editor:this.editor})),[e]}}),tl=t.Node.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",(0,t.mergeAttributes)(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(e,t)=>{if("list_item"!==e.type)return[];let n=[];if(e.tokens&&e.tokens.length>0)if(e.tokens.some(e=>"paragraph"===e.type))n=t.parseChildren(e.tokens);else{let r=e.tokens[0];if(r&&"text"===r.type&&r.tokens&&r.tokens.length>0){if(n=[{type:"paragraph",content:t.parseInline(r.tokens)}],e.tokens.length>1){let r=e.tokens.slice(1),i=t.parseChildren(r);n.push(...i)}}else n=t.parseChildren(e.tokens)}return 0===n.length&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(e,n,r)=>(0,t.renderNestedMarkdownContent)(e,n,e=>{var t,n;if("bulletList"===e.parentType)return"- ";if("orderedList"===e.parentType){let r=(null==(n=null==(t=e.meta)?void 0:t.parentAttrs)?void 0:n.start)||1;return`${r+e.index}. `}return"- "},r),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),ta={},td={findListItemPos:()=>th,getNextListDepth:()=>tp,handleBackspace:()=>tg,handleDelete:()=>tk,hasListBefore:()=>tu,hasListItemAfter:()=>tv,hasListItemBefore:()=>tf,listItemHasSubList:()=>tm,nextListIsDeeper:()=>ty,nextListIsHigher:()=>tb};for(var tc in td)tr(ta,tc,{get:td[tc],enumerable:!0});var th=(e,n)=>{let{$from:r}=n.selection,i=(0,t.getNodeType)(e,n.schema),o=r.depth,s=r.pos,l=null;for(;o>0&&null===l;)r.node(o).type===i?l=o:(o-=1,s-=1);return null===l?null:{$pos:n.doc.resolve(s),depth:l}},tp=(e,n)=>{let r=th(e,n);if(!r)return!1;let[,i]=(0,t.getNodeAtPosition)(n,e,r.$pos.pos+4);return i},tu=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),o=e.doc.resolve(i).node();return!!o&&!!n.includes(o.type.name)},tf=(e,t)=>{var n;let{$anchor:r}=t.selection,i=t.doc.resolve(r.pos-2);return 0!==i.index()&&(null==(n=i.nodeBefore)?void 0:n.type.name)===e},tm=(e,n,r)=>{if(!r)return!1;let i=(0,t.getNodeType)(e,n.schema),o=!1;return r.descendants(e=>{e.type===i&&(o=!0)}),o},tg=(e,n,r)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!(0,t.isNodeActive)(e.state,n)&&tu(e.state,n,r)){let{$anchor:t}=e.state.selection,r=e.state.doc.resolve(t.before()-1),i=[];r.node().descendants((e,t)=>{e.type.name===n&&i.push({node:e,pos:t})});let o=i.at(-1);if(!o)return!1;let s=e.state.doc.resolve(r.start()+o.pos+1);return e.chain().cut({from:t.start()-1,to:t.end()+1},s.end()).joinForward().run()}if(!(0,t.isNodeActive)(e.state,n)||!(0,t.isAtStartOfNode)(e.state))return!1;let i=th(n,e.state);if(!i)return!1;let o=e.state.doc.resolve(i.$pos.pos-2).node(i.depth),s=tm(n,e.state,o);return tf(n,e.state)&&!s?e.commands.joinItemBackward():e.chain().liftListItem(n).run()},ty=(e,t)=>{let n=tp(e,t),r=th(e,t);return!!r&&!!n&&n>r.depth},tb=(e,t)=>{let n=tp(e,t),r=th(e,t);return!!r&&!!n&&n{if(!(0,t.isNodeActive)(e.state,n)||!(0,t.isAtEndOfNode)(e.state,n))return!1;let{selection:r}=e.state,{$from:i,$to:o}=r;return!(!r.empty&&i.sameParent(o))&&(ty(n,e.state)?e.chain().focus(e.state.selection.from+4).lift(n).joinBackward().run():tb(n,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward())},tv=(e,t)=>{var n;let{$anchor:r}=t.selection,i=t.doc.resolve(r.pos-r.parentOffset-2);return i.index()!==i.parent.childCount-1&&(null==(n=i.nodeAfter)?void 0:n.type.name)===e},tw=t.Extension.create({name:"listKeymap",addOptions:()=>({listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}),addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&tk(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&tk(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&tg(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&tg(e,n,r)&&(t=!0)}),t}}}}),tS=/^(\s*)(\d+)\.\s+(.*)$/,tx=/^\s/,tM="textStyle",tC=/^(\d+)\.\s$/,tT=t.Node.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){let{start:n,...r}=e;return 1===n?["ol",(0,t.mergeAttributes)(this.options.HTMLAttributes,r),0]:["ol",(0,t.mergeAttributes)(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>{var n;if("list"!==e.type||!e.ordered)return[];let r=e.start||1,i=e.items?(n=e.items,n.map(e=>{if("list_item"!==e.type)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if("paragraph"===e.type||"list"===e.type||"blockquote"===e.type||"code"===e.type)n.push(...t.parseChildren([e]));else if("text"===e.type&&e.tokens){let r=t.parseChildren([e]);n.push({type:"paragraph",content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:"listItem",content:n}})):[];return 1!==r?{type:"orderedList",attrs:{start:r},content:i}:{type:"orderedList",content:i}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"orderedList",level:"block",start:e=>{let t=e.match(/^(\s*)(\d+)\.\s+/),n=null==t?void 0:t.index;return void 0!==n?n:-1},tokenize:(e,t,n)=>{var r;let i=e.split("\n"),[o,s]=function(e){let t=[],n=0,r=0;for(;nn;)u.push(t[p]),p+=1;if(u.length>0){let t=Math.min(...u.map(e=>e.indent)),n=e(u,t,r);c.push({type:"list",ordered:!0,start:u[0].number,items:n,raw:u.map(e=>e.raw).join("\n")})}o.push({type:"list_item",raw:l.raw,tokens:c}),s=p}else s+=1}return o}(o,0,n);if(0!==l.length)return{type:"list",ordered:!0,start:(null==(r=o[0])?void 0:r.number)||1,items:l,raw:i.slice(0,s).join("\n")}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(tM)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=(0,t.wrappingInputRule)({find:tC,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=(0,t.wrappingInputRule)({find:tC,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(tM)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),tN=/^\s*(\[([( |x])?\])\s$/,tE=t.Node.create({name:"taskItem",addOptions:()=>({nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute("data-checked");return""===t||"true"===t},renderHTML:e=>({"data-checked":e.checked})}}),parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:n}){return["li",(0,t.mergeAttributes)(this.options.HTMLAttributes,n,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode("paragraph",{},t.parseInline(e.tokens))):e.text?n.push(t.createNode("paragraph",{},[t.createNode("text",{text:e.text})])):n.push(t.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode("taskItem",{checked:e.checked||!1},n)},renderMarkdown:(e,n)=>{var r;let i=(null==(r=e.attrs)?void 0:r.checked)?"x":" ",o=`- [${i}] `;return(0,t.renderNestedMarkdownContent)(e,n,o)},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:n,getPos:r,editor:i})=>{let o=document.createElement("li"),s=document.createElement("label"),l=document.createElement("span"),a=document.createElement("input"),d=document.createElement("div"),c=e=>{var t,n;a.ariaLabel=(null==(n=null==(t=this.options.a11y)?void 0:t.checkboxLabel)?void 0:n.call(t,e,a.checked))||`Task item checkbox for ${e.textContent||"empty task item"}`};c(e),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",e=>e.preventDefault()),a.addEventListener("change",t=>{if(!i.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}let{checked:n}=t.target;i.isEditable&&"function"==typeof r&&i.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=r();if("number"!=typeof t)return!1;let i=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...null==i?void 0:i.attrs,checked:n}),!0}).run(),i.isEditable||!this.options.onReadOnlyChecked||this.options.onReadOnlyChecked(e,n)||(a.checked=!a.checked)}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{o.setAttribute(e,t)}),o.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,s.append(a,l),o.append(s,d),Object.entries(n).forEach(([e,t])=>{o.setAttribute(e,t)});let h=new Set(Object.keys(n));return{dom:o,contentDOM:d,update:e=>{if(e.type!==this.type)return!1;o.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,c(e);let n=i.extensionManager.attributes,r=(0,t.getRenderedAttributes)(e,n),s=new Set(Object.keys(r)),l=this.options.HTMLAttributes;return h.forEach(e=>{s.has(e)||(e in l?o.setAttribute(e,l[e]):o.removeAttribute(e))}),Object.entries(r).forEach(([e,t])=>{null==t?e in l?o.setAttribute(e,l[e]):o.removeAttribute(e):o.setAttribute(e,t)}),h=s,!0}}}},addInputRules(){return[(0,t.wrappingInputRule)({find:tN,type:this.type,getAttributes:e=>({checked:"x"===e[e.length-1]})})]}}),tO=t.Node.create({name:"taskList",addOptions:()=>({itemTypeName:"taskItem",HTMLAttributes:{}}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",(0,t.mergeAttributes)(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode("taskList",{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;let n=null==(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))?void 0:t.index;return void 0!==n?n:-1},tokenize(e,n,r){let i=e=>{let n=(0,t.parseIndentedBlocks)(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:r.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:i},r);return n?[{type:"taskList",raw:n.raw,items:n.items}]:r.blockTokens(e)},o=(0,t.parseIndentedBlocks)(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:r.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:i},r);if(o)return{type:"taskList",raw:o.raw,items:o.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});t.Extension.create({name:"listKit",addExtensions(){let e=[];return!1!==this.options.bulletList&&e.push(ts.configure(this.options.bulletList)),!1!==this.options.listItem&&e.push(tl.configure(this.options.listItem)),!1!==this.options.listKeymap&&e.push(tw.configure(this.options.listKeymap)),!1!==this.options.orderedList&&e.push(tT.configure(this.options.orderedList)),!1!==this.options.taskItem&&e.push(tE.configure(this.options.taskItem)),!1!==this.options.taskList&&e.push(tO.configure(this.options.taskList)),e}});var tA=" ",tD=t.Node.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",(0,t.mergeAttributes)(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(1===n.length&&"image"===n[0].type)return t.parseChildren([n[0]]);let r=t.parseInline(n);return 1===r.length&&"text"===r[0].type&&(r[0].text===tA||" "===r[0].text)?t.createNode("paragraph",void 0,[]):t.createNode("paragraph",void 0,r)},renderMarkdown:(e,t)=>{if(!e)return"";let n=Array.isArray(e.content)?e.content:[];return 0===n.length?tA:t.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),tR=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,tI=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,tP=t.Mark.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",(0,t.mergeAttributes)(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[(0,t.markInputRule)({find:tR,type:this.type})]},addPasteRules(){return[(0,t.markPasteRule)({find:tI,type:this.type})]}}),tL=t.Node.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),tz=t.Mark.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",(0,t.mergeAttributes)(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown:(e,t)=>`++${t.renderChildren(e)}++`,markdownTokenizer:{name:"underline",level:"inline",start:e=>e.indexOf("++"),tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:"underline",raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),tB=e.i(589430),t$=t.Extension.create({name:"starterKit",addExtensions(){var e,t,n,r;let o=[];return!1!==this.options.bold&&o.push(d.configure(this.options.bold)),!1!==this.options.blockquote&&o.push(i.configure(this.options.blockquote)),!1!==this.options.bulletList&&o.push(ts.configure(this.options.bulletList)),!1!==this.options.code&&o.push(p.configure(this.options.code)),!1!==this.options.codeBlock&&o.push(g.configure(this.options.codeBlock)),!1!==this.options.document&&o.push(y.configure(this.options.document)),!1!==this.options.dropcursor&&o.push(tB.Dropcursor.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&o.push(tB.Gapcursor.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&o.push(b.configure(this.options.hardBreak)),!1!==this.options.heading&&o.push(k.configure(this.options.heading)),!1!==this.options.undoRedo&&o.push(tB.UndoRedo.configure(this.options.undoRedo)),!1!==this.options.horizontalRule&&o.push(v.configure(this.options.horizontalRule)),!1!==this.options.italic&&o.push(C.configure(this.options.italic)),!1!==this.options.listItem&&o.push(tl.configure(this.options.listItem)),!1!==this.options.listKeymap&&o.push(tw.configure(null==(e=this.options)?void 0:e.listKeymap)),!1!==this.options.link&&o.push(tn.configure(null==(t=this.options)?void 0:t.link)),!1!==this.options.orderedList&&o.push(tT.configure(this.options.orderedList)),!1!==this.options.paragraph&&o.push(tD.configure(this.options.paragraph)),!1!==this.options.strike&&o.push(tP.configure(this.options.strike)),!1!==this.options.text&&o.push(tL.configure(this.options.text)),!1!==this.options.underline&&o.push(tz.configure(null==(n=this.options)?void 0:n.underline)),!1!==this.options.trailingNode&&o.push(tB.TrailingNode.configure(null==(r=this.options)?void 0:r.trailingNode)),o}});e.s(["default",()=>t$],999445)},418874,e=>{"use strict";e.s([])},49174,e=>{"use strict";e.s([])},233038,e=>{"use strict";var t=e.i(713118),n=e.i(182004);function r(e){return e===n.NodeType.GROUP||e===n.NodeType.VIDEO_GROUP}function i(e,t){let n=new Map(t.map(e=>[e.id,e])),r=Array.from(e.keys()),i=new Set(r);for(let t of r){let r=e.get(t),o=n.get(t);if(r&&o&&!(o.parentId&&i.has(o.parentId)))return{x:o.position.x-r.x,y:o.position.y-r.y}}return{x:0,y:0}}function o(e,t){let n=c(t,e),r=new Map(t.map(e=>[e.id,e])),i=new Map;for(let e of n){let t=r.get(e);t&&i.set(e,{...t.position})}return i}function s(e){let t=e instanceof HTMLElement?e:e instanceof Node?e.parentElement:null;if(t&&("INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.closest('[contenteditable="true"]')))return!0;let n=document.activeElement;return!!(n instanceof HTMLElement&&("INPUT"===n.tagName||"TEXTAREA"===n.tagName||n.closest('[contenteditable="true"]')))||!1}function l(e){return"object"==typeof e&&null!==e&&(!!e.altKey||"function"==typeof e.getModifierState&&e.getModifierState("Alt"))}function a(e){return"object"==typeof e&&null!==e&&(!!e.metaKey||!!e.ctrlKey||"function"==typeof e.getModifierState&&(e.getModifierState("Meta")||e.getModifierState("Control")))}function d(e,t){let n=new Set(e),i=new Set(t.filter(e=>n.has(e.id)&&r(e.type)).map(e=>e.id));for(let e of t)e.parentId&&i.has(e.parentId)&&n.add(e.id);return Array.from(n)}function c(e,t){let n=new Set(t),i=!0;for(;i;)for(let t of(i=!1,[...n])){let o=e.find(e=>e.id===t);if(!o?.parentId)continue;let s=e.find(e=>e.id===o.parentId);if(s&&r(s.type)&&!n.has(s.id)){for(let t of(n.add(s.id),e))t.parentId===s.id&&(n.has(t.id)||(i=!0),n.add(t.id));i=!0}}for(let t of e.filter(e=>n.has(e.id)&&r(e.type)).map(e=>e.id))e.forEach(e=>{e.parentId===t&&n.add(e.id)});return n}function h(e,t){if(!e.parentId)return{...e.position};let n=t.find(t=>t.id===e.parentId);if(!n)return{...e.position};let r=h(n,t);return{x:r.x+e.position.x,y:r.y+e.position.y}}function p(e){return{width:e.measured?.width??("number"==typeof e.width?e.width:void 0)??t.NODE_WIDTH,height:e.measured?.height??("number"==typeof e.height?e.height:void 0)??t.NODE_HEIGHT_EMPTY}}function u(e,t){let{width:n,height:i}=p(e),o=e.position.x,s=e.position.y,l=o+n,a=s+i;if(r(e.type))for(let n of t){if(n.parentId!==e.id)continue;let r=h(n,t),{width:i,height:d}=p(n);o=Math.min(o,r.x),s=Math.min(s,r.y),l=Math.max(l,r.x+i),a=Math.max(a,r.y+d)}return{left:o,right:l,top:s,bottom:a}}function f(e,t){let n=h(e,t),{width:i,height:o}=p(e),s=n.x,l=n.y,a=n.x+i,d=n.y+o;if(r(e.type))for(let n of t){if(n.parentId!==e.id)continue;let r=h(n,t),{width:i,height:o}=p(n);s=Math.min(s,r.x),l=Math.min(l,r.y),a=Math.max(a,r.x+i),d=Math.max(d,r.y+o)}return{left:s,right:a,top:l,bottom:d}}function m(e){let{width:t,height:n}=p(e);return{left:e.position.x,top:e.position.y,right:e.position.x+t,bottom:e.position.y+n,width:t,height:n}}function g(e,t=20){if(0===e.length)return null;let n=1/0,r=1/0,i=-1/0,o=-1/0;return e.forEach(e=>{let t=m(e);n=Math.min(n,t.left),r=Math.min(r,t.top),i=Math.max(i,t.right),o=Math.max(o,t.bottom)}),{x:n-t,y:r-t,width:i-n+2*t,height:o-r+2*t}}function y(e,t=20){return t*(Math.sqrt(e)-e)/e}function b(e,t){let n=y(t);return{x:e.x-n,y:e.y-n,width:e.width+2*n,height:e.height+2*n}}e.s(["GROUP_LAYOUT_GAP",0,36,"GROUP_LAYOUT_PADDING",0,36,"GROUP_LAYOUT_TOP_PADDING",0,66,"GROUP_MIN_PADDING",0,12,"GROUP_PADDING",0,20,"buildAltMultiStartPositionMap",()=>o,"calculateBoundingBox",()=>g,"compensateBounds",()=>b,"computeMultiAltDragDeltaFlow",()=>i,"expandNodeIdsForGroupCopy",()=>c,"expandNodeIdsWithGroupChildren",()=>d,"getAbsolutePosition",()=>h,"getFlowBoundsForChatAtViewportHit",()=>f,"getFlowBoundsUnionForBoxSelection",()=>u,"getNodeBounds",()=>m,"getNodeFlowSize",()=>p,"getZoomPaddingCompensation",()=>y,"isAltOrOptionActive",()=>l,"isCanvasGroupLikeNodeType",()=>r,"isInputElement",()=>s,"isMetaOrCtrlActive",()=>a])}]);