From 2a283a4183b5265b08f8ca0c81a13efb311af2e4 Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Mon, 23 Dec 2024 09:38:17 +0100 Subject: [PATCH] Tiptap update --- .../static/django_prose_editor/editor.js | 34 +- package.json | 36 +- yarn.lock | 678 +++++++++--------- 3 files changed, 377 insertions(+), 371 deletions(-) diff --git a/django_prose_editor/static/django_prose_editor/editor.js b/django_prose_editor/static/django_prose_editor/editor.js index 64214dd..9d4fe36 100644 --- a/django_prose_editor/static/django_prose_editor/editor.js +++ b/django_prose_editor/static/django_prose_editor/editor.js @@ -1,18 +1,18 @@ -(()=>{var kl=Object.defineProperty,of=Object.defineProperties;var sf=Object.getOwnPropertyDescriptors;var or=Object.getOwnPropertySymbols;var xl=Object.prototype.hasOwnProperty,Sl=Object.prototype.propertyIsEnumerable;var bl=(n,e,t)=>e in n?kl(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,b=(n,e)=>{for(var t in e||(e={}))xl.call(e,t)&&bl(n,t,e[t]);if(or)for(var t of or(e))Sl.call(e,t)&&bl(n,t,e[t]);return n},v=(n,e)=>of(n,sf(e));var wl=(n,e)=>{var t={};for(var r in n)xl.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&or)for(var r of or(n))e.indexOf(r)<0&&Sl.call(n,r)&&(t[r]=n[r]);return t};var lf=(n,e)=>{for(var t in e)kl(n,t,{get:e[t],enumerable:!0})};var gl={};lf(gl,{Blockquote:()=>vd,Bold:()=>Rd,BulletList:()=>Pd,Code:()=>Jd,CodeBlock:()=>Ud,Color:()=>Gd,CommandManager:()=>Nt,Document:()=>yd,Dropcursor:()=>kd,Editor:()=>Ln,Extension:()=>H,Gapcursor:()=>Sd,HTML:()=>Pu,HardBreak:()=>Od,Heading:()=>Ld,Highlight:()=>Yd,History:()=>Ad,HorizontalRule:()=>Bd,InputRule:()=>at,Italic:()=>zd,Link:()=>Qu,ListItem:()=>Fd,Mark:()=>K,Menu:()=>s0,NoSpellCheck:()=>Xu,Node:()=>z,NodePos:()=>Vr,NodeView:()=>as,OrderedList:()=>Vd,Paragraph:()=>Ed,PasteRule:()=>Yt,Plugin:()=>P,Strike:()=>jd,Subscript:()=>_d,Superscript:()=>Wd,Table:()=>Ou,TableCell:()=>Nu,TableHeader:()=>vu,TableRow:()=>Ru,Text:()=>Nd,TextAlign:()=>Qd,TextStyle:()=>qd,Tracker:()=>cs,Typographic:()=>Zu,Underline:()=>Kd,callOrReturn:()=>R,combineTransactionSteps:()=>ys,createChainableState:()=>Bn,createDocument:()=>Hr,createNodeFromContent:()=>Pn,createStyleTag:()=>gd,createTextareaEditor:()=>g0,crel:()=>j,defaultBlockAt:()=>od,deleteProps:()=>ss,elementFromString:()=>Gt,escapeForRegEx:()=>cg,extensions:()=>ig,findChildren:()=>vm,findChildrenInRange:()=>bs,findDuplicates:()=>Zc,findParentNode:()=>_n,findParentNodeClosestToPos:()=>Kr,fromString:()=>qc,generateHTML:()=>Rm,generateJSON:()=>Dm,generateText:()=>Im,getAttributes:()=>Ur,getAttributesFromExtensions:()=>ds,getChangedRanges:()=>xs,getDebugJSON:()=>ld,getExtensionField:()=>C,getHTMLFromFragment:()=>Fn,getMarkAttributes:()=>jn,getMarkRange:()=>Wr,getMarkType:()=>qe,getMarksBetween:()=>Wn,getNodeAtPosition:()=>Lm,getNodeAttributes:()=>id,getNodeType:()=>X,getRenderedAttributes:()=>zr,getSchema:()=>Jr,getSchemaByResolvedExtensions:()=>fs,getSchemaTypeByName:()=>Br,getSchemaTypeNameByName:()=>Vn,getSplittedAttributes:()=>Dn,getText:()=>ks,getTextBetween:()=>hs,getTextContentFromNodes:()=>Gc,getTextSerializersFromSchema:()=>_r,initializeEditors:()=>y0,injectExtensionAttributesToParseRule:()=>rs,inputRulesPlugin:()=>Yc,isActive:()=>ad,isAtEndOfNode:()=>Bm,isAtStartOfNode:()=>zm,isEmptyObject:()=>Uc,isExtensionRulesEnabled:()=>is,isFunction:()=>us,isList:()=>ls,isMacOS:()=>gs,isMarkActive:()=>$r,isNodeActive:()=>Qt,isNodeEmpty:()=>qr,isNodeSelection:()=>Ss,isNumber:()=>Qc,isPlainObject:()=>Rn,isRegExp:()=>jr,isString:()=>dg,isTextSelection:()=>ps,isiOS:()=>$n,markInputRule:()=>ke,markPasteRule:()=>pe,menuItemsFromEditor:()=>rf,mergeAttributes:()=>N,mergeDeep:()=>Hn,minMax:()=>Pe,nodeInputRule:()=>ws,nodePasteRule:()=>ug,objectIncludes:()=>In,pasteRulesPlugin:()=>Xc,posToDOMRect:()=>Fm,removeDuplicates:()=>sd,resolveFocusPosition:()=>ms,selectionToInsertionEnd:()=>rd,settings:()=>It,splitExtensions:()=>zn,textInputRule:()=>lg,textPasteRule:()=>fg,textblockTypeInputRule:()=>Xt,updateAttrsDialog:()=>so,wrappingInputRule:()=>Ge});function ie(n){this.content=n}ie.prototype={constructor:ie,find:function(n){for(var e=0;e>1}};ie.from=function(n){if(n instanceof ie)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new ie(e)};var Vo=ie;function Dl(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(r),i=e.child(r);if(o==i){t+=o.nodeSize;continue}if(!o.sameMarkup(i))return t;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)t++;return t}if(o.content.size||i.content.size){let s=Dl(o.content,i.content,t+1);if(s!=null)return s}t+=o.nodeSize}}function Il(n,e,t,r){for(let o=n.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:t,b:r};let s=n.child(--o),l=e.child(--i),a=s.nodeSize;if(s==l){t-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:t,b:r};if(s.isText&&s.text!=l.text){let c=0,d=Math.min(s.text.length,l.text.length);for(;ce&&r(a,o+l,i||null,s)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),r,o+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,o){let i="",s=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(o[o.length-1]=t.withText(t.text+r.text),i=1);ie)for(let i=0,s=0;se&&((st)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),r.push(l),o+=l.nodeSize),s=a}return new n(r,o)}cutByIndex(e,t){return e==t?n.empty:e==0&&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 o=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return o[e]=t,new n(o,i)}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 new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,o=0;;r++){let i=this.child(r),s=o+i.nodeSize;if(s>=e)return s==e||t>0?ir(r+1,s):ir(r,o);o=s}}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 new 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 o=0;othis.type.rank&&(t||(t=e.slice(0,o)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;tr.type.rank-o.type.rank),t}};F.none=[];var gt=class extends Error{},S=class n{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Ll(this.content,e+this.openStart,t);return r&&new n(r,this.openStart,this.openEnd)}removeBetween(e,t){return new n(Pl(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 n.empty;let r=t.openStart||0,o=t.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new n(k.fromJSON(e,t.content),r,o)}static maxOpen(e,t=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)o++;return new n(e,r,o)}};S.empty=new S(k.empty,0,0);function Pl(n,e,t){let{index:r,offset:o}=n.findIndex(e),i=n.maybeChild(r),{index:s,offset:l}=n.findIndex(t);if(o==e||i.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Pl(i.content,e-o-1,t-o-1)))}function Ll(n,e,t,r){let{index:o,offset:i}=n.findIndex(e),s=n.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Ll(s.content,e-i-1,t);return l&&n.replaceChild(o,s.copy(l))}function af(n,e,t){if(t.openStart>n.depth)throw new gt("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new gt("Inconsistent open depths");return Bl(n,e,t,0)}function Bl(n,e,t,r){let o=n.index(r),i=n.node(r);if(o==e.index(r)&&r=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function ln(n,e,t,r){let o=(e||n).node(t),i=0,s=e?e.index(t):o.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(pt(n.nodeAfter,r),i++));for(let l=i;lo&&Wo(n,e,o+1),s=r.depth>o&&Wo(t,r,o+1),l=[];return ln(null,n,o,l),i&&s&&e.index(o)==t.index(o)?(zl(i,s),pt(mt(i,Fl(n,e,t,r,o+1)),l)):(i&&pt(mt(i,ar(n,e,o+1)),l),ln(e,t,o,l),s&&pt(mt(s,ar(t,r,o+1)),l)),ln(r,null,o,l),new k(l)}function ar(n,e,t){let r=[];if(ln(null,n,t,r),n.depth>t){let o=Wo(n,e,t+1);pt(mt(o,ar(n,e,t+1)),r)}return ln(e,null,t,r),new k(r)}function cf(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)o=e.node(i).copy(k.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}var cr=class n{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(t);return r?e.child(t).cut(r):o}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],o=t==0?0:this.path[t*3-1]+1;for(let i=0;i0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new yt(this,e,r);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 new RangeError("Position "+t+" out of range");let r=[],o=0,i=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),c=i-a;if(r.push(s,l,o+a),!c||(s=s.child(l),s.isText))break;i=c-1,o+=a+1}return new n(t,r,i)}static resolveCached(e,t){let r=Cl.get(e);if(r)for(let i=0;ie&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}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()+")"),Hl(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=k.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=o;at.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let o=k.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};me.prototype.text=void 0;var Jo=class n extends me{constructor(e,t,r,o){if(super(e,t,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Hl(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 n(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new n(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function Hl(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}var bt=class n{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Uo(e,t);if(r.next==null)return n.empty;let o=$l(r);r.next&&r.err("Unexpected trailing text");let i=bf(yf(o));return kf(i,r),i}matchType(e){for(let t=0;tc.createAndFill()));for(let c=0;c=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let o=0;o{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s"+e.indexOf(r.next[s].next);return i}).join(` -`)}};bt.empty=new bt(!0);var Uo=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};function $l(n){let e=[];do e.push(ff(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function ff(n){let e=[];do e.push(hf(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function hf(n){let e=gf(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=pf(n,e);else break;return e}function Ml(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function pf(n,e){let t=Ml(n),r=t;return n.eat(",")&&(n.next!="}"?r=Ml(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function mf(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let o=[];for(let i in t){let s=t[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&n.err("No node type or group '"+e+"' found"),o}function gf(n){if(n.eat("(")){let e=$l(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=mf(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function yf(n){let e=[[]];return o(i(n,0),t()),e;function t(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function o(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=i(s.exprs[a],l);if(a==s.exprs.length-1)return c;o(c,l=t())}else if(s.type=="star"){let a=t();return r(l,a),o(i(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=t();return o(i(s.expr,l),a),o(i(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c{n[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let d=0;d{c||o.push([l,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let i=e[r.join(",")]=new bt(r.indexOf(n.length-1)>-1);for(let s=0;s-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:_l(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new me(this,this.computeAttrs(e),k.from(t),F.setFrom(r))}createChecked(e=null,t,r){return t=k.from(t),this.checkContent(t),new me(this,this.computeAttrs(e),t,F.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=k.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let o=this.contentMatch.matchFragment(t),i=o&&o.fillBefore(k.empty,!0);return i?new me(this,e,t.append(i),F.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;tr[i]=new n(i,t,s));let o=t.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function xf(n,e,t){let r=t.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${i}`)}}var qo=class{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?xf(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}},cn=class n{constructor(e,t,r,o){this.name=e,this.rank=t,this.schema=r,this.spec=o,this.attrs=Kl(e,o.attrs),this.excluded=null;let i=jl(this.attrs);this.instance=i?new F(this,i):null}create(e=null){return!e&&this.instance?this.instance:new F(this,_l(this.attrs,e))}static compile(e,t){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new n(i,o++,t,s)),r}removeFromSet(e){for(var t=0;t-1}},dn=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let o in e)t[o]=e[o];t.nodes=Vo.from(e.nodes),t.marks=Vo.from(e.marks||{}),this.nodes=dr.compile(this.spec.nodes,this),this.marks=cn.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=bt.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?Al(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:Al(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof dr){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,o)}text(e,t){let r=this.nodes.text;return new Jo(r,r.defaultAttrs,e,F.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return me.fromJSON(this,e)}markFromJSON(e){return F.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}};function Al(n,e){let t=[];for(let r=0;r-1)&&t.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function Sf(n){return n.tag!=null}function wf(n){return n.style!=null}var Re=class n{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(o=>{if(Sf(o))this.tags.push(o);else if(wf(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new ur(this,t,!1);return r.addAll(e,F.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new ur(this,t,!0);return r.addAll(e,F.none,t.from,t.to),S.maxOpen(r.finish())}matchTag(e,t,r){for(let o=r?this.tags.indexOf(r)+1:0;oe.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let a=s.getAttrs(t);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let t=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s{r(s=Ol(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=Ol(s)),s.node||s.ignore||s.mark||(s.node=o)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new n(e,n.schemaRules(e)))}},Jl={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},Cf={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ul={ol:!0,ul:!0},un=1,Go=2,an=4;function El(n,e,t){return e!=null?(e?un:0)|(e==="full"?Go:0):n&&n.whitespace=="pre"?un|Go:t&~an}var Bt=class{constructor(e,t,r,o,i,s){this.type=e,this.attrs=t,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=F.none,this.match=i||(s&an?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(k.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&un)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let t=k.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(k.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Jl.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},ur=class{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=t.topNode,i,s=El(null,t.preserveWhitespace,0)|(r?an:0);o?i=new Bt(o.type,o.attrs,F.none,!0,t.topMatch||o.type.contentMatch,s):r?i=new Bt(null,null,F.none,!0,null,s):i=new Bt(e.schema.topNodeType,null,F.none,!0,null,s),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,o=this.top,i=o.options&Go?"full":this.localPreserveWS||(o.options&un)>0;if(i==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)i!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,` +(()=>{var kl=Object.defineProperty,of=Object.defineProperties;var sf=Object.getOwnPropertyDescriptors;var or=Object.getOwnPropertySymbols;var xl=Object.prototype.hasOwnProperty,Sl=Object.prototype.propertyIsEnumerable;var bl=(n,e,t)=>e in n?kl(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,b=(n,e)=>{for(var t in e||(e={}))xl.call(e,t)&&bl(n,t,e[t]);if(or)for(var t of or(e))Sl.call(e,t)&&bl(n,t,e[t]);return n},v=(n,e)=>of(n,sf(e));var wl=(n,e)=>{var t={};for(var r in n)xl.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&or)for(var r of or(n))e.indexOf(r)<0&&Sl.call(n,r)&&(t[r]=n[r]);return t};var lf=(n,e)=>{for(var t in e)kl(n,t,{get:e[t],enumerable:!0})};var gl={};lf(gl,{Blockquote:()=>vd,Bold:()=>Rd,BulletList:()=>Pd,Code:()=>Jd,CodeBlock:()=>Ud,Color:()=>Gd,CommandManager:()=>Nt,Document:()=>yd,Dropcursor:()=>kd,Editor:()=>Bn,Extension:()=>H,Gapcursor:()=>Sd,HTML:()=>Pu,HardBreak:()=>Od,Heading:()=>Ld,Highlight:()=>Yd,History:()=>Ad,HorizontalRule:()=>Bd,InputRule:()=>at,Italic:()=>zd,Link:()=>Qu,ListItem:()=>Fd,Mark:()=>K,Menu:()=>s0,NoSpellCheck:()=>Xu,Node:()=>z,NodePos:()=>Vr,NodeView:()=>as,OrderedList:()=>Vd,Paragraph:()=>Ed,PasteRule:()=>Qt,Plugin:()=>P,Strike:()=>jd,Subscript:()=>_d,Superscript:()=>Wd,Table:()=>Ou,TableCell:()=>Nu,TableHeader:()=>vu,TableRow:()=>Ru,Text:()=>Nd,TextAlign:()=>Qd,TextStyle:()=>qd,Tracker:()=>cs,Typographic:()=>Zu,Underline:()=>Kd,callOrReturn:()=>R,combineTransactionSteps:()=>ys,createChainableState:()=>zn,createDocument:()=>Hr,createNodeFromContent:()=>Ln,createStyleTag:()=>gd,createTextareaEditor:()=>g0,crel:()=>j,defaultBlockAt:()=>od,deleteProps:()=>ss,elementFromString:()=>Yt,escapeForRegEx:()=>cg,extensions:()=>ig,findChildren:()=>vm,findChildrenInRange:()=>bs,findDuplicates:()=>Zc,findParentNode:()=>Wn,findParentNodeClosestToPos:()=>Kr,fromString:()=>qc,generateHTML:()=>Rm,generateJSON:()=>Dm,generateText:()=>Im,getAttributes:()=>Ur,getAttributesFromExtensions:()=>ds,getChangedRanges:()=>xs,getDebugJSON:()=>ld,getExtensionField:()=>C,getHTMLFromFragment:()=>Hn,getMarkAttributes:()=>_n,getMarkRange:()=>Wr,getMarkType:()=>qe,getMarksBetween:()=>Kn,getNodeAtPosition:()=>Lm,getNodeAttributes:()=>id,getNodeType:()=>X,getRenderedAttributes:()=>zr,getSchema:()=>Jr,getSchemaByResolvedExtensions:()=>fs,getSchemaTypeByName:()=>Br,getSchemaTypeNameByName:()=>jn,getSplittedAttributes:()=>In,getText:()=>ks,getTextBetween:()=>hs,getTextContentFromNodes:()=>Gc,getTextSerializersFromSchema:()=>_r,initializeEditors:()=>y0,injectExtensionAttributesToParseRule:()=>rs,inputRulesPlugin:()=>Yc,isActive:()=>ad,isAtEndOfNode:()=>Bm,isAtStartOfNode:()=>zm,isEmptyObject:()=>Uc,isExtensionRulesEnabled:()=>is,isFunction:()=>us,isList:()=>ls,isMacOS:()=>gs,isMarkActive:()=>$r,isNodeActive:()=>Xt,isNodeEmpty:()=>qr,isNodeSelection:()=>Ss,isNumber:()=>Qc,isPlainObject:()=>Dn,isRegExp:()=>jr,isString:()=>dg,isTextSelection:()=>ps,isiOS:()=>Vn,markInputRule:()=>ke,markPasteRule:()=>pe,menuItemsFromEditor:()=>rf,mergeAttributes:()=>N,mergeDeep:()=>$n,minMax:()=>Pe,nodeInputRule:()=>ws,nodePasteRule:()=>ug,objectIncludes:()=>Pn,pasteRulesPlugin:()=>Xc,posToDOMRect:()=>Fm,removeDuplicates:()=>sd,resolveFocusPosition:()=>ms,selectionToInsertionEnd:()=>rd,settings:()=>It,splitExtensions:()=>Fn,textInputRule:()=>lg,textPasteRule:()=>fg,textblockTypeInputRule:()=>Zt,updateAttrsDialog:()=>so,wrappingInputRule:()=>Ge});function ie(n){this.content=n}ie.prototype={constructor:ie,find:function(n){for(var e=0;e>1}};ie.from=function(n){if(n instanceof ie)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new ie(e)};var Vo=ie;function Dl(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(r),i=e.child(r);if(o==i){t+=o.nodeSize;continue}if(!o.sameMarkup(i))return t;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)t++;return t}if(o.content.size||i.content.size){let s=Dl(o.content,i.content,t+1);if(s!=null)return s}t+=o.nodeSize}}function Il(n,e,t,r){for(let o=n.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:t,b:r};let s=n.child(--o),l=e.child(--i),a=s.nodeSize;if(s==l){t-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:t,b:r};if(s.isText&&s.text!=l.text){let c=0,d=Math.min(s.text.length,l.text.length);for(;ce&&r(a,o+l,i||null,s)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),r,o+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,o){let i="",s=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(o[o.length-1]=t.withText(t.text+r.text),i=1);ie)for(let i=0,s=0;se&&((st)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),r.push(l),o+=l.nodeSize),s=a}return new n(r,o)}cutByIndex(e,t){return e==t?n.empty:e==0&&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 o=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return o[e]=t,new n(o,i)}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 new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,o=0;;r++){let i=this.child(r),s=o+i.nodeSize;if(s>=e)return s==e||t>0?ir(r+1,s):ir(r,o);o=s}}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 new 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 o=0;othis.type.rank&&(t||(t=e.slice(0,o)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;tr.type.rank-o.type.rank),t}};F.none=[];var gt=class extends Error{},S=class n{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Ll(this.content,e+this.openStart,t);return r&&new n(r,this.openStart,this.openEnd)}removeBetween(e,t){return new n(Pl(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 n.empty;let r=t.openStart||0,o=t.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new n(k.fromJSON(e,t.content),r,o)}static maxOpen(e,t=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)o++;return new n(e,r,o)}};S.empty=new S(k.empty,0,0);function Pl(n,e,t){let{index:r,offset:o}=n.findIndex(e),i=n.maybeChild(r),{index:s,offset:l}=n.findIndex(t);if(o==e||i.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Pl(i.content,e-o-1,t-o-1)))}function Ll(n,e,t,r){let{index:o,offset:i}=n.findIndex(e),s=n.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Ll(s.content,e-i-1,t);return l&&n.replaceChild(o,s.copy(l))}function af(n,e,t){if(t.openStart>n.depth)throw new gt("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new gt("Inconsistent open depths");return Bl(n,e,t,0)}function Bl(n,e,t,r){let o=n.index(r),i=n.node(r);if(o==e.index(r)&&r=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function an(n,e,t,r){let o=(e||n).node(t),i=0,s=e?e.index(t):o.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(pt(n.nodeAfter,r),i++));for(let l=i;lo&&Wo(n,e,o+1),s=r.depth>o&&Wo(t,r,o+1),l=[];return an(null,n,o,l),i&&s&&e.index(o)==t.index(o)?(zl(i,s),pt(mt(i,Fl(n,e,t,r,o+1)),l)):(i&&pt(mt(i,ar(n,e,o+1)),l),an(e,t,o,l),s&&pt(mt(s,ar(t,r,o+1)),l)),an(r,null,o,l),new k(l)}function ar(n,e,t){let r=[];if(an(null,n,t,r),n.depth>t){let o=Wo(n,e,t+1);pt(mt(o,ar(n,e,t+1)),r)}return an(e,null,t,r),new k(r)}function cf(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)o=e.node(i).copy(k.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}var cr=class n{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(t);return r?e.child(t).cut(r):o}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],o=t==0?0:this.path[t*3-1]+1;for(let i=0;i0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new yt(this,e,r);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 new RangeError("Position "+t+" out of range");let r=[],o=0,i=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),c=i-a;if(r.push(s,l,o+a),!c||(s=s.child(l),s.isText))break;i=c-1,o+=a+1}return new n(t,r,i)}static resolveCached(e,t){let r=Cl.get(e);if(r)for(let i=0;ie&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}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()+")"),Hl(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=k.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=o;at.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let o=k.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};me.prototype.text=void 0;var Jo=class n extends me{constructor(e,t,r,o){if(super(e,t,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Hl(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 n(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new n(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function Hl(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}var bt=class n{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Uo(e,t);if(r.next==null)return n.empty;let o=$l(r);r.next&&r.err("Unexpected trailing text");let i=bf(yf(o));return kf(i,r),i}matchType(e){for(let t=0;tc.createAndFill()));for(let c=0;c=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let o=0;o{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s"+e.indexOf(r.next[s].next);return i}).join(` +`)}};bt.empty=new bt(!0);var Uo=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};function $l(n){let e=[];do e.push(ff(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function ff(n){let e=[];do e.push(hf(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function hf(n){let e=gf(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=pf(n,e);else break;return e}function Ml(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function pf(n,e){let t=Ml(n),r=t;return n.eat(",")&&(n.next!="}"?r=Ml(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function mf(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let o=[];for(let i in t){let s=t[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&n.err("No node type or group '"+e+"' found"),o}function gf(n){if(n.eat("(")){let e=$l(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=mf(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function yf(n){let e=[[]];return o(i(n,0),t()),e;function t(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function o(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=i(s.exprs[a],l);if(a==s.exprs.length-1)return c;o(c,l=t())}else if(s.type=="star"){let a=t();return r(l,a),o(i(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=t();return o(i(s.expr,l),a),o(i(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c{n[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let d=0;d{c||o.push([l,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let i=e[r.join(",")]=new bt(r.indexOf(n.length-1)>-1);for(let s=0;s-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:_l(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new me(this,this.computeAttrs(e),k.from(t),F.setFrom(r))}createChecked(e=null,t,r){return t=k.from(t),this.checkContent(t),new me(this,this.computeAttrs(e),t,F.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=k.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let o=this.contentMatch.matchFragment(t),i=o&&o.fillBefore(k.empty,!0);return i?new me(this,e,t.append(i),F.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;tr[i]=new n(i,t,s));let o=t.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function xf(n,e,t){let r=t.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${i}`)}}var qo=class{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?xf(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}},dn=class n{constructor(e,t,r,o){this.name=e,this.rank=t,this.schema=r,this.spec=o,this.attrs=Kl(e,o.attrs),this.excluded=null;let i=jl(this.attrs);this.instance=i?new F(this,i):null}create(e=null){return!e&&this.instance?this.instance:new F(this,_l(this.attrs,e))}static compile(e,t){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new n(i,o++,t,s)),r}removeFromSet(e){for(var t=0;t-1}},un=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let o in e)t[o]=e[o];t.nodes=Vo.from(e.nodes),t.marks=Vo.from(e.marks||{}),this.nodes=dr.compile(this.spec.nodes,this),this.marks=dn.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=bt.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?Al(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:Al(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof dr){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,o)}text(e,t){let r=this.nodes.text;return new Jo(r,r.defaultAttrs,e,F.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return me.fromJSON(this,e)}markFromJSON(e){return F.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}};function Al(n,e){let t=[];for(let r=0;r-1)&&t.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function Sf(n){return n.tag!=null}function wf(n){return n.style!=null}var Re=class n{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(o=>{if(Sf(o))this.tags.push(o);else if(wf(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new ur(this,t,!1);return r.addAll(e,F.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new ur(this,t,!0);return r.addAll(e,F.none,t.from,t.to),S.maxOpen(r.finish())}matchTag(e,t,r){for(let o=r?this.tags.indexOf(r)+1:0;oe.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let a=s.getAttrs(t);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let t=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s{r(s=Ol(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=Ol(s)),s.node||s.ignore||s.mark||(s.node=o)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new n(e,n.schemaRules(e)))}},Jl={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},Cf={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ul={ol:!0,ul:!0},fn=1,Go=2,cn=4;function El(n,e,t){return e!=null?(e?fn:0)|(e==="full"?Go:0):n&&n.whitespace=="pre"?fn|Go:t&~cn}var zt=class{constructor(e,t,r,o,i,s){this.type=e,this.attrs=t,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=F.none,this.match=i||(s&cn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(k.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&fn)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let t=k.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(k.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Jl.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},ur=class{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=t.topNode,i,s=El(null,t.preserveWhitespace,0)|(r?cn:0);o?i=new zt(o.type,o.attrs,F.none,!0,t.topMatch||o.type.contentMatch,s):r?i=new zt(null,null,F.none,!0,null,s):i=new zt(e.schema.topNodeType,null,F.none,!0,null,s),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,o=this.top,i=o.options&Go?"full":this.localPreserveWS||(o.options&fn)>0;if(i==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)i!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,` `);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let s=o.content[o.content.length-1],l=e.previousSibling;(!s||l&&l.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),t),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let o=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;Ul.hasOwnProperty(s)&&this.parser.normalizeLists&&Mf(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Cf.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,d=this.needsBlock;if(Jl.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let u=a&&a.skip?t:this.readStyles(e,t);u&&this.addAll(e,u),c&&this.sync(i),this.needsBlock=d}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=o}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(` -`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let o=0;o!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,o){let i,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),r)||this.leafFallback(e,r);else{let a=this.enter(s,t.attrs||null,r,t.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=o==null?null:e.childNodes[o];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,t);this.findAtPoint(e,i)}findPlace(e,t){let r,o;for(let i=this.open;i>=0;i--){let s=this.nodes[i],l=s.findWrapping(e);if(l&&(!r||r.length>l.length)&&(r=l,o=s,!l.length)||s.solid)break}if(!r)return null;this.sync(o);for(let i=0;i(s.type?s.type.allowsMarkType(c.type):Nl(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Bt(e,t,a,o,null,l)),this.open++,r}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;this.localPreserveWS&&(this.nodes[t].options|=un)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let d=a>0||a==0&&o?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;a--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}};function Mf(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Ul.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Tf(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Ol(n){let e={};for(let t in n)e[t]=n[t];return e}function Nl(n,e){let t=e.schema.nodes;for(let r in t){let o=t[r];if(!o.allowsMarkType(n))continue;let i=[],s=l=>{i.push(l);for(let a=0;a{if(i.length||s.marks.length){let l=0,a=0;for(;l=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let o=this.marks[e.type.name];return o&&sr(_o(r),o(e,t),null,e.attrs)}static renderSpec(e,t,r=null,o){return sr(e,t,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new n(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=vl(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return vl(e.marks)}};function vl(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function _o(n){return n.document||window.document}var Rl=new WeakMap;function Af(n){let e=Rl.get(n);return e===void 0&&Rl.set(n,e=Ef(n)),e}function Ef(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=o.indexOf(" ");s>0&&(t=o.slice(0,s),o=o.slice(s+1));let l,a=t?n.createElementNS(t,o):n.createElement(o),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let f=u.indexOf(" ");f>0?a.setAttributeNS(u.slice(0,f),u.slice(f+1),c[u]):a.setAttribute(u,c[u])}}for(let u=d;ud)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=sr(n,f,t,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}var Yl=65535,Ql=Math.pow(2,16);function Of(n,e){return n+e*Ql}function ql(n){return n&Yl}function Nf(n){return(n-(n&Yl))/Ql}var Xl=1,Zl=2,fr=4,ea=8,pn=class{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&ea)>0}get deletedBefore(){return(this.delInfo&(Xl|fr))>0}get deletedAfter(){return(this.delInfo&(Zl|fr))>0}get deletedAcross(){return(this.delInfo&fr)>0}},Ve=class n{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&n.empty)return n.empty}recover(e){let t=0,r=ql(e);if(!this.inverted)for(let o=0;oe)break;let c=this.ranges[l+i],d=this.ranges[l+s],u=a+c;if(e<=u){let f=c?e==a?-1:e==u?1:t:t,h=a+o+(f<0?0:d);if(r)return h;let p=e==(t<0?a:u)?null:Of(l/3,e-a),m=e==a?Zl:e==u?Xl:fr;return(t<0?e!=a:e!=u)&&(m|=ea),new pn(h,m,p)}o+=d-c}return r?e+o:new pn(e+o,0,null)}touches(e,t){let r=0,o=ql(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;le)break;let c=this.ranges[l+i],d=a+c;if(e<=d&&l==o*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o=0;t--){let o=e.getMirror(t);this.appendMap(e.maps[t].invert(),o!=null&&o>t?r-o-1:void 0)}}invert(){let e=new n;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;ri&&a!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),t.openStart,t.openEnd);return te.fromReplace(e,this.from,this.to,i)}invert(){return new kt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new n(t.pos,r.pos,this.mark)}merge(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new n(t.from,t.to,e.markFromJSON(t.mark))}};Z.jsonID("addMark",gn);var kt=class n extends Z{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new S(ti(t.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),t.openStart,t.openEnd);return te.fromReplace(e,this.from,this.to,r)}invert(){return new gn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new n(t.pos,r.pos,this.mark)}merge(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new n(t.from,t.to,e.markFromJSON(t.mark))}};Z.jsonID("removeMark",kt);var yn=class n extends Z{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return te.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return te.fromReplace(e,this.pos,this.pos+1,new S(k.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let o=0;or.pos?null:new n(t.pos,r.pos,o,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(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new n(t.from,t.to,t.gapFrom,t.gapTo,S.fromJSON(e,t.slice),t.insert,!!t.structure)}};Z.jsonID("replaceAround",Y);function Zo(n,e,t){let r=n.resolve(e),o=t-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function vf(n,e,t,r){let o=[],i=[],s,l;n.doc.nodesBetween(e,t,(a,c,d)=>{if(!a.isInline)return;let u=a.marks;if(!r.isInSet(u)&&d.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,t),p=r.addToSet(u);for(let m=0;mn.step(a)),i.forEach(a=>n.step(a))}function Rf(n,e,t,r){let o=[],i=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;i++;let a=null;if(r instanceof cn){let c=s.marks,d;for(;d=r.isInSet(c);)(a||(a=[])).push(d),c=d.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,t);for(let d=0;dn.step(new kt(s.from,s.to,s.style)))}function ni(n,e,t,r=t.contentMatch,o=!0){let i=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a=0;a--)n.step(s[a])}function Df(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function je(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let o=n.$from.node(r),i=n.$from.index(r),s=n.$to.indexAfter(r);if(rt;p--)m||r.index(p)>0?(m=!0,d=k.from(r.node(p).copy(d)),u++):a--;let f=k.empty,h=0;for(let p=i,m=!1;p>t;p--)m||o.after(p+1)=0;s--){if(r.size){let l=t[s].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=k.from(t[s].type.create(t[s].attrs,r))}let o=e.start,i=e.end;n.step(new Y(o,i,o,i,new S(r,0,0),t.length,!0))}function zf(n,e,t,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let a=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,a)&&Ff(n.doc,n.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&na(n,s,l,i),ni(n,n.mapping.slice(i).map(l,1),r,void 0,c===null);let d=n.mapping.slice(i),u=d.map(l,1),f=d.map(l+s.nodeSize,1);return n.step(new Y(u,f,u+1,f-1,new S(k.from(r.create(a,null,s.marks)),0,0),1,!0)),c===!0&&ta(n,s,l,i),!1}})}function ta(n,e,t,r){e.forEach((o,i)=>{if(o.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(o.text);){let a=n.mapping.slice(r).map(t+1+i+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function na(n,e,t,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=n.mapping.slice(r).map(t+1+i);n.replaceWith(s,s+1,e.type.schema.text(` -`))}})}function Ff(n,e,t){let r=n.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,t)}function Hf(n,e,t,r,o){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let s=t.create(r,null,o||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,s);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Y(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new S(k.from(s),0,0),1,!0))}function we(n,e,t=1,r){let o=n.resolve(e),i=o.depth-t,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,d=t-2;c>i;c--,d--){let u=o.node(c),f=o.index(c);if(u.type.spec.isolating)return!1;let h=u.content.cutByIndex(f,u.childCount),p=r&&r[d+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[d]||u;if(!u.canReplace(f+1,u.childCount)||!m.type.validContent(h))return!1}let l=o.indexAfter(i),a=r&&r[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function $f(n,e,t=1,r){let o=n.doc.resolve(e),i=k.empty,s=k.empty;for(let l=o.depth,a=o.depth-t,c=t-1;l>a;l--,c--){i=k.from(o.node(l).copy(i));let d=r&&r[c];s=k.from(d?d.type.create(d.attrs,s):o.node(l).copy(s))}n.step(new se(e,e,new S(i.append(s),t,t),!0))}function Oe(n,e){let t=n.resolve(e),r=t.index();return ra(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Vf(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let o=0;o0?(i=r.node(o+1),l++,s=r.node(o).maybeChild(l)):(i=r.node(o).maybeChild(l-1),s=r.node(o+1)),i&&!i.isTextblock&&ra(i,s)&&r.node(o).canReplace(l,l+1))return e;if(o==0)break;e=t<0?r.before(o):r.after(o)}}function jf(n,e,t){let r=null,{linebreakReplacement:o}=n.doc.type.schema,i=n.doc.resolve(e-t),s=i.node().type;if(o&&s.inlineContent){let d=s.whitespace=="pre",u=!!s.contentMatch.matchType(o);d&&!u?r=!1:!d&&u&&(r=!0)}let l=n.steps.length;if(r===!1){let d=n.doc.resolve(e+t);na(n,d.node(),d.before(),l)}s.inlineContent&&ni(n,e+t-1,s,i.node().contentMatchAt(i.index()),r==null);let a=n.mapping.slice(l),c=a.map(e-t);if(n.step(new se(c,a.map(e+t,-1),S.empty,!0)),r===!0){let d=n.doc.resolve(c);ta(n,d.node(),d.before(),n.steps.length)}return n}function _f(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,t))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,t))return r.after(o+1);if(i=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),c=r.node(s),d=!1;if(i==1)d=c.canReplace(a,a,o);else{let u=c.contentMatchAt(a).findWrapping(o.firstChild.type);d=u&&c.canReplaceWith(a,a,u[0])}if(d)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function kn(n,e,t=e,r=S.empty){if(e==t&&!r.size)return null;let o=n.resolve(e),i=n.resolve(t);return oa(o,i,r)?new se(e,t,r):new ei(o,i,r).fit()}function oa(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}var ei=class{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=k.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=k.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,l=o.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new S(i,s,l);return e>-1?new Y(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new se(r.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,o=this.unplaced.openEnd;r1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}t=i.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=Qo(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],d,u=null;if(t==1&&(s?c.matchType(s.type)||(u=c.fillBefore(k.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:u};if(t==2&&s&&(d=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:i,wrap:d};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=Qo(e,t);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new S(e,t+1,Math.max(r,o.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=Qo(e,t);if(o.childCount<=1&&t>0){let i=e.size-t<=t+o.size;this.unplaced=new S(fn(e,t-1,1),t-1,i?t-1:r)}else this.unplaced=new S(fn(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:o,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let m=0;m1||a==0||m.content.size)&&(u=g,d.push(ia(m.mark(f.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=hn(this.placed,t,k.from(d)),this.frontier[t].match=u,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:o}=this.frontier[t],i=t=0;l--){let{match:a,type:c}=this.frontier[l],d=Xo(e,l,c,a,!0);if(!d||d.childCount)continue e}return{depth:t,fit:s,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=hn(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,t=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=hn(this.placed,this.depth,k.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(k.empty,!0);t.childCount&&(this.placed=hn(this.placed,this.frontier.length,t))}};function fn(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(fn(n.firstChild.content,e-1,t)))}function hn(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(hn(n.lastChild.content,e-1,t)))}function Qo(n,e){for(let t=0;t1&&(r=r.replaceChild(0,ia(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(k.empty,!0)))),n.copy(r)}function Xo(n,e,t,r,o){let i=n.node(e),s=o?n.indexAfter(e):n.index(e);if(s==i.childCount&&!t.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,s);return l&&!Wf(t,i.content,s)?l:null}function Wf(n,e,t){for(let r=t;r0;f--,h--){let p=o.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;s.indexOf(f)>-1?l=f:o.before(f)==h&&s.splice(1,0,-f)}let a=s.indexOf(l),c=[],d=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=d-1;f>=0;f--){let h=c[f],p=Kf(h.type);if(p&&!h.sameMarkup(o.node(Math.abs(l)-1)))d=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+d+1)%(r.openStart+1),p=c[h];if(p)for(let m=0;m=0&&(n.replace(e,t,r),!(n.steps.length>u));f--){let h=s[f];h<0||(e=o.before(h),t=i.after(h))}}function sa(n,e,t,r,o){if(er){let i=o.contentMatchAt(0),s=i.fillBefore(n).append(n);n=s.append(i.matchFragment(s).fillBefore(k.empty,!0))}return n}function Uf(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let o=_f(n.doc,e,r.type);o!=null&&(e=t=o)}n.replaceRange(e,t,new S(k.from(r),0,0))}function qf(n,e,t){let r=n.doc.resolve(e),o=n.doc.resolve(t),i=la(r,o);for(let s=0;s0&&(a||r.node(l-1).canReplace(r.index(l-1),o.indexAfter(l-1))))return n.delete(r.before(l),o.after(l))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&o.end(s)-t!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return n.delete(r.before(s),t);n.delete(e,t)}function la(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let o=r;o>=0;o--){let i=n.start(o);if(ie.pos+(e.depth-o)||n.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==n.depth&&o==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&t.push(o)}return t}var hr=class n extends Z{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return te.fail("No node at attribute step's position");let r=Object.create(null);for(let i in t.attrs)r[i]=t.attrs[i];r[this.attr]=this.value;let o=t.type.create(r,null,t.marks);return te.fromReplace(e,this.pos,this.pos+1,new S(k.from(o),0,t.isLeaf?0:1))}getMap(){return Ve.empty}invert(e){return new n(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 n(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new n(t.pos,t.attr,t.value)}};Z.jsonID("attr",hr);var pr=class n extends Z{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let o in e.attrs)t[o]=e.attrs[o];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return te.ok(r)}getMap(){return Ve.empty}invert(e){return new n(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(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new n(t.attr,t.value)}};Z.jsonID("docAttr",pr);var zt=class extends Error{};zt=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};zt.prototype=Object.create(Error.prototype);zt.prototype.constructor=zt;zt.prototype.name="TransformError";var et=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new mn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new zt(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=S.empty){let o=kn(this.doc,e,t,r);return o&&this.step(o),this}replaceWith(e,t,r){return this.replace(e,t,new S(k.from(r),0,0))}delete(e,t){return this.replace(e,t,S.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return Jf(this,e,t,r),this}replaceRangeWith(e,t,r){return Uf(this,e,t,r),this}deleteRange(e,t){return qf(this,e,t),this}lift(e,t){return If(this,e,t),this}join(e,t=1){return jf(this,e,t),this}wrap(e,t){return Bf(this,e,t),this}setBlockType(e,t=e,r,o=null){return zf(this,e,t,r,o),this}setNodeMarkup(e,t,r=null,o){return Hf(this,e,t,r,o),this}setNodeAttribute(e,t,r){return this.step(new hr(e,t,r)),this}setDocAttribute(e,t){return this.step(new pr(e,t)),this}addNodeMark(e,t){return this.step(new yn(e,t)),this}removeNodeMark(e,t){if(!(t instanceof F)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new bn(e,t)),this}split(e,t=1,r){return $f(this,e,t,r),this}addMark(e,t,r){return vf(this,e,t,r),this}removeMark(e,t,r){return Rf(this,e,t,r),this}clearIncompatible(e,t,r){return ni(this,e,t,r),this}};var ri=Object.create(null),T=class{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Vt(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;i--){let s=t<0?$t(e.node(0),e.node(i),e.before(i+1),e.index(i),t,r):$t(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new be(e.node(0))}static atStart(e){return $t(e,e,0,0,1)||new be(e)}static atEnd(e){return $t(e,e,e.content.size,e.childCount,-1)||new be(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=ri[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in ri)throw new RangeError("Duplicate use of selection JSON ID "+e);return ri[e]=t,t.prototype.jsonID=e,t}getBookmark(){return M.between(this.$anchor,this.$head).getBookmark()}};T.prototype.visible=!0;var Vt=class{constructor(e,t){this.$from=e,this.$to=t}},aa=!1;function ca(n){!aa&&!n.parent.inlineContent&&(aa=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}var M=class n extends T{constructor(e,t=e){ca(e),ca(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return T.near(r);let o=e.resolve(t.map(this.anchor));return new n(o.parent.inlineContent?o:r,r)}replace(e,t=S.empty){if(super.replace(e,t),t==S.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof n&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new yr(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new n(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let o=e.resolve(t);return new this(o,r==t?o:e.resolve(r))}static between(e,t,r){let o=e.pos-t.pos;if((!r||o)&&(r=o>=0?1:-1),!t.parent.inlineContent){let i=T.findFrom(t,r,!0)||T.findFrom(t,-r,!0);if(i)t=i.$head;else return T.near(t,r)}return e.parent.inlineContent||(o==0?e=t:(e=(T.findFrom(e,-r,!0)||T.findFrom(e,r,!0)).$anchor,e.pos0?0:1);o>0?s=0;s+=o){let l=e.child(s);if(l.isAtom){if(!i&&A.isSelectable(l))return A.create(n,t-(o<0?l.nodeSize:0))}else{let a=$t(n,l,t+o,o<0?l.childCount:0,o,i);if(a)return a}t+=l.nodeSize*o}return null}function da(n,e,t){let r=n.steps.length-1;if(r{s==null&&(s=d)}),n.setSelection(T.near(n.doc.resolve(s),t))}var ua=1,gr=2,fa=4,si=class extends et{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|=gr,this}ensureMarks(e){return F.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&gr)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~gr,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||F.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let o=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r==null?t:r,!e)return this.deleteRange(t,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(t);i=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,o.text(e,i)),this.selection.empty||this.setSelection(T.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=fa,this}get scrolledIntoView(){return(this.updated&fa)>0}};function ha(n,e){return!e||!n?n:n.bind(e)}var xt=class{constructor(e,t,r){this.name=e,this.init=ha(t.init,r),this.apply=ha(t.apply,r)}},Yf=[new xt("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new xt("selection",{init(n,e){return n.selection||T.atStart(e.doc)},apply(n){return n.selection}}),new xt("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new xt("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})],xn=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Yf.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new xt(r.key,r.spec.state,r))})}},br=class n{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 r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],i=o.spec.state;i&&i.toJSON&&(t[r]=i.toJSON.call(o,this[o.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new xn(e.schema,e.plugins),i=new n(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=me.fromJSON(e.schema,t.doc);else if(s.name=="selection")i.selection=T.fromJSON(i.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){i[s.name]=c.fromJSON.call(a,e,t[l],i);return}}i[s.name]=s.init(e,i)}}),i}};function pa(n,e,t){for(let r in n){let o=n[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=pa(o,e,{})),t[r]=o}return t}var P=class{constructor(e){this.spec=e,this.props={},e.props&&pa(e.props,this,this.props),this.key=e.key?e.key.key:ma("plugin")}getState(e){return e[this.key]}},oi=Object.create(null);function ma(n){return n in oi?n+"$"+ ++oi[n]:(oi[n]=0,n+"$")}var V=class{constructor(e="key"){this.key=ma(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};var ne=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Mn=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e},fi=null,We=function(n,e,t){let r=fi||(fi=document.createRange());return r.setEnd(n,t==null?n.nodeValue.length:t),r.setStart(n,e||0),r},Qf=function(){fi=null},Et=function(n,e,t,r){return t&&(ga(n,e,t,r,-1)||ga(n,e,t,r,1))},Xf=/^(img|br|input|textarea|hr)$/i;function ga(n,e,t,r,o){for(;;){if(n==t&&e==r)return!0;if(e==(o<0?0:Me(n))){let i=n.parentNode;if(!i||i.nodeType!=1||On(n)||Xf.test(n.nodeName)||n.contentEditable=="false")return!1;e=ne(n)+(o<0?0:1),n=i}else if(n.nodeType==1){if(n=n.childNodes[e+(o<0?-1:0)],n.contentEditable=="false")return!1;e=o<0?Me(n):0}else return!1}}function Me(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Zf(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Me(n)}else if(n.parentNode&&!On(n))e=ne(n),n=n.parentNode;else return null}}function eh(n,e){for(;;){if(n.nodeType==3&&e2),Ce=Jt||(De?/Mac/.test(De.platform):!1),oh=De?/Win/.test(De.platform):!1,Ke=/Android \d/.test(st),Nn=!!ya&&"webkitFontSmoothing"in ya.documentElement.style,ih=Nn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function sh(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function _e(n,e){return typeof n=="number"?n:n[e]}function lh(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function ba(n,e,t){let r=n.someProp("scrollThreshold")||0,o=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let s=t||n.dom;s;s=Mn(s)){if(s.nodeType!=1)continue;let l=s,a=l==i.body,c=a?sh(i):lh(l),d=0,u=0;if(e.topc.bottom-_e(r,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+_e(o,"top")-c.top:e.bottom-c.bottom+_e(o,"bottom")),e.leftc.right-_e(r,"right")&&(d=e.right-c.right+_e(o,"right")),d||u)if(a)i.defaultView.scrollBy(d,u);else{let f=l.scrollLeft,h=l.scrollTop;u&&(l.scrollTop+=u),d&&(l.scrollLeft+=d);let p=l.scrollLeft-f,m=l.scrollTop-h;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function ah(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=t+1;s=t-20){r=l,o=a.top;break}}return{refDOM:r,refTop:o,stack:Qa(n.dom)}}function Qa(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Mn(r));return e}function ch({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Xa(t,r==0?0:r-e)}function Xa(n,e){for(let t=0;t=l){s=Math.max(p.bottom,s),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=d,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(i=u+1)}}return!t&&a&&(t=a,o=c,r=0),t&&t.nodeType==3?uh(t,o):!t||r&&t.nodeType==1?{node:n,offset:i}:Za(t,o)}function uh(n,e){let t=n.nodeValue.length,r=document.createRange();for(let o=0;o=(i.left+i.right)/2?1:0)}}return{node:n,offset:0}}function vi(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function fh(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,o,i)}function ph(n,e,t,r){let o=-1;for(let i=e,s=!1;i!=n.dom;){let l=n.docView.nearestDesc(i,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&(!s&&a.left>r.left||a.top>r.top?o=l.posBefore:(!s&&a.right-1?o:n.docView.posFromDOM(e,t,-1)}function ec(n,e,t){let r=n.childNodes.length;if(r&&t.tope.top&&o++}let c;Nn&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==n.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(l=ph(n,r,o,e))}l==null&&(l=hh(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function ka(n){return n.top=0&&o==r.nodeValue.length?(a--,d=1):t<0?a--:c++,Sn(tt(We(r,a,c),d),d<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(t<0||o==Me(r))){let a=r.childNodes[o-1];if(a.nodeType==1)return li(a.getBoundingClientRect(),!1)}if(i==null&&o=0)}if(i==null&&o&&(t<0||o==Me(r))){let a=r.childNodes[o-1],c=a.nodeType==3?We(a,Me(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Sn(tt(c,1),!1)}if(i==null&&o=0)}function Sn(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function li(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function nc(n,e,t){let r=n.state,o=n.root.activeElement;r!=e&&n.updateState(e),o!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),o!=n.dom&&o&&o.focus()}}function yh(n,e,t){let r=e.selection,o=t=="up"?r.$from:r.$to;return nc(n,e,()=>{let{node:i}=n.docView.domFromPos(o.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=tc(n,o.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=We(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;cd.top+1&&(t=="up"?s.top-d.top>(d.bottom-s.top)*2:d.bottom-s.bottom>(s.bottom-d.top)*2))return!1}}return!0})}var bh=/[\u0590-\u08ac]/;function kh(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,l=n.domSelection();return l?!bh.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?i:s:nc(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:d,anchorOffset:u}=n.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",t,"character");let h=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(d,u),a&&(a!=d||c!=u)&&l.extend&&l.extend(a,c)}catch(y){}return f!=null&&(l.caretBidiLevel=f),g}):r.pos==r.start()||r.pos==r.end()}var xa=null,Sa=null,wa=!1;function xh(n,e,t){return xa==e&&Sa==t?wa:(xa=e,Sa=t,wa=t=="up"||t=="down"?yh(n,e,t):kh(n,e,t))}var Te=0,Ca=1,wt=2,Ie=3,Ot=class{constructor(e,t,r,o){this.parent=e,this.children=t,this.dom=r,this.contentDOM=o,this.dirty=Te,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;tne(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&t==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return(o==null?r>0:o)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!t||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;te||s instanceof Sr){o=e-i;break}i=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,t);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof kr&&i.side>=0;r--);if(t<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&t&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?ne(i.dom)+1:0}}else{let i,s=!0;for(;i=r=d&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,d);e=s;for(let u=l;u>0;u--){let f=this.children[u-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=ne(f.dom)+1;break}e-=f.size}o==-1&&(o=0)}if(o>-1&&(c>t||l==this.children.length-1)){t=c;for(let d=l+1;dp&&st){let p=l;l=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,o=0;o=r:er){let l=r+i.border,a=s-i.border;if(e>=l&&t<=a){this.dirty=e==r||t==s?wt:Ca,e==l&&t==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Ie:i.markDirty(e-l,t-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?wt:Ie}r=s}this.dirty=wt}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?wt:Ca;t.dirty{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==Te&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}},gi=class extends Ot{constructor(e,t,r,o){super(e,[],t,null),this.textDOM=r,this.text=o}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 e.type==="characterData"&&e.target.nodeValue==e.oldValue}},Ut=class n extends Ot{constructor(e,t,r,o,i){super(e,[],r,o),this.mark=t,this.spec=i}static create(e,t,r,o){let i=o.nodeViews[t.type.name],s=i&&i(t,o,r);return(!s||!s.dom)&&(s=$e.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new n(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Ie||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ie&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Te){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(i=xi(i,0,e,r));for(let l=0;l{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,o),d=c&&c.dom,u=c&&c.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=$e.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!u&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let f=d;return d=ic(d,r,t),c?a=new yi(e,t,r,o,d,u||null,f,c,i,s+1):t.isText?new xr(e,t,r,o,d,f,i):new n(e,t,r,o,d,u||null,f,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>k.empty)}return e}matchesNode(e,t,r){return this.dirty==Te&&e.eq(this.node)&&wr(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,o=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new ki(this,s&&s.node,e);Mh(this.node,this.innerDeco,(c,d,u)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!u&&a.syncToMarks(d==this.node.childCount?F.none:this.node.child(d).marks,r,e),a.placeWidget(c,e,o)},(c,d,u,f)=>{a.syncToMarks(c.marks,r,e);let h;a.findNodeMatch(c,d,u,f)||l&&e.state.selection.from>o&&e.state.selection.to-1&&a.updateNodeAt(c,d,u,h,e)||a.updateNextNode(c,d,u,e,f,o)||a.addNode(c,d,u,e,o),o+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==wt)&&(s&&this.protectLocalComposition(e,s),rc(this.contentDOM,this.children,e),Jt&&Th(this.dom))}localCompositionInfo(e,t){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof M)||rt+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=Ah(this.node.content,s,r-t,o-t);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:o}){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 s=new gi(this,i,t,o);e.input.compositionNodes.push(s),this.children=xi(this.children,r,r+o.length,e,s)}update(e,t,r,o){return this.dirty==Ie||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,o),!0)}updateInner(e,t,r,o){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=Te}updateOuterDeco(e){if(wr(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=oc(this.dom,this.nodeDOM,bi(this.outerDeco,this.node,t),bi(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}};function Ma(n,e,t,r,o){ic(r,e,n);let i=new it(void 0,n,e,t,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}var xr=class n extends it{constructor(e,t,r,o,i,s,l){super(e,t,r,o,i,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,o){return this.dirty==Ie||this.dirty!=Te&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Te||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=Te,!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,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let o=this.node.cut(e,t),i=document.createTextNode(o.text);return new n(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Ie)}get domAtom(){return!1}isText(e){return this.node.text==e}},Sr=class extends Ot{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Te&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},yi=class extends it{constructor(e,t,r,o,i,s,l,a,c,d){super(e,t,r,o,i,s,l,c,d),this.spec=a}update(e,t,r,o){if(this.dirty==Ie)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,r);return i&&this.updateInner(e,t,r,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,o){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function rc(n,e,t){let r=n.firstChild,o=!1;for(let i=0;i>1,s=Math.min(i,e.length);for(;o-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=Ut.create(this.top,e[i],t,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,i++}}findNodeMatch(e,t,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,r))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l0;){let l;for(;;)if(r){let c=t.children[r-1];if(c instanceof Ut)t=c,r=c.children.length;else{l=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(o-1))break;--o,i.set(l,o),s.push(l)}}return{index:o,matched:i,matches:s.reverse()}}function Ch(n,e){return n.type.side-e.type.side}function Mh(n,e,t,r){let o=e.locals(n),i=0;if(o.length==0){for(let c=0;ci;)l.push(o[s++]);let p=i+f.nodeSize;if(f.isText){let g=p;s!g.inline):l.slice();r(f,m,e.forChild(i,f),h),i=p}}function Th(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function Ah(n,e,t,r){for(let o=0,i=0;o=t){if(i>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l=0&&c+e.length+l>=t)return l+c;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function xi(n,e,t,r,o){let i=[];for(let s=0,l=0;s=t||d<=e?i.push(a):(ct&&i.push(a.slice(t-c,a.size,r)))}return i}function Ri(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let o=n.docView.nearestDesc(t.focusNode),i=o&&o.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(vr(t)){for(a=s;o&&!o.node;)o=o.parent;let u=o.node;if(o&&u.isAtom&&A.isSelectable(u)&&o.parent&&!(u.isInline&&th(t.focusNode,t.focusOffset,o.dom))){let f=o.posBefore;c=new A(s==f?l:r.resolve(f))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let u=s,f=s;for(let h=0;h{(t.anchorNode!=r||t.anchorOffset!=o)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!sc(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Oh(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let r=n.cursorWrapper.dom,o=r.nodeName=="IMG";o?t.setStart(r.parentNode,ne(r)+1):t.setStart(r,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!o&&!n.state.selection.visible&&ge&&ot<=11&&(r.disabled=!0,r.disabled=!1)}function lc(n,e){if(e instanceof A){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Na(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Na(n)}function Na(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Di(n,e,t,r){return n.someProp("createSelectionBetween",o=>o(n,e,t))||M.between(e,t,r)}function va(n){return n.editable&&!n.hasFocus()?!1:ac(n)}function ac(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch(t){return!1}}function Nh(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Et(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Si(n,e){let{$anchor:t,$head:r}=n.selection,o=e>0?t.max(r):t.min(r),i=o.parent.inlineContent?o.depth?n.doc.resolve(e>0?o.after():o.before()):null:o;return i&&T.findFrom(i,e)}function nt(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Ra(n,e,t){let r=n.state.selection;if(r instanceof M)if(t.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=n.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return nt(n,new M(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let o=Si(n.state,e);return o&&o instanceof A?nt(n,o):!1}else if(!(Ce&&t.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?A.isSelectable(i)?nt(n,new A(e<0?n.state.doc.resolve(o.pos-i.nodeSize):o)):Nn?nt(n,new M(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof A&&r.node.isInline)return nt(n,new M(e>0?r.$to:r.$from));{let o=Si(n.state,e);return o?nt(n,o):!1}}}function Cr(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Cn(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function _t(n,e){return e<0?vh(n):Rh(n)}function vh(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o,i,s=!1;for(Ne&&t.nodeType==1&&r0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(Cn(l,-1))o=t,i=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(cc(t))break;{let l=t.previousSibling;for(;l&&Cn(l,-1);)o=t.parentNode,i=ne(l),l=l.previousSibling;if(l)t=l,r=Cr(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?wi(n,t,r):o&&wi(n,o,i)}function Rh(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o=Cr(t),i,s;for(;;)if(r{n.state==o&&Je(n)},50)}function Da(n,e){let t=n.state.doc.resolve(e);if(!(ae||oh)&&t.parent.inlineContent){let o=n.coordsAtPos(e);if(e>t.start()){let i=n.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>o.top&&s1)return i.lefto.top&&s1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Ia(n,e,t){let r=n.state.selection;if(r instanceof M&&!r.empty||t.indexOf("s")>-1||Ce&&t.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=Si(n.state,e);if(s&&s instanceof A)return nt(n,s)}if(!o.parent.inlineContent){let s=e<0?o:i,l=r instanceof be?T.near(s,e):T.findFrom(s,e);return l?nt(n,l):!1}return!1}function Pa(n,e){if(!(n.state.selection instanceof M))return!0;let{$head:t,$anchor:r,empty:o}=n.state.selection;if(!t.sameParent(r))return!0;if(!o)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let s=n.state.tr;return e<0?s.delete(t.pos-i.nodeSize,t.pos):s.delete(t.pos,t.pos+i.nodeSize),n.dispatch(s),!0}return!1}function La(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Ph(n){if(!ue||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;La(n,r,"true"),setTimeout(()=>La(n,r,"false"),20)}return!1}function Lh(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Bh(n,e){let t=e.keyCode,r=Lh(e);if(t==8||Ce&&t==72&&r=="c")return Pa(n,-1)||_t(n,-1);if(t==46&&!e.shiftKey||Ce&&t==68&&r=="c")return Pa(n,1)||_t(n,1);if(t==13||t==27)return!0;if(t==37||Ce&&t==66&&r=="c"){let o=t==37?Da(n,n.state.selection.from)=="ltr"?-1:1:-1;return Ra(n,o,r)||_t(n,o)}else if(t==39||Ce&&t==70&&r=="c"){let o=t==39?Da(n,n.state.selection.from)=="ltr"?1:-1:1;return Ra(n,o,r)||_t(n,o)}else{if(t==38||Ce&&t==80&&r=="c")return Ia(n,-1,r)||_t(n,-1);if(t==40||Ce&&t==78&&r=="c")return Ph(n)||Ia(n,1,r)||_t(n,1);if(r==(Ce?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function dc(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let s=n.someProp("clipboardSerializer")||$e.fromSchema(n.state.schema),l=gc(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,d,u=0;for(;c&&c.nodeType==1&&(d=mc[c.nodeName.toLowerCase()]);){for(let h=d.length-1;h>=0;h--){let p=l.createElement(d[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),u++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${i}${u?` -${u}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,` +`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let o=0;o!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,o){let i,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),r)||this.leafFallback(e,r);else{let a=this.enter(s,t.attrs||null,r,t.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=o==null?null:e.childNodes[o];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,t);this.findAtPoint(e,i)}findPlace(e,t){let r,o;for(let i=this.open;i>=0;i--){let s=this.nodes[i],l=s.findWrapping(e);if(l&&(!r||r.length>l.length)&&(r=l,o=s,!l.length)||s.solid)break}if(!r)return null;this.sync(o);for(let i=0;i(s.type?s.type.allowsMarkType(c.type):Nl(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new zt(e,t,a,o,null,l)),this.open++,r}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;this.localPreserveWS&&(this.nodes[t].options|=fn)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let d=a>0||a==0&&o?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;a--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}};function Mf(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Ul.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Tf(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Ol(n){let e={};for(let t in n)e[t]=n[t];return e}function Nl(n,e){let t=e.schema.nodes;for(let r in t){let o=t[r];if(!o.allowsMarkType(n))continue;let i=[],s=l=>{i.push(l);for(let a=0;a{if(i.length||s.marks.length){let l=0,a=0;for(;l=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let o=this.marks[e.type.name];return o&&sr(_o(r),o(e,t),null,e.attrs)}static renderSpec(e,t,r=null,o){return sr(e,t,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new n(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=vl(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return vl(e.marks)}};function vl(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function _o(n){return n.document||window.document}var Rl=new WeakMap;function Af(n){let e=Rl.get(n);return e===void 0&&Rl.set(n,e=Ef(n)),e}function Ef(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=o.indexOf(" ");s>0&&(t=o.slice(0,s),o=o.slice(s+1));let l,a=t?n.createElementNS(t,o):n.createElement(o),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let f=u.indexOf(" ");f>0?a.setAttributeNS(u.slice(0,f),u.slice(f+1),c[u]):a.setAttribute(u,c[u])}}for(let u=d;ud)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=sr(n,f,t,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}var Yl=65535,Ql=Math.pow(2,16);function Of(n,e){return n+e*Ql}function ql(n){return n&Yl}function Nf(n){return(n-(n&Yl))/Ql}var Xl=1,Zl=2,fr=4,ea=8,mn=class{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&ea)>0}get deletedBefore(){return(this.delInfo&(Xl|fr))>0}get deletedAfter(){return(this.delInfo&(Zl|fr))>0}get deletedAcross(){return(this.delInfo&fr)>0}},Ve=class n{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&n.empty)return n.empty}recover(e){let t=0,r=ql(e);if(!this.inverted)for(let o=0;oe)break;let c=this.ranges[l+i],d=this.ranges[l+s],u=a+c;if(e<=u){let f=c?e==a?-1:e==u?1:t:t,h=a+o+(f<0?0:d);if(r)return h;let p=e==(t<0?a:u)?null:Of(l/3,e-a),m=e==a?Zl:e==u?Xl:fr;return(t<0?e!=a:e!=u)&&(m|=ea),new mn(h,m,p)}o+=d-c}return r?e+o:new mn(e+o,0,null)}touches(e,t){let r=0,o=ql(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;le)break;let c=this.ranges[l+i],d=a+c;if(e<=d&&l==o*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o=0;t--){let o=e.getMirror(t);this.appendMap(e.maps[t].invert(),o!=null&&o>t?r-o-1:void 0)}}invert(){let e=new n;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;ri&&a!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),t.openStart,t.openEnd);return te.fromReplace(e,this.from,this.to,i)}invert(){return new kt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new n(t.pos,r.pos,this.mark)}merge(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new n(t.from,t.to,e.markFromJSON(t.mark))}};Z.jsonID("addMark",yn);var kt=class n extends Z{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new S(ti(t.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),t.openStart,t.openEnd);return te.fromReplace(e,this.from,this.to,r)}invert(){return new yn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new n(t.pos,r.pos,this.mark)}merge(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new n(t.from,t.to,e.markFromJSON(t.mark))}};Z.jsonID("removeMark",kt);var bn=class n extends Z{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return te.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return te.fromReplace(e,this.pos,this.pos+1,new S(k.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let o=0;or.pos?null:new n(t.pos,r.pos,o,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(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new n(t.from,t.to,t.gapFrom,t.gapTo,S.fromJSON(e,t.slice),t.insert,!!t.structure)}};Z.jsonID("replaceAround",Y);function Zo(n,e,t){let r=n.resolve(e),o=t-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function vf(n,e,t,r){let o=[],i=[],s,l;n.doc.nodesBetween(e,t,(a,c,d)=>{if(!a.isInline)return;let u=a.marks;if(!r.isInSet(u)&&d.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,t),p=r.addToSet(u);for(let m=0;mn.step(a)),i.forEach(a=>n.step(a))}function Rf(n,e,t,r){let o=[],i=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;i++;let a=null;if(r instanceof dn){let c=s.marks,d;for(;d=r.isInSet(c);)(a||(a=[])).push(d),c=d.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,t);for(let d=0;dn.step(new kt(s.from,s.to,s.style)))}function ni(n,e,t,r=t.contentMatch,o=!0){let i=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a=0;a--)n.step(s[a])}function Df(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function je(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let o=n.$from.node(r),i=n.$from.index(r),s=n.$to.indexAfter(r);if(rt;p--)m||r.index(p)>0?(m=!0,d=k.from(r.node(p).copy(d)),u++):a--;let f=k.empty,h=0;for(let p=i,m=!1;p>t;p--)m||o.after(p+1)=0;s--){if(r.size){let l=t[s].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=k.from(t[s].type.create(t[s].attrs,r))}let o=e.start,i=e.end;n.step(new Y(o,i,o,i,new S(r,0,0),t.length,!0))}function zf(n,e,t,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let a=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,a)&&Ff(n.doc,n.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&na(n,s,l,i),ni(n,n.mapping.slice(i).map(l,1),r,void 0,c===null);let d=n.mapping.slice(i),u=d.map(l,1),f=d.map(l+s.nodeSize,1);return n.step(new Y(u,f,u+1,f-1,new S(k.from(r.create(a,null,s.marks)),0,0),1,!0)),c===!0&&ta(n,s,l,i),!1}})}function ta(n,e,t,r){e.forEach((o,i)=>{if(o.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(o.text);){let a=n.mapping.slice(r).map(t+1+i+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function na(n,e,t,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=n.mapping.slice(r).map(t+1+i);n.replaceWith(s,s+1,e.type.schema.text(` +`))}})}function Ff(n,e,t){let r=n.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,t)}function Hf(n,e,t,r,o){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let s=t.create(r,null,o||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,s);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Y(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new S(k.from(s),0,0),1,!0))}function we(n,e,t=1,r){let o=n.resolve(e),i=o.depth-t,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,d=t-2;c>i;c--,d--){let u=o.node(c),f=o.index(c);if(u.type.spec.isolating)return!1;let h=u.content.cutByIndex(f,u.childCount),p=r&&r[d+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[d]||u;if(!u.canReplace(f+1,u.childCount)||!m.type.validContent(h))return!1}let l=o.indexAfter(i),a=r&&r[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function $f(n,e,t=1,r){let o=n.doc.resolve(e),i=k.empty,s=k.empty;for(let l=o.depth,a=o.depth-t,c=t-1;l>a;l--,c--){i=k.from(o.node(l).copy(i));let d=r&&r[c];s=k.from(d?d.type.create(d.attrs,s):o.node(l).copy(s))}n.step(new se(e,e,new S(i.append(s),t,t),!0))}function Oe(n,e){let t=n.resolve(e),r=t.index();return ra(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Vf(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let o=0;o0?(i=r.node(o+1),l++,s=r.node(o).maybeChild(l)):(i=r.node(o).maybeChild(l-1),s=r.node(o+1)),i&&!i.isTextblock&&ra(i,s)&&r.node(o).canReplace(l,l+1))return e;if(o==0)break;e=t<0?r.before(o):r.after(o)}}function jf(n,e,t){let r=null,{linebreakReplacement:o}=n.doc.type.schema,i=n.doc.resolve(e-t),s=i.node().type;if(o&&s.inlineContent){let d=s.whitespace=="pre",u=!!s.contentMatch.matchType(o);d&&!u?r=!1:!d&&u&&(r=!0)}let l=n.steps.length;if(r===!1){let d=n.doc.resolve(e+t);na(n,d.node(),d.before(),l)}s.inlineContent&&ni(n,e+t-1,s,i.node().contentMatchAt(i.index()),r==null);let a=n.mapping.slice(l),c=a.map(e-t);if(n.step(new se(c,a.map(e+t,-1),S.empty,!0)),r===!0){let d=n.doc.resolve(c);ta(n,d.node(),d.before(),n.steps.length)}return n}function _f(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,t))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,t))return r.after(o+1);if(i=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),c=r.node(s),d=!1;if(i==1)d=c.canReplace(a,a,o);else{let u=c.contentMatchAt(a).findWrapping(o.firstChild.type);d=u&&c.canReplaceWith(a,a,u[0])}if(d)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function xn(n,e,t=e,r=S.empty){if(e==t&&!r.size)return null;let o=n.resolve(e),i=n.resolve(t);return oa(o,i,r)?new se(e,t,r):new ei(o,i,r).fit()}function oa(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}var ei=class{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=k.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=k.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,l=o.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new S(i,s,l);return e>-1?new Y(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new se(r.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,o=this.unplaced.openEnd;r1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}t=i.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=Qo(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],d,u=null;if(t==1&&(s?c.matchType(s.type)||(u=c.fillBefore(k.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:u};if(t==2&&s&&(d=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:i,wrap:d};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=Qo(e,t);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new S(e,t+1,Math.max(r,o.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=Qo(e,t);if(o.childCount<=1&&t>0){let i=e.size-t<=t+o.size;this.unplaced=new S(hn(e,t-1,1),t-1,i?t-1:r)}else this.unplaced=new S(hn(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:o,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let m=0;m1||a==0||m.content.size)&&(u=g,d.push(ia(m.mark(f.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=pn(this.placed,t,k.from(d)),this.frontier[t].match=u,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:o}=this.frontier[t],i=t=0;l--){let{match:a,type:c}=this.frontier[l],d=Xo(e,l,c,a,!0);if(!d||d.childCount)continue e}return{depth:t,fit:s,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=pn(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,t=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=pn(this.placed,this.depth,k.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(k.empty,!0);t.childCount&&(this.placed=pn(this.placed,this.frontier.length,t))}};function hn(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(hn(n.firstChild.content,e-1,t)))}function pn(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(pn(n.lastChild.content,e-1,t)))}function Qo(n,e){for(let t=0;t1&&(r=r.replaceChild(0,ia(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(k.empty,!0)))),n.copy(r)}function Xo(n,e,t,r,o){let i=n.node(e),s=o?n.indexAfter(e):n.index(e);if(s==i.childCount&&!t.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,s);return l&&!Wf(t,i.content,s)?l:null}function Wf(n,e,t){for(let r=t;r0;f--,h--){let p=o.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;s.indexOf(f)>-1?l=f:o.before(f)==h&&s.splice(1,0,-f)}let a=s.indexOf(l),c=[],d=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=d-1;f>=0;f--){let h=c[f],p=Kf(h.type);if(p&&!h.sameMarkup(o.node(Math.abs(l)-1)))d=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+d+1)%(r.openStart+1),p=c[h];if(p)for(let m=0;m=0&&(n.replace(e,t,r),!(n.steps.length>u));f--){let h=s[f];h<0||(e=o.before(h),t=i.after(h))}}function sa(n,e,t,r,o){if(er){let i=o.contentMatchAt(0),s=i.fillBefore(n).append(n);n=s.append(i.matchFragment(s).fillBefore(k.empty,!0))}return n}function Uf(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let o=_f(n.doc,e,r.type);o!=null&&(e=t=o)}n.replaceRange(e,t,new S(k.from(r),0,0))}function qf(n,e,t){let r=n.doc.resolve(e),o=n.doc.resolve(t),i=la(r,o);for(let s=0;s0&&(a||r.node(l-1).canReplace(r.index(l-1),o.indexAfter(l-1))))return n.delete(r.before(l),o.after(l))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&o.end(s)-t!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return n.delete(r.before(s),t);n.delete(e,t)}function la(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let o=r;o>=0;o--){let i=n.start(o);if(ie.pos+(e.depth-o)||n.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==n.depth&&o==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&t.push(o)}return t}var hr=class n extends Z{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return te.fail("No node at attribute step's position");let r=Object.create(null);for(let i in t.attrs)r[i]=t.attrs[i];r[this.attr]=this.value;let o=t.type.create(r,null,t.marks);return te.fromReplace(e,this.pos,this.pos+1,new S(k.from(o),0,t.isLeaf?0:1))}getMap(){return Ve.empty}invert(e){return new n(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 n(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new n(t.pos,t.attr,t.value)}};Z.jsonID("attr",hr);var pr=class n extends Z{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let o in e.attrs)t[o]=e.attrs[o];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return te.ok(r)}getMap(){return Ve.empty}invert(e){return new n(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(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new n(t.attr,t.value)}};Z.jsonID("docAttr",pr);var Ft=class extends Error{};Ft=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Ft.prototype=Object.create(Error.prototype);Ft.prototype.constructor=Ft;Ft.prototype.name="TransformError";var et=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new gn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Ft(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=S.empty){let o=xn(this.doc,e,t,r);return o&&this.step(o),this}replaceWith(e,t,r){return this.replace(e,t,new S(k.from(r),0,0))}delete(e,t){return this.replace(e,t,S.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return Jf(this,e,t,r),this}replaceRangeWith(e,t,r){return Uf(this,e,t,r),this}deleteRange(e,t){return qf(this,e,t),this}lift(e,t){return If(this,e,t),this}join(e,t=1){return jf(this,e,t),this}wrap(e,t){return Bf(this,e,t),this}setBlockType(e,t=e,r,o=null){return zf(this,e,t,r,o),this}setNodeMarkup(e,t,r=null,o){return Hf(this,e,t,r,o),this}setNodeAttribute(e,t,r){return this.step(new hr(e,t,r)),this}setDocAttribute(e,t){return this.step(new pr(e,t)),this}addNodeMark(e,t){return this.step(new bn(e,t)),this}removeNodeMark(e,t){if(!(t instanceof F)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new kn(e,t)),this}split(e,t=1,r){return $f(this,e,t,r),this}addMark(e,t,r){return vf(this,e,t,r),this}removeMark(e,t,r){return Rf(this,e,t,r),this}clearIncompatible(e,t,r){return ni(this,e,t,r),this}};var ri=Object.create(null),T=class{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new jt(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;i--){let s=t<0?Vt(e.node(0),e.node(i),e.before(i+1),e.index(i),t,r):Vt(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new be(e.node(0))}static atStart(e){return Vt(e,e,0,0,1)||new be(e)}static atEnd(e){return Vt(e,e,e.content.size,e.childCount,-1)||new be(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=ri[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in ri)throw new RangeError("Duplicate use of selection JSON ID "+e);return ri[e]=t,t.prototype.jsonID=e,t}getBookmark(){return M.between(this.$anchor,this.$head).getBookmark()}};T.prototype.visible=!0;var jt=class{constructor(e,t){this.$from=e,this.$to=t}},aa=!1;function ca(n){!aa&&!n.parent.inlineContent&&(aa=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}var M=class n extends T{constructor(e,t=e){ca(e),ca(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return T.near(r);let o=e.resolve(t.map(this.anchor));return new n(o.parent.inlineContent?o:r,r)}replace(e,t=S.empty){if(super.replace(e,t),t==S.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof n&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new yr(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new n(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let o=e.resolve(t);return new this(o,r==t?o:e.resolve(r))}static between(e,t,r){let o=e.pos-t.pos;if((!r||o)&&(r=o>=0?1:-1),!t.parent.inlineContent){let i=T.findFrom(t,r,!0)||T.findFrom(t,-r,!0);if(i)t=i.$head;else return T.near(t,r)}return e.parent.inlineContent||(o==0?e=t:(e=(T.findFrom(e,-r,!0)||T.findFrom(e,r,!0)).$anchor,e.pos0?0:1);o>0?s=0;s+=o){let l=e.child(s);if(l.isAtom){if(!i&&A.isSelectable(l))return A.create(n,t-(o<0?l.nodeSize:0))}else{let a=Vt(n,l,t+o,o<0?l.childCount:0,o,i);if(a)return a}t+=l.nodeSize*o}return null}function da(n,e,t){let r=n.steps.length-1;if(r{s==null&&(s=d)}),n.setSelection(T.near(n.doc.resolve(s),t))}var ua=1,gr=2,fa=4,si=class extends et{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|=gr,this}ensureMarks(e){return F.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&gr)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~gr,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||F.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let o=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r==null?t:r,!e)return this.deleteRange(t,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(t);i=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,o.text(e,i)),this.selection.empty||this.setSelection(T.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=fa,this}get scrolledIntoView(){return(this.updated&fa)>0}};function ha(n,e){return!e||!n?n:n.bind(e)}var xt=class{constructor(e,t,r){this.name=e,this.init=ha(t.init,r),this.apply=ha(t.apply,r)}},Yf=[new xt("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new xt("selection",{init(n,e){return n.selection||T.atStart(e.doc)},apply(n){return n.selection}}),new xt("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new xt("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})],Sn=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Yf.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new xt(r.key,r.spec.state,r))})}},br=class n{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 r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],i=o.spec.state;i&&i.toJSON&&(t[r]=i.toJSON.call(o,this[o.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new Sn(e.schema,e.plugins),i=new n(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=me.fromJSON(e.schema,t.doc);else if(s.name=="selection")i.selection=T.fromJSON(i.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){i[s.name]=c.fromJSON.call(a,e,t[l],i);return}}i[s.name]=s.init(e,i)}}),i}};function pa(n,e,t){for(let r in n){let o=n[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=pa(o,e,{})),t[r]=o}return t}var P=class{constructor(e){this.spec=e,this.props={},e.props&&pa(e.props,this,this.props),this.key=e.key?e.key.key:ma("plugin")}getState(e){return e[this.key]}},oi=Object.create(null);function ma(n){return n in oi?n+"$"+ ++oi[n]:(oi[n]=0,n+"$")}var V=class{constructor(e="key"){this.key=ma(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};var ne=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Tn=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e},fi=null,We=function(n,e,t){let r=fi||(fi=document.createRange());return r.setEnd(n,t==null?n.nodeValue.length:t),r.setStart(n,e||0),r},Qf=function(){fi=null},Et=function(n,e,t,r){return t&&(ga(n,e,t,r,-1)||ga(n,e,t,r,1))},Xf=/^(img|br|input|textarea|hr)$/i;function ga(n,e,t,r,o){for(;;){if(n==t&&e==r)return!0;if(e==(o<0?0:Me(n))){let i=n.parentNode;if(!i||i.nodeType!=1||Nn(n)||Xf.test(n.nodeName)||n.contentEditable=="false")return!1;e=ne(n)+(o<0?0:1),n=i}else if(n.nodeType==1){if(n=n.childNodes[e+(o<0?-1:0)],n.contentEditable=="false")return!1;e=o<0?Me(n):0}else return!1}}function Me(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Zf(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Me(n)}else if(n.parentNode&&!Nn(n))e=ne(n),n=n.parentNode;else return null}}function eh(n,e){for(;;){if(n.nodeType==3&&e2),Ce=Ut||(De?/Mac/.test(De.platform):!1),oh=De?/Win/.test(De.platform):!1,Ke=/Android \d/.test(st),vn=!!ya&&"webkitFontSmoothing"in ya.documentElement.style,ih=vn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function sh(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function _e(n,e){return typeof n=="number"?n:n[e]}function lh(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function ba(n,e,t){let r=n.someProp("scrollThreshold")||0,o=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let s=t||n.dom;s;s=Tn(s)){if(s.nodeType!=1)continue;let l=s,a=l==i.body,c=a?sh(i):lh(l),d=0,u=0;if(e.topc.bottom-_e(r,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+_e(o,"top")-c.top:e.bottom-c.bottom+_e(o,"bottom")),e.leftc.right-_e(r,"right")&&(d=e.right-c.right+_e(o,"right")),d||u)if(a)i.defaultView.scrollBy(d,u);else{let f=l.scrollLeft,h=l.scrollTop;u&&(l.scrollTop+=u),d&&(l.scrollLeft+=d);let p=l.scrollLeft-f,m=l.scrollTop-h;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function ah(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=t+1;s=t-20){r=l,o=a.top;break}}return{refDOM:r,refTop:o,stack:Qa(n.dom)}}function Qa(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Tn(r));return e}function ch({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Xa(t,r==0?0:r-e)}function Xa(n,e){for(let t=0;t=l){s=Math.max(p.bottom,s),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=d,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(i=u+1)}}return!t&&a&&(t=a,o=c,r=0),t&&t.nodeType==3?uh(t,o):!t||r&&t.nodeType==1?{node:n,offset:i}:Za(t,o)}function uh(n,e){let t=n.nodeValue.length,r=document.createRange();for(let o=0;o=(i.left+i.right)/2?1:0)}}return{node:n,offset:0}}function vi(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function fh(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,o,i)}function ph(n,e,t,r){let o=-1;for(let i=e,s=!1;i!=n.dom;){let l=n.docView.nearestDesc(i,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&(!s&&a.left>r.left||a.top>r.top?o=l.posBefore:(!s&&a.right-1?o:n.docView.posFromDOM(e,t,-1)}function ec(n,e,t){let r=n.childNodes.length;if(r&&t.tope.top&&o++}let c;vn&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==n.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(l=ph(n,r,o,e))}l==null&&(l=hh(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function ka(n){return n.top=0&&o==r.nodeValue.length?(a--,d=1):t<0?a--:c++,wn(tt(We(r,a,c),d),d<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(t<0||o==Me(r))){let a=r.childNodes[o-1];if(a.nodeType==1)return li(a.getBoundingClientRect(),!1)}if(i==null&&o=0)}if(i==null&&o&&(t<0||o==Me(r))){let a=r.childNodes[o-1],c=a.nodeType==3?We(a,Me(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return wn(tt(c,1),!1)}if(i==null&&o=0)}function wn(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function li(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function nc(n,e,t){let r=n.state,o=n.root.activeElement;r!=e&&n.updateState(e),o!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),o!=n.dom&&o&&o.focus()}}function yh(n,e,t){let r=e.selection,o=t=="up"?r.$from:r.$to;return nc(n,e,()=>{let{node:i}=n.docView.domFromPos(o.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=tc(n,o.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=We(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;cd.top+1&&(t=="up"?s.top-d.top>(d.bottom-s.top)*2:d.bottom-s.bottom>(s.bottom-d.top)*2))return!1}}return!0})}var bh=/[\u0590-\u08ac]/;function kh(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,l=n.domSelection();return l?!bh.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?i:s:nc(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:d,anchorOffset:u}=n.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",t,"character");let h=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(d,u),a&&(a!=d||c!=u)&&l.extend&&l.extend(a,c)}catch(y){}return f!=null&&(l.caretBidiLevel=f),g}):r.pos==r.start()||r.pos==r.end()}var xa=null,Sa=null,wa=!1;function xh(n,e,t){return xa==e&&Sa==t?wa:(xa=e,Sa=t,wa=t=="up"||t=="down"?yh(n,e,t):kh(n,e,t))}var Te=0,Ca=1,wt=2,Ie=3,Ot=class{constructor(e,t,r,o){this.parent=e,this.children=t,this.dom=r,this.contentDOM=o,this.dirty=Te,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;tne(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&t==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return(o==null?r>0:o)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!t||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;te||s instanceof Sr){o=e-i;break}i=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,t);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof kr&&i.side>=0;r--);if(t<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&t&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?ne(i.dom)+1:0}}else{let i,s=!0;for(;i=r=d&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,d);e=s;for(let u=l;u>0;u--){let f=this.children[u-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=ne(f.dom)+1;break}e-=f.size}o==-1&&(o=0)}if(o>-1&&(c>t||l==this.children.length-1)){t=c;for(let d=l+1;dp&&st){let p=l;l=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,o=0;o=r:er){let l=r+i.border,a=s-i.border;if(e>=l&&t<=a){this.dirty=e==r||t==s?wt:Ca,e==l&&t==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Ie:i.markDirty(e-l,t-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?wt:Ie}r=s}this.dirty=wt}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?wt:Ca;t.dirty{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==Te&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}},gi=class extends Ot{constructor(e,t,r,o){super(e,[],t,null),this.textDOM=r,this.text=o}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 e.type==="characterData"&&e.target.nodeValue==e.oldValue}},qt=class n extends Ot{constructor(e,t,r,o,i){super(e,[],r,o),this.mark=t,this.spec=i}static create(e,t,r,o){let i=o.nodeViews[t.type.name],s=i&&i(t,o,r);return(!s||!s.dom)&&(s=$e.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new n(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Ie||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ie&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Te){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(i=xi(i,0,e,r));for(let l=0;l{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,o),d=c&&c.dom,u=c&&c.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=$e.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!u&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let f=d;return d=ic(d,r,t),c?a=new yi(e,t,r,o,d,u||null,f,c,i,s+1):t.isText?new xr(e,t,r,o,d,f,i):new n(e,t,r,o,d,u||null,f,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>k.empty)}return e}matchesNode(e,t,r){return this.dirty==Te&&e.eq(this.node)&&wr(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,o=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new ki(this,s&&s.node,e);Mh(this.node,this.innerDeco,(c,d,u)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!u&&a.syncToMarks(d==this.node.childCount?F.none:this.node.child(d).marks,r,e),a.placeWidget(c,e,o)},(c,d,u,f)=>{a.syncToMarks(c.marks,r,e);let h;a.findNodeMatch(c,d,u,f)||l&&e.state.selection.from>o&&e.state.selection.to-1&&a.updateNodeAt(c,d,u,h,e)||a.updateNextNode(c,d,u,e,f,o)||a.addNode(c,d,u,e,o),o+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==wt)&&(s&&this.protectLocalComposition(e,s),rc(this.contentDOM,this.children,e),Ut&&Th(this.dom))}localCompositionInfo(e,t){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof M)||rt+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=Ah(this.node.content,s,r-t,o-t);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:o}){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 s=new gi(this,i,t,o);e.input.compositionNodes.push(s),this.children=xi(this.children,r,r+o.length,e,s)}update(e,t,r,o){return this.dirty==Ie||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,o),!0)}updateInner(e,t,r,o){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=Te}updateOuterDeco(e){if(wr(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=oc(this.dom,this.nodeDOM,bi(this.outerDeco,this.node,t),bi(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}};function Ma(n,e,t,r,o){ic(r,e,n);let i=new it(void 0,n,e,t,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}var xr=class n extends it{constructor(e,t,r,o,i,s,l){super(e,t,r,o,i,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,o){return this.dirty==Ie||this.dirty!=Te&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Te||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=Te,!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,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let o=this.node.cut(e,t),i=document.createTextNode(o.text);return new n(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Ie)}get domAtom(){return!1}isText(e){return this.node.text==e}},Sr=class extends Ot{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Te&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},yi=class extends it{constructor(e,t,r,o,i,s,l,a,c,d){super(e,t,r,o,i,s,l,c,d),this.spec=a}update(e,t,r,o){if(this.dirty==Ie)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,r);return i&&this.updateInner(e,t,r,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,o){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function rc(n,e,t){let r=n.firstChild,o=!1;for(let i=0;i>1,s=Math.min(i,e.length);for(;o-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=qt.create(this.top,e[i],t,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,i++}}findNodeMatch(e,t,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,r))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l0;){let l;for(;;)if(r){let c=t.children[r-1];if(c instanceof qt)t=c,r=c.children.length;else{l=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(o-1))break;--o,i.set(l,o),s.push(l)}}return{index:o,matched:i,matches:s.reverse()}}function Ch(n,e){return n.type.side-e.type.side}function Mh(n,e,t,r){let o=e.locals(n),i=0;if(o.length==0){for(let c=0;ci;)l.push(o[s++]);let p=i+f.nodeSize;if(f.isText){let g=p;s!g.inline):l.slice();r(f,m,e.forChild(i,f),h),i=p}}function Th(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function Ah(n,e,t,r){for(let o=0,i=0;o=t){if(i>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l=0&&c+e.length+l>=t)return l+c;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function xi(n,e,t,r,o){let i=[];for(let s=0,l=0;s=t||d<=e?i.push(a):(ct&&i.push(a.slice(t-c,a.size,r)))}return i}function Ri(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let o=n.docView.nearestDesc(t.focusNode),i=o&&o.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(vr(t)){for(a=s;o&&!o.node;)o=o.parent;let u=o.node;if(o&&u.isAtom&&A.isSelectable(u)&&o.parent&&!(u.isInline&&th(t.focusNode,t.focusOffset,o.dom))){let f=o.posBefore;c=new A(s==f?l:r.resolve(f))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let u=s,f=s;for(let h=0;h{(t.anchorNode!=r||t.anchorOffset!=o)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!sc(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Oh(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let r=n.cursorWrapper.dom,o=r.nodeName=="IMG";o?t.setStart(r.parentNode,ne(r)+1):t.setStart(r,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!o&&!n.state.selection.visible&&ge&&ot<=11&&(r.disabled=!0,r.disabled=!1)}function lc(n,e){if(e instanceof A){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Na(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Na(n)}function Na(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Di(n,e,t,r){return n.someProp("createSelectionBetween",o=>o(n,e,t))||M.between(e,t,r)}function va(n){return n.editable&&!n.hasFocus()?!1:ac(n)}function ac(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch(t){return!1}}function Nh(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Et(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Si(n,e){let{$anchor:t,$head:r}=n.selection,o=e>0?t.max(r):t.min(r),i=o.parent.inlineContent?o.depth?n.doc.resolve(e>0?o.after():o.before()):null:o;return i&&T.findFrom(i,e)}function nt(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Ra(n,e,t){let r=n.state.selection;if(r instanceof M)if(t.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=n.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return nt(n,new M(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let o=Si(n.state,e);return o&&o instanceof A?nt(n,o):!1}else if(!(Ce&&t.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?A.isSelectable(i)?nt(n,new A(e<0?n.state.doc.resolve(o.pos-i.nodeSize):o)):vn?nt(n,new M(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof A&&r.node.isInline)return nt(n,new M(e>0?r.$to:r.$from));{let o=Si(n.state,e);return o?nt(n,o):!1}}}function Cr(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Mn(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Wt(n,e){return e<0?vh(n):Rh(n)}function vh(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o,i,s=!1;for(Ne&&t.nodeType==1&&r0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(Mn(l,-1))o=t,i=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(cc(t))break;{let l=t.previousSibling;for(;l&&Mn(l,-1);)o=t.parentNode,i=ne(l),l=l.previousSibling;if(l)t=l,r=Cr(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?wi(n,t,r):o&&wi(n,o,i)}function Rh(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o=Cr(t),i,s;for(;;)if(r{n.state==o&&Je(n)},50)}function Da(n,e){let t=n.state.doc.resolve(e);if(!(ae||oh)&&t.parent.inlineContent){let o=n.coordsAtPos(e);if(e>t.start()){let i=n.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>o.top&&s1)return i.lefto.top&&s1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Ia(n,e,t){let r=n.state.selection;if(r instanceof M&&!r.empty||t.indexOf("s")>-1||Ce&&t.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=Si(n.state,e);if(s&&s instanceof A)return nt(n,s)}if(!o.parent.inlineContent){let s=e<0?o:i,l=r instanceof be?T.near(s,e):T.findFrom(s,e);return l?nt(n,l):!1}return!1}function Pa(n,e){if(!(n.state.selection instanceof M))return!0;let{$head:t,$anchor:r,empty:o}=n.state.selection;if(!t.sameParent(r))return!0;if(!o)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let s=n.state.tr;return e<0?s.delete(t.pos-i.nodeSize,t.pos):s.delete(t.pos,t.pos+i.nodeSize),n.dispatch(s),!0}return!1}function La(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Ph(n){if(!ue||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;La(n,r,"true"),setTimeout(()=>La(n,r,"false"),20)}return!1}function Lh(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Bh(n,e){let t=e.keyCode,r=Lh(e);if(t==8||Ce&&t==72&&r=="c")return Pa(n,-1)||Wt(n,-1);if(t==46&&!e.shiftKey||Ce&&t==68&&r=="c")return Pa(n,1)||Wt(n,1);if(t==13||t==27)return!0;if(t==37||Ce&&t==66&&r=="c"){let o=t==37?Da(n,n.state.selection.from)=="ltr"?-1:1:-1;return Ra(n,o,r)||Wt(n,o)}else if(t==39||Ce&&t==70&&r=="c"){let o=t==39?Da(n,n.state.selection.from)=="ltr"?1:-1:1;return Ra(n,o,r)||Wt(n,o)}else{if(t==38||Ce&&t==80&&r=="c")return Ia(n,-1,r)||Wt(n,-1);if(t==40||Ce&&t==78&&r=="c")return Ph(n)||Ia(n,1,r)||Wt(n,1);if(r==(Ce?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function dc(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let s=n.someProp("clipboardSerializer")||$e.fromSchema(n.state.schema),l=gc(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,d,u=0;for(;c&&c.nodeType==1&&(d=mc[c.nodeName.toLowerCase()]);){for(let h=d.length-1;h>=0;h--){let p=l.createElement(d[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),u++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${i}${u?` -${u}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,` `);return{dom:a,text:f,slice:e}}function uc(n,e,t,r,o){let i=o.parent.type.spec.code,s,l;if(!t&&!e)return null;let a=e&&(r||i||!t);if(a){if(n.someProp("transformPastedText",f=>{e=f(e,i||r,n)}),i)return e?new S(k.from(n.state.schema.text(e.replace(/\r\n?/g,` -`))),0,0):S.empty;let u=n.someProp("clipboardTextParser",f=>f(e,o,r,n));if(u)l=u;else{let f=o.marks(),{schema:h}=n.state,p=$e.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=s.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(h.text(m,f)))})}}else n.someProp("transformPastedHTML",u=>{t=u(t,n)}),s=$h(t),Nn&&Vh(s);let c=s&&s.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||Re.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||d),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!zh.test(f.parentNode.nodeName)?{ignore:!0}:null}})),d)l=jh(Ba(l,+d[1],+d[2]),d[4]);else if(l=S.maxOpen(Fh(l.content,o),!0),l.openStart||l.openEnd){let u=0,f=0;for(let h=l.content.firstChild;u{l=u(l,n)}),l}var zh=/^(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 Fh(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.index(t)),i,s=[];if(n.forEach(l=>{if(!s)return;let a=o.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&i.length&&hc(a,i,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=pc(s[s.length-1],i.length));let d=fc(l,a);s.push(d),o=o.matchType(d.type),i=a}}),s)return k.from(s)}return n}function fc(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,k.from(n));return n}function hc(n,e,t,r,o){if(o1&&(i=0),o=t&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=o).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(k.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function Ba(n,e,t){return et})),ci.createHTML(n)):n}function $h(n){let e=/^(\s*]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=gc().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),o;if((o=r&&mc[r[1].toLowerCase()])&&(n=o.map(i=>"<"+i+">").join("")+n+o.map(i=>"").reverse().join("")),t.innerHTML=Hh(n),o)for(let i=0;i=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;o=k.from(a.create(r[l+1],o)),i++,s++}return new S(o,i,s)}var fe={},he={},_h={touchstart:!0,touchmove:!0},Mi=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function Wh(n){for(let e in fe){let t=fe[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Jh(n,r)&&!Ii(n,r)&&(n.editable||!(r.type in he))&&t(n,r)},_h[e]?{passive:!0}:void 0)}ue&&n.dom.addEventListener("input",()=>null),Ti(n)}function rt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Kh(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Ti(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Ii(n,r))})}function Ii(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Jh(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function Uh(n,e){!Ii(n,e)&&fe[e.type]&&(n.editable||!(e.type in he))&&fe[e.type](n,e)}he.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!bc(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Ke&&ae&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Jt&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",o=>o(n,St(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Bh(n,t)?t.preventDefault():rt(n,"key")};he.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};he.keypress=(n,e)=>{let t=e;if(bc(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Ce&&t.metaKey)return;if(n.someProp("handleKeyPress",o=>o(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof M)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(t.charCode);!/[\r\n]/.test(o)&&!n.someProp("handleTextInput",i=>i(n,r.$from.pos,r.$to.pos,o))&&n.dispatch(n.state.tr.insertText(o).scrollIntoView()),t.preventDefault()}};function Rr(n){return{left:n.clientX,top:n.clientY}}function qh(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Pi(n,e,t,r,o){if(r==-1)return!1;let i=n.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(n.someProp(e,l=>s>i.depth?l(n,t,i.nodeAfter,i.before(s),o,!0):l(n,t,i.node(s),i.before(s),o,!1)))return!0;return!1}function Kt(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);t=="pointer"&&r.setMeta("pointer",!0),n.dispatch(r)}function Gh(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&A.isSelectable(r)?(Kt(n,new A(t),"pointer"),!0):!1}function Yh(n,e){if(e==-1)return!1;let t=n.state.selection,r,o;t instanceof A&&(r=t.node);let i=n.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(A.isSelectable(l)){r&&t.$from.depth>0&&s>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?o=i.before(t.$from.depth):o=i.before(s);break}}return o!=null?(Kt(n,A.create(n.state.doc,o),"pointer"),!0):!1}function Qh(n,e,t,r,o){return Pi(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(o?Yh(n,t):Gh(n,t))}function Xh(n,e,t,r){return Pi(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",o=>o(n,e,r))}function Zh(n,e,t,r){return Pi(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",o=>o(n,e,r))||ep(n,t,r)}function ep(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Kt(n,M.create(r,0,r.content.size),"pointer"),!0):!1;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),l=o.before(i);if(s.inlineContent)Kt(n,M.create(r,l+1,l+1+s.content.size),"pointer");else if(A.isSelectable(s))Kt(n,A.create(r,l),"pointer");else continue;return!0}}function Li(n){return Mr(n)}var yc=Ce?"metaKey":"ctrlKey";fe.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Li(n),o=Date.now(),i="singleClick";o-n.input.lastClick.time<500&&qh(t,n.input.lastClick)&&!t[yc]&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:o,x:t.clientX,y:t.clientY,type:i};let s=n.posAtCoords(Rr(t));s&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Ai(n,s,t,!!r)):(i=="doubleClick"?Xh:Zh)(n,s.pos,s.inside,t)?t.preventDefault():rt(n,"pointer"))};var Ai=class{constructor(e,t,r,o){this.view=e,this.pos=t,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[yc],this.allowDefault=r.shiftKey;let i,s;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let d=e.state.doc.resolve(t.pos);i=d.parent,s=d.depth?d.before():0}let l=o?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.dom.nodeType==1?a.dom:null;let{selection:c}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof A&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ne&&!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)),rt(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(()=>Je(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Rr(e))),this.updateAllowDefault(e),this.allowDefault||!t?rt(this.view,"pointer"):Qh(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ue&&this.mightDrag&&!this.mightDrag.node.isAtom||ae&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Kt(this.view,T.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):rt(this.view,"pointer")}move(e){this.updateAllowDefault(e),rt(this.view,"pointer"),e.buttons==0&&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)}};fe.touchstart=n=>{n.input.lastTouch=Date.now(),Li(n),rt(n,"pointer")};fe.touchmove=n=>{n.input.lastTouch=Date.now(),rt(n,"pointer")};fe.contextmenu=n=>Li(n);function bc(n,e){return n.composing?!0:ue&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}var tp=Ke?5e3:-1;he.compositionstart=he.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof M&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),Mr(n,!0),n.markCursor=null;else if(Mr(n,!e.selection.empty),Ne&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){let l=n.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}n.input.composing=!0}kc(n,tp)};he.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,kc(n,20))};function kc(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Mr(n),e))}function xc(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=rp());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function np(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Zf(e.focusNode,e.focusOffset),r=eh(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let o=r.pmViewDesc,i=n.domObserver.lastChangedTextNode;if(t==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return r}}return t||r}function rp(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Mr(n,e=!1){if(!(Ke&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),xc(n),e||n.docView&&n.docView.dirty){let t=Ri(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!n.state.selection.empty?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function op(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}var Tn=ge&&ot<15||Jt&&ih<604;fe.copy=he.cut=(n,e)=>{let t=e,r=n.state.selection,o=t.type=="cut";if(r.empty)return;let i=Tn?null:t.clipboardData,s=r.content(),{dom:l,text:a}=dc(n,s);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):op(n,l),o&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function ip(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function sp(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?An(n,r.value,null,o,e):An(n,r.textContent,r.innerHTML,o,e)},50)}function An(n,e,t,r,o){let i=uc(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,o,i||S.empty)))return!0;if(!i)return!1;let s=ip(i),l=s?n.state.tr.replaceSelectionWith(s,r):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Sc(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}he.paste=(n,e)=>{let t=e;if(n.composing&&!Ke)return;let r=Tn?null:t.clipboardData,o=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&An(n,Sc(r),r.getData("text/html"),o,t)?t.preventDefault():sp(n,t)};var Tr=class{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}},wc=Ce?"altKey":"ctrlKey";fe.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let o=n.state.selection,i=o.empty?null:n.posAtCoords(Rr(t)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof A?o.to-1:o.to))){if(r&&r.mightDrag)s=A.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let u=n.docView.nearestDesc(t.target,!0);u&&u.node.type.spec.draggable&&u!=n.docView&&(s=A.create(n.state.doc,u.posBefore))}}let l=(s||n.state.selection).content(),{dom:a,text:c,slice:d}=dc(n,l);(!t.dataTransfer.files.length||!ae||Ya>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Tn?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Tn||t.dataTransfer.setData("text/plain",c),n.dragging=new Tr(d,!t[wc],s)};fe.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};he.dragover=he.dragenter=(n,e)=>e.preventDefault();he.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let o=n.posAtCoords(Rr(t));if(!o)return;let i=n.state.doc.resolve(o.pos),s=r&&r.slice;s?n.someProp("transformPasted",p=>{s=p(s,n)}):s=uc(n,Sc(t.dataTransfer),Tn?null:t.dataTransfer.getData("text/html"),!1,i);let l=!!(r&&!t[wc]);if(n.someProp("handleDrop",p=>p(n,t,s||S.empty,l))){t.preventDefault();return}if(!s)return;t.preventDefault();let a=s?mr(n.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let c=n.state.tr;if(l){let{node:p}=r;p?p.replace(c):c.deleteSelection()}let d=c.mapping.map(a),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=c.doc;if(u?c.replaceRangeWith(d,d,s.content.firstChild):c.replaceRange(d,d,s),c.doc.eq(f))return;let h=c.doc.resolve(d);if(u&&A.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new A(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,y,w)=>p=w),c.setSelection(Di(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};fe.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Je(n)},20))};fe.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};fe.beforeinput=(n,e)=>{if(ae&&Ke&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",i=>i(n,St(8,"Backspace")))))return;let{$cursor:o}=n.state.selection;o&&o.pos>0&&n.dispatch(n.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let n in he)fe[n]=he[n];function En(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}var Ar=class n{constructor(e,t){this.toDOM=e,this.spec=t||Tt,this.side=this.spec.side||0}map(e,t,r,o){let{pos:i,deleted:s}=e.mapResult(t.from+o,this.side<0?-1:1);return s?null:new re(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof n&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&En(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},Mt=class n{constructor(e,t){this.attrs=e,this.spec=t||Tt}map(e,t,r,o){let i=e.map(t.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(t.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new re(i,s,this)}valid(e,t){return t.from=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+o,l.to+o))}for(let s=0;se){let l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,r,o+l,i)}}map(e,t,r){return this==le||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Tt)}mapInner(e,t,r,o,i){let s;for(let l=0;l{let c=a+r,d;if(d=Mc(t,l,c)){for(o||(o=this.children.slice());il&&u.to=e){this.children[l]==e&&(r=this.children[l+2]);break}let i=e+1,s=i+t.content.size;for(let l=0;li&&a.type instanceof Mt){let c=Math.max(i,a.from)-i,d=Math.min(s,a.to)-i;co.map(e,t,Tt));return n.from(r)}forChild(e,t){if(t.isLeaf)return G.empty;let r=[];for(let o=0;ot instanceof G)?e:e.reduce((t,r)=>t.concat(r instanceof G?r:r.members),[]))}}forEachSet(e){for(let t=0;t{let g=m-p-(h-f);for(let y=0;yw+d-u)continue;let O=l[y]+d-u;h>=O?l[y+1]=f<=O?-2:-1:f>=d&&g&&(l[y]+=g,l[y+1]+=g)}u+=g}),d=t.maps[c].map(d,-1)}let a=!1;for(let c=0;c=r.content.size){a=!0;continue}let f=t.map(n[c+1]+i,-1),h=f-o,{index:p,offset:m}=r.content.findIndex(u),g=r.maybeChild(p);if(g&&m==u&&m+g.nodeSize==h){let y=l[c+2].mapInner(t,g,d+1,n[c]+i+1,s);y!=le?(l[c]=u,l[c+1]=h,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=ap(l,n,e,t,o,i,s),d=Or(c,r,0,s);e=d.local;for(let u=0;ut&&s.to{let c=Mc(n,l,a+t);if(c){i=!0;let d=Or(c,l,t+a+1,r);d!=le&&o.push(a,a+l.nodeSize,d)}});let s=Cc(i?Tc(n):n,-t).sort(At);for(let l=0;l0;)e++;n.splice(e,0,t)}function di(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=le&&e.push(r)}),n.cursorWrapper&&e.push(G.create(n.state.doc,[n.cursorWrapper.deco])),Er.from(e)}var cp={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},dp=ge&&ot<=11,Oi=class{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}},Ni=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Oi,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;oo.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),dp&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.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,cp)),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(va(this.view)){if(this.suppressingSelectionUpdates)return Je(this.view);if(ge&&ot<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Et(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,r;for(let i=e.focusNode;i;i=Mn(i))t.add(i);for(let i=e.anchorNode;i;i=Mn(i))if(t.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&va(e)&&!this.ignoreSelectionChange(r),i=-1,s=-1,l=!1,a=[];if(e.editable)for(let d=0;du.nodeName=="BR");if(d.length==2){let[u,f]=d;u.parentNode&&u.parentNode.parentNode==f.parentNode?f.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let f of d){let h=f.parentNode;h&&h.nodeName=="LI"&&(!u||hp(e,u)!=h)&&f.remove()}}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||o)&&(i>-1&&(e.docView.markDirty(i,s),up(e)),this.handleDOMChange(i,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Je(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;do;g--){let y=r.childNodes[g-1],w=y.pmViewDesc;if(y.nodeName=="BR"&&!w){i=g;break}if(!w||w.size)break}let u=n.state.doc,f=n.someProp("domParser")||Re.fromSchema(n.state.schema),h=u.resolve(s),p=null,m=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:o,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:mp,context:h});if(c&&c[0].pos!=null){let g=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=g),p={anchor:g+s,head:y+s}}return{doc:m,sel:p,from:s,to:l}}function mp(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(ue&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||ue&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}var gp=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function yp(n,e,t,r,o){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let B=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,Se=Ri(n,B);if(Se&&!n.state.selection.eq(Se)){if(ae&&Ke&&n.input.lastKeyCode===13&&Date.now()-100on(n,St(13,"Enter"))))return;let ht=n.state.tr.setSelection(Se);B=="pointer"?ht.setMeta("pointer",!0):B=="key"&&ht.scrollIntoView(),i&&ht.setMeta("composition",i),n.dispatch(ht)}return}let s=n.state.doc.resolve(e),l=s.sharedDepth(t);e=s.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=pp(n,e,t),d=n.state.doc,u=d.slice(c.from,c.to),f,h;n.input.lastKeyCode===8&&Date.now()-100Date.now()-225||Ke)&&o.some(B=>B.nodeType==1&&!gp.test(B.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",B=>B(n,St(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof M&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let B=ja(n,n.state.doc,c.sel);if(B&&!B.eq(n.state.selection)){let Se=n.state.tr.setSelection(B);i&&Se.setMeta("composition",i),n.dispatch(Se)}}return}n.state.selection.fromn.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),ge&&ot<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)==" \xA0"&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),y=d.resolve(p.start),w=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=p.endA,O;if((Jt&&n.input.lastIOSEnter>Date.now()-225&&(!w||o.some(B=>B.nodeName=="DIV"||B.nodeName=="P"))||!w&&m.posB(n,St(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&kp(d,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",B=>B(n,St(8,"Backspace")))){Ke&&ae&&n.domObserver.suppressSelectionUpdates();return}ae&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),Ke&&!w&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(B){return B(n,St(13,"Enter"))})},20));let L=p.start,E=p.endA,I,W,q;if(w){if(m.pos==g.pos)ge&&ot<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Je(n),20)),I=n.state.tr.delete(L,E),W=d.resolve(p.start).marksAcross(d.resolve(p.endA));else if(p.endA==p.endB&&(q=bp(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start()))))I=n.state.tr,q.type=="add"?I.addMark(L,E,q.mark):I.removeMark(L,E,q.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let B=m.parent.textBetween(m.parentOffset,g.parentOffset);if(n.someProp("handleTextInput",Se=>Se(n,L,E,B)))return;I=n.state.tr.insertText(B,L,E)}}if(I||(I=n.state.tr.replace(L,E,c.doc.slice(p.start-c.from,p.endB-c.from))),c.sel){let B=ja(n,I.doc,c.sel);B&&!(ae&&n.composing&&B.empty&&(p.start!=p.endB||n.input.lastChromeDeletee.content.size?null:Di(n,e.resolve(t.anchor),e.resolve(t.head))}function bp(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,o=t,i=r,s,l,a;for(let d=0;dd.mark(l.addToSet(d.marks));else if(o.length==0&&i.length==1)l=i[0],s="remove",a=d=>d.mark(l.removeFromSet(d.marks));else return null;let c=[];for(let d=0;dt||ui(s,!0,!1)0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,o++,e=!1;if(t){let i=n.node(r).maybeChild(n.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function xp(n,e,t,r,o){let i=n.findDiffStart(e,t);if(i==null)return null;let{a:s,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(o=="end"){let a=Math.max(0,i-Math.min(s,l));r-=s+a-i}if(s=s?i-r:0;i-=a,i&&i=l?i-r:0;i-=a,i&&i=56320&&e<=57343&&t>=55296&&t<=56319}var Nr=class{constructor(e,t){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 Mi,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(qa),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Ja(this),Ka(this),this.nodeViews=Ua(this),this.docView=Ma(this.state.doc,Wa(this),di(this),this.dom,this),this.domObserver=new Ni(this,(r,o,i,s)=>yp(this,r,o,i,s)),this.domObserver.start(),Wh(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ti(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(qa),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(xc(this),s=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=Ua(this);wp(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&Ti(this),this.editable=Ja(this),Ka(this);let a=di(this),c=Wa(this),d=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",u=i||!this.docView.matchesNode(e.doc,c,a);(u||!e.selection.eq(o.selection))&&(s=!0);let f=d=="preserve"&&s&&this.dom.style.overflowAnchor==null&&ah(this);if(s){this.domObserver.stop();let h=u&&(ge||ae)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&Sp(o.selection,e.selection);if(u){let p=ae?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=np(this)),(i||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Ma(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Nh(this))?Je(this,h):(lc(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():f&&ch(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof A){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&ba(this,t.getBoundingClientRect(),e)}else ba(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){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new Tr(e.slice,e.move,o<0?void 0:A.create(this.state.doc,o))}someProp(e,t){let r=this._props&&this._props[e],o;if(r!=null&&(o=t?t(r):r))return o;for(let s=0;st.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return mh(this,e)}coordsAtPos(e,t=1){return tc(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,r=-1){let o=this.docView.posFromDOM(e,t,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,t){return xh(this,t||this.state,e)}pasteHTML(e,t){return An(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return An(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(Kh(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],di(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Qf())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Uh(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?ue&&this.root.nodeType===11&&nh(this.dom.ownerDocument)==this.dom&&fp(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};function Wa(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[re.node(0,n.state.doc.content.size,e)]}function Ka(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:re.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Ja(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Sp(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Ua(n){let e=Object.create(null);function t(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function wp(n,e){let t=0,r=0;for(let o in n){if(n[o]!=e[o])return!0;t++}for(let o in e)r++;return t!=r}function qa(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Ue={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:"'"},Ir={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Cp=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),Mp=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Q=0;Q<10;Q++)Ue[48+Q]=Ue[96+Q]=String(Q);var Q;for(Q=1;Q<=24;Q++)Ue[Q+111]="F"+Q;var Q;for(Q=65;Q<=90;Q++)Ue[Q]=String.fromCharCode(Q+32),Ir[Q]=String.fromCharCode(Q);var Q;for(Dr in Ue)Ir.hasOwnProperty(Dr)||(Ir[Dr]=Ue[Dr]);var Dr;function Ac(n){var e=Cp&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Mp&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Ir:Ue)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}var Tp=typeof navigator!="undefined"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Ap(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,o,i,s;for(let l=0;l127)&&(i=Ue[r.keyCode])&&i!=o){let l=e[zi(i,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}var Pr=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Nc(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}var Hi=(n,e,t)=>{let r=Nc(n,t);if(!r)return!1;let o=Vi(r);if(!o){let s=r.blockRange(),l=s&&je(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let i=o.nodeBefore;if(Fc(n,o,e,-1))return!0;if(r.parent.content.size==0&&(qt(i,"end")||A.isSelectable(i)))for(let s=r.depth;;s--){let l=kn(n.doc,r.before(s),r.after(s),S.empty);if(l&&l.slice.size1)break}return i.isAtom&&o.depth==r.depth-1?(e&&e(n.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1},vc=(n,e,t)=>{let r=Nc(n,t);if(!r)return!1;let o=Vi(r);return o?Dc(n,o,e):!1},Rc=(n,e,t)=>{let r=Ic(n,t);if(!r)return!1;let o=Wi(r);return o?Dc(n,o,e):!1};function Dc(n,e,t){let r=e.nodeBefore,o=r,i=e.pos-1;for(;!o.isTextblock;i--){if(o.type.spec.isolating)return!1;let d=o.lastChild;if(!d)return!1;o=d}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let d=l.firstChild;if(!d)return!1;l=d}let c=kn(n.doc,i,a,S.empty);if(!c||c.from!=i||c instanceof se&&c.slice.size>=a-i)return!1;if(t){let d=n.tr.step(c);d.setSelection(M.create(d.doc,i)),t(d.scrollIntoView())}return!0}function qt(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}var $i=(n,e,t)=>{let{$head:r,empty:o}=n.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;i=Vi(r)}let s=i&&i.nodeBefore;return!s||!A.isSelectable(s)?!1:(e&&e(n.tr.setSelection(A.create(n.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function Vi(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Ic(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset{let r=Ic(n,t);if(!r)return!1;let o=Wi(r);if(!o)return!1;let i=o.nodeAfter;if(Fc(n,o,e,1))return!0;if(r.parent.content.size==0&&(qt(i,"start")||A.isSelectable(i))){let s=kn(n.doc,r.before(),r.after(),S.empty);if(s&&s.slice.size{let{$head:r,empty:o}=n.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset=0;e--){let t=n.node(e);if(n.index(e)+1{let t=n.selection,r=t instanceof A,o;if(r){if(t.node.isTextblock||!Oe(n.doc,t.from))return!1;o=t.from}else if(o=Ht(n.doc,t.from,-1),o==null)return!1;if(e){let i=n.tr.join(o);r&&i.setSelection(A.create(i.doc,o-n.doc.resolve(o).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},Lc=(n,e)=>{let t=n.selection,r;if(t instanceof A){if(t.node.isTextblock||!Oe(n.doc,t.to))return!1;r=t.to}else if(r=Ht(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},Bc=(n,e)=>{let{$from:t,$to:r}=n.selection,o=t.blockRange(r),i=o&&je(o);return i==null?!1:(e&&e(n.tr.lift(o,i).scrollIntoView()),!0)},Ki=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(` -`).scrollIntoView()),!0)};function Ji(n){for(let e=0;e{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let o=t.node(-1),i=t.indexAfter(-1),s=Ji(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,s.createAndFill());a.setSelection(T.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},qi=(n,e)=>{let t=n.selection,{$from:r,$to:o}=t;if(t instanceof be||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Ji(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index(){let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(we(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let r=t.blockRange(),o=r&&je(r);return o==null?!1:(e&&e(n.tr.lift(r,o).scrollIntoView()),!0)};function Op(n){return(e,t)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof A&&e.selection.node.isBlock)return!r.parentOffset||!we(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,l,a=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){a=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),l=Ji(r.node(h-1).contentMatchAt(r.indexAfter(h-1)));let m=n&&n(o.parent,a,r);i.unshift(m||(a&&l?{type:l}:null)),s=h;break}else{if(h==1)return!1;i.unshift(null)}let d=e.tr;(e.selection instanceof M||e.selection instanceof be)&&d.deleteSelection();let u=d.mapping.map(r.pos),f=we(d.doc,u,i.length,i);if(f||(i[0]=l?{type:l}:null,f=we(d.doc,u,i.length,i)),d.split(u,i.length,i),!a&&c&&r.node(s).type!=l){let h=d.mapping.map(r.before(s)),p=d.doc.resolve(h);l&&r.node(s-1).canReplaceWith(p.index(),p.index()+1,l)&&d.setNodeMarkup(d.mapping.map(r.before(s)),l)}return t&&t(d.scrollIntoView()),!0}}var Np=Op();var zc=(n,e)=>{let{$from:t,to:r}=n.selection,o,i=t.sharedDepth(r);return i==0?!1:(o=t.before(i),e&&e(n.tr.setSelection(A.create(n.doc,o))),!0)},vp=(n,e)=>(e&&e(n.tr.setSelection(new be(n.doc))),!0);function Rp(n,e,t){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||Oe(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Fc(n,e,t,r){let o=e.nodeBefore,i=e.nodeAfter,s,l,a=o.type.spec.isolating||i.type.spec.isolating;if(!a&&Rp(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(l=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(t){let h=e.pos+i.nodeSize,p=k.empty;for(let y=s.length-1;y>=0;y--)p=k.from(s[y].create(null,p));p=k.from(o.copy(p));let m=n.tr.step(new Y(e.pos-1,h,e.pos,h,new S(p,1,0),s.length,!0)),g=m.doc.resolve(h+2*s.length);g.nodeAfter&&g.nodeAfter.type==o.type&&Oe(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let d=i.type.spec.isolating||r>0&&a?null:T.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),f=u&&je(u);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(u,f).scrollIntoView()),!0;if(c&&qt(i,"start",!0)&&qt(o,"end")){let h=o,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=i,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(t){let y=k.empty;for(let O=p.length-1;O>=0;O--)y=k.from(p[O].copy(y));let w=n.tr.step(new Y(e.pos-p.length,e.pos+i.nodeSize,e.pos+g,e.pos+i.nodeSize-g,new S(y,p.length,0),0,!0));t(w.scrollIntoView())}return!0}}return!1}function Hc(n){return function(e,t){let r=e.selection,o=n<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(t&&t(e.tr.setSelection(M.create(e.doc,n<0?o.start(i):o.end(i)))),!0):!1}}var Yi=Hc(-1),Qi=Hc(1);function $c(n,e=null){return function(t,r){let{$from:o,$to:i}=t.selection,s=o.blockRange(i),l=s&&Ft(s,n,e);return l?(r&&r(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Xi(n,e=null){return function(t,r){let o=!1;for(let i=0;i{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)o=!0;else{let d=t.doc.resolve(c),u=d.index();o=d.parent.canReplaceWith(u,u+1,n)}})}if(!o)return!1;if(r){let i=t.tr;for(let s=0;s=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=s.resolve(e.start-2);i=new yt(a,a,e.depth),e.endIndex=0;d--)i=k.from(t[d].type.create(t[d].attrs,i));n.step(new Y(e.start-(r?2:0),e.end,e.start,e.end,new S(i,0,0),t.length,!0));let s=0;for(let d=0;ds.childCount>0&&s.firstChild.type==n);return i?t?r.node(i.depth-1).type==n?Lp(e,t,n,i):Bp(e,t,i):!0:!1}}function Lp(n,e,t,r){let o=n.tr,i=r.end,s=r.$to.end(r.depth);im;p--)h-=o.child(p).nodeSize,r.delete(h-1,h+1);let i=r.doc.resolve(t.start),s=i.nodeAfter;if(r.mapping.map(t.end)!=t.start+i.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==o.childCount,c=i.node(-1),d=i.index(-1);if(!c.canReplace(d+(l?0:1),d+1,s.content.append(a?k.empty:k.from(o))))return!1;let u=i.pos,f=u+s.nodeSize;return r.step(new Y(u-(l?1:0),f+(a?1:0),u+1,f-1,new S((l?k.empty:k.from(o.copy(k.empty))).append(a?k.empty:k.from(o.copy(k.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function _c(n){return function(e,t){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==n);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,a=l.child(s-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,d=k.from(c?n.create():null),u=new S(k.from(n.create(null,k.from(l.type.create(null,d)))),c?3:1,0),f=i.start,h=i.end;t(e.tr.step(new Y(f-(c?3:1),h,f,h,u,1,!0)).scrollIntoView())}return!0}}function Bn(n){let{state:e,transaction:t}=n,{selection:r}=t,{doc:o}=t,{storedMarks:i}=t;return v(b({},e),{apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=t.selection,o=t.doc,i=t.storedMarks,t}})}var Nt=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:r}=this,{view:o}=t,{tr:i}=r,s=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...d)=>{let u=a(...d)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(i),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:r,editor:o,state:i}=this,{view:s}=o,l=[],a=!!e,c=e||i.tr,d=()=>(!a&&t&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),l.every(f=>f===!0)),u=v(b({},Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...m)=>{let g=this.buildProps(c,t),y=h(...m)(g);return l.push(y),u}]))),{run:d});return u}createCan(e){let{rawCommands:t,state:r}=this,o=!1,i=e||r.tr,s=this.buildProps(i,o),l=Object.fromEntries(Object.entries(t).map(([a,c])=>[a,(...d)=>c(...d)(v(b({},s),{dispatch:void 0}))]));return v(b({},l),{chain:()=>this.createChain(i,o)})}buildProps(e,t=!0){let{rawCommands:r,editor:o,state:i}=this,{view:s}=o,l={tr:e,editor:o,view:s,state:Bn({state:i,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([a,c])=>[a,(...d)=>c(...d)(l)]))}};return l}},ns=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let r=this.callbacks[e];return r&&r.forEach(o=>o.apply(this,t)),this}off(e,t){let r=this.callbacks[e];return r&&(t?this.callbacks[e]=r.filter(o=>o!==t):delete this.callbacks[e]),this}once(e,t){let r=(...o)=>{this.off(e,r),t.apply(this,o)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}};function C(n,e,t){return n.config[e]===void 0&&n.parent?C(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind(v(b({},t),{parent:n.parent?C(n.parent,e,t):null})):n.config[e]}function zn(n){let e=n.filter(o=>o.type==="extension"),t=n.filter(o=>o.type==="node"),r=n.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function ds(n){let e=[],{nodeExtensions:t,markExtensions:r}=zn(n),o=[...t,...r],i={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(s=>{let l={name:s.name,options:s.options,storage:s.storage,extensions:o},a=C(s,"addGlobalAttributes",l);if(!a)return;a().forEach(d=>{d.types.forEach(u=>{Object.entries(d.attributes).forEach(([f,h])=>{e.push({type:u,name:f,attribute:b(b({},i),h)})})})})}),o.forEach(s=>{let l={name:s.name,options:s.options,storage:s.storage},a=C(s,"addAttributes",l);if(!a)return;let c=a();Object.entries(c).forEach(([d,u])=>{let f=b(b({},i),u);typeof(f==null?void 0:f.default)=="function"&&(f.default=f.default()),f!=null&&f.isRequired&&(f==null?void 0:f.default)===void 0&&delete f.default,e.push({type:s.name,name:d,attribute:f})})}),e}function X(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function N(...n){return n.filter(e=>!!e).reduce((e,t)=>{let r=b({},e);return Object.entries(t).forEach(([o,i])=>{if(!r[o]){r[o]=i;return}if(o==="class"){let l=i?i.split(" "):[],a=r[o]?r[o].split(" "):[],c=l.filter(d=>!a.includes(d));r[o]=[...a,...c].join(" ")}else if(o==="style"){let l=i?i.split(";").map(d=>d.trim()).filter(Boolean):[],a=r[o]?r[o].split(";").map(d=>d.trim()).filter(Boolean):[],c=new Map;a.forEach(d=>{let[u,f]=d.split(":").map(h=>h.trim());c.set(u,f)}),l.forEach(d=>{let[u,f]=d.split(":").map(h=>h.trim());c.set(u,f)}),r[o]=Array.from(c.entries()).map(([d,u])=>`${d}: ${u}`).join("; ")}else r[o]=i}),r},{})}function zr(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>N(t,r),{})}function us(n){return typeof n=="function"}function R(n,e=void 0,...t){return us(n)?e?n.bind(e)(...t):n(...t):n}function Uc(n={}){return Object.keys(n).length===0&&n.constructor===Object}function qc(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function rs(n,e){return"style"in n?n:v(b({},n),{getAttrs:t=>{let r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;let o=e.reduce((i,s)=>{let l=s.attribute.parseHTML?s.attribute.parseHTML(t):qc(t.getAttribute(s.name));return l==null?i:v(b({},i),{[s.name]:l})},{});return b(b({},r),o)}})}function Wc(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Uc(t)?!1:t!=null))}function fs(n,e){var t;let r=ds(n),{nodeExtensions:o,markExtensions:i}=zn(n),s=(t=o.find(c=>C(c,"topNode")))===null||t===void 0?void 0:t.name,l=Object.fromEntries(o.map(c=>{let d=r.filter(y=>y.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((y,w)=>{let O=C(w,"extendNodeSchema",u);return b(b({},y),O?O(c):{})},{}),h=Wc(v(b({},f),{content:R(C(c,"content",u)),marks:R(C(c,"marks",u)),group:R(C(c,"group",u)),inline:R(C(c,"inline",u)),atom:R(C(c,"atom",u)),selectable:R(C(c,"selectable",u)),draggable:R(C(c,"draggable",u)),code:R(C(c,"code",u)),whitespace:R(C(c,"whitespace",u)),linebreakReplacement:R(C(c,"linebreakReplacement",u)),defining:R(C(c,"defining",u)),isolating:R(C(c,"isolating",u)),attrs:Object.fromEntries(d.map(y=>{var w;return[y.name,{default:(w=y==null?void 0:y.attribute)===null||w===void 0?void 0:w.default}]}))})),p=R(C(c,"parseHTML",u));p&&(h.parseDOM=p.map(y=>rs(y,d)));let m=C(c,"renderHTML",u);m&&(h.toDOM=y=>m({node:y,HTMLAttributes:zr(y,d)}));let g=C(c,"renderText",u);return g&&(h.toText=g),[c.name,h]})),a=Object.fromEntries(i.map(c=>{let d=r.filter(g=>g.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((g,y)=>{let w=C(y,"extendMarkSchema",u);return b(b({},g),w?w(c):{})},{}),h=Wc(v(b({},f),{inclusive:R(C(c,"inclusive",u)),excludes:R(C(c,"excludes",u)),group:R(C(c,"group",u)),spanning:R(C(c,"spanning",u)),code:R(C(c,"code",u)),attrs:Object.fromEntries(d.map(g=>{var y;return[g.name,{default:(y=g==null?void 0:g.attribute)===null||y===void 0?void 0:y.default}]}))})),p=R(C(c,"parseHTML",u));p&&(h.parseDOM=p.map(g=>rs(g,d)));let m=C(c,"renderHTML",u);return m&&(h.toDOM=g=>m({mark:g,HTMLAttributes:zr(g,d)})),[c.name,h]}));return new dn({topNode:s,nodes:l,marks:a})}function Br(n,e){return e.nodes[n]||e.marks[n]||null}function is(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function Fn(n,e){let t=$e.fromSchema(e).serializeFragment(n),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(t),o.innerHTML}var Gc=(n,e=500)=>{let t="",r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(o,i,s,l)=>{var a,c;let d=((c=(a=o.type.spec).toText)===null||c===void 0?void 0:c.call(a,{node:o,pos:i,parent:s,index:l}))||o.textContent||"%leaf%";t+=o.isAtom&&!o.isText?d:d.slice(0,Math.max(0,r-i))}),t};function jr(n){return Object.prototype.toString.call(n)==="[object RegExp]"}var at=class{constructor(e){this.find=e.find,this.handler=e.handler}},zp=(n,e)=>{if(jr(e))return e.exec(n);let t=e(n);if(!t)return null;let r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function Lr(n){var e;let{editor:t,from:r,to:o,text:i,rules:s,plugin:l}=n,{view:a}=t;if(a.composing)return!1;let c=a.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let d=!1,u=Gc(c)+i;return s.forEach(f=>{if(d)return;let h=zp(u,f.find);if(!h)return;let p=a.state.tr,m=Bn({state:a.state,transaction:p}),g={from:r-(h[0].length-i.length),to:o},{commands:y,chain:w,can:O}=new Nt({editor:t,state:m});f.handler({state:m,range:g,match:h,commands:y,chain:w,can:O})===null||!p.steps.length||(p.setMeta(l,{transform:p,from:r,to:o,text:i}),a.dispatch(p),d=!0)}),d}function Yc(n){let{editor:e,rules:t}=n,r=new P({state:{init(){return null},apply(o,i,s){let l=o.getMeta(r);if(l)return l;let a=o.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:d}=a;typeof d=="string"?d=d:d=Fn(k.from(d),s.schema);let{from:u}=a,f=u+d.length;Lr({editor:e,from:u,to:f,text:d,rules:t,plugin:r})}),o.selectionSet||o.docChanged?null:i}},props:{handleTextInput(o,i,s,l){return Lr({editor:e,from:i,to:s,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{let{$cursor:i}=o.state.selection;i&&Lr({editor:e,from:i.pos,to:i.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(o,i){if(i.key!=="Enter")return!1;let{$cursor:s}=o.state.selection;return s?Lr({editor:e,from:s.pos,to:s.pos,text:` -`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function Fp(n){return Object.prototype.toString.call(n).slice(8,-1)}function Rn(n){return Fp(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Hn(n,e){let t=b({},n);return Rn(n)&&Rn(e)&&Object.keys(e).forEach(r=>{Rn(e[r])&&Rn(n[r])?t[r]=Hn(n[r],e[r]):t[r]=e[r]}),t}var K=class n{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=b(b({},this.config),e),this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=R(C(this,"addOptions",{name:this.name}))),this.storage=R(C(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new n(e)}configure(e={}){let t=this.extend(v(b({},this.config),{addOptions:()=>Hn(this.options,e)}));return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new n(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=R(C(t,"addOptions",{name:t.name})),t.storage=R(C(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){let{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){let s=o.marks();if(!!!s.find(c=>(c==null?void 0:c.type.name)===t.name))return!1;let a=s.find(c=>(c==null?void 0:c.type.name)===t.name);return a&&r.removeStoredMark(a),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}};function Qc(n){return typeof n=="number"}var Yt=class{constructor(e){this.find=e.find,this.handler=e.handler}},Hp=(n,e,t)=>{if(jr(e))return[...n.matchAll(e)];let r=e(n,t);return r?r.map(o=>{let i=[o.text];return i.index=o.index,i.input=n,i.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(o.replaceWith)),i}):[]};function $p(n){let{editor:e,state:t,from:r,to:o,rule:i,pasteEvent:s,dropEvent:l}=n,{commands:a,chain:c,can:d}=new Nt({editor:e,state:t}),u=[];return t.doc.nodesBetween(r,o,(h,p)=>{if(!h.isTextblock||h.type.spec.code)return;let m=Math.max(r,p),g=Math.min(o,p+h.content.size),y=h.textBetween(m-p,g-p,void 0,"\uFFFC");Hp(y,i.find,s).forEach(O=>{if(O.index===void 0)return;let L=m+O.index+1,E=L+O[0].length,I={from:t.tr.mapping.map(L),to:t.tr.mapping.map(E)},W=i.handler({state:t,range:I,match:O,commands:a,chain:c,can:d,pasteEvent:s,dropEvent:l});u.push(W)})}),u.every(h=>h!==null)}var Vp=n=>{var e;let t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)===null||e===void 0||e.setData("text/html",n),t};function Xc(n){let{editor:e,rules:t}=n,r=null,o=!1,i=!1,s=typeof ClipboardEvent!="undefined"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent!="undefined"?new DragEvent("drop"):null}catch(d){l=null}let a=({state:d,from:u,to:f,rule:h,pasteEvt:p})=>{let m=d.tr,g=Bn({state:d,transaction:m});if(!(!$p({editor:e,state:g,from:Math.max(u-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:l})||!m.steps.length)){try{l=typeof DragEvent!="undefined"?new DragEvent("drop"):null}catch(w){l=null}return s=typeof ClipboardEvent!="undefined"?new ClipboardEvent("paste"):null,m}};return t.map(d=>new P({view(u){let f=h=>{var p;r=!((p=u.dom.parentElement)===null||p===void 0)&&p.contains(h.target)?u.dom.parentElement:null};return window.addEventListener("dragstart",f),{destroy(){window.removeEventListener("dragstart",f)}}},props:{handleDOMEvents:{drop:(u,f)=>(i=r===u.dom.parentElement,l=f,!1),paste:(u,f)=>{var h;let p=(h=f.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return s=f,o=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(u,f,h)=>{let p=u[0],m=p.getMeta("uiEvent")==="paste"&&!o,g=p.getMeta("uiEvent")==="drop"&&!i,y=p.getMeta("applyPasteRules"),w=!!y;if(!m&&!g&&!w)return;if(w){let{text:E}=y;typeof E=="string"?E=E:E=Fn(k.from(E),h.schema);let{from:I}=y,W=I+E.length,q=Vp(E);return a({rule:d,state:h,from:I,to:{b:W},pasteEvt:q})}let O=f.doc.content.findDiffStart(h.doc.content),L=f.doc.content.findDiffEnd(h.doc.content);if(!(!Qc(O)||!L||O===L.b))return a({rule:d,state:h,from:O,to:L,pasteEvt:s})}}))}function Zc(n){let e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}var Fr=class n{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=n.resolve(e),this.schema=fs(this.extensions,t),this.setupExtensions()}static resolve(e){let t=n.sort(n.flatten(e)),r=Zc(t.map(o=>o.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(o=>`'${o}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(t=>{let r={name:t.name,options:t.options,storage:t.storage},o=C(t,"addExtensions",r);return o?[t,...this.flatten(o())]:t}).flat(10)}static sort(e){return e.sort((r,o)=>{let i=C(r,"priority")||100,s=C(o,"priority")||100;return i>s?-1:i{let r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:Br(t.name,this.schema)},o=C(t,"addCommands",r);return o?b(b({},e),o()):e},{})}get plugins(){let{editor:e}=this,t=n.sort([...this.extensions].reverse()),r=[],o=[],i=t.map(s=>{let l={name:s.name,options:s.options,storage:s.storage,editor:e,type:Br(s.name,this.schema)},a=[],c=C(s,"addKeyboardShortcuts",l),d={};if(s.type==="mark"&&C(s,"exitable",l)&&(d.ArrowRight=()=>K.handleExit({editor:e,mark:s})),c){let m=Object.fromEntries(Object.entries(c()).map(([g,y])=>[g,()=>y({editor:e})]));d=b(b({},d),m)}let u=Ec(d);a.push(u);let f=C(s,"addInputRules",l);is(s,e.options.enableInputRules)&&f&&r.push(...f());let h=C(s,"addPasteRules",l);is(s,e.options.enablePasteRules)&&h&&o.push(...h());let p=C(s,"addProseMirrorPlugins",l);if(p){let m=p();a.push(...m)}return a}).flat();return[Yc({editor:e,rules:r}),...Xc({editor:e,rules:o}),...i]}get attributes(){return ds(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=zn(this.extensions);return Object.fromEntries(t.filter(r=>!!C(r,"addNodeView")).map(r=>{let o=this.attributes.filter(a=>a.type===r.name),i={name:r.name,options:r.options,storage:r.storage,editor:e,type:X(r.name,this.schema)},s=C(r,"addNodeView",i);if(!s)return[];let l=(a,c,d,u,f)=>{let h=zr(a,o);return s()({node:a,view:c,getPos:d,decorations:u,innerDecorations:f,editor:e,extension:r,HTMLAttributes:h})};return[r.name,l]}))}setupExtensions(){this.extensions.forEach(e=>{var t;this.editor.extensionStorage[e.name]=e.storage;let r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Br(e.name,this.schema)};e.type==="mark"&&(!((t=R(C(e,"keepOnSplit",r)))!==null&&t!==void 0)||t)&&this.splittableMarks.push(e.name);let o=C(e,"onBeforeCreate",r),i=C(e,"onCreate",r),s=C(e,"onUpdate",r),l=C(e,"onSelectionUpdate",r),a=C(e,"onTransaction",r),c=C(e,"onFocus",r),d=C(e,"onBlur",r),u=C(e,"onDestroy",r);o&&this.editor.on("beforeCreate",o),i&&this.editor.on("create",i),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),u&&this.editor.on("destroy",u)})}},H=class n{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=b(b({},this.config),e),this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=R(C(this,"addOptions",{name:this.name}))),this.storage=R(C(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new n(e)}configure(e={}){let t=this.extend(v(b({},this.config),{addOptions:()=>Hn(this.options,e)}));return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new n(b(b({},this.config),e));return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=R(C(t,"addOptions",{name:t.name})),t.storage=R(C(t,"addStorage",{name:t.name,options:t.options})),t}};function hs(n,e,t){let{from:r,to:o}=e,{blockSeparator:i=` +`))),0,0):S.empty;let u=n.someProp("clipboardTextParser",f=>f(e,o,r,n));if(u)l=u;else{let f=o.marks(),{schema:h}=n.state,p=$e.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=s.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(h.text(m,f)))})}}else n.someProp("transformPastedHTML",u=>{t=u(t,n)}),s=$h(t),vn&&Vh(s);let c=s&&s.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||Re.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||d),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!zh.test(f.parentNode.nodeName)?{ignore:!0}:null}})),d)l=jh(Ba(l,+d[1],+d[2]),d[4]);else if(l=S.maxOpen(Fh(l.content,o),!0),l.openStart||l.openEnd){let u=0,f=0;for(let h=l.content.firstChild;u{l=u(l,n)}),l}var zh=/^(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 Fh(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.index(t)),i,s=[];if(n.forEach(l=>{if(!s)return;let a=o.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&i.length&&hc(a,i,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=pc(s[s.length-1],i.length));let d=fc(l,a);s.push(d),o=o.matchType(d.type),i=a}}),s)return k.from(s)}return n}function fc(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,k.from(n));return n}function hc(n,e,t,r,o){if(o1&&(i=0),o=t&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=o).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(k.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function Ba(n,e,t){return et})),ci.createHTML(n)):n}function $h(n){let e=/^(\s*]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=gc().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),o;if((o=r&&mc[r[1].toLowerCase()])&&(n=o.map(i=>"<"+i+">").join("")+n+o.map(i=>"").reverse().join("")),t.innerHTML=Hh(n),o)for(let i=0;i=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;o=k.from(a.create(r[l+1],o)),i++,s++}return new S(o,i,s)}var fe={},he={},_h={touchstart:!0,touchmove:!0},Mi=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function Wh(n){for(let e in fe){let t=fe[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Jh(n,r)&&!Ii(n,r)&&(n.editable||!(r.type in he))&&t(n,r)},_h[e]?{passive:!0}:void 0)}ue&&n.dom.addEventListener("input",()=>null),Ti(n)}function rt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Kh(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Ti(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Ii(n,r))})}function Ii(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Jh(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function Uh(n,e){!Ii(n,e)&&fe[e.type]&&(n.editable||!(e.type in he))&&fe[e.type](n,e)}he.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!bc(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Ke&&ae&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Ut&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",o=>o(n,St(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Bh(n,t)?t.preventDefault():rt(n,"key")};he.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};he.keypress=(n,e)=>{let t=e;if(bc(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Ce&&t.metaKey)return;if(n.someProp("handleKeyPress",o=>o(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof M)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(t.charCode);!/[\r\n]/.test(o)&&!n.someProp("handleTextInput",i=>i(n,r.$from.pos,r.$to.pos,o))&&n.dispatch(n.state.tr.insertText(o).scrollIntoView()),t.preventDefault()}};function Rr(n){return{left:n.clientX,top:n.clientY}}function qh(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Pi(n,e,t,r,o){if(r==-1)return!1;let i=n.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(n.someProp(e,l=>s>i.depth?l(n,t,i.nodeAfter,i.before(s),o,!0):l(n,t,i.node(s),i.before(s),o,!1)))return!0;return!1}function Jt(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);t=="pointer"&&r.setMeta("pointer",!0),n.dispatch(r)}function Gh(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&A.isSelectable(r)?(Jt(n,new A(t),"pointer"),!0):!1}function Yh(n,e){if(e==-1)return!1;let t=n.state.selection,r,o;t instanceof A&&(r=t.node);let i=n.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(A.isSelectable(l)){r&&t.$from.depth>0&&s>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?o=i.before(t.$from.depth):o=i.before(s);break}}return o!=null?(Jt(n,A.create(n.state.doc,o),"pointer"),!0):!1}function Qh(n,e,t,r,o){return Pi(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(o?Yh(n,t):Gh(n,t))}function Xh(n,e,t,r){return Pi(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",o=>o(n,e,r))}function Zh(n,e,t,r){return Pi(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",o=>o(n,e,r))||ep(n,t,r)}function ep(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Jt(n,M.create(r,0,r.content.size),"pointer"),!0):!1;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),l=o.before(i);if(s.inlineContent)Jt(n,M.create(r,l+1,l+1+s.content.size),"pointer");else if(A.isSelectable(s))Jt(n,A.create(r,l),"pointer");else continue;return!0}}function Li(n){return Mr(n)}var yc=Ce?"metaKey":"ctrlKey";fe.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Li(n),o=Date.now(),i="singleClick";o-n.input.lastClick.time<500&&qh(t,n.input.lastClick)&&!t[yc]&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:o,x:t.clientX,y:t.clientY,type:i};let s=n.posAtCoords(Rr(t));s&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Ai(n,s,t,!!r)):(i=="doubleClick"?Xh:Zh)(n,s.pos,s.inside,t)?t.preventDefault():rt(n,"pointer"))};var Ai=class{constructor(e,t,r,o){this.view=e,this.pos=t,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[yc],this.allowDefault=r.shiftKey;let i,s;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let d=e.state.doc.resolve(t.pos);i=d.parent,s=d.depth?d.before():0}let l=o?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.dom.nodeType==1?a.dom:null;let{selection:c}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof A&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ne&&!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)),rt(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(()=>Je(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Rr(e))),this.updateAllowDefault(e),this.allowDefault||!t?rt(this.view,"pointer"):Qh(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ue&&this.mightDrag&&!this.mightDrag.node.isAtom||ae&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Jt(this.view,T.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):rt(this.view,"pointer")}move(e){this.updateAllowDefault(e),rt(this.view,"pointer"),e.buttons==0&&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)}};fe.touchstart=n=>{n.input.lastTouch=Date.now(),Li(n),rt(n,"pointer")};fe.touchmove=n=>{n.input.lastTouch=Date.now(),rt(n,"pointer")};fe.contextmenu=n=>Li(n);function bc(n,e){return n.composing?!0:ue&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}var tp=Ke?5e3:-1;he.compositionstart=he.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof M&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),Mr(n,!0),n.markCursor=null;else if(Mr(n,!e.selection.empty),Ne&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){let l=n.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}n.input.composing=!0}kc(n,tp)};he.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,kc(n,20))};function kc(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Mr(n),e))}function xc(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=rp());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function np(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Zf(e.focusNode,e.focusOffset),r=eh(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let o=r.pmViewDesc,i=n.domObserver.lastChangedTextNode;if(t==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return r}}return t||r}function rp(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Mr(n,e=!1){if(!(Ke&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),xc(n),e||n.docView&&n.docView.dirty){let t=Ri(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!n.state.selection.empty?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function op(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}var An=ge&&ot<15||Ut&&ih<604;fe.copy=he.cut=(n,e)=>{let t=e,r=n.state.selection,o=t.type=="cut";if(r.empty)return;let i=An?null:t.clipboardData,s=r.content(),{dom:l,text:a}=dc(n,s);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):op(n,l),o&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function ip(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function sp(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?En(n,r.value,null,o,e):En(n,r.textContent,r.innerHTML,o,e)},50)}function En(n,e,t,r,o){let i=uc(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,o,i||S.empty)))return!0;if(!i)return!1;let s=ip(i),l=s?n.state.tr.replaceSelectionWith(s,r):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Sc(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}he.paste=(n,e)=>{let t=e;if(n.composing&&!Ke)return;let r=An?null:t.clipboardData,o=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&En(n,Sc(r),r.getData("text/html"),o,t)?t.preventDefault():sp(n,t)};var Tr=class{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}},wc=Ce?"altKey":"ctrlKey";fe.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let o=n.state.selection,i=o.empty?null:n.posAtCoords(Rr(t)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof A?o.to-1:o.to))){if(r&&r.mightDrag)s=A.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let u=n.docView.nearestDesc(t.target,!0);u&&u.node.type.spec.draggable&&u!=n.docView&&(s=A.create(n.state.doc,u.posBefore))}}let l=(s||n.state.selection).content(),{dom:a,text:c,slice:d}=dc(n,l);(!t.dataTransfer.files.length||!ae||Ya>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(An?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",An||t.dataTransfer.setData("text/plain",c),n.dragging=new Tr(d,!t[wc],s)};fe.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};he.dragover=he.dragenter=(n,e)=>e.preventDefault();he.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let o=n.posAtCoords(Rr(t));if(!o)return;let i=n.state.doc.resolve(o.pos),s=r&&r.slice;s?n.someProp("transformPasted",p=>{s=p(s,n)}):s=uc(n,Sc(t.dataTransfer),An?null:t.dataTransfer.getData("text/html"),!1,i);let l=!!(r&&!t[wc]);if(n.someProp("handleDrop",p=>p(n,t,s||S.empty,l))){t.preventDefault();return}if(!s)return;t.preventDefault();let a=s?mr(n.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let c=n.state.tr;if(l){let{node:p}=r;p?p.replace(c):c.deleteSelection()}let d=c.mapping.map(a),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=c.doc;if(u?c.replaceRangeWith(d,d,s.content.firstChild):c.replaceRange(d,d,s),c.doc.eq(f))return;let h=c.doc.resolve(d);if(u&&A.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new A(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,y,w)=>p=w),c.setSelection(Di(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};fe.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Je(n)},20))};fe.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};fe.beforeinput=(n,e)=>{if(ae&&Ke&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",i=>i(n,St(8,"Backspace")))))return;let{$cursor:o}=n.state.selection;o&&o.pos>0&&n.dispatch(n.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let n in he)fe[n]=he[n];function On(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}var Ar=class n{constructor(e,t){this.toDOM=e,this.spec=t||Tt,this.side=this.spec.side||0}map(e,t,r,o){let{pos:i,deleted:s}=e.mapResult(t.from+o,this.side<0?-1:1);return s?null:new re(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof n&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&On(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},Mt=class n{constructor(e,t){this.attrs=e,this.spec=t||Tt}map(e,t,r,o){let i=e.map(t.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(t.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new re(i,s,this)}valid(e,t){return t.from=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+o,l.to+o))}for(let s=0;se){let l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,r,o+l,i)}}map(e,t,r){return this==le||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Tt)}mapInner(e,t,r,o,i){let s;for(let l=0;l{let c=a+r,d;if(d=Mc(t,l,c)){for(o||(o=this.children.slice());il&&u.to=e){this.children[l]==e&&(r=this.children[l+2]);break}let i=e+1,s=i+t.content.size;for(let l=0;li&&a.type instanceof Mt){let c=Math.max(i,a.from)-i,d=Math.min(s,a.to)-i;co.map(e,t,Tt));return n.from(r)}forChild(e,t){if(t.isLeaf)return G.empty;let r=[];for(let o=0;ot instanceof G)?e:e.reduce((t,r)=>t.concat(r instanceof G?r:r.members),[]))}}forEachSet(e){for(let t=0;t{let g=m-p-(h-f);for(let y=0;yw+d-u)continue;let O=l[y]+d-u;h>=O?l[y+1]=f<=O?-2:-1:f>=d&&g&&(l[y]+=g,l[y+1]+=g)}u+=g}),d=t.maps[c].map(d,-1)}let a=!1;for(let c=0;c=r.content.size){a=!0;continue}let f=t.map(n[c+1]+i,-1),h=f-o,{index:p,offset:m}=r.content.findIndex(u),g=r.maybeChild(p);if(g&&m==u&&m+g.nodeSize==h){let y=l[c+2].mapInner(t,g,d+1,n[c]+i+1,s);y!=le?(l[c]=u,l[c+1]=h,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=ap(l,n,e,t,o,i,s),d=Or(c,r,0,s);e=d.local;for(let u=0;ut&&s.to{let c=Mc(n,l,a+t);if(c){i=!0;let d=Or(c,l,t+a+1,r);d!=le&&o.push(a,a+l.nodeSize,d)}});let s=Cc(i?Tc(n):n,-t).sort(At);for(let l=0;l0;)e++;n.splice(e,0,t)}function di(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=le&&e.push(r)}),n.cursorWrapper&&e.push(G.create(n.state.doc,[n.cursorWrapper.deco])),Er.from(e)}var cp={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},dp=ge&&ot<=11,Oi=class{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}},Ni=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Oi,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;oo.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),dp&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.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,cp)),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(va(this.view)){if(this.suppressingSelectionUpdates)return Je(this.view);if(ge&&ot<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Et(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,r;for(let i=e.focusNode;i;i=Tn(i))t.add(i);for(let i=e.anchorNode;i;i=Tn(i))if(t.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&va(e)&&!this.ignoreSelectionChange(r),i=-1,s=-1,l=!1,a=[];if(e.editable)for(let d=0;du.nodeName=="BR");if(d.length==2){let[u,f]=d;u.parentNode&&u.parentNode.parentNode==f.parentNode?f.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let f of d){let h=f.parentNode;h&&h.nodeName=="LI"&&(!u||hp(e,u)!=h)&&f.remove()}}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||o)&&(i>-1&&(e.docView.markDirty(i,s),up(e)),this.handleDOMChange(i,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Je(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;do;g--){let y=r.childNodes[g-1],w=y.pmViewDesc;if(y.nodeName=="BR"&&!w){i=g;break}if(!w||w.size)break}let u=n.state.doc,f=n.someProp("domParser")||Re.fromSchema(n.state.schema),h=u.resolve(s),p=null,m=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:o,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:mp,context:h});if(c&&c[0].pos!=null){let g=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=g),p={anchor:g+s,head:y+s}}return{doc:m,sel:p,from:s,to:l}}function mp(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(ue&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||ue&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}var gp=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function yp(n,e,t,r,o){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let B=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,Se=Ri(n,B);if(Se&&!n.state.selection.eq(Se)){if(ae&&Ke&&n.input.lastKeyCode===13&&Date.now()-100sn(n,St(13,"Enter"))))return;let ht=n.state.tr.setSelection(Se);B=="pointer"?ht.setMeta("pointer",!0):B=="key"&&ht.scrollIntoView(),i&&ht.setMeta("composition",i),n.dispatch(ht)}return}let s=n.state.doc.resolve(e),l=s.sharedDepth(t);e=s.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=pp(n,e,t),d=n.state.doc,u=d.slice(c.from,c.to),f,h;n.input.lastKeyCode===8&&Date.now()-100Date.now()-225||Ke)&&o.some(B=>B.nodeType==1&&!gp.test(B.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",B=>B(n,St(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof M&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let B=ja(n,n.state.doc,c.sel);if(B&&!B.eq(n.state.selection)){let Se=n.state.tr.setSelection(B);i&&Se.setMeta("composition",i),n.dispatch(Se)}}return}n.state.selection.fromn.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),ge&&ot<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)==" \xA0"&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),y=d.resolve(p.start),w=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=p.endA,O;if((Ut&&n.input.lastIOSEnter>Date.now()-225&&(!w||o.some(B=>B.nodeName=="DIV"||B.nodeName=="P"))||!w&&m.posB(n,St(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&kp(d,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",B=>B(n,St(8,"Backspace")))){Ke&&ae&&n.domObserver.suppressSelectionUpdates();return}ae&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),Ke&&!w&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(B){return B(n,St(13,"Enter"))})},20));let L=p.start,E=p.endA,I,W,q;if(w){if(m.pos==g.pos)ge&&ot<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Je(n),20)),I=n.state.tr.delete(L,E),W=d.resolve(p.start).marksAcross(d.resolve(p.endA));else if(p.endA==p.endB&&(q=bp(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start()))))I=n.state.tr,q.type=="add"?I.addMark(L,E,q.mark):I.removeMark(L,E,q.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let B=m.parent.textBetween(m.parentOffset,g.parentOffset);if(n.someProp("handleTextInput",Se=>Se(n,L,E,B)))return;I=n.state.tr.insertText(B,L,E)}}if(I||(I=n.state.tr.replace(L,E,c.doc.slice(p.start-c.from,p.endB-c.from))),c.sel){let B=ja(n,I.doc,c.sel);B&&!(ae&&n.composing&&B.empty&&(p.start!=p.endB||n.input.lastChromeDeletee.content.size?null:Di(n,e.resolve(t.anchor),e.resolve(t.head))}function bp(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,o=t,i=r,s,l,a;for(let d=0;dd.mark(l.addToSet(d.marks));else if(o.length==0&&i.length==1)l=i[0],s="remove",a=d=>d.mark(l.removeFromSet(d.marks));else return null;let c=[];for(let d=0;dt||ui(s,!0,!1)0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,o++,e=!1;if(t){let i=n.node(r).maybeChild(n.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function xp(n,e,t,r,o){let i=n.findDiffStart(e,t);if(i==null)return null;let{a:s,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(o=="end"){let a=Math.max(0,i-Math.min(s,l));r-=s+a-i}if(s=s?i-r:0;i-=a,i&&i=l?i-r:0;i-=a,i&&i=56320&&e<=57343&&t>=55296&&t<=56319}var Nr=class{constructor(e,t){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 Mi,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(qa),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Ja(this),Ka(this),this.nodeViews=Ua(this),this.docView=Ma(this.state.doc,Wa(this),di(this),this.dom,this),this.domObserver=new Ni(this,(r,o,i,s)=>yp(this,r,o,i,s)),this.domObserver.start(),Wh(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ti(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(qa),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(xc(this),s=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=Ua(this);wp(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&Ti(this),this.editable=Ja(this),Ka(this);let a=di(this),c=Wa(this),d=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",u=i||!this.docView.matchesNode(e.doc,c,a);(u||!e.selection.eq(o.selection))&&(s=!0);let f=d=="preserve"&&s&&this.dom.style.overflowAnchor==null&&ah(this);if(s){this.domObserver.stop();let h=u&&(ge||ae)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&Sp(o.selection,e.selection);if(u){let p=ae?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=np(this)),(i||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Ma(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Nh(this))?Je(this,h):(lc(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():f&&ch(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof A){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&ba(this,t.getBoundingClientRect(),e)}else ba(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){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new Tr(e.slice,e.move,o<0?void 0:A.create(this.state.doc,o))}someProp(e,t){let r=this._props&&this._props[e],o;if(r!=null&&(o=t?t(r):r))return o;for(let s=0;st.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return mh(this,e)}coordsAtPos(e,t=1){return tc(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,r=-1){let o=this.docView.posFromDOM(e,t,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,t){return xh(this,t||this.state,e)}pasteHTML(e,t){return En(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return En(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(Kh(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],di(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Qf())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Uh(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?ue&&this.root.nodeType===11&&nh(this.dom.ownerDocument)==this.dom&&fp(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};function Wa(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[re.node(0,n.state.doc.content.size,e)]}function Ka(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:re.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Ja(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Sp(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Ua(n){let e=Object.create(null);function t(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function wp(n,e){let t=0,r=0;for(let o in n){if(n[o]!=e[o])return!0;t++}for(let o in e)r++;return t!=r}function qa(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Ue={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:"'"},Ir={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Cp=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),Mp=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Q=0;Q<10;Q++)Ue[48+Q]=Ue[96+Q]=String(Q);var Q;for(Q=1;Q<=24;Q++)Ue[Q+111]="F"+Q;var Q;for(Q=65;Q<=90;Q++)Ue[Q]=String.fromCharCode(Q+32),Ir[Q]=String.fromCharCode(Q);var Q;for(Dr in Ue)Ir.hasOwnProperty(Dr)||(Ir[Dr]=Ue[Dr]);var Dr;function Ac(n){var e=Cp&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Mp&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Ir:Ue)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}var Tp=typeof navigator!="undefined"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Ap(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,o,i,s;for(let l=0;l127)&&(i=Ue[r.keyCode])&&i!=o){let l=e[zi(i,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}var Pr=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Nc(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}var Hi=(n,e,t)=>{let r=Nc(n,t);if(!r)return!1;let o=Vi(r);if(!o){let s=r.blockRange(),l=s&&je(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let i=o.nodeBefore;if(Fc(n,o,e,-1))return!0;if(r.parent.content.size==0&&(Gt(i,"end")||A.isSelectable(i)))for(let s=r.depth;;s--){let l=xn(n.doc,r.before(s),r.after(s),S.empty);if(l&&l.slice.size1)break}return i.isAtom&&o.depth==r.depth-1?(e&&e(n.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1},vc=(n,e,t)=>{let r=Nc(n,t);if(!r)return!1;let o=Vi(r);return o?Dc(n,o,e):!1},Rc=(n,e,t)=>{let r=Ic(n,t);if(!r)return!1;let o=Wi(r);return o?Dc(n,o,e):!1};function Dc(n,e,t){let r=e.nodeBefore,o=r,i=e.pos-1;for(;!o.isTextblock;i--){if(o.type.spec.isolating)return!1;let d=o.lastChild;if(!d)return!1;o=d}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let d=l.firstChild;if(!d)return!1;l=d}let c=xn(n.doc,i,a,S.empty);if(!c||c.from!=i||c instanceof se&&c.slice.size>=a-i)return!1;if(t){let d=n.tr.step(c);d.setSelection(M.create(d.doc,i)),t(d.scrollIntoView())}return!0}function Gt(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}var $i=(n,e,t)=>{let{$head:r,empty:o}=n.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;i=Vi(r)}let s=i&&i.nodeBefore;return!s||!A.isSelectable(s)?!1:(e&&e(n.tr.setSelection(A.create(n.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function Vi(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Ic(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset{let r=Ic(n,t);if(!r)return!1;let o=Wi(r);if(!o)return!1;let i=o.nodeAfter;if(Fc(n,o,e,1))return!0;if(r.parent.content.size==0&&(Gt(i,"start")||A.isSelectable(i))){let s=xn(n.doc,r.before(),r.after(),S.empty);if(s&&s.slice.size{let{$head:r,empty:o}=n.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset=0;e--){let t=n.node(e);if(n.index(e)+1{let t=n.selection,r=t instanceof A,o;if(r){if(t.node.isTextblock||!Oe(n.doc,t.from))return!1;o=t.from}else if(o=$t(n.doc,t.from,-1),o==null)return!1;if(e){let i=n.tr.join(o);r&&i.setSelection(A.create(i.doc,o-n.doc.resolve(o).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},Lc=(n,e)=>{let t=n.selection,r;if(t instanceof A){if(t.node.isTextblock||!Oe(n.doc,t.to))return!1;r=t.to}else if(r=$t(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},Bc=(n,e)=>{let{$from:t,$to:r}=n.selection,o=t.blockRange(r),i=o&&je(o);return i==null?!1:(e&&e(n.tr.lift(o,i).scrollIntoView()),!0)},Ki=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(` +`).scrollIntoView()),!0)};function Ji(n){for(let e=0;e{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let o=t.node(-1),i=t.indexAfter(-1),s=Ji(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,s.createAndFill());a.setSelection(T.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},qi=(n,e)=>{let t=n.selection,{$from:r,$to:o}=t;if(t instanceof be||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Ji(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index(){let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(we(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let r=t.blockRange(),o=r&&je(r);return o==null?!1:(e&&e(n.tr.lift(r,o).scrollIntoView()),!0)};function Op(n){return(e,t)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof A&&e.selection.node.isBlock)return!r.parentOffset||!we(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,l,a=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){a=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),l=Ji(r.node(h-1).contentMatchAt(r.indexAfter(h-1)));let m=n&&n(o.parent,a,r);i.unshift(m||(a&&l?{type:l}:null)),s=h;break}else{if(h==1)return!1;i.unshift(null)}let d=e.tr;(e.selection instanceof M||e.selection instanceof be)&&d.deleteSelection();let u=d.mapping.map(r.pos),f=we(d.doc,u,i.length,i);if(f||(i[0]=l?{type:l}:null,f=we(d.doc,u,i.length,i)),d.split(u,i.length,i),!a&&c&&r.node(s).type!=l){let h=d.mapping.map(r.before(s)),p=d.doc.resolve(h);l&&r.node(s-1).canReplaceWith(p.index(),p.index()+1,l)&&d.setNodeMarkup(d.mapping.map(r.before(s)),l)}return t&&t(d.scrollIntoView()),!0}}var Np=Op();var zc=(n,e)=>{let{$from:t,to:r}=n.selection,o,i=t.sharedDepth(r);return i==0?!1:(o=t.before(i),e&&e(n.tr.setSelection(A.create(n.doc,o))),!0)},vp=(n,e)=>(e&&e(n.tr.setSelection(new be(n.doc))),!0);function Rp(n,e,t){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||Oe(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Fc(n,e,t,r){let o=e.nodeBefore,i=e.nodeAfter,s,l,a=o.type.spec.isolating||i.type.spec.isolating;if(!a&&Rp(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(l=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(t){let h=e.pos+i.nodeSize,p=k.empty;for(let y=s.length-1;y>=0;y--)p=k.from(s[y].create(null,p));p=k.from(o.copy(p));let m=n.tr.step(new Y(e.pos-1,h,e.pos,h,new S(p,1,0),s.length,!0)),g=m.doc.resolve(h+2*s.length);g.nodeAfter&&g.nodeAfter.type==o.type&&Oe(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let d=i.type.spec.isolating||r>0&&a?null:T.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),f=u&&je(u);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(u,f).scrollIntoView()),!0;if(c&&Gt(i,"start",!0)&&Gt(o,"end")){let h=o,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=i,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(t){let y=k.empty;for(let O=p.length-1;O>=0;O--)y=k.from(p[O].copy(y));let w=n.tr.step(new Y(e.pos-p.length,e.pos+i.nodeSize,e.pos+g,e.pos+i.nodeSize-g,new S(y,p.length,0),0,!0));t(w.scrollIntoView())}return!0}}return!1}function Hc(n){return function(e,t){let r=e.selection,o=n<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(t&&t(e.tr.setSelection(M.create(e.doc,n<0?o.start(i):o.end(i)))),!0):!1}}var Yi=Hc(-1),Qi=Hc(1);function $c(n,e=null){return function(t,r){let{$from:o,$to:i}=t.selection,s=o.blockRange(i),l=s&&Ht(s,n,e);return l?(r&&r(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Xi(n,e=null){return function(t,r){let o=!1;for(let i=0;i{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)o=!0;else{let d=t.doc.resolve(c),u=d.index();o=d.parent.canReplaceWith(u,u+1,n)}})}if(!o)return!1;if(r){let i=t.tr;for(let s=0;s=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=s.resolve(e.start-2);i=new yt(a,a,e.depth),e.endIndex=0;d--)i=k.from(t[d].type.create(t[d].attrs,i));n.step(new Y(e.start-(r?2:0),e.end,e.start,e.end,new S(i,0,0),t.length,!0));let s=0;for(let d=0;ds.childCount>0&&s.firstChild.type==n);return i?t?r.node(i.depth-1).type==n?Lp(e,t,n,i):Bp(e,t,i):!0:!1}}function Lp(n,e,t,r){let o=n.tr,i=r.end,s=r.$to.end(r.depth);im;p--)h-=o.child(p).nodeSize,r.delete(h-1,h+1);let i=r.doc.resolve(t.start),s=i.nodeAfter;if(r.mapping.map(t.end)!=t.start+i.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==o.childCount,c=i.node(-1),d=i.index(-1);if(!c.canReplace(d+(l?0:1),d+1,s.content.append(a?k.empty:k.from(o))))return!1;let u=i.pos,f=u+s.nodeSize;return r.step(new Y(u-(l?1:0),f+(a?1:0),u+1,f-1,new S((l?k.empty:k.from(o.copy(k.empty))).append(a?k.empty:k.from(o.copy(k.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function _c(n){return function(e,t){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==n);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,a=l.child(s-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,d=k.from(c?n.create():null),u=new S(k.from(n.create(null,k.from(l.type.create(null,d)))),c?3:1,0),f=i.start,h=i.end;t(e.tr.step(new Y(f-(c?3:1),h,f,h,u,1,!0)).scrollIntoView())}return!0}}function zn(n){let{state:e,transaction:t}=n,{selection:r}=t,{doc:o}=t,{storedMarks:i}=t;return v(b({},e),{apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=t.selection,o=t.doc,i=t.storedMarks,t}})}var Nt=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:r}=this,{view:o}=t,{tr:i}=r,s=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...d)=>{let u=a(...d)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(i),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:r,editor:o,state:i}=this,{view:s}=o,l=[],a=!!e,c=e||i.tr,d=()=>(!a&&t&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),l.every(f=>f===!0)),u=v(b({},Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...m)=>{let g=this.buildProps(c,t),y=h(...m)(g);return l.push(y),u}]))),{run:d});return u}createCan(e){let{rawCommands:t,state:r}=this,o=!1,i=e||r.tr,s=this.buildProps(i,o),l=Object.fromEntries(Object.entries(t).map(([a,c])=>[a,(...d)=>c(...d)(v(b({},s),{dispatch:void 0}))]));return v(b({},l),{chain:()=>this.createChain(i,o)})}buildProps(e,t=!0){let{rawCommands:r,editor:o,state:i}=this,{view:s}=o,l={tr:e,editor:o,view:s,state:zn({state:i,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([a,c])=>[a,(...d)=>c(...d)(l)]))}};return l}},ns=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let r=this.callbacks[e];return r&&r.forEach(o=>o.apply(this,t)),this}off(e,t){let r=this.callbacks[e];return r&&(t?this.callbacks[e]=r.filter(o=>o!==t):delete this.callbacks[e]),this}once(e,t){let r=(...o)=>{this.off(e,r),t.apply(this,o)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}};function C(n,e,t){return n.config[e]===void 0&&n.parent?C(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind(v(b({},t),{parent:n.parent?C(n.parent,e,t):null})):n.config[e]}function Fn(n){let e=n.filter(o=>o.type==="extension"),t=n.filter(o=>o.type==="node"),r=n.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function ds(n){let e=[],{nodeExtensions:t,markExtensions:r}=Fn(n),o=[...t,...r],i={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(s=>{let l={name:s.name,options:s.options,storage:s.storage,extensions:o},a=C(s,"addGlobalAttributes",l);if(!a)return;a().forEach(d=>{d.types.forEach(u=>{Object.entries(d.attributes).forEach(([f,h])=>{e.push({type:u,name:f,attribute:b(b({},i),h)})})})})}),o.forEach(s=>{let l={name:s.name,options:s.options,storage:s.storage},a=C(s,"addAttributes",l);if(!a)return;let c=a();Object.entries(c).forEach(([d,u])=>{let f=b(b({},i),u);typeof(f==null?void 0:f.default)=="function"&&(f.default=f.default()),f!=null&&f.isRequired&&(f==null?void 0:f.default)===void 0&&delete f.default,e.push({type:s.name,name:d,attribute:f})})}),e}function X(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function N(...n){return n.filter(e=>!!e).reduce((e,t)=>{let r=b({},e);return Object.entries(t).forEach(([o,i])=>{if(!r[o]){r[o]=i;return}if(o==="class"){let l=i?i.split(" "):[],a=r[o]?r[o].split(" "):[],c=l.filter(d=>!a.includes(d));r[o]=[...a,...c].join(" ")}else if(o==="style"){let l=i?i.split(";").map(d=>d.trim()).filter(Boolean):[],a=r[o]?r[o].split(";").map(d=>d.trim()).filter(Boolean):[],c=new Map;a.forEach(d=>{let[u,f]=d.split(":").map(h=>h.trim());c.set(u,f)}),l.forEach(d=>{let[u,f]=d.split(":").map(h=>h.trim());c.set(u,f)}),r[o]=Array.from(c.entries()).map(([d,u])=>`${d}: ${u}`).join("; ")}else r[o]=i}),r},{})}function zr(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>N(t,r),{})}function us(n){return typeof n=="function"}function R(n,e=void 0,...t){return us(n)?e?n.bind(e)(...t):n(...t):n}function Uc(n={}){return Object.keys(n).length===0&&n.constructor===Object}function qc(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function rs(n,e){return"style"in n?n:v(b({},n),{getAttrs:t=>{let r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;let o=e.reduce((i,s)=>{let l=s.attribute.parseHTML?s.attribute.parseHTML(t):qc(t.getAttribute(s.name));return l==null?i:v(b({},i),{[s.name]:l})},{});return b(b({},r),o)}})}function Wc(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Uc(t)?!1:t!=null))}function fs(n,e){var t;let r=ds(n),{nodeExtensions:o,markExtensions:i}=Fn(n),s=(t=o.find(c=>C(c,"topNode")))===null||t===void 0?void 0:t.name,l=Object.fromEntries(o.map(c=>{let d=r.filter(y=>y.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((y,w)=>{let O=C(w,"extendNodeSchema",u);return b(b({},y),O?O(c):{})},{}),h=Wc(v(b({},f),{content:R(C(c,"content",u)),marks:R(C(c,"marks",u)),group:R(C(c,"group",u)),inline:R(C(c,"inline",u)),atom:R(C(c,"atom",u)),selectable:R(C(c,"selectable",u)),draggable:R(C(c,"draggable",u)),code:R(C(c,"code",u)),whitespace:R(C(c,"whitespace",u)),linebreakReplacement:R(C(c,"linebreakReplacement",u)),defining:R(C(c,"defining",u)),isolating:R(C(c,"isolating",u)),attrs:Object.fromEntries(d.map(y=>{var w;return[y.name,{default:(w=y==null?void 0:y.attribute)===null||w===void 0?void 0:w.default}]}))})),p=R(C(c,"parseHTML",u));p&&(h.parseDOM=p.map(y=>rs(y,d)));let m=C(c,"renderHTML",u);m&&(h.toDOM=y=>m({node:y,HTMLAttributes:zr(y,d)}));let g=C(c,"renderText",u);return g&&(h.toText=g),[c.name,h]})),a=Object.fromEntries(i.map(c=>{let d=r.filter(g=>g.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((g,y)=>{let w=C(y,"extendMarkSchema",u);return b(b({},g),w?w(c):{})},{}),h=Wc(v(b({},f),{inclusive:R(C(c,"inclusive",u)),excludes:R(C(c,"excludes",u)),group:R(C(c,"group",u)),spanning:R(C(c,"spanning",u)),code:R(C(c,"code",u)),attrs:Object.fromEntries(d.map(g=>{var y;return[g.name,{default:(y=g==null?void 0:g.attribute)===null||y===void 0?void 0:y.default}]}))})),p=R(C(c,"parseHTML",u));p&&(h.parseDOM=p.map(g=>rs(g,d)));let m=C(c,"renderHTML",u);return m&&(h.toDOM=g=>m({mark:g,HTMLAttributes:zr(g,d)})),[c.name,h]}));return new un({topNode:s,nodes:l,marks:a})}function Br(n,e){return e.nodes[n]||e.marks[n]||null}function is(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function Hn(n,e){let t=$e.fromSchema(e).serializeFragment(n),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(t),o.innerHTML}var Gc=(n,e=500)=>{let t="",r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(o,i,s,l)=>{var a,c;let d=((c=(a=o.type.spec).toText)===null||c===void 0?void 0:c.call(a,{node:o,pos:i,parent:s,index:l}))||o.textContent||"%leaf%";t+=o.isAtom&&!o.isText?d:d.slice(0,Math.max(0,r-i))}),t};function jr(n){return Object.prototype.toString.call(n)==="[object RegExp]"}var at=class{constructor(e){this.find=e.find,this.handler=e.handler}},zp=(n,e)=>{if(jr(e))return e.exec(n);let t=e(n);if(!t)return null;let r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function Lr(n){var e;let{editor:t,from:r,to:o,text:i,rules:s,plugin:l}=n,{view:a}=t;if(a.composing)return!1;let c=a.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let d=!1,u=Gc(c)+i;return s.forEach(f=>{if(d)return;let h=zp(u,f.find);if(!h)return;let p=a.state.tr,m=zn({state:a.state,transaction:p}),g={from:r-(h[0].length-i.length),to:o},{commands:y,chain:w,can:O}=new Nt({editor:t,state:m});f.handler({state:m,range:g,match:h,commands:y,chain:w,can:O})===null||!p.steps.length||(p.setMeta(l,{transform:p,from:r,to:o,text:i}),a.dispatch(p),d=!0)}),d}function Yc(n){let{editor:e,rules:t}=n,r=new P({state:{init(){return null},apply(o,i,s){let l=o.getMeta(r);if(l)return l;let a=o.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:d}=a;typeof d=="string"?d=d:d=Hn(k.from(d),s.schema);let{from:u}=a,f=u+d.length;Lr({editor:e,from:u,to:f,text:d,rules:t,plugin:r})}),o.selectionSet||o.docChanged?null:i}},props:{handleTextInput(o,i,s,l){return Lr({editor:e,from:i,to:s,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{let{$cursor:i}=o.state.selection;i&&Lr({editor:e,from:i.pos,to:i.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(o,i){if(i.key!=="Enter")return!1;let{$cursor:s}=o.state.selection;return s?Lr({editor:e,from:s.pos,to:s.pos,text:` +`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function Fp(n){return Object.prototype.toString.call(n).slice(8,-1)}function Dn(n){return Fp(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function $n(n,e){let t=b({},n);return Dn(n)&&Dn(e)&&Object.keys(e).forEach(r=>{Dn(e[r])&&Dn(n[r])?t[r]=$n(n[r],e[r]):t[r]=e[r]}),t}var K=class n{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=b(b({},this.config),e),this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=R(C(this,"addOptions",{name:this.name}))),this.storage=R(C(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new n(e)}configure(e={}){let t=this.extend(v(b({},this.config),{addOptions:()=>$n(this.options,e)}));return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new n(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=R(C(t,"addOptions",{name:t.name})),t.storage=R(C(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){let{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){let s=o.marks();if(!!!s.find(c=>(c==null?void 0:c.type.name)===t.name))return!1;let a=s.find(c=>(c==null?void 0:c.type.name)===t.name);return a&&r.removeStoredMark(a),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}};function Qc(n){return typeof n=="number"}var Qt=class{constructor(e){this.find=e.find,this.handler=e.handler}},Hp=(n,e,t)=>{if(jr(e))return[...n.matchAll(e)];let r=e(n,t);return r?r.map(o=>{let i=[o.text];return i.index=o.index,i.input=n,i.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(o.replaceWith)),i}):[]};function $p(n){let{editor:e,state:t,from:r,to:o,rule:i,pasteEvent:s,dropEvent:l}=n,{commands:a,chain:c,can:d}=new Nt({editor:e,state:t}),u=[];return t.doc.nodesBetween(r,o,(h,p)=>{if(!h.isTextblock||h.type.spec.code)return;let m=Math.max(r,p),g=Math.min(o,p+h.content.size),y=h.textBetween(m-p,g-p,void 0,"\uFFFC");Hp(y,i.find,s).forEach(O=>{if(O.index===void 0)return;let L=m+O.index+1,E=L+O[0].length,I={from:t.tr.mapping.map(L),to:t.tr.mapping.map(E)},W=i.handler({state:t,range:I,match:O,commands:a,chain:c,can:d,pasteEvent:s,dropEvent:l});u.push(W)})}),u.every(h=>h!==null)}var Vp=n=>{var e;let t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)===null||e===void 0||e.setData("text/html",n),t};function Xc(n){let{editor:e,rules:t}=n,r=null,o=!1,i=!1,s=typeof ClipboardEvent!="undefined"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent!="undefined"?new DragEvent("drop"):null}catch(d){l=null}let a=({state:d,from:u,to:f,rule:h,pasteEvt:p})=>{let m=d.tr,g=zn({state:d,transaction:m});if(!(!$p({editor:e,state:g,from:Math.max(u-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:l})||!m.steps.length)){try{l=typeof DragEvent!="undefined"?new DragEvent("drop"):null}catch(w){l=null}return s=typeof ClipboardEvent!="undefined"?new ClipboardEvent("paste"):null,m}};return t.map(d=>new P({view(u){let f=h=>{var p;r=!((p=u.dom.parentElement)===null||p===void 0)&&p.contains(h.target)?u.dom.parentElement:null};return window.addEventListener("dragstart",f),{destroy(){window.removeEventListener("dragstart",f)}}},props:{handleDOMEvents:{drop:(u,f)=>(i=r===u.dom.parentElement,l=f,!1),paste:(u,f)=>{var h;let p=(h=f.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return s=f,o=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(u,f,h)=>{let p=u[0],m=p.getMeta("uiEvent")==="paste"&&!o,g=p.getMeta("uiEvent")==="drop"&&!i,y=p.getMeta("applyPasteRules"),w=!!y;if(!m&&!g&&!w)return;if(w){let{text:E}=y;typeof E=="string"?E=E:E=Hn(k.from(E),h.schema);let{from:I}=y,W=I+E.length,q=Vp(E);return a({rule:d,state:h,from:I,to:{b:W},pasteEvt:q})}let O=f.doc.content.findDiffStart(h.doc.content),L=f.doc.content.findDiffEnd(h.doc.content);if(!(!Qc(O)||!L||O===L.b))return a({rule:d,state:h,from:O,to:L,pasteEvt:s})}}))}function Zc(n){let e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}var Fr=class n{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=n.resolve(e),this.schema=fs(this.extensions,t),this.setupExtensions()}static resolve(e){let t=n.sort(n.flatten(e)),r=Zc(t.map(o=>o.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(o=>`'${o}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(t=>{let r={name:t.name,options:t.options,storage:t.storage},o=C(t,"addExtensions",r);return o?[t,...this.flatten(o())]:t}).flat(10)}static sort(e){return e.sort((r,o)=>{let i=C(r,"priority")||100,s=C(o,"priority")||100;return i>s?-1:i{let r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:Br(t.name,this.schema)},o=C(t,"addCommands",r);return o?b(b({},e),o()):e},{})}get plugins(){let{editor:e}=this,t=n.sort([...this.extensions].reverse()),r=[],o=[],i=t.map(s=>{let l={name:s.name,options:s.options,storage:s.storage,editor:e,type:Br(s.name,this.schema)},a=[],c=C(s,"addKeyboardShortcuts",l),d={};if(s.type==="mark"&&C(s,"exitable",l)&&(d.ArrowRight=()=>K.handleExit({editor:e,mark:s})),c){let m=Object.fromEntries(Object.entries(c()).map(([g,y])=>[g,()=>y({editor:e})]));d=b(b({},d),m)}let u=Ec(d);a.push(u);let f=C(s,"addInputRules",l);is(s,e.options.enableInputRules)&&f&&r.push(...f());let h=C(s,"addPasteRules",l);is(s,e.options.enablePasteRules)&&h&&o.push(...h());let p=C(s,"addProseMirrorPlugins",l);if(p){let m=p();a.push(...m)}return a}).flat();return[Yc({editor:e,rules:r}),...Xc({editor:e,rules:o}),...i]}get attributes(){return ds(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=Fn(this.extensions);return Object.fromEntries(t.filter(r=>!!C(r,"addNodeView")).map(r=>{let o=this.attributes.filter(a=>a.type===r.name),i={name:r.name,options:r.options,storage:r.storage,editor:e,type:X(r.name,this.schema)},s=C(r,"addNodeView",i);if(!s)return[];let l=(a,c,d,u,f)=>{let h=zr(a,o);return s()({node:a,view:c,getPos:d,decorations:u,innerDecorations:f,editor:e,extension:r,HTMLAttributes:h})};return[r.name,l]}))}setupExtensions(){this.extensions.forEach(e=>{var t;this.editor.extensionStorage[e.name]=e.storage;let r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Br(e.name,this.schema)};e.type==="mark"&&(!((t=R(C(e,"keepOnSplit",r)))!==null&&t!==void 0)||t)&&this.splittableMarks.push(e.name);let o=C(e,"onBeforeCreate",r),i=C(e,"onCreate",r),s=C(e,"onUpdate",r),l=C(e,"onSelectionUpdate",r),a=C(e,"onTransaction",r),c=C(e,"onFocus",r),d=C(e,"onBlur",r),u=C(e,"onDestroy",r);o&&this.editor.on("beforeCreate",o),i&&this.editor.on("create",i),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),u&&this.editor.on("destroy",u)})}},H=class n{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=b(b({},this.config),e),this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=R(C(this,"addOptions",{name:this.name}))),this.storage=R(C(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new n(e)}configure(e={}){let t=this.extend(v(b({},this.config),{addOptions:()=>$n(this.options,e)}));return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new n(b(b({},this.config),e));return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=R(C(t,"addOptions",{name:t.name})),t.storage=R(C(t,"addStorage",{name:t.name,options:t.options})),t}};function hs(n,e,t){let{from:r,to:o}=e,{blockSeparator:i=` -`,textSerializers:s={}}=t||{},l="";return n.nodesBetween(r,o,(a,c,d,u)=>{var f;a.isBlock&&c>r&&(l+=i);let h=s==null?void 0:s[a.type.name];if(h)return d&&(l+=h({node:a,pos:c,parent:d,index:u,range:e})),!1;a.isText&&(l+=(f=a==null?void 0:a.text)===null||f===void 0?void 0:f.slice(Math.max(r,c)-c,o-c))}),l}function _r(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}var ed=H.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new P({key:new V("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:o}=e,{ranges:i}=o,s=Math.min(...i.map(d=>d.$from.pos)),l=Math.max(...i.map(d=>d.$to.pos)),a=_r(t);return hs(r,{from:s,to:l},v(b({},this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{}),{textSerializers:a}))}}})]}}),jp=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),_p=(n=!1)=>({commands:e})=>e.setContent("",n),Wp=()=>({state:n,tr:e,dispatch:t})=>{let{selection:r}=e,{ranges:o}=r;return t&&o.forEach(({$from:i,$to:s})=>{n.doc.nodesBetween(i.pos,s.pos,(l,a)=>{if(l.type.isText)return;let{doc:c,mapping:d}=e,u=c.resolve(d.map(a)),f=c.resolve(d.map(a+l.nodeSize)),h=u.blockRange(f);if(!h)return;let p=je(h);if(l.type.isTextblock){let{defaultType:m}=u.parent.contentMatchAt(u.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},Kp=n=>e=>n(e),Jp=()=>({state:n,dispatch:e})=>qi(n,e),Up=(n,e)=>({editor:t,tr:r})=>{let{state:o}=t,i=o.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);let s=r.mapping.map(e);return r.insert(s,i.content),r.setSelection(new M(r.doc.resolve(s-1))),!0},qp=()=>({tr:n,dispatch:e})=>{let{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;let o=n.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===r.type){if(e){let l=o.before(i),a=o.after(i);n.delete(l,a).scrollIntoView()}return!0}return!1},Gp=n=>({tr:e,state:t,dispatch:r})=>{let o=X(n,t.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(r){let a=i.before(s),c=i.after(s);e.delete(a,c).scrollIntoView()}return!0}return!1},Yp=n=>({tr:e,dispatch:t})=>{let{from:r,to:o}=n;return t&&e.delete(r,o),!0},Qp=()=>({state:n,dispatch:e})=>Pr(n,e),Xp=()=>({commands:n})=>n.keyboardShortcut("Enter"),Zp=()=>({state:n,dispatch:e})=>Ui(n,e);function In(n,e,t={strict:!0}){let r=Object.keys(e);return r.length?r.every(o=>t.strict?e[o]===n[o]:jr(e[o])?e[o].test(n[o]):e[o]===n[o]):!0}function td(n,e,t={}){return n.find(r=>r.type===e&&In(Object.fromEntries(Object.keys(t).map(o=>[o,r.attrs[o]])),t))}function Kc(n,e,t={}){return!!td(n,e,t)}function Wr(n,e,t){var r;if(!n||!e)return;let o=n.parent.childAfter(n.parentOffset);if((!o.node||!o.node.marks.some(d=>d.type===e))&&(o=n.parent.childBefore(n.parentOffset)),!o.node||!o.node.marks.some(d=>d.type===e)||(t=t||((r=o.node.marks[0])===null||r===void 0?void 0:r.attrs),!td([...o.node.marks],e,t)))return;let s=o.index,l=n.start()+o.offset,a=s+1,c=l+o.node.nodeSize;for(;s>0&&Kc([...n.parent.child(s-1).marks],e,t);)s-=1,l-=n.parent.child(s).nodeSize;for(;a({tr:t,state:r,dispatch:o})=>{let i=qe(n,r.schema),{doc:s,selection:l}=t,{$from:a,from:c,to:d}=l;if(o){let u=Wr(a,i,e);if(u&&u.from<=c&&u.to>=d){let f=M.create(s,u.from,u.to);t.setSelection(f)}}return!0},tm=n=>e=>{let t=typeof n=="function"?n(e):n;for(let r=0;r({editor:t,view:r,tr:o,dispatch:i})=>{e=b({scrollIntoView:!0},e);let s=()=>{$n()&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(i&&n===null&&!ps(t.state.selection))return s(),!0;let l=ms(o.doc,n)||t.state.selection,a=t.state.selection.eq(l);return i&&(a||o.setSelection(l),a&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},rm=(n,e)=>t=>n.every((r,o)=>e(r,v(b({},t),{index:o}))),om=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),nd=n=>{let e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){let r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&nd(r)}return n};function Gt(n){let e=`${n}`,t=new window.DOMParser().parseFromString(e,"text/html").body;return nd(t)}function Pn(n,e,t){if(n instanceof me||n instanceof k)return n;t=b({slice:!0,parseOptions:{}},t);let r=typeof n=="object"&&n!==null,o=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return k.fromArray(n.map(l=>e.nodeFromJSON(l)));let s=e.nodeFromJSON(n);return t.errorOnInvalidContent&&s.check(),s}catch(i){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",i),Pn("",e,t)}if(o){if(t.errorOnInvalidContent){let s=!1,l="",a=new dn({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?Re.fromSchema(a).parseSlice(Gt(n),t.parseOptions):Re.fromSchema(a).parse(Gt(n),t.parseOptions),t.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}let i=Re.fromSchema(e);return t.slice?i.parseSlice(Gt(n),t.parseOptions).content:i.parse(Gt(n),t.parseOptions)}return Pn("",e,t)}function rd(n,e,t){let r=n.steps.length-1;if(r{s===0&&(s=d)}),n.setSelection(T.near(n.doc.resolve(s),t))}var im=n=>!("type"in n),sm=(n,e,t)=>({tr:r,dispatch:o,editor:i})=>{var s;if(o){t=b({parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1},t);let l;try{l=Pn(e,i.schema,{parseOptions:b({preserveWhitespace:"full"},t.parseOptions),errorOnInvalidContent:(s=t.errorOnInvalidContent)!==null&&s!==void 0?s:i.options.enableContentCheck})}catch(p){return i.emit("contentError",{editor:i,error:p,disableCollaboration:()=>{i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}}),!1}let{from:a,to:c}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},d=!0,u=!0;if((im(l)?l:[l]).forEach(p=>{p.check(),d=d?p.isText&&p.marks.length===0:!1,u=u?p.isBlock:!1}),a===c&&u){let{parent:p}=r.doc.resolve(a);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(a-=1,c+=1)}let h;if(d){if(Array.isArray(e))h=e.map(p=>p.text||"").join("");else if(e instanceof k){let p="";e.forEach(m=>{m.text&&(p+=m.text)}),h=p}else typeof e=="object"&&e&&e.text?h=e.text:h=e;r.insertText(h,a,c)}else h=l,r.replaceWith(a,c,h);t.updateSelection&&rd(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:a,text:h}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:a,text:h})}return!0},lm=()=>({state:n,dispatch:e})=>Pc(n,e),am=()=>({state:n,dispatch:e})=>Lc(n,e),cm=()=>({state:n,dispatch:e})=>Hi(n,e),dm=()=>({state:n,dispatch:e})=>ji(n,e),um=()=>({state:n,dispatch:e,tr:t})=>{try{let r=Ht(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch(r){return!1}},fm=()=>({state:n,dispatch:e,tr:t})=>{try{let r=Ht(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch(r){return!1}},hm=()=>({state:n,dispatch:e})=>vc(n,e),pm=()=>({state:n,dispatch:e})=>Rc(n,e);function gs(){return typeof navigator!="undefined"?/Mac/.test(navigator.platform):!1}function mm(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t==="Space"&&(t=" ");let r,o,i,s;for(let l=0;l({editor:e,view:t,tr:r,dispatch:o})=>{let i=mm(n).split(/-(?!$)/),s=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,l))});return a==null||a.steps.forEach(c=>{let d=c.map(r.mapping);d&&o&&r.maybeStep(d)}),!0};function Qt(n,e,t={}){let{from:r,to:o,empty:i}=n.selection,s=e?X(e,n.schema):null,l=[];n.doc.nodesBetween(r,o,(u,f)=>{if(u.isText)return;let h=Math.max(r,f),p=Math.min(o,f+u.nodeSize);l.push({node:u,from:h,to:p})});let a=o-r,c=l.filter(u=>s?s.name===u.node.type.name:!0).filter(u=>In(u.node.attrs,t,{strict:!1}));return i?!!c.length:c.reduce((u,f)=>u+f.to-f.from,0)>=a}var ym=(n,e={})=>({state:t,dispatch:r})=>{let o=X(n,t.schema);return Qt(t,o,e)?Bc(t,r):!1},bm=()=>({state:n,dispatch:e})=>Gi(n,e),km=n=>({state:e,dispatch:t})=>{let r=X(n,e.schema);return jc(r)(e,t)},xm=()=>({state:n,dispatch:e})=>Ki(n,e);function Vn(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function ss(n,e){let t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,o)=>(t.includes(o)||(r[o]=n[o]),r),{})}var Sm=(n,e)=>({tr:t,state:r,dispatch:o})=>{let i=null,s=null,l=Vn(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(i=X(n,r.schema)),l==="mark"&&(s=qe(n,r.schema)),o&&t.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(c,d)=>{i&&i===c.type&&t.setNodeMarkup(d,void 0,ss(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(u=>{s===u.type&&t.addMark(d,d+c.nodeSize,s.create(ss(u.attrs,e)))})})}),!0):!1},wm=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),Cm=()=>({tr:n,commands:e})=>e.setTextSelection({from:0,to:n.doc.content.size}),Mm=()=>({state:n,dispatch:e})=>$i(n,e),Tm=()=>({state:n,dispatch:e})=>_i(n,e),Am=()=>({state:n,dispatch:e})=>zc(n,e),Em=()=>({state:n,dispatch:e})=>Qi(n,e),Om=()=>({state:n,dispatch:e})=>Yi(n,e);function Hr(n,e,t={},r={}){return Pn(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}var Nm=(n,e=!1,t={},r={})=>({editor:o,tr:i,dispatch:s,commands:l})=>{var a,c;let{doc:d}=i;if(t.preserveWhitespace!=="full"){let u=Hr(n,o.schema,t,{errorOnInvalidContent:(a=r.errorOnInvalidContent)!==null&&a!==void 0?a:o.options.enableContentCheck});return s&&i.replaceWith(0,d.content.size,u).setMeta("preventUpdate",!e),!0}return s&&i.setMeta("preventUpdate",!e),l.insertContentAt({from:0,to:d.content.size},n,{parseOptions:t,errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:o.options.enableContentCheck})};function jn(n,e){let t=qe(e,n.schema),{from:r,to:o,empty:i}=n.selection,s=[];i?(n.storedMarks&&s.push(...n.storedMarks),s.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,o,a=>{s.push(...a.marks)});let l=s.find(a=>a.type.name===t.name);return l?b({},l.attrs):{}}function ys(n,e){let t=new et(n);return e.forEach(r=>{r.steps.forEach(o=>{t.step(o)})}),t}function od(n){for(let e=0;e{e(r)&&t.push({node:r,pos:o})}),t}function bs(n,e,t){let r=[];return n.nodesBetween(e.from,e.to,(o,i)=>{t(o)&&r.push({node:o,pos:i})}),r}function Kr(n,e){for(let t=n.depth;t>0;t-=1){let r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function _n(n){return e=>Kr(e.$from,n)}function Jr(n,e){let t=Fr.resolve(n);return fs(t,e)}function Rm(n,e){let t=Jr(e),r=me.fromJSON(t,n);return Fn(r.content,t)}function Dm(n,e){let t=Jr(e),r=Gt(n);return Re.fromSchema(t).parse(r).toJSON()}function ks(n,e){let t={from:0,to:n.content.size};return hs(n,t,e)}function Im(n,e,t){let{blockSeparator:r=` +`,textSerializers:s={}}=t||{},l="";return n.nodesBetween(r,o,(a,c,d,u)=>{var f;a.isBlock&&c>r&&(l+=i);let h=s==null?void 0:s[a.type.name];if(h)return d&&(l+=h({node:a,pos:c,parent:d,index:u,range:e})),!1;a.isText&&(l+=(f=a==null?void 0:a.text)===null||f===void 0?void 0:f.slice(Math.max(r,c)-c,o-c))}),l}function _r(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}var ed=H.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new P({key:new V("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:o}=e,{ranges:i}=o,s=Math.min(...i.map(d=>d.$from.pos)),l=Math.max(...i.map(d=>d.$to.pos)),a=_r(t);return hs(r,{from:s,to:l},v(b({},this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{}),{textSerializers:a}))}}})]}}),jp=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),_p=(n=!1)=>({commands:e})=>e.setContent("",n),Wp=()=>({state:n,tr:e,dispatch:t})=>{let{selection:r}=e,{ranges:o}=r;return t&&o.forEach(({$from:i,$to:s})=>{n.doc.nodesBetween(i.pos,s.pos,(l,a)=>{if(l.type.isText)return;let{doc:c,mapping:d}=e,u=c.resolve(d.map(a)),f=c.resolve(d.map(a+l.nodeSize)),h=u.blockRange(f);if(!h)return;let p=je(h);if(l.type.isTextblock){let{defaultType:m}=u.parent.contentMatchAt(u.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},Kp=n=>e=>n(e),Jp=()=>({state:n,dispatch:e})=>qi(n,e),Up=(n,e)=>({editor:t,tr:r})=>{let{state:o}=t,i=o.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);let s=r.mapping.map(e);return r.insert(s,i.content),r.setSelection(new M(r.doc.resolve(s-1))),!0},qp=()=>({tr:n,dispatch:e})=>{let{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;let o=n.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===r.type){if(e){let l=o.before(i),a=o.after(i);n.delete(l,a).scrollIntoView()}return!0}return!1},Gp=n=>({tr:e,state:t,dispatch:r})=>{let o=X(n,t.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(r){let a=i.before(s),c=i.after(s);e.delete(a,c).scrollIntoView()}return!0}return!1},Yp=n=>({tr:e,dispatch:t})=>{let{from:r,to:o}=n;return t&&e.delete(r,o),!0},Qp=()=>({state:n,dispatch:e})=>Pr(n,e),Xp=()=>({commands:n})=>n.keyboardShortcut("Enter"),Zp=()=>({state:n,dispatch:e})=>Ui(n,e);function Pn(n,e,t={strict:!0}){let r=Object.keys(e);return r.length?r.every(o=>t.strict?e[o]===n[o]:jr(e[o])?e[o].test(n[o]):e[o]===n[o]):!0}function td(n,e,t={}){return n.find(r=>r.type===e&&Pn(Object.fromEntries(Object.keys(t).map(o=>[o,r.attrs[o]])),t))}function Kc(n,e,t={}){return!!td(n,e,t)}function Wr(n,e,t){var r;if(!n||!e)return;let o=n.parent.childAfter(n.parentOffset);if((!o.node||!o.node.marks.some(d=>d.type===e))&&(o=n.parent.childBefore(n.parentOffset)),!o.node||!o.node.marks.some(d=>d.type===e)||(t=t||((r=o.node.marks[0])===null||r===void 0?void 0:r.attrs),!td([...o.node.marks],e,t)))return;let s=o.index,l=n.start()+o.offset,a=s+1,c=l+o.node.nodeSize;for(;s>0&&Kc([...n.parent.child(s-1).marks],e,t);)s-=1,l-=n.parent.child(s).nodeSize;for(;a({tr:t,state:r,dispatch:o})=>{let i=qe(n,r.schema),{doc:s,selection:l}=t,{$from:a,from:c,to:d}=l;if(o){let u=Wr(a,i,e);if(u&&u.from<=c&&u.to>=d){let f=M.create(s,u.from,u.to);t.setSelection(f)}}return!0},tm=n=>e=>{let t=typeof n=="function"?n(e):n;for(let r=0;r({editor:t,view:r,tr:o,dispatch:i})=>{e=b({scrollIntoView:!0},e);let s=()=>{Vn()&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(i&&n===null&&!ps(t.state.selection))return s(),!0;let l=ms(o.doc,n)||t.state.selection,a=t.state.selection.eq(l);return i&&(a||o.setSelection(l),a&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},rm=(n,e)=>t=>n.every((r,o)=>e(r,v(b({},t),{index:o}))),om=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),nd=n=>{let e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){let r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&nd(r)}return n};function Yt(n){let e=`${n}`,t=new window.DOMParser().parseFromString(e,"text/html").body;return nd(t)}function Ln(n,e,t){if(n instanceof me||n instanceof k)return n;t=b({slice:!0,parseOptions:{}},t);let r=typeof n=="object"&&n!==null,o=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return k.fromArray(n.map(l=>e.nodeFromJSON(l)));let s=e.nodeFromJSON(n);return t.errorOnInvalidContent&&s.check(),s}catch(i){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",i),Ln("",e,t)}if(o){if(t.errorOnInvalidContent){let s=!1,l="",a=new un({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?Re.fromSchema(a).parseSlice(Yt(n),t.parseOptions):Re.fromSchema(a).parse(Yt(n),t.parseOptions),t.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}let i=Re.fromSchema(e);return t.slice?i.parseSlice(Yt(n),t.parseOptions).content:i.parse(Yt(n),t.parseOptions)}return Ln("",e,t)}function rd(n,e,t){let r=n.steps.length-1;if(r{s===0&&(s=d)}),n.setSelection(T.near(n.doc.resolve(s),t))}var im=n=>!("type"in n),sm=(n,e,t)=>({tr:r,dispatch:o,editor:i})=>{var s;if(o){t=b({parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1},t);let l;try{l=Ln(e,i.schema,{parseOptions:b({preserveWhitespace:"full"},t.parseOptions),errorOnInvalidContent:(s=t.errorOnInvalidContent)!==null&&s!==void 0?s:i.options.enableContentCheck})}catch(p){return i.emit("contentError",{editor:i,error:p,disableCollaboration:()=>{i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}}),!1}let{from:a,to:c}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},d=!0,u=!0;if((im(l)?l:[l]).forEach(p=>{p.check(),d=d?p.isText&&p.marks.length===0:!1,u=u?p.isBlock:!1}),a===c&&u){let{parent:p}=r.doc.resolve(a);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(a-=1,c+=1)}let h;if(d){if(Array.isArray(e))h=e.map(p=>p.text||"").join("");else if(e instanceof k){let p="";e.forEach(m=>{m.text&&(p+=m.text)}),h=p}else typeof e=="object"&&e&&e.text?h=e.text:h=e;r.insertText(h,a,c)}else h=l,r.replaceWith(a,c,h);t.updateSelection&&rd(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:a,text:h}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:a,text:h})}return!0},lm=()=>({state:n,dispatch:e})=>Pc(n,e),am=()=>({state:n,dispatch:e})=>Lc(n,e),cm=()=>({state:n,dispatch:e})=>Hi(n,e),dm=()=>({state:n,dispatch:e})=>ji(n,e),um=()=>({state:n,dispatch:e,tr:t})=>{try{let r=$t(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch(r){return!1}},fm=()=>({state:n,dispatch:e,tr:t})=>{try{let r=$t(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch(r){return!1}},hm=()=>({state:n,dispatch:e})=>vc(n,e),pm=()=>({state:n,dispatch:e})=>Rc(n,e);function gs(){return typeof navigator!="undefined"?/Mac/.test(navigator.platform):!1}function mm(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t==="Space"&&(t=" ");let r,o,i,s;for(let l=0;l({editor:e,view:t,tr:r,dispatch:o})=>{let i=mm(n).split(/-(?!$)/),s=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,l))});return a==null||a.steps.forEach(c=>{let d=c.map(r.mapping);d&&o&&r.maybeStep(d)}),!0};function Xt(n,e,t={}){let{from:r,to:o,empty:i}=n.selection,s=e?X(e,n.schema):null,l=[];n.doc.nodesBetween(r,o,(u,f)=>{if(u.isText)return;let h=Math.max(r,f),p=Math.min(o,f+u.nodeSize);l.push({node:u,from:h,to:p})});let a=o-r,c=l.filter(u=>s?s.name===u.node.type.name:!0).filter(u=>Pn(u.node.attrs,t,{strict:!1}));return i?!!c.length:c.reduce((u,f)=>u+f.to-f.from,0)>=a}var ym=(n,e={})=>({state:t,dispatch:r})=>{let o=X(n,t.schema);return Xt(t,o,e)?Bc(t,r):!1},bm=()=>({state:n,dispatch:e})=>Gi(n,e),km=n=>({state:e,dispatch:t})=>{let r=X(n,e.schema);return jc(r)(e,t)},xm=()=>({state:n,dispatch:e})=>Ki(n,e);function jn(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function ss(n,e){let t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,o)=>(t.includes(o)||(r[o]=n[o]),r),{})}var Sm=(n,e)=>({tr:t,state:r,dispatch:o})=>{let i=null,s=null,l=jn(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(i=X(n,r.schema)),l==="mark"&&(s=qe(n,r.schema)),o&&t.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(c,d)=>{i&&i===c.type&&t.setNodeMarkup(d,void 0,ss(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(u=>{s===u.type&&t.addMark(d,d+c.nodeSize,s.create(ss(u.attrs,e)))})})}),!0):!1},wm=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),Cm=()=>({tr:n,commands:e})=>e.setTextSelection({from:0,to:n.doc.content.size}),Mm=()=>({state:n,dispatch:e})=>$i(n,e),Tm=()=>({state:n,dispatch:e})=>_i(n,e),Am=()=>({state:n,dispatch:e})=>zc(n,e),Em=()=>({state:n,dispatch:e})=>Qi(n,e),Om=()=>({state:n,dispatch:e})=>Yi(n,e);function Hr(n,e,t={},r={}){return Ln(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}var Nm=(n,e=!1,t={},r={})=>({editor:o,tr:i,dispatch:s,commands:l})=>{var a,c;let{doc:d}=i;if(t.preserveWhitespace!=="full"){let u=Hr(n,o.schema,t,{errorOnInvalidContent:(a=r.errorOnInvalidContent)!==null&&a!==void 0?a:o.options.enableContentCheck});return s&&i.replaceWith(0,d.content.size,u).setMeta("preventUpdate",!e),!0}return s&&i.setMeta("preventUpdate",!e),l.insertContentAt({from:0,to:d.content.size},n,{parseOptions:t,errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:o.options.enableContentCheck})};function _n(n,e){let t=qe(e,n.schema),{from:r,to:o,empty:i}=n.selection,s=[];i?(n.storedMarks&&s.push(...n.storedMarks),s.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,o,a=>{s.push(...a.marks)});let l=s.find(a=>a.type.name===t.name);return l?b({},l.attrs):{}}function ys(n,e){let t=new et(n);return e.forEach(r=>{r.steps.forEach(o=>{t.step(o)})}),t}function od(n){for(let e=0;e{e(r)&&t.push({node:r,pos:o})}),t}function bs(n,e,t){let r=[];return n.nodesBetween(e.from,e.to,(o,i)=>{t(o)&&r.push({node:o,pos:i})}),r}function Kr(n,e){for(let t=n.depth;t>0;t-=1){let r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function Wn(n){return e=>Kr(e.$from,n)}function Jr(n,e){let t=Fr.resolve(n);return fs(t,e)}function Rm(n,e){let t=Jr(e),r=me.fromJSON(t,n);return Hn(r.content,t)}function Dm(n,e){let t=Jr(e),r=Yt(n);return Re.fromSchema(t).parse(r).toJSON()}function ks(n,e){let t={from:0,to:n.content.size};return hs(n,t,e)}function Im(n,e,t){let{blockSeparator:r=` -`,textSerializers:o={}}=t||{},i=Jr(e),s=me.fromJSON(i,n);return ks(s,{blockSeparator:r,textSerializers:b(b({},_r(i)),o)})}function id(n,e){let t=X(e,n.schema),{from:r,to:o}=n.selection,i=[];n.doc.nodesBetween(r,o,l=>{i.push(l)});let s=i.reverse().find(l=>l.type.name===t.name);return s?b({},s.attrs):{}}function Ur(n,e){let t=Vn(typeof e=="string"?e:e.name,n.schema);return t==="node"?id(n,e):t==="mark"?jn(n,e):{}}function sd(n,e=JSON.stringify){let t={};return n.filter(r=>{let o=e(r);return Object.prototype.hasOwnProperty.call(t,o)?!1:t[o]=!0})}function Pm(n){let e=sd(n);return e.length===1?e:e.filter((t,r)=>!e.filter((i,s)=>s!==r).some(i=>t.oldRange.from>=i.oldRange.from&&t.oldRange.to<=i.oldRange.to&&t.newRange.from>=i.newRange.from&&t.newRange.to<=i.newRange.to))}function xs(n){let{mapping:e,steps:t}=n,r=[];return e.maps.forEach((o,i)=>{let s=[];if(o.ranges.length)o.forEach((l,a)=>{s.push({from:l,to:a})});else{let{from:l,to:a}=t[i];if(l===void 0||a===void 0)return;s.push({from:l,to:a})}s.forEach(({from:l,to:a})=>{let c=e.slice(i).map(l,-1),d=e.slice(i).map(a),u=e.invert().map(c,-1),f=e.invert().map(d);r.push({oldRange:{from:u,to:f},newRange:{from:c,to:d}})})}),Pm(r)}function ld(n,e=0){let r=n.type===n.type.schema.topNodeType?0:1,o=e,i=o+n.nodeSize,s=n.marks.map(c=>{let d={type:c.type.name};return Object.keys(c.attrs).length&&(d.attrs=b({},c.attrs)),d}),l=b({},n.attrs),a={type:n.type.name,from:o,to:i};return Object.keys(l).length&&(a.attrs=l),s.length&&(a.marks=s),n.content.childCount&&(a.content=[],n.forEach((c,d)=>{var u;(u=a.content)===null||u===void 0||u.push(ld(c,e+d+r))})),n.text&&(a.text=n.text),a}function Wn(n,e,t){let r=[];return n===e?t.resolve(n).marks().forEach(o=>{let i=t.resolve(n),s=Wr(i,o.type);s&&r.push(b({mark:o},s))}):t.nodesBetween(n,e,(o,i)=>{!o||(o==null?void 0:o.nodeSize)===void 0||r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}var Lm=(n,e,t,r=20)=>{let o=n.doc.resolve(t),i=r,s=null;for(;i>0&&s===null;){let l=o.node(i);(l==null?void 0:l.type.name)===e?s=l:i-=1}return[s,i]};function Dn(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{let o=n.find(i=>i.type===e&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}function $r(n,e,t={}){let{empty:r,ranges:o}=n.selection,i=e?qe(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(u=>i?i.name===u.type.name:!0).find(u=>In(u.attrs,t,{strict:!1}));let s=0,l=[];if(o.forEach(({$from:u,$to:f})=>{let h=u.pos,p=f.pos;n.doc.nodesBetween(h,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;let y=Math.max(h,g),w=Math.min(p,g+m.nodeSize),O=w-y;s+=O,l.push(...m.marks.map(L=>({mark:L,from:y,to:w})))})}),s===0)return!1;let a=l.filter(u=>i?i.name===u.mark.type.name:!0).filter(u=>In(u.mark.attrs,t,{strict:!1})).reduce((u,f)=>u+f.to-f.from,0),c=l.filter(u=>i?u.mark.type!==i&&u.mark.type.excludes(i):!0).reduce((u,f)=>u+f.to-f.from,0);return(a>0?a+c:a)>=s}function ad(n,e,t={}){if(!e)return Qt(n,null,t)||$r(n,null,t);let r=Vn(e,n.schema);return r==="node"?Qt(n,e,t):r==="mark"?$r(n,e,t):!1}var Bm=(n,e)=>{let{$from:t,$to:r,$anchor:o}=n.selection;if(e){let i=_n(l=>l.type.name===e)(n.selection);if(!i)return!1;let s=n.doc.resolve(i.pos+1);return o.pos+1===s.end()}return!(r.parentOffset{let{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function ls(n,e){let{nodeExtensions:t}=zn(e),r=t.find(s=>s.name===n);if(!r)return!1;let o={name:r.name,options:r.options,storage:r.storage},i=R(C(r,"group",o));return typeof i!="string"?!1:i.split(" ").includes("list")}function qr(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!==null&&r!==void 0?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let o=!0;return n.content.forEach(i=>{o!==!1&&(qr(i,{ignoreWhitespace:t,checkChildren:e})||(o=!1))}),o}return!1}function Ss(n){return n instanceof A}function Fm(n,e,t){let o=n.state.doc.content.size,i=Pe(e,0,o),s=Pe(t,0,o),l=n.coordsAtPos(i),a=n.coordsAtPos(s,-1),c=Math.min(l.top,a.top),d=Math.max(l.bottom,a.bottom),u=Math.min(l.left,a.left),f=Math.max(l.right,a.right),h=f-u,p=d-c,y={top:c,bottom:d,left:u,right:f,width:h,height:p,x:u,y:c};return v(b({},y),{toJSON:()=>y})}function Hm(n,e,t){var r;let{selection:o}=e,i=null;if(ps(o)&&(i=o.$cursor),i){let l=(r=n.storedMarks)!==null&&r!==void 0?r:i.marks();return!!t.isInSet(l)||!l.some(a=>a.type.excludes(t))}let{ranges:s}=o;return s.some(({$from:l,$to:a})=>{let c=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,a.pos,(d,u,f)=>{if(c)return!1;if(d.isInline){let h=!f||f.type.allowsMarkType(t),p=!!t.isInSet(d.marks)||!d.marks.some(m=>m.type.excludes(t));c=h&&p}return!c}),c})}var $m=(n,e={})=>({tr:t,state:r,dispatch:o})=>{let{selection:i}=t,{empty:s,ranges:l}=i,a=qe(n,r.schema);if(o)if(s){let c=jn(r,a);t.addStoredMark(a.create(b(b({},c),e)))}else l.forEach(c=>{let d=c.$from.pos,u=c.$to.pos;r.doc.nodesBetween(d,u,(f,h)=>{let p=Math.max(h,d),m=Math.min(h+f.nodeSize,u);f.marks.find(y=>y.type===a)?f.marks.forEach(y=>{a===y.type&&t.addMark(p,m,a.create(b(b({},y.attrs),e)))}):t.addMark(p,m,a.create(e))})});return Hm(r,t,a)},Vm=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),jm=(n,e={})=>({state:t,dispatch:r,chain:o})=>{let i=X(n,t.schema),s;return t.selection.$anchor.sameParent(t.selection.$head)&&(s=t.selection.$anchor.parent.attrs),i.isTextblock?o().command(({commands:l})=>Xi(i,b(b({},s),e))(t)?!0:l.clearNodes()).command(({state:l})=>Xi(i,b(b({},s),e))(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},_m=n=>({tr:e,dispatch:t})=>{if(t){let{doc:r}=e,o=Pe(n,0,r.content.size),i=A.create(r,o);e.setSelection(i)}return!0},Wm=n=>({tr:e,dispatch:t})=>{if(t){let{doc:r}=e,{from:o,to:i}=typeof n=="number"?{from:n,to:n}:n,s=M.atStart(r).from,l=M.atEnd(r).to,a=Pe(o,s,l),c=Pe(i,s,l),d=M.create(r,a,c);e.setSelection(d)}return!0},Km=n=>({state:e,dispatch:t})=>{let r=X(n,e.schema);return _c(r)(e,t)};function Jc(n,e){let t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){let r=t.filter(o=>e==null?void 0:e.includes(o.type.name));n.tr.ensureMarks(r)}}var Jm=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:o})=>{let{selection:i,doc:s}=e,{$from:l,$to:a}=i,c=o.extensionManager.attributes,d=Dn(c,l.node().type.name,l.node().attrs);if(i instanceof A&&i.node.isBlock)return!l.parentOffset||!we(s,l.pos)?!1:(r&&(n&&Jc(t,o.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;let u=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:od(l.node(-1).contentMatchAt(l.indexAfter(-1))),h=u&&f?[{type:f,attrs:d}]:void 0,p=we(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&we(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:d}]:void 0),r){if(p&&(i instanceof M&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!u&&!l.parentOffset&&l.parent.type!==f)){let m=e.mapping.map(l.before()),g=e.doc.resolve(m);l.node(-1).canReplaceWith(g.index(),g.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}n&&Jc(t,o.extensionManager.splittableMarks),e.scrollIntoView()}return p},Um=(n,e={})=>({tr:t,state:r,dispatch:o,editor:i})=>{var s;let l=X(n,r.schema),{$from:a,$to:c}=r.selection,d=r.selection.node;if(d&&d.isBlock||a.depth<2||!a.sameParent(c))return!1;let u=a.node(-1);if(u.type!==l)return!1;let f=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(o){let y=k.empty,w=a.index(-1)?1:a.index(-2)?2:3;for(let q=a.depth-w;q>=a.depth-3;q-=1)y=k.from(a.node(q).copy(y));let O=a.indexAfter(-1){if(W>-1)return!1;q.isTextblock&&q.content.size===0&&(W=B+1)}),W>-1&&t.setSelection(M.near(t.doc.resolve(W))),t.scrollIntoView()}return!0}let h=c.pos===a.end()?u.contentMatchAt(0).defaultType:null,p=b(b({},Dn(f,u.type.name,u.attrs)),e),m=b(b({},Dn(f,a.node().type.name,a.node().attrs)),e);t.delete(a.pos,c.pos);let g=h?[{type:l,attrs:p},{type:h,attrs:m}]:[{type:l,attrs:p}];if(!we(t.doc,a.pos,2))return!1;if(o){let{selection:y,storedMarks:w}=r,{splittableMarks:O}=i.extensionManager,L=w||y.$to.parentOffset&&y.$from.marks();if(t.split(a.pos,2,g).scrollIntoView(),!L||!o)return!0;let E=L.filter(I=>O.includes(I.type.name));t.ensureMarks(E)}return!0},es=(n,e)=>{let t=_n(s=>s.type===e)(n.selection);if(!t)return!0;let r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;let o=n.doc.nodeAt(r);return t.node.type===(o==null?void 0:o.type)&&Oe(n.doc,t.pos)&&n.join(t.pos),!0},ts=(n,e)=>{let t=_n(s=>s.type===e)(n.selection);if(!t)return!0;let r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;let o=n.doc.nodeAt(r);return t.node.type===(o==null?void 0:o.type)&&Oe(n.doc,r)&&n.join(r),!0},qm=(n,e,t,r={})=>({editor:o,tr:i,state:s,dispatch:l,chain:a,commands:c,can:d})=>{let{extensions:u,splittableMarks:f}=o.extensionManager,h=X(n,s.schema),p=X(e,s.schema),{selection:m,storedMarks:g}=s,{$from:y,$to:w}=m,O=y.blockRange(w),L=g||m.$to.parentOffset&&m.$from.marks();if(!O)return!1;let E=_n(I=>ls(I.type.name,u))(m);if(O.depth>=1&&E&&O.depth-E.depth<=1){if(E.node.type===h)return c.liftListItem(p);if(ls(E.node.type.name,u)&&h.validContent(E.node.content)&&l)return a().command(()=>(i.setNodeMarkup(E.pos,h),!0)).command(()=>es(i,h)).command(()=>ts(i,h)).run()}return!t||!L||!l?a().command(()=>d().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>es(i,h)).command(()=>ts(i,h)).run():a().command(()=>{let I=d().wrapInList(h,r),W=L.filter(q=>f.includes(q.type.name));return i.ensureMarks(W),I?!0:c.clearNodes()}).wrapInList(h,r).command(()=>es(i,h)).command(()=>ts(i,h)).run()},Gm=(n,e={},t={})=>({state:r,commands:o})=>{let{extendEmptyMarkRange:i=!1}=t,s=qe(n,r.schema);return $r(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},Ym=(n,e,t={})=>({state:r,commands:o})=>{let i=X(n,r.schema),s=X(e,r.schema),l=Qt(r,i,t),a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?o.setNode(s,a):o.setNode(i,b(b({},a),t))},Qm=(n,e={})=>({state:t,commands:r})=>{let o=X(n,t.schema);return Qt(t,o,e)?r.lift(o):r.wrapIn(o,e)},Xm=()=>({state:n,dispatch:e})=>{let t=n.plugins;for(let r=0;r=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(i.text){let a=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,n.schema.text(i.text,a))}else s.delete(i.from,i.to)}return!0}}return!1},Zm=()=>({tr:n,dispatch:e})=>{let{selection:t}=n,{empty:r,ranges:o}=t;return r||e&&o.forEach(i=>{n.removeMark(i.$from.pos,i.$to.pos)}),!0},eg=(n,e={})=>({tr:t,state:r,dispatch:o})=>{var i;let{extendEmptyMarkRange:s=!1}=e,{selection:l}=t,a=qe(n,r.schema),{$from:c,empty:d,ranges:u}=l;if(!o)return!0;if(d&&s){let{from:f,to:h}=l,p=(i=c.marks().find(g=>g.type===a))===null||i===void 0?void 0:i.attrs,m=Wr(c,a,p);m&&(f=m.from,h=m.to),t.removeMark(f,h,a)}else u.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,a)});return t.removeStoredMark(a),!0},tg=(n,e={})=>({tr:t,state:r,dispatch:o})=>{let i=null,s=null,l=Vn(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(i=X(n,r.schema)),l==="mark"&&(s=qe(n,r.schema)),o&&t.selection.ranges.forEach(a=>{let c=a.$from.pos,d=a.$to.pos,u,f,h,p;t.selection.empty?r.doc.nodesBetween(c,d,(m,g)=>{i&&i===m.type&&(h=Math.max(g,c),p=Math.min(g+m.nodeSize,d),u=g,f=m)}):r.doc.nodesBetween(c,d,(m,g)=>{g=c&&g<=d&&(i&&i===m.type&&t.setNodeMarkup(g,void 0,b(b({},m.attrs),e)),s&&m.marks.length&&m.marks.forEach(y=>{if(s===y.type){let w=Math.max(g,c),O=Math.min(g+m.nodeSize,d);t.addMark(w,O,s.create(b(b({},y.attrs),e)))}}))}),f&&(u!==void 0&&t.setNodeMarkup(u,void 0,b(b({},f.attrs),e)),s&&f.marks.length&&f.marks.forEach(m=>{s===m.type&&t.addMark(h,p,s.create(b(b({},m.attrs),e)))}))}),!0):!1},ng=(n,e={})=>({state:t,dispatch:r})=>{let o=X(n,t.schema);return $c(o,e)(t,r)},rg=(n,e={})=>({state:t,dispatch:r})=>{let o=X(n,t.schema);return Vc(o,e)(t,r)},og=Object.freeze({__proto__:null,blur:jp,clearContent:_p,clearNodes:Wp,command:Kp,createParagraphNear:Jp,cut:Up,deleteCurrentNode:qp,deleteNode:Gp,deleteRange:Yp,deleteSelection:Qp,enter:Xp,exitCode:Zp,extendMarkRange:em,first:tm,focus:nm,forEach:rm,insertContent:om,insertContentAt:sm,joinBackward:cm,joinDown:am,joinForward:dm,joinItemBackward:um,joinItemForward:fm,joinTextblockBackward:hm,joinTextblockForward:pm,joinUp:lm,keyboardShortcut:gm,lift:ym,liftEmptyBlock:bm,liftListItem:km,newlineInCode:xm,resetAttributes:Sm,scrollIntoView:wm,selectAll:Cm,selectNodeBackward:Mm,selectNodeForward:Tm,selectParentNode:Am,selectTextblockEnd:Em,selectTextblockStart:Om,setContent:Nm,setMark:$m,setMeta:Vm,setNode:jm,setNodeSelection:_m,setTextSelection:Wm,sinkListItem:Km,splitBlock:Jm,splitListItem:Um,toggleList:qm,toggleMark:Gm,toggleNode:Ym,toggleWrap:Qm,undoInputRule:Xm,unsetAllMarks:Zm,unsetMark:eg,updateAttributes:tg,wrapIn:ng,wrapInList:rg}),cd=H.create({name:"commands",addCommands(){return b({},og)}}),dd=H.create({name:"drop",addProseMirrorPlugins(){return[new P({key:new V("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),ud=H.create({name:"editable",addProseMirrorPlugins(){return[new P({key:new V("editable"),props:{editable:()=>this.editor.options.editable}})]}}),fd=H.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:n}=this;return[new P({key:new V("focusEvents"),props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;let r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;let r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),hd=H.create({name:"keymap",addKeyboardShortcuts(){let n=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{let{selection:a,doc:c}=l,{empty:d,$anchor:u}=a,{pos:f,parent:h}=u,p=u.parent.isTextblock&&f>0?l.doc.resolve(f-1):u,m=p.parent.type.spec.isolating,g=u.pos-u.parentOffset,y=m&&p.parent.childCount===1?g===u.pos:T.atStart(c).from===f;return!d||!h.type.isTextblock||h.textContent.length||!y||y&&u.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o=b({},r),i=v(b({},r),{"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()});return $n()||gs()?i:o},addProseMirrorPlugins(){return[new P({key:new V("clearDocument"),appendTransaction:(n,e,t)=>{let r=n.some(m=>m.docChanged)&&!e.doc.eq(t.doc),o=n.some(m=>m.getMeta("preventClearDocument"));if(!r||o)return;let{empty:i,from:s,to:l}=e.selection,a=T.atStart(e.doc).from,c=T.atEnd(e.doc).to;if(i||!(s===a&&l===c)||!qr(t.doc))return;let f=t.tr,h=Bn({state:t,transaction:f}),{commands:p}=new Nt({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),pd=H.create({name:"paste",addProseMirrorPlugins(){return[new P({key:new V("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),md=H.create({name:"tabindex",addProseMirrorPlugins(){return[new P({key:new V("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),ig=Object.freeze({__proto__:null,ClipboardTextSerializer:ed,Commands:cd,Drop:dd,Editable:ud,FocusEvents:fd,Keymap:hd,Paste:pd,Tabindex:md}),Vr=class n{get name(){return this.node.type.name}constructor(e,t,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=o}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},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?0:1)}get parent(){if(this.depth===0)return null;let e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new n(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new n(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new n(e,this.editor)}get children(){let e=[];return this.node.content.forEach((t,r)=>{let o=t.isBlock&&!t.isTextblock,i=t.isAtom&&!t.isText,s=this.pos+r+(i?0:1),l=this.resolvedPos.doc.resolve(s);if(!o&&l.depth<=this.depth)return;let a=new n(l,this.editor,o,o?t:null);o&&(a.actualDepth=this.depth+1),e.push(new n(l,this.editor,o,o?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(t).length>0){let i=o.node.attrs,s=Object.keys(t);for(let l=0;l{r&&o.length>0||(s.node.type.name===e&&i.every(a=>t[a]===s.node.attrs[a])&&o.push(s),!(r&&o.length>0)&&(o=o.concat(s.querySelectorAll(e,t,r))))}),o}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,b(b({},this.node.attrs),e)),this.editor.view.dispatch(t)}},sg=`.ProseMirror { +`,textSerializers:o={}}=t||{},i=Jr(e),s=me.fromJSON(i,n);return ks(s,{blockSeparator:r,textSerializers:b(b({},_r(i)),o)})}function id(n,e){let t=X(e,n.schema),{from:r,to:o}=n.selection,i=[];n.doc.nodesBetween(r,o,l=>{i.push(l)});let s=i.reverse().find(l=>l.type.name===t.name);return s?b({},s.attrs):{}}function Ur(n,e){let t=jn(typeof e=="string"?e:e.name,n.schema);return t==="node"?id(n,e):t==="mark"?_n(n,e):{}}function sd(n,e=JSON.stringify){let t={};return n.filter(r=>{let o=e(r);return Object.prototype.hasOwnProperty.call(t,o)?!1:t[o]=!0})}function Pm(n){let e=sd(n);return e.length===1?e:e.filter((t,r)=>!e.filter((i,s)=>s!==r).some(i=>t.oldRange.from>=i.oldRange.from&&t.oldRange.to<=i.oldRange.to&&t.newRange.from>=i.newRange.from&&t.newRange.to<=i.newRange.to))}function xs(n){let{mapping:e,steps:t}=n,r=[];return e.maps.forEach((o,i)=>{let s=[];if(o.ranges.length)o.forEach((l,a)=>{s.push({from:l,to:a})});else{let{from:l,to:a}=t[i];if(l===void 0||a===void 0)return;s.push({from:l,to:a})}s.forEach(({from:l,to:a})=>{let c=e.slice(i).map(l,-1),d=e.slice(i).map(a),u=e.invert().map(c,-1),f=e.invert().map(d);r.push({oldRange:{from:u,to:f},newRange:{from:c,to:d}})})}),Pm(r)}function ld(n,e=0){let r=n.type===n.type.schema.topNodeType?0:1,o=e,i=o+n.nodeSize,s=n.marks.map(c=>{let d={type:c.type.name};return Object.keys(c.attrs).length&&(d.attrs=b({},c.attrs)),d}),l=b({},n.attrs),a={type:n.type.name,from:o,to:i};return Object.keys(l).length&&(a.attrs=l),s.length&&(a.marks=s),n.content.childCount&&(a.content=[],n.forEach((c,d)=>{var u;(u=a.content)===null||u===void 0||u.push(ld(c,e+d+r))})),n.text&&(a.text=n.text),a}function Kn(n,e,t){let r=[];return n===e?t.resolve(n).marks().forEach(o=>{let i=t.resolve(n),s=Wr(i,o.type);s&&r.push(b({mark:o},s))}):t.nodesBetween(n,e,(o,i)=>{!o||(o==null?void 0:o.nodeSize)===void 0||r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}var Lm=(n,e,t,r=20)=>{let o=n.doc.resolve(t),i=r,s=null;for(;i>0&&s===null;){let l=o.node(i);(l==null?void 0:l.type.name)===e?s=l:i-=1}return[s,i]};function In(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{let o=n.find(i=>i.type===e&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}function $r(n,e,t={}){let{empty:r,ranges:o}=n.selection,i=e?qe(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(u=>i?i.name===u.type.name:!0).find(u=>Pn(u.attrs,t,{strict:!1}));let s=0,l=[];if(o.forEach(({$from:u,$to:f})=>{let h=u.pos,p=f.pos;n.doc.nodesBetween(h,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;let y=Math.max(h,g),w=Math.min(p,g+m.nodeSize),O=w-y;s+=O,l.push(...m.marks.map(L=>({mark:L,from:y,to:w})))})}),s===0)return!1;let a=l.filter(u=>i?i.name===u.mark.type.name:!0).filter(u=>Pn(u.mark.attrs,t,{strict:!1})).reduce((u,f)=>u+f.to-f.from,0),c=l.filter(u=>i?u.mark.type!==i&&u.mark.type.excludes(i):!0).reduce((u,f)=>u+f.to-f.from,0);return(a>0?a+c:a)>=s}function ad(n,e,t={}){if(!e)return Xt(n,null,t)||$r(n,null,t);let r=jn(e,n.schema);return r==="node"?Xt(n,e,t):r==="mark"?$r(n,e,t):!1}var Bm=(n,e)=>{let{$from:t,$to:r,$anchor:o}=n.selection;if(e){let i=Wn(l=>l.type.name===e)(n.selection);if(!i)return!1;let s=n.doc.resolve(i.pos+1);return o.pos+1===s.end()}return!(r.parentOffset{let{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function ls(n,e){let{nodeExtensions:t}=Fn(e),r=t.find(s=>s.name===n);if(!r)return!1;let o={name:r.name,options:r.options,storage:r.storage},i=R(C(r,"group",o));return typeof i!="string"?!1:i.split(" ").includes("list")}function qr(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!==null&&r!==void 0?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let o=!0;return n.content.forEach(i=>{o!==!1&&(qr(i,{ignoreWhitespace:t,checkChildren:e})||(o=!1))}),o}return!1}function Ss(n){return n instanceof A}function Fm(n,e,t){let o=n.state.doc.content.size,i=Pe(e,0,o),s=Pe(t,0,o),l=n.coordsAtPos(i),a=n.coordsAtPos(s,-1),c=Math.min(l.top,a.top),d=Math.max(l.bottom,a.bottom),u=Math.min(l.left,a.left),f=Math.max(l.right,a.right),h=f-u,p=d-c,y={top:c,bottom:d,left:u,right:f,width:h,height:p,x:u,y:c};return v(b({},y),{toJSON:()=>y})}function Hm(n,e,t){var r;let{selection:o}=e,i=null;if(ps(o)&&(i=o.$cursor),i){let l=(r=n.storedMarks)!==null&&r!==void 0?r:i.marks();return!!t.isInSet(l)||!l.some(a=>a.type.excludes(t))}let{ranges:s}=o;return s.some(({$from:l,$to:a})=>{let c=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,a.pos,(d,u,f)=>{if(c)return!1;if(d.isInline){let h=!f||f.type.allowsMarkType(t),p=!!t.isInSet(d.marks)||!d.marks.some(m=>m.type.excludes(t));c=h&&p}return!c}),c})}var $m=(n,e={})=>({tr:t,state:r,dispatch:o})=>{let{selection:i}=t,{empty:s,ranges:l}=i,a=qe(n,r.schema);if(o)if(s){let c=_n(r,a);t.addStoredMark(a.create(b(b({},c),e)))}else l.forEach(c=>{let d=c.$from.pos,u=c.$to.pos;r.doc.nodesBetween(d,u,(f,h)=>{let p=Math.max(h,d),m=Math.min(h+f.nodeSize,u);f.marks.find(y=>y.type===a)?f.marks.forEach(y=>{a===y.type&&t.addMark(p,m,a.create(b(b({},y.attrs),e)))}):t.addMark(p,m,a.create(e))})});return Hm(r,t,a)},Vm=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),jm=(n,e={})=>({state:t,dispatch:r,chain:o})=>{let i=X(n,t.schema),s;return t.selection.$anchor.sameParent(t.selection.$head)&&(s=t.selection.$anchor.parent.attrs),i.isTextblock?o().command(({commands:l})=>Xi(i,b(b({},s),e))(t)?!0:l.clearNodes()).command(({state:l})=>Xi(i,b(b({},s),e))(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},_m=n=>({tr:e,dispatch:t})=>{if(t){let{doc:r}=e,o=Pe(n,0,r.content.size),i=A.create(r,o);e.setSelection(i)}return!0},Wm=n=>({tr:e,dispatch:t})=>{if(t){let{doc:r}=e,{from:o,to:i}=typeof n=="number"?{from:n,to:n}:n,s=M.atStart(r).from,l=M.atEnd(r).to,a=Pe(o,s,l),c=Pe(i,s,l),d=M.create(r,a,c);e.setSelection(d)}return!0},Km=n=>({state:e,dispatch:t})=>{let r=X(n,e.schema);return _c(r)(e,t)};function Jc(n,e){let t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){let r=t.filter(o=>e==null?void 0:e.includes(o.type.name));n.tr.ensureMarks(r)}}var Jm=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:o})=>{let{selection:i,doc:s}=e,{$from:l,$to:a}=i,c=o.extensionManager.attributes,d=In(c,l.node().type.name,l.node().attrs);if(i instanceof A&&i.node.isBlock)return!l.parentOffset||!we(s,l.pos)?!1:(r&&(n&&Jc(t,o.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;let u=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:od(l.node(-1).contentMatchAt(l.indexAfter(-1))),h=u&&f?[{type:f,attrs:d}]:void 0,p=we(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&we(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:d}]:void 0),r){if(p&&(i instanceof M&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!u&&!l.parentOffset&&l.parent.type!==f)){let m=e.mapping.map(l.before()),g=e.doc.resolve(m);l.node(-1).canReplaceWith(g.index(),g.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}n&&Jc(t,o.extensionManager.splittableMarks),e.scrollIntoView()}return p},Um=(n,e={})=>({tr:t,state:r,dispatch:o,editor:i})=>{var s;let l=X(n,r.schema),{$from:a,$to:c}=r.selection,d=r.selection.node;if(d&&d.isBlock||a.depth<2||!a.sameParent(c))return!1;let u=a.node(-1);if(u.type!==l)return!1;let f=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(o){let y=k.empty,w=a.index(-1)?1:a.index(-2)?2:3;for(let q=a.depth-w;q>=a.depth-3;q-=1)y=k.from(a.node(q).copy(y));let O=a.indexAfter(-1){if(W>-1)return!1;q.isTextblock&&q.content.size===0&&(W=B+1)}),W>-1&&t.setSelection(M.near(t.doc.resolve(W))),t.scrollIntoView()}return!0}let h=c.pos===a.end()?u.contentMatchAt(0).defaultType:null,p=b(b({},In(f,u.type.name,u.attrs)),e),m=b(b({},In(f,a.node().type.name,a.node().attrs)),e);t.delete(a.pos,c.pos);let g=h?[{type:l,attrs:p},{type:h,attrs:m}]:[{type:l,attrs:p}];if(!we(t.doc,a.pos,2))return!1;if(o){let{selection:y,storedMarks:w}=r,{splittableMarks:O}=i.extensionManager,L=w||y.$to.parentOffset&&y.$from.marks();if(t.split(a.pos,2,g).scrollIntoView(),!L||!o)return!0;let E=L.filter(I=>O.includes(I.type.name));t.ensureMarks(E)}return!0},es=(n,e)=>{let t=Wn(s=>s.type===e)(n.selection);if(!t)return!0;let r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;let o=n.doc.nodeAt(r);return t.node.type===(o==null?void 0:o.type)&&Oe(n.doc,t.pos)&&n.join(t.pos),!0},ts=(n,e)=>{let t=Wn(s=>s.type===e)(n.selection);if(!t)return!0;let r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;let o=n.doc.nodeAt(r);return t.node.type===(o==null?void 0:o.type)&&Oe(n.doc,r)&&n.join(r),!0},qm=(n,e,t,r={})=>({editor:o,tr:i,state:s,dispatch:l,chain:a,commands:c,can:d})=>{let{extensions:u,splittableMarks:f}=o.extensionManager,h=X(n,s.schema),p=X(e,s.schema),{selection:m,storedMarks:g}=s,{$from:y,$to:w}=m,O=y.blockRange(w),L=g||m.$to.parentOffset&&m.$from.marks();if(!O)return!1;let E=Wn(I=>ls(I.type.name,u))(m);if(O.depth>=1&&E&&O.depth-E.depth<=1){if(E.node.type===h)return c.liftListItem(p);if(ls(E.node.type.name,u)&&h.validContent(E.node.content)&&l)return a().command(()=>(i.setNodeMarkup(E.pos,h),!0)).command(()=>es(i,h)).command(()=>ts(i,h)).run()}return!t||!L||!l?a().command(()=>d().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>es(i,h)).command(()=>ts(i,h)).run():a().command(()=>{let I=d().wrapInList(h,r),W=L.filter(q=>f.includes(q.type.name));return i.ensureMarks(W),I?!0:c.clearNodes()}).wrapInList(h,r).command(()=>es(i,h)).command(()=>ts(i,h)).run()},Gm=(n,e={},t={})=>({state:r,commands:o})=>{let{extendEmptyMarkRange:i=!1}=t,s=qe(n,r.schema);return $r(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},Ym=(n,e,t={})=>({state:r,commands:o})=>{let i=X(n,r.schema),s=X(e,r.schema),l=Xt(r,i,t),a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?o.setNode(s,a):o.setNode(i,b(b({},a),t))},Qm=(n,e={})=>({state:t,commands:r})=>{let o=X(n,t.schema);return Xt(t,o,e)?r.lift(o):r.wrapIn(o,e)},Xm=()=>({state:n,dispatch:e})=>{let t=n.plugins;for(let r=0;r=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(i.text){let a=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,n.schema.text(i.text,a))}else s.delete(i.from,i.to)}return!0}}return!1},Zm=()=>({tr:n,dispatch:e})=>{let{selection:t}=n,{empty:r,ranges:o}=t;return r||e&&o.forEach(i=>{n.removeMark(i.$from.pos,i.$to.pos)}),!0},eg=(n,e={})=>({tr:t,state:r,dispatch:o})=>{var i;let{extendEmptyMarkRange:s=!1}=e,{selection:l}=t,a=qe(n,r.schema),{$from:c,empty:d,ranges:u}=l;if(!o)return!0;if(d&&s){let{from:f,to:h}=l,p=(i=c.marks().find(g=>g.type===a))===null||i===void 0?void 0:i.attrs,m=Wr(c,a,p);m&&(f=m.from,h=m.to),t.removeMark(f,h,a)}else u.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,a)});return t.removeStoredMark(a),!0},tg=(n,e={})=>({tr:t,state:r,dispatch:o})=>{let i=null,s=null,l=jn(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(i=X(n,r.schema)),l==="mark"&&(s=qe(n,r.schema)),o&&t.selection.ranges.forEach(a=>{let c=a.$from.pos,d=a.$to.pos,u,f,h,p;t.selection.empty?r.doc.nodesBetween(c,d,(m,g)=>{i&&i===m.type&&(h=Math.max(g,c),p=Math.min(g+m.nodeSize,d),u=g,f=m)}):r.doc.nodesBetween(c,d,(m,g)=>{g=c&&g<=d&&(i&&i===m.type&&t.setNodeMarkup(g,void 0,b(b({},m.attrs),e)),s&&m.marks.length&&m.marks.forEach(y=>{if(s===y.type){let w=Math.max(g,c),O=Math.min(g+m.nodeSize,d);t.addMark(w,O,s.create(b(b({},y.attrs),e)))}}))}),f&&(u!==void 0&&t.setNodeMarkup(u,void 0,b(b({},f.attrs),e)),s&&f.marks.length&&f.marks.forEach(m=>{s===m.type&&t.addMark(h,p,s.create(b(b({},m.attrs),e)))}))}),!0):!1},ng=(n,e={})=>({state:t,dispatch:r})=>{let o=X(n,t.schema);return $c(o,e)(t,r)},rg=(n,e={})=>({state:t,dispatch:r})=>{let o=X(n,t.schema);return Vc(o,e)(t,r)},og=Object.freeze({__proto__:null,blur:jp,clearContent:_p,clearNodes:Wp,command:Kp,createParagraphNear:Jp,cut:Up,deleteCurrentNode:qp,deleteNode:Gp,deleteRange:Yp,deleteSelection:Qp,enter:Xp,exitCode:Zp,extendMarkRange:em,first:tm,focus:nm,forEach:rm,insertContent:om,insertContentAt:sm,joinBackward:cm,joinDown:am,joinForward:dm,joinItemBackward:um,joinItemForward:fm,joinTextblockBackward:hm,joinTextblockForward:pm,joinUp:lm,keyboardShortcut:gm,lift:ym,liftEmptyBlock:bm,liftListItem:km,newlineInCode:xm,resetAttributes:Sm,scrollIntoView:wm,selectAll:Cm,selectNodeBackward:Mm,selectNodeForward:Tm,selectParentNode:Am,selectTextblockEnd:Em,selectTextblockStart:Om,setContent:Nm,setMark:$m,setMeta:Vm,setNode:jm,setNodeSelection:_m,setTextSelection:Wm,sinkListItem:Km,splitBlock:Jm,splitListItem:Um,toggleList:qm,toggleMark:Gm,toggleNode:Ym,toggleWrap:Qm,undoInputRule:Xm,unsetAllMarks:Zm,unsetMark:eg,updateAttributes:tg,wrapIn:ng,wrapInList:rg}),cd=H.create({name:"commands",addCommands(){return b({},og)}}),dd=H.create({name:"drop",addProseMirrorPlugins(){return[new P({key:new V("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),ud=H.create({name:"editable",addProseMirrorPlugins(){return[new P({key:new V("editable"),props:{editable:()=>this.editor.options.editable}})]}}),fd=H.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:n}=this;return[new P({key:new V("focusEvents"),props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;let r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;let r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),hd=H.create({name:"keymap",addKeyboardShortcuts(){let n=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{let{selection:a,doc:c}=l,{empty:d,$anchor:u}=a,{pos:f,parent:h}=u,p=u.parent.isTextblock&&f>0?l.doc.resolve(f-1):u,m=p.parent.type.spec.isolating,g=u.pos-u.parentOffset,y=m&&p.parent.childCount===1?g===u.pos:T.atStart(c).from===f;return!d||!h.type.isTextblock||h.textContent.length||!y||y&&u.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o=b({},r),i=v(b({},r),{"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()});return Vn()||gs()?i:o},addProseMirrorPlugins(){return[new P({key:new V("clearDocument"),appendTransaction:(n,e,t)=>{let r=n.some(m=>m.docChanged)&&!e.doc.eq(t.doc),o=n.some(m=>m.getMeta("preventClearDocument"));if(!r||o)return;let{empty:i,from:s,to:l}=e.selection,a=T.atStart(e.doc).from,c=T.atEnd(e.doc).to;if(i||!(s===a&&l===c)||!qr(t.doc))return;let f=t.tr,h=zn({state:t,transaction:f}),{commands:p}=new Nt({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),pd=H.create({name:"paste",addProseMirrorPlugins(){return[new P({key:new V("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),md=H.create({name:"tabindex",addProseMirrorPlugins(){return[new P({key:new V("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),ig=Object.freeze({__proto__:null,ClipboardTextSerializer:ed,Commands:cd,Drop:dd,Editable:ud,FocusEvents:fd,Keymap:hd,Paste:pd,Tabindex:md}),Vr=class n{get name(){return this.node.type.name}constructor(e,t,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=o}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},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?0:1)}get parent(){if(this.depth===0)return null;let e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new n(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new n(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new n(e,this.editor)}get children(){let e=[];return this.node.content.forEach((t,r)=>{let o=t.isBlock&&!t.isTextblock,i=t.isAtom&&!t.isText,s=this.pos+r+(i?0:1),l=this.resolvedPos.doc.resolve(s);if(!o&&l.depth<=this.depth)return;let a=new n(l,this.editor,o,o?t:null);o&&(a.actualDepth=this.depth+1),e.push(new n(l,this.editor,o,o?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(t).length>0){let i=o.node.attrs,s=Object.keys(t);for(let l=0;l{r&&o.length>0||(s.node.type.name===e&&i.every(a=>t[a]===s.node.attrs[a])&&o.push(s),!(r&&o.length>0)&&(o=o.concat(s.querySelectorAll(e,t,r))))}),o}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,b(b({},this.node.attrs),e)),this.editor.view.dispatch(t)}},sg=`.ProseMirror { position: relative; } @@ -86,14 +86,14 @@ img.ProseMirror-separator { .tippy-box[data-animation=fade][data-state=hidden] { opacity: 0 -}`;function gd(n,e,t){let r=document.querySelector(`style[data-tiptap-style${t?`-${t}`:""}]`);if(r!==null)return r;let o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute(`data-tiptap-style${t?`-${t}`:""}`,""),o.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(o),o}var Ln=class extends ns{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:t})=>{throw t},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),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:t,slice:r,moved:o})=>this.options.onDrop(t,r,o)),this.on("paste",({event:t,slice:r})=>this.options.onPaste(t,r)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}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&&document&&(this.css=gd(sg,this.options.injectNonce))}setOptions(e={}){this.options=b(b({},this.options),e),!(!this.view||!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})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,t){let r=us(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],o=this.state.reconfigure({plugins:r});return this.view.updateState(o),o}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,r=t;if([].concat(e).forEach(i=>{let s=typeof i=="string"?`${i}$`:i.key;r=t.filter(l=>!l.key.startsWith(s))}),t.length===r.length)return;let o=this.state.reconfigure({plugins:r});return this.view.updateState(o),o}createExtensionManager(){var e,t;let o=[...this.options.enableCoreExtensions?[ud,ed.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),cd,fd,hd,md,dd,pd].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i==null?void 0:i.type));this.extensionManager=new Fr(o,this)}createCommandManager(){this.commandManager=new Nt({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let t;try{t=Hr(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(s){if(!(s instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(s.message))throw s;this.emit("contentError",{editor:this,error:s,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(l=>l.name!=="collaboration"),this.createExtensionManager()}}),t=Hr(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}let r=ms(t,this.options.autofocus);this.view=new Nr(this.options.element,v(b({},this.options.editorProps),{attributes:b({role:"textbox"},(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes),dispatchTransaction:this.dispatchTransaction.bind(this),state:br.create({doc:t,selection:r||void 0})}));let o=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(o),this.createNodeViews(),this.prependClass();let i=this.view.dom;i.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${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(s=>{var l;return(l=this.capturedTransaction)===null||l===void 0?void 0:l.step(s)});return}let t=this.state.apply(e),r=!this.state.selection.eq(t.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});let o=e.getMeta("focus"),i=e.getMeta("blur");o&&this.emit("focus",{editor:this,event:o.event,transaction:e}),i&&this.emit("blur",{editor:this,event:i.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return Ur(this.state,e)}isActive(e,t){let r=typeof e=="string"?e:null,o=typeof e=="string"?t:e;return ad(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Fn(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=` +}`;function gd(n,e,t){let r=document.querySelector(`style[data-tiptap-style${t?`-${t}`:""}]`);if(r!==null)return r;let o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute(`data-tiptap-style${t?`-${t}`:""}`,""),o.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(o),o}var Bn=class extends ns{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:t})=>{throw t},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),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:t,slice:r,moved:o})=>this.options.onDrop(t,r,o)),this.on("paste",({event:t,slice:r})=>this.options.onPaste(t,r)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}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&&document&&(this.css=gd(sg,this.options.injectNonce))}setOptions(e={}){this.options=b(b({},this.options),e),!(!this.view||!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})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,t){let r=us(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],o=this.state.reconfigure({plugins:r});return this.view.updateState(o),o}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,r=t;if([].concat(e).forEach(i=>{let s=typeof i=="string"?`${i}$`:i.key;r=t.filter(l=>!l.key.startsWith(s))}),t.length===r.length)return;let o=this.state.reconfigure({plugins:r});return this.view.updateState(o),o}createExtensionManager(){var e,t;let o=[...this.options.enableCoreExtensions?[ud,ed.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),cd,fd,hd,md,dd,pd].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i==null?void 0:i.type));this.extensionManager=new Fr(o,this)}createCommandManager(){this.commandManager=new Nt({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let t;try{t=Hr(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(s){if(!(s instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(s.message))throw s;this.emit("contentError",{editor:this,error:s,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(l=>l.name!=="collaboration"),this.createExtensionManager()}}),t=Hr(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}let r=ms(t,this.options.autofocus);this.view=new Nr(this.options.element,v(b({},this.options.editorProps),{attributes:b({role:"textbox"},(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes),dispatchTransaction:this.dispatchTransaction.bind(this),state:br.create({doc:t,selection:r||void 0})}));let o=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(o),this.createNodeViews(),this.prependClass();let i=this.view.dom;i.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${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(s=>{var l;return(l=this.capturedTransaction)===null||l===void 0?void 0:l.step(s)});return}let t=this.state.apply(e),r=!this.state.selection.eq(t.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});let o=e.getMeta("focus"),i=e.getMeta("blur");o&&this.emit("focus",{editor:this,event:o.event,transaction:e}),i&&this.emit("blur",{editor:this,event:i.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return Ur(this.state,e)}isActive(e,t){let r=typeof e=="string"?e:null,o=typeof e=="string"?t:e;return ad(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Hn(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=` -`,textSerializers:r={}}=e||{};return ks(this.state.doc,{blockSeparator:t,textSerializers:b(b({},_r(this.schema)),r)})}get isEmpty(){return qr(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){let e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,t))||null}$pos(e){let t=this.state.doc.resolve(e);return new Vr(t,this)}get $doc(){return this.$pos(0)}};function ke(n){return new at({find:n.find,handler:({state:e,range:t,match:r})=>{let o=R(n.getAttributes,void 0,r);if(o===!1||o===null)return null;let{tr:i}=e,s=r[r.length-1],l=r[0];if(s){let a=l.search(/\S/),c=t.from+l.indexOf(s),d=c+s.length;if(Wn(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===n.type&&m!==h.mark.type)).filter(h=>h.to>c).length)return null;dt.from&&i.delete(t.from+a,c);let f=t.from+a+s.length;i.addMark(t.from+a,f,n.type.create(o||{})),i.removeStoredMark(n.type)}}})}function ws(n){return new at({find:n.find,handler:({state:e,range:t,match:r})=>{let o=R(n.getAttributes,void 0,r)||{},{tr:i}=e,s=t.from,l=t.to,a=n.type.create(o);if(r[1]){let c=r[0].lastIndexOf(r[1]),d=s+c;d>l?d=l:l=d+r[1].length;let u=r[0][r[0].length-1];i.insertText(u,s+r[0].length-1),i.replaceWith(d,l,a)}else if(r[0]){let c=n.type.isInline?s:s-1;i.insert(c,n.type.create(o)).delete(i.mapping.map(s),i.mapping.map(l))}i.scrollIntoView()}})}function Xt(n){return new at({find:n.find,handler:({state:e,range:t,match:r})=>{let o=e.doc.resolve(t.from),i=R(n.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,i)}})}function lg(n){return new at({find:n.find,handler:({state:e,range:t,match:r})=>{let o=n.replace,i=t.from,s=t.to;if(r[1]){let l=r[0].lastIndexOf(r[1]);o+=r[0].slice(l+r[1].length),i+=l;let a=i-s;a>0&&(o=r[0].slice(l-a,l)+o,i=s)}e.tr.insertText(o,i,s)}})}function Ge(n){return new at({find:n.find,handler:({state:e,range:t,match:r,chain:o})=>{let i=R(n.getAttributes,void 0,r)||{},s=e.tr.delete(t.from,t.to),a=s.doc.resolve(t.from).blockRange(),c=a&&Ft(a,n.type,i);if(!c)return null;if(s.wrap(a,c),n.keepMarks&&n.editor){let{selection:u,storedMarks:f}=e,{splittableMarks:h}=n.editor.extensionManager,p=f||u.$to.parentOffset&&u.$from.marks();if(p){let m=p.filter(g=>h.includes(g.type.name));s.ensureMarks(m)}}if(n.keepAttributes){let u=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(u,i).run()}let d=s.doc.resolve(t.from-1).nodeBefore;d&&d.type===n.type&&Oe(s.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,d))&&s.join(t.from-1)}})}var z=class n{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=b(b({},this.config),e),this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=R(C(this,"addOptions",{name:this.name}))),this.storage=R(C(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new n(e)}configure(e={}){let t=this.extend(v(b({},this.config),{addOptions:()=>Hn(this.options,e)}));return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new n(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=R(C(t,"addOptions",{name:t.name})),t.storage=R(C(t,"addStorage",{name:t.name,options:t.options})),t}};function ag(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}var as=class{constructor(e,t,r){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options=b({stopEvent:null,ignoreMutation:null},r),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,r,o,i,s,l,a;let{view:c}=this.editor,d=e.target,u=d.nodeType===3?(t=d.parentElement)===null||t===void 0?void 0:t.closest("[data-drag-handle]"):d.closest("[data-drag-handle]");if(!this.dom||!((r=this.contentDOM)===null||r===void 0)&&r.contains(d)||!u)return;let f=0,h=0;if(this.dom!==u){let y=this.dom.getBoundingClientRect(),w=u.getBoundingClientRect(),O=(o=e.offsetX)!==null&&o!==void 0?o:(i=e.nativeEvent)===null||i===void 0?void 0:i.offsetX,L=(s=e.offsetY)!==null&&s!==void 0?s:(l=e.nativeEvent)===null||l===void 0?void 0:l.offsetY;f=w.x-y.x+O,h=w.y-y.y+L}(a=e.dataTransfer)===null||a===void 0||a.setDragImage(this.dom,f,h);let p=this.getPos();if(typeof p!="number")return;let m=A.create(c.state.doc,p),g=c.state.tr.setSelection(m);c.dispatch(g)}stopEvent(e){var t;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:e});let r=e.target;if(!(this.dom.contains(r)&&!(!((t=this.contentDOM)===null||t===void 0)&&t.contains(r))))return!1;let i=e.type.startsWith("drag"),s=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(r.tagName)||r.isContentEditable)&&!s&&!i)return!0;let{isEditable:a}=this.editor,{isDragging:c}=this,d=!!this.node.type.spec.draggable,u=A.isSelectable(this.node),f=e.type==="copy",h=e.type==="paste",p=e.type==="cut",m=e.type==="mousedown";if(!d&&u&&i&&e.preventDefault(),d&&i&&!c)return e.preventDefault(),!1;if(d&&a&&!c&&m){let g=r.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(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!(c||s||f||h||p||m&&u)}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type==="selection"||this.dom.contains(e.target)&&e.type==="childList"&&($n()||ag())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(r=>r.isContentEditable)?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target)}updateAttributes(e){this.editor.commands.command(({tr:t})=>{let r=this.getPos();return typeof r!="number"?!1:(t.setNodeMarkup(r,void 0,b(b({},this.node.attrs),e)),!0)})}deleteNode(){let e=this.getPos();if(typeof e!="number")return;let t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function pe(n){return new Yt({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:o})=>{let i=R(n.getAttributes,void 0,r,o);if(i===!1||i===null)return null;let{tr:s}=e,l=r[r.length-1],a=r[0],c=t.to;if(l){let d=a.search(/\S/),u=t.from+a.indexOf(l),f=u+l.length;if(Wn(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===n.type&&g!==p.mark.type)).filter(p=>p.to>u).length)return null;ft.from&&s.delete(t.from+d,u),c=t.from+d+l.length,s.addMark(t.from+d,c,n.type.create(i||{})),s.removeStoredMark(n.type)}}})}function cg(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function dg(n){return typeof n=="string"}function ug(n){return new Yt({find:n.find,handler({match:e,chain:t,range:r,pasteEvent:o}){let i=R(n.getAttributes,void 0,e,o),s=R(n.getContent,void 0,i);if(i===!1||i===null)return null;let l={type:n.type.name,attrs:i};s&&(l.content=s),e.input&&t().deleteRange(r).insertContentAt(r.from,l)}})}function fg(n){return new Yt({find:n.find,handler:({state:e,range:t,match:r})=>{let o=n.replace,i=t.from,s=t.to;if(r[1]){let l=r[0].lastIndexOf(r[1]);o+=r[0].slice(l+r[1].length),i+=l;let a=i-s;a>0&&(o=r[0].slice(l-a,l)+o,i=s)}e.tr.insertText(o,i,s)}})}var cs=class{constructor(e){this.transaction=e,this.currentStep=this.transaction.steps.length}map(e){let t=!1;return{position:this.transaction.steps.slice(this.currentStep).reduce((o,i)=>{let s=i.getMap().mapResult(o);return s.deleted&&(t=!0),s.pos},e),deleted:t}}};var yd=z.create({name:"doc",topNode:!0,content:"block+"});function bd(n={}){return new P({view(e){return new Cs(e,n)}})}var Cs=class{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&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,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r;if(t){let l=e.nodeBefore,a=e.nodeAfter;if(l||a){let c=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(c){let d=c.getBoundingClientRect(),u=l?d.bottom:d.top;l&&a&&(u=(u+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:d.left,right:d.right,top:u-this.width/2,bottom:u+this.width/2}}}}if(!r){let l=this.editorView.coordsAtPos(this.cursorPos);r={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let o=this.editorView.dom.offsetParent;this.element||(this.element=o.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",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let i,s;if(!o||o==document.body&&getComputedStyle(o).position=="static")i=-pageXOffset,s=-pageYOffset;else{let l=o.getBoundingClientRect();i=l.left-o.scrollLeft,s=l.top-o.scrollTop}this.element.style.left=r.left-i+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"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}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,t,e):o;if(t&&!i){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=mr(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}};var kd=H.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[bd(this.options)]}});var ce=class n extends T{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return n.valid(r)?new n(r):T.near(r)}content(){return S.empty}eq(e){return e instanceof n&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new n(e.resolve(t.pos))}getBookmark(){return new Ms(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!hg(e)||!pg(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let o=t.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&n.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)0){i=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=t;let a=e.doc.resolve(o);if(n.valid(a))return a}for(;;){let s=t>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!A.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*t),r=!1;continue e}break}i=s,o+=t;let l=e.doc.resolve(o);if(n.valid(l))return l}return null}}};ce.prototype.visible=!1;ce.findFrom=ce.findGapCursorFrom;T.jsonID("gapcursor",ce);var Ms=class n{constructor(e){this.pos=e}map(e){return new n(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return ce.valid(t)?new ce(t):T.near(t)}};function hg(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function pg(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function xd(){return new P({props:{decorations:bg,createSelectionBetween(n,e,t){return e.pos==t.pos&&ce.valid(t)?new ce(t):null},handleClick:gg,handleKeyDown:mg,handleDOMEvents:{beforeinput:yg}}})}var mg=vn({ArrowLeft:Gr("horiz",-1),ArrowRight:Gr("horiz",1),ArrowUp:Gr("vert",-1),ArrowDown:Gr("vert",1)});function Gr(n,e){let t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof M){if(!i.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=ce.findGapCursorFrom(l,e,a);return c?(o&&o(r.tr.setSelection(new ce(c))),!0):!1}}function gg(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!ce.valid(r))return!1;let o=n.posAtCoords({left:t.clientX,top:t.clientY});return o&&o.inside>-1&&A.isSelectable(n.state.doc.nodeAt(o.inside))?!1:(n.dispatch(n.state.tr.setSelection(new ce(r))),!0)}function yg(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof ce))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let o=k.empty;for(let s=r.length-1;s>=0;s--)o=k.from(r[s].createAndFill(null,o));let i=n.state.tr.replace(t.pos,t.pos,new S(o,0,0));return i.setSelection(M.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function bg(n){if(!(n.selection instanceof ce))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",G.create(n.doc,[re.widget(n.selection.head,e,{key:"gapcursor"})])}var Sd=H.create({name:"gapCursor",addProseMirrorPlugins(){return[xd()]},extendNodeSchema(n){var e;let t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=R(C(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}});var Yr=200,oe=function(){};oe.prototype.append=function(e){return e.length?(e=oe.from(e),!this.length&&e||e.length=t?oe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};oe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};oe.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};oe.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},t,r),o};oe.from=function(e){return e instanceof oe?e:e&&e.length?new wd(e):oe.empty};var wd=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,l){for(var a=i;a=s;a--)if(o(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=Yr)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=Yr)return new e(o.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(oe);oe.empty=new wd([]);var kg=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return rl&&this.right.forEachInner(r,Math.max(o-l,0),Math.min(this.length,i)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(r,o-l,Math.max(i,l)-l,s+l)===!1||i=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(oe),Ts=oe;var xg=500,Rt=class n{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;t&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,l,a,c=[],d=[];return this.items.forEach((u,f)=>{if(!u.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,d.push(u);return}if(o){d.push(new Le(u.map));let h=u.step.map(o.slice(i)),p;h&&s.maybeStep(h).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],c.push(new Le(p,void 0,void 0,c.length+d.length))),i--,p&&o.appendMap(p,i)}else s.maybeStep(u.step);if(u.selection)return l=o?u.selection.map(o.slice(i)):u.selection,a=new n(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,r,o){let i=[],s=this.eventCount,l=this.items,a=!o&&l.length?l.get(l.length-1):null;for(let d=0;dwg&&(l=Sg(l,c),s-=c),new n(l.append(i),s)}remapping(e,t){let r=new mn;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,t),r}addMaps(e){return this.eventCount==0?this:new n(this.items.append(e.map(t=>new Le(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-t),i=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},o);let a=t;this.items.forEach(f=>{let h=i.getMirror(--a);if(h==null)return;s=Math.min(s,h);let p=i.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),g=f.selection&&f.selection.map(i.slice(a+1,h));g&&l++,r.push(new Le(p,m,g))}else r.push(new Le(p))},o);let c=[];for(let f=t;fxg&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,o=[],i=0;return this.items.forEach((s,l)=>{if(l>=e)o.push(s),s.selection&&i++;else if(s.step){let a=s.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let d=s.selection&&s.selection.map(t.slice(r));d&&i++;let u=new Le(c.invert(),a,d),f,h=o.length-1;(f=o.length&&o[h].merge(u))?o[h]=f:o.push(u)}}else s.map&&r--},this.items.length,0),new n(Ts.from(o.reverse()),i)}};Rt.empty=new Rt(Ts.empty,0);function Sg(n,e){let t;return n.forEach((r,o)=>{if(r.selection&&e--==0)return t=o,!1}),n.slice(t)}var Le=class n{constructor(e,t,r,o){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new n(t.getMap().invert(),t,this.selection)}}},Be=class{constructor(e,t,r,o,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}},wg=20;function Cg(n,e,t,r){let o=t.getMeta(vt),i;if(o)return o.historyState;t.getMeta(Ag)&&(n=new Be(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(vt))return s.getMeta(vt).redo?new Be(n.done.addTransform(t,void 0,r,Qr(e)),n.undone,Cd(t.mapping.maps),n.prevTime,n.prevComposition):new Be(n.done,n.undone.addTransform(t,void 0,r,Qr(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!Mg(t,n.prevRanges)),c=s?As(n.prevRanges,t.mapping):Cd(t.mapping.maps);return new Be(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,Qr(e)),Rt.empty,c,t.time,l==null?n.prevComposition:l)}else return(i=t.getMeta("rebased"))?new Be(n.done.rebased(t,i),n.undone.rebased(t,i),As(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Be(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),As(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Mg(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,o)=>{for(let i=0;i=e[i]&&(t=!0)}),t}function Cd(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,o,i,s)=>e.push(i,s));return e}function As(n,e){if(!n)return null;let t=[];for(let r=0;r{let o=vt.getState(t);if(!o||(n?o.undone:o.done).eventCount==0)return!1;if(r){let i=Tg(o,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}var Os=Xr(!1,!0),Ns=Xr(!0,!0),Hb=Xr(!1,!1),$b=Xr(!0,!1);var Ad=H.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Os(n,e),redo:()=>({state:n,dispatch:e})=>Ns(n,e)}},addProseMirrorPlugins(){return[Td(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});var Ed=z.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",N(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var Od=z.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",N(this.options.HTMLAttributes,n)]},renderText(){return` -`},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{let{selection:o,storedMarks:i}=t;if(o.$from.parent.type.spec.isolating)return!1;let{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,a=i||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&a&&s){let u=a.filter(f=>l.includes(f.type.name));c.ensureMarks(u)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var Nd=z.create({name:"text",group:"inline"});var Eg=/^\s*>\s$/,vd=z.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",N(this.options.HTMLAttributes,n),0]},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Ge({find:Eg,type:this.type})]}});var Og=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Ng=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,vg=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Rg=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Rd=K.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return["strong",N(this.options.HTMLAttributes,n),0]},addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[ke({find:Og,type:this.type}),ke({find:vg,type:this.type})]},addPasteRules(){return[pe({find:Ng,type:this.type}),pe({find:Rg,type:this.type})]}});var Dg="listItem",Dd="textStyle",Id=/^\s*([-+*])\s$/,Pd=z.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",N(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Dg,this.editor.getAttributes(Dd)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Ge({find:Id,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Ge({find:Id,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Dd),editor:this.editor})),[n]}});var Ld=z.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,N(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>v(b({},n),{[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>Xt({find:new RegExp(`^(#{1,${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var Bd=z.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",N(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{let{selection:t}=e,{$from:r,$to:o}=t,i=n();return r.parentOffset===0?i.insertContentAt({from:Math.max(r.pos-1,0),to:o.pos},{type:this.name}):Ss(t)?i.insertContentAt(o.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({tr:s,dispatch:l})=>{var a;if(l){let{$to:c}=s.selection,d=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?s.setSelection(M.create(s.doc,c.pos+1)):c.nodeAfter.isBlock?s.setSelection(A.create(s.doc,c.pos)):s.setSelection(M.create(s.doc,c.pos));else{let u=(a=c.parent.type.contentMatch.defaultType)===null||a===void 0?void 0:a.create();u&&(s.insert(d,u),s.setSelection(M.create(s.doc,d+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[ws({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});var Ig=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Pg=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Lg=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Bg=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,zd=K.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",N(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[ke({find:Ig,type:this.type}),ke({find:Lg,type:this.type})]},addPasteRules(){return[pe({find:Pg,type:this.type}),pe({find:Bg,type:this.type})]}});var Fd=z.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",N(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});var zg="listItem",Hd="textStyle",$d=/^(\d+)\.\s$/,Vd=z.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){let r=n,{start:e}=r,t=wl(r,["start"]);return e===1?["ol",N(this.options.HTMLAttributes,t),0]:["ol",N(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(zg,this.editor.getAttributes(Hd)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Ge({find:$d,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)&&(n=Ge({find:$d,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>b({start:+e[1]},this.editor.getAttributes(Hd)),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}});var Fg=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Hg=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,jd=K.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",N(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[ke({find:Fg,type:this.type})]},addPasteRules(){return[pe({find:Hg,type:this.type})]}});var _d=K.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(n){return n!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sub",N(this.options.HTMLAttributes,n),0]},addCommands(){return{setSubscript:()=>({commands:n})=>n.setMark(this.name),toggleSubscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSubscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}});var Wd=K.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(n){return n!=="super"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sup",N(this.options.HTMLAttributes,n),0]},addCommands(){return{setSuperscript:()=>({commands:n})=>n.setMark(this.name),toggleSuperscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSuperscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}});var Kd=K.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",N(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});var $g=new RegExp("(?({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[ke({find:$g,type:this.type})]},addPasteRules(){return[pe({find:Vg,type:this.type})]}});var jg=/^```([a-z]+)?[\s\n]$/,_g=/^~~~([a-z]+)?[\s\n]$/,Ud=z.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;let{languageClassPrefix:t}=this.options,i=[...((e=n.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(s=>s.startsWith(t)).map(s=>s.replace(t,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",N(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:e}=n,{selection:t}=e,{$from:r,empty:o}=t;if(!o||r.parent.type!==this.type)return!1;let i=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(` +`,textSerializers:r={}}=e||{};return ks(this.state.doc,{blockSeparator:t,textSerializers:b(b({},_r(this.schema)),r)})}get isEmpty(){return qr(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){let e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,t))||null}$pos(e){let t=this.state.doc.resolve(e);return new Vr(t,this)}get $doc(){return this.$pos(0)}};function ke(n){return new at({find:n.find,handler:({state:e,range:t,match:r})=>{let o=R(n.getAttributes,void 0,r);if(o===!1||o===null)return null;let{tr:i}=e,s=r[r.length-1],l=r[0];if(s){let a=l.search(/\S/),c=t.from+l.indexOf(s),d=c+s.length;if(Kn(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===n.type&&m!==h.mark.type)).filter(h=>h.to>c).length)return null;dt.from&&i.delete(t.from+a,c);let f=t.from+a+s.length;i.addMark(t.from+a,f,n.type.create(o||{})),i.removeStoredMark(n.type)}}})}function ws(n){return new at({find:n.find,handler:({state:e,range:t,match:r})=>{let o=R(n.getAttributes,void 0,r)||{},{tr:i}=e,s=t.from,l=t.to,a=n.type.create(o);if(r[1]){let c=r[0].lastIndexOf(r[1]),d=s+c;d>l?d=l:l=d+r[1].length;let u=r[0][r[0].length-1];i.insertText(u,s+r[0].length-1),i.replaceWith(d,l,a)}else if(r[0]){let c=n.type.isInline?s:s-1;i.insert(c,n.type.create(o)).delete(i.mapping.map(s),i.mapping.map(l))}i.scrollIntoView()}})}function Zt(n){return new at({find:n.find,handler:({state:e,range:t,match:r})=>{let o=e.doc.resolve(t.from),i=R(n.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,i)}})}function lg(n){return new at({find:n.find,handler:({state:e,range:t,match:r})=>{let o=n.replace,i=t.from,s=t.to;if(r[1]){let l=r[0].lastIndexOf(r[1]);o+=r[0].slice(l+r[1].length),i+=l;let a=i-s;a>0&&(o=r[0].slice(l-a,l)+o,i=s)}e.tr.insertText(o,i,s)}})}function Ge(n){return new at({find:n.find,handler:({state:e,range:t,match:r,chain:o})=>{let i=R(n.getAttributes,void 0,r)||{},s=e.tr.delete(t.from,t.to),a=s.doc.resolve(t.from).blockRange(),c=a&&Ht(a,n.type,i);if(!c)return null;if(s.wrap(a,c),n.keepMarks&&n.editor){let{selection:u,storedMarks:f}=e,{splittableMarks:h}=n.editor.extensionManager,p=f||u.$to.parentOffset&&u.$from.marks();if(p){let m=p.filter(g=>h.includes(g.type.name));s.ensureMarks(m)}}if(n.keepAttributes){let u=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(u,i).run()}let d=s.doc.resolve(t.from-1).nodeBefore;d&&d.type===n.type&&Oe(s.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,d))&&s.join(t.from-1)}})}var z=class n{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=b(b({},this.config),e),this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=R(C(this,"addOptions",{name:this.name}))),this.storage=R(C(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new n(e)}configure(e={}){let t=this.extend(v(b({},this.config),{addOptions:()=>$n(this.options,e)}));return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new n(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=R(C(t,"addOptions",{name:t.name})),t.storage=R(C(t,"addStorage",{name:t.name,options:t.options})),t}};function ag(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}var as=class{constructor(e,t,r){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options=b({stopEvent:null,ignoreMutation:null},r),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,r,o,i,s,l,a;let{view:c}=this.editor,d=e.target,u=d.nodeType===3?(t=d.parentElement)===null||t===void 0?void 0:t.closest("[data-drag-handle]"):d.closest("[data-drag-handle]");if(!this.dom||!((r=this.contentDOM)===null||r===void 0)&&r.contains(d)||!u)return;let f=0,h=0;if(this.dom!==u){let y=this.dom.getBoundingClientRect(),w=u.getBoundingClientRect(),O=(o=e.offsetX)!==null&&o!==void 0?o:(i=e.nativeEvent)===null||i===void 0?void 0:i.offsetX,L=(s=e.offsetY)!==null&&s!==void 0?s:(l=e.nativeEvent)===null||l===void 0?void 0:l.offsetY;f=w.x-y.x+O,h=w.y-y.y+L}(a=e.dataTransfer)===null||a===void 0||a.setDragImage(this.dom,f,h);let p=this.getPos();if(typeof p!="number")return;let m=A.create(c.state.doc,p),g=c.state.tr.setSelection(m);c.dispatch(g)}stopEvent(e){var t;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:e});let r=e.target;if(!(this.dom.contains(r)&&!(!((t=this.contentDOM)===null||t===void 0)&&t.contains(r))))return!1;let i=e.type.startsWith("drag"),s=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(r.tagName)||r.isContentEditable)&&!s&&!i)return!0;let{isEditable:a}=this.editor,{isDragging:c}=this,d=!!this.node.type.spec.draggable,u=A.isSelectable(this.node),f=e.type==="copy",h=e.type==="paste",p=e.type==="cut",m=e.type==="mousedown";if(!d&&u&&i&&e.preventDefault(),d&&i&&!c)return e.preventDefault(),!1;if(d&&a&&!c&&m){let g=r.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(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!(c||s||f||h||p||m&&u)}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type==="selection"||this.dom.contains(e.target)&&e.type==="childList"&&(Vn()||ag())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(r=>r.isContentEditable)?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target)}updateAttributes(e){this.editor.commands.command(({tr:t})=>{let r=this.getPos();return typeof r!="number"?!1:(t.setNodeMarkup(r,void 0,b(b({},this.node.attrs),e)),!0)})}deleteNode(){let e=this.getPos();if(typeof e!="number")return;let t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function pe(n){return new Qt({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:o})=>{let i=R(n.getAttributes,void 0,r,o);if(i===!1||i===null)return null;let{tr:s}=e,l=r[r.length-1],a=r[0],c=t.to;if(l){let d=a.search(/\S/),u=t.from+a.indexOf(l),f=u+l.length;if(Kn(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===n.type&&g!==p.mark.type)).filter(p=>p.to>u).length)return null;ft.from&&s.delete(t.from+d,u),c=t.from+d+l.length,s.addMark(t.from+d,c,n.type.create(i||{})),s.removeStoredMark(n.type)}}})}function cg(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function dg(n){return typeof n=="string"}function ug(n){return new Qt({find:n.find,handler({match:e,chain:t,range:r,pasteEvent:o}){let i=R(n.getAttributes,void 0,e,o),s=R(n.getContent,void 0,i);if(i===!1||i===null)return null;let l={type:n.type.name,attrs:i};s&&(l.content=s),e.input&&t().deleteRange(r).insertContentAt(r.from,l)}})}function fg(n){return new Qt({find:n.find,handler:({state:e,range:t,match:r})=>{let o=n.replace,i=t.from,s=t.to;if(r[1]){let l=r[0].lastIndexOf(r[1]);o+=r[0].slice(l+r[1].length),i+=l;let a=i-s;a>0&&(o=r[0].slice(l-a,l)+o,i=s)}e.tr.insertText(o,i,s)}})}var cs=class{constructor(e){this.transaction=e,this.currentStep=this.transaction.steps.length}map(e){let t=!1;return{position:this.transaction.steps.slice(this.currentStep).reduce((o,i)=>{let s=i.getMap().mapResult(o);return s.deleted&&(t=!0),s.pos},e),deleted:t}}};var yd=z.create({name:"doc",topNode:!0,content:"block+"});function bd(n={}){return new P({view(e){return new Cs(e,n)}})}var Cs=class{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&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,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r;if(t){let l=e.nodeBefore,a=e.nodeAfter;if(l||a){let c=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(c){let d=c.getBoundingClientRect(),u=l?d.bottom:d.top;l&&a&&(u=(u+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:d.left,right:d.right,top:u-this.width/2,bottom:u+this.width/2}}}}if(!r){let l=this.editorView.coordsAtPos(this.cursorPos);r={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let o=this.editorView.dom.offsetParent;this.element||(this.element=o.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",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let i,s;if(!o||o==document.body&&getComputedStyle(o).position=="static")i=-pageXOffset,s=-pageYOffset;else{let l=o.getBoundingClientRect();i=l.left-o.scrollLeft,s=l.top-o.scrollTop}this.element.style.left=r.left-i+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"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}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,t,e):o;if(t&&!i){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=mr(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}};var kd=H.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[bd(this.options)]}});var ce=class n extends T{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return n.valid(r)?new n(r):T.near(r)}content(){return S.empty}eq(e){return e instanceof n&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new n(e.resolve(t.pos))}getBookmark(){return new Ms(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!hg(e)||!pg(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let o=t.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&n.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)0){i=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=t;let a=e.doc.resolve(o);if(n.valid(a))return a}for(;;){let s=t>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!A.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*t),r=!1;continue e}break}i=s,o+=t;let l=e.doc.resolve(o);if(n.valid(l))return l}return null}}};ce.prototype.visible=!1;ce.findFrom=ce.findGapCursorFrom;T.jsonID("gapcursor",ce);var Ms=class n{constructor(e){this.pos=e}map(e){return new n(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return ce.valid(t)?new ce(t):T.near(t)}};function hg(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function pg(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function xd(){return new P({props:{decorations:bg,createSelectionBetween(n,e,t){return e.pos==t.pos&&ce.valid(t)?new ce(t):null},handleClick:gg,handleKeyDown:mg,handleDOMEvents:{beforeinput:yg}}})}var mg=Rn({ArrowLeft:Gr("horiz",-1),ArrowRight:Gr("horiz",1),ArrowUp:Gr("vert",-1),ArrowDown:Gr("vert",1)});function Gr(n,e){let t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof M){if(!i.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=ce.findGapCursorFrom(l,e,a);return c?(o&&o(r.tr.setSelection(new ce(c))),!0):!1}}function gg(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!ce.valid(r))return!1;let o=n.posAtCoords({left:t.clientX,top:t.clientY});return o&&o.inside>-1&&A.isSelectable(n.state.doc.nodeAt(o.inside))?!1:(n.dispatch(n.state.tr.setSelection(new ce(r))),!0)}function yg(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof ce))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let o=k.empty;for(let s=r.length-1;s>=0;s--)o=k.from(r[s].createAndFill(null,o));let i=n.state.tr.replace(t.pos,t.pos,new S(o,0,0));return i.setSelection(M.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function bg(n){if(!(n.selection instanceof ce))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",G.create(n.doc,[re.widget(n.selection.head,e,{key:"gapcursor"})])}var Sd=H.create({name:"gapCursor",addProseMirrorPlugins(){return[xd()]},extendNodeSchema(n){var e;let t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=R(C(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}});var Yr=200,oe=function(){};oe.prototype.append=function(e){return e.length?(e=oe.from(e),!this.length&&e||e.length=t?oe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};oe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};oe.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};oe.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},t,r),o};oe.from=function(e){return e instanceof oe?e:e&&e.length?new wd(e):oe.empty};var wd=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,l){for(var a=i;a=s;a--)if(o(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=Yr)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=Yr)return new e(o.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(oe);oe.empty=new wd([]);var kg=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return rl&&this.right.forEachInner(r,Math.max(o-l,0),Math.min(this.length,i)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(r,o-l,Math.max(i,l)-l,s+l)===!1||i=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(oe),Ts=oe;var xg=500,Rt=class n{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;t&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,l,a,c=[],d=[];return this.items.forEach((u,f)=>{if(!u.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,d.push(u);return}if(o){d.push(new Le(u.map));let h=u.step.map(o.slice(i)),p;h&&s.maybeStep(h).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],c.push(new Le(p,void 0,void 0,c.length+d.length))),i--,p&&o.appendMap(p,i)}else s.maybeStep(u.step);if(u.selection)return l=o?u.selection.map(o.slice(i)):u.selection,a=new n(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,r,o){let i=[],s=this.eventCount,l=this.items,a=!o&&l.length?l.get(l.length-1):null;for(let d=0;dwg&&(l=Sg(l,c),s-=c),new n(l.append(i),s)}remapping(e,t){let r=new gn;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,t),r}addMaps(e){return this.eventCount==0?this:new n(this.items.append(e.map(t=>new Le(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-t),i=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},o);let a=t;this.items.forEach(f=>{let h=i.getMirror(--a);if(h==null)return;s=Math.min(s,h);let p=i.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),g=f.selection&&f.selection.map(i.slice(a+1,h));g&&l++,r.push(new Le(p,m,g))}else r.push(new Le(p))},o);let c=[];for(let f=t;fxg&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,o=[],i=0;return this.items.forEach((s,l)=>{if(l>=e)o.push(s),s.selection&&i++;else if(s.step){let a=s.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let d=s.selection&&s.selection.map(t.slice(r));d&&i++;let u=new Le(c.invert(),a,d),f,h=o.length-1;(f=o.length&&o[h].merge(u))?o[h]=f:o.push(u)}}else s.map&&r--},this.items.length,0),new n(Ts.from(o.reverse()),i)}};Rt.empty=new Rt(Ts.empty,0);function Sg(n,e){let t;return n.forEach((r,o)=>{if(r.selection&&e--==0)return t=o,!1}),n.slice(t)}var Le=class n{constructor(e,t,r,o){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new n(t.getMap().invert(),t,this.selection)}}},Be=class{constructor(e,t,r,o,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}},wg=20;function Cg(n,e,t,r){let o=t.getMeta(vt),i;if(o)return o.historyState;t.getMeta(Ag)&&(n=new Be(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(vt))return s.getMeta(vt).redo?new Be(n.done.addTransform(t,void 0,r,Qr(e)),n.undone,Cd(t.mapping.maps),n.prevTime,n.prevComposition):new Be(n.done,n.undone.addTransform(t,void 0,r,Qr(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!Mg(t,n.prevRanges)),c=s?As(n.prevRanges,t.mapping):Cd(t.mapping.maps);return new Be(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,Qr(e)),Rt.empty,c,t.time,l==null?n.prevComposition:l)}else return(i=t.getMeta("rebased"))?new Be(n.done.rebased(t,i),n.undone.rebased(t,i),As(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Be(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),As(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Mg(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,o)=>{for(let i=0;i=e[i]&&(t=!0)}),t}function Cd(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,o,i,s)=>e.push(i,s));return e}function As(n,e){if(!n)return null;let t=[];for(let r=0;r{let o=vt.getState(t);if(!o||(n?o.undone:o.done).eventCount==0)return!1;if(r){let i=Tg(o,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}var Os=Xr(!1,!0),Ns=Xr(!0,!0),Hb=Xr(!1,!1),$b=Xr(!0,!1);var Ad=H.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Os(n,e),redo:()=>({state:n,dispatch:e})=>Ns(n,e)}},addProseMirrorPlugins(){return[Td(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});var Ed=z.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",N(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var Od=z.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",N(this.options.HTMLAttributes,n)]},renderText(){return` +`},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{let{selection:o,storedMarks:i}=t;if(o.$from.parent.type.spec.isolating)return!1;let{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,a=i||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&a&&s){let u=a.filter(f=>l.includes(f.type.name));c.ensureMarks(u)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var Nd=z.create({name:"text",group:"inline"});var Eg=/^\s*>\s$/,vd=z.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",N(this.options.HTMLAttributes,n),0]},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Ge({find:Eg,type:this.type})]}});var Og=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Ng=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,vg=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Rg=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Rd=K.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return["strong",N(this.options.HTMLAttributes,n),0]},addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[ke({find:Og,type:this.type}),ke({find:vg,type:this.type})]},addPasteRules(){return[pe({find:Ng,type:this.type}),pe({find:Rg,type:this.type})]}});var Dg="listItem",Dd="textStyle",Id=/^\s*([-+*])\s$/,Pd=z.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",N(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Dg,this.editor.getAttributes(Dd)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Ge({find:Id,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Ge({find:Id,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Dd),editor:this.editor})),[n]}});var Ld=z.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,N(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>v(b({},n),{[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>Zt({find:new RegExp(`^(#{1,${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var Bd=z.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",N(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{let{selection:t}=e,{$from:r,$to:o}=t,i=n();return r.parentOffset===0?i.insertContentAt({from:Math.max(r.pos-1,0),to:o.pos},{type:this.name}):Ss(t)?i.insertContentAt(o.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({tr:s,dispatch:l})=>{var a;if(l){let{$to:c}=s.selection,d=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?s.setSelection(M.create(s.doc,c.pos+1)):c.nodeAfter.isBlock?s.setSelection(A.create(s.doc,c.pos)):s.setSelection(M.create(s.doc,c.pos));else{let u=(a=c.parent.type.contentMatch.defaultType)===null||a===void 0?void 0:a.create();u&&(s.insert(d,u),s.setSelection(M.create(s.doc,d+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[ws({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});var Ig=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Pg=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Lg=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Bg=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,zd=K.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",N(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[ke({find:Ig,type:this.type}),ke({find:Lg,type:this.type})]},addPasteRules(){return[pe({find:Pg,type:this.type}),pe({find:Bg,type:this.type})]}});var Fd=z.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",N(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});var zg="listItem",Hd="textStyle",$d=/^(\d+)\.\s$/,Vd=z.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){let r=n,{start:e}=r,t=wl(r,["start"]);return e===1?["ol",N(this.options.HTMLAttributes,t),0]:["ol",N(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(zg,this.editor.getAttributes(Hd)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Ge({find:$d,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)&&(n=Ge({find:$d,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>b({start:+e[1]},this.editor.getAttributes(Hd)),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}});var Fg=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Hg=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,jd=K.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",N(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[ke({find:Fg,type:this.type})]},addPasteRules(){return[pe({find:Hg,type:this.type})]}});var _d=K.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(n){return n!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sub",N(this.options.HTMLAttributes,n),0]},addCommands(){return{setSubscript:()=>({commands:n})=>n.setMark(this.name),toggleSubscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSubscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}});var Wd=K.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(n){return n!=="super"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sup",N(this.options.HTMLAttributes,n),0]},addCommands(){return{setSuperscript:()=>({commands:n})=>n.setMark(this.name),toggleSuperscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSuperscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}});var Kd=K.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",N(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});var $g=new RegExp("(?({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[ke({find:$g,type:this.type})]},addPasteRules(){return[pe({find:Vg,type:this.type})]}});var jg=/^```([a-z]+)?[\s\n]$/,_g=/^~~~([a-z]+)?[\s\n]$/,Ud=z.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;let{languageClassPrefix:t}=this.options,i=[...((e=n.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(s=>s.startsWith(t)).map(s=>s.replace(t,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",N(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:e}=n,{selection:t}=e,{$from:r,empty:o}=t;if(!o||r.parent.type!==this.type)return!1;let i=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(` -`);return!i||!s?!1:n.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;let{state:e}=n,{selection:t,doc:r}=e,{$from:o,empty:i}=t;if(!i||o.parent.type!==this.type||!(o.parentOffset===o.parent.nodeSize-2))return!1;let l=o.after();return l===void 0?!1:r.nodeAt(l)?n.commands.command(({tr:c})=>(c.setSelection(T.near(r.resolve(l))),!0)):n.commands.exitCode()}}},addInputRules(){return[Xt({find:jg,type:this.type,getAttributes:n=>({language:n[1]})}),Xt({find:_g,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new P({key:new V("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;let t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,i=o==null?void 0:o.mode;if(!t||!i)return!1;let{tr:s,schema:l}=n.state,a=l.text(t.replace(/\r\n?/g,` -`));return s.replaceSelectionWith(this.type.create({language:i},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(M.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),n.dispatch(s),!0}}})]}});var qd=K.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["span",N(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:n,commands:e})=>{let t=jn(n,this.type);return Object.entries(t).some(([,o])=>!!o)?!0:e.unsetMark(this.name)}}}});var Gd=H.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var e;return(e=n.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:e})=>e().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}});var Wg=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,Kg=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,Yd=K.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:n=>n.getAttribute("data-color")||n.style.backgroundColor,renderHTML:n=>n.color?{"data-color":n.color,style:`background-color: ${n.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:n}){return["mark",N(this.options.HTMLAttributes,n),0]},addCommands(){return{setHighlight:n=>({commands:e})=>e.setMark(this.name,n),toggleHighlight:n=>({commands:e})=>e.toggleMark(this.name,n),unsetHighlight:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[ke({find:Wg,type:this.type})]},addPasteRules(){return[pe({find:Kg,type:this.type})]}});var Qd=H.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>{let e=n.style.textAlign||this.options.defaultAlignment;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${n.textAlign}`}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).every(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).every(e=>e)}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}});var Rs,Ds;if(typeof WeakMap!="undefined"){let n=new WeakMap;Rs=e=>n.get(e),Ds=(e,t)=>(n.set(e,t),t)}else{let n=[],t=0;Rs=r=>{for(let o=0;o(t==10&&(t=0),n[t++]=r,n[t++]=o)}var J=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e=t){(i||(i=[])).push({type:"overlong_rowspan",pos:d,n:y-O});break}let L=o+O*e;for(let E=0;Er&&(i+=c.attrs.colspan)}}for(let s=0;s1&&(t=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function qg(n,e,t){n.problems||(n.problems=[]);let r={};for(let o=0;o0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function Yg(n){for(let e=n.depth;e>0;e--){let t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function ve(n){let e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function oo(n){let e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;let t=Zt(e.$head)||Qg(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function Qg(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function Is(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function Xg(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function Bs(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function lu(n,e,t){let r=n.node(-1),o=J.get(r),i=n.start(-1),s=o.nextCell(n.pos-i,e,t);return s==null?null:n.node(0).resolve(i+s)}function Dt(n,e,t=1){let r=v(b({},n),{colspan:n.colspan-t});return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}function au(n,e,t=1){let r=v(b({},n),{colspan:n.colspan+t});if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;od!=t.pos-i);a.unshift(t.pos-i);let c=a.map(d=>{let u=r.nodeAt(d);if(!u)throw RangeError(`No cell with offset ${d} found`);let f=i+d+1;return new Vt(l.resolve(f),l.resolve(f+u.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){let r=e.resolve(t.map(this.$anchorCell.pos)),o=e.resolve(t.map(this.$headCell.pos));if(Is(r)&&Is(o)&&Bs(r,o)){let i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?Ye.rowSelection(r,o):i&&this.isColSelection()?Ye.colSelection(r,o):new Ye(r,o)}return M.between(r,o)}content(){let e=this.$anchorCell.node(-1),t=J.get(e),r=this.$anchorCell.start(-1),o=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},s=[];for(let a=o.top;a0||g>0){let y=p.attrs;if(m>0&&(y=Dt(y,0,m)),g>0&&(y=Dt(y,y.colspan-g,g)),h.lefto.bottom){let y=v(b({},p.attrs),{rowspan:Math.min(h.bottom,o.bottom)-Math.max(h.top,o.top)});h.top0)return!1;let r=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){let r=e.node(-1),o=J.get(r),i=e.start(-1),s=o.findCell(e.pos-i),l=o.findCell(t.pos-i),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(i+o.map[s.left])),l.bottom0&&(t=a.resolve(i+o.map[l.left])),s.bottom0)return!1;let s=o+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==t.width}eq(e){return e instanceof Ye&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){let r=e.node(-1),o=J.get(r),i=e.start(-1),s=o.findCell(e.pos-i),l=o.findCell(t.pos-i),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(i+o.map[s.top*o.width])),l.right0&&(t=a.resolve(i+o.map[l.top*o.width])),s.right{e.push(re.node(r,r+t.nodeSize,{class:"selectedCell"}))}),G.create(n.doc,e)}function ny({$from:n,$to:e}){if(n.pos==e.pos||n.pos=0&&!(n.after(o+1)=0&&!(e.before(i+1)>e.start(i));i--,r--);return t==r&&/row|table/.test(n.node(o).type.spec.tableRole)}function ry({$from:n,$to:e}){let t,r;for(let o=n.depth;o>0;o--){let i=n.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){t=i;break}}for(let o=e.depth;o>0;o--){let i=e.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return t!==r&&e.parentOffset===0}function oy(n,e,t){let r=(e||n).selection,o=(e||n).doc,i,s;if(r instanceof A&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=$.create(o,r.from);else if(s=="row"){let l=o.resolve(r.from+1);i=$.rowSelection(l,l)}else if(!t){let l=J.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];i=$.create(o,a+1,c)}}else r instanceof M&&ny(r)?i=M.create(o,r.from):r instanceof M&&ry(r)&&(i=M.create(o,r.$from.start(),r.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}var iy=new V("fix-tables");function du(n,e,t,r){let o=n.childCount,i=e.childCount;e:for(let s=0,l=0;s{o.type.spec.tableRole=="table"&&(t=sy(n,o,i,t))};return e?e.doc!=n.doc&&du(e.doc,n.doc,0,r):n.doc.descendants(r),t}function sy(n,e,t,r){let o=J.get(e);if(!o.problems)return r;r||(r=n.tr);let i=[];for(let a=0;a0){let h="cell";d.firstChild&&(h=d.firstChild.type.spec.tableRole);let p=[];for(let g=0;g0?-1:0;Zg(e,r,o+i)&&(i=o==0||o==e.width?null:0);for(let s=0;s0&&o0&&e.map[l-1]==a||o0?-1:0;ay(e,r,o+a)&&(a=o==0||o==e.height?null:0);for(let c=0,d=e.width*o;c0&&o0&&u==e.map[d-e.width]){let f=t.nodeAt(u).attrs;n.setNodeMarkup(n.mapping.slice(l).map(u+r),null,v(b({},f),{rowspan:f.rowspan-1})),c+=f.colspan-1}else if(o0&&t[i]==t[i-1]||r.right0&&t[o]==t[o-n]||r.bottomt[r.type.spec.tableRole])(n,e)}function uy(n){return(e,t)=>{var r;let o=e.selection,i,s;if(o instanceof $){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;i=o.$anchorCell.nodeAfter,s=o.$anchorCell.pos}else{if(i=Yg(o.$from),!i)return!1;s=(r=Zt(o.$from))==null?void 0:r.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(t){let l=i.attrs,a=[],c=l.colwidth;l.rowspan>1&&(l=v(b({},l),{rowspan:1})),l.colspan>1&&(l=v(b({},l),{colspan:1}));let d=ze(e),u=e.tr;for(let h=0;h{s.attrs[n]!==e&&i.setNodeMarkup(l,null,v(b({},s.attrs),{[n]:e}))}):i.setNodeMarkup(o.pos,null,v(b({},o.nodeAfter.attrs),{[n]:e})),r(i)}return!0}}function fy(n){return function(e,t){if(!ve(e))return!1;if(t){let r=de(e.schema),o=ze(e),i=e.tr,s=o.map.cellsInRect(n=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:n=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=s.map(a=>o.table.nodeAt(a));for(let a=0;a{let p=h+i.tableStart,m=s.doc.nodeAt(p);m&&s.setNodeMarkup(p,f,m.attrs)}),r(s)}return!0}}var Q1=en("row",{useDeprecatedLogic:!0}),X1=en("column",{useDeprecatedLogic:!0}),xu=en("cell",{useDeprecatedLogic:!0});function hy(n,e){if(e<0){let t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,o=n.before();r>=0;r--){let i=n.node(-1).child(r),s=i.lastChild;if(s)return o-1-s.nodeSize;o-=i.nodeSize}}else{if(n.index()0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}function Zr(n,e){let t=n.selection;if(!(t instanceof $))return!1;if(e){let r=n.tr,o=de(n.schema).cell.createAndFill().content;t.forEachCell((i,s)=>{i.content.eq(o)||r.replace(r.mapping.map(s+1),r.mapping.map(s+i.nodeSize-1),new S(o,0,0))}),r.docChanged&&e(r)}return!0}function py(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;let o=e.child(0),i=o.type.spec.tableRole,s=o.type.schema,l=[];if(i=="row")for(let a=0;a=0;s--){let{rowspan:l,colspan:a}=i.child(s).attrs;for(let c=o;c=e.length&&e.push(k.empty),t[o]r&&(f=f.type.createChecked(Dt(f.attrs,f.attrs.colspan,d+f.attrs.colspan-r),f.content)),c.push(f),d+=f.attrs.colspan;for(let h=1;ho&&(u=u.type.create(v(b({},u.attrs),{rowspan:Math.max(1,o-u.attrs.rowspan)}),u.content)),a.push(u)}i.push(k.from(a))}t=i,e=o}return{width:n,height:e,rows:t}}function yy(n,e,t,r,o,i,s){let l=n.doc.type.schema,a=de(l),c,d;if(o>e.width)for(let u=0,f=0;ue.height){let u=[];for(let p=0,m=(e.height-1)*e.width;p=e.width?!1:t.nodeAt(e.map[m+p]).type==a.header_cell;u.push(g?d||(d=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}let f=a.row.create(null,k.from(u)),h=[];for(let p=e.height;p{if(!o)return!1;let i=t.selection;if(i instanceof $)return no(t,r,T.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;let s=wu(o,n,e);if(s==null)return!1;if(n=="horiz")return no(t,r,T.near(t.doc.resolve(i.head+e),e));{let l=t.doc.resolve(s),a=lu(l,n,e),c;return a?c=T.near(a,1):e<0?c=T.near(t.doc.resolve(l.before(-1)),-1):c=T.near(t.doc.resolve(l.after(-1)),1),no(t,r,c)}}}function to(n,e){return(t,r,o)=>{if(!o)return!1;let i=t.selection,s;if(i instanceof $)s=i;else{let a=wu(o,n,e);if(a==null)return!1;s=new $(t.doc.resolve(a))}let l=lu(s.$headCell,n,e);return l?no(t,r,new $(s.$anchorCell,l)):!1}}function ky(n,e){let t=n.state.doc,r=Zt(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new $(r))),!0):!1}function xy(n,e,t){if(!ve(n.state))return!1;let r=py(t),o=n.state.selection;if(o instanceof $){r||(r={width:1,height:1,rows:[k.from(Ps(de(n.state.schema).cell,t))]});let i=o.$anchorCell.node(-1),s=o.$anchorCell.start(-1),l=J.get(i).rectBetween(o.$anchorCell.pos-s,o.$headCell.pos-s);return r=gy(r,l.right-l.left,l.bottom-l.top),nu(n.state,n.dispatch,s,l,r),!0}else if(r){let i=oo(n.state),s=i.start(-1);return nu(n.state,n.dispatch,s,J.get(i.node(-1)).findCell(i.pos-s),r),!0}else return!1}function Sy(n,e){var t;if(e.ctrlKey||e.metaKey)return;let r=ru(n,e.target),o;if(e.shiftKey&&n.state.selection instanceof $)i(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=Zt(n.state.selection.$anchor))!=null&&((t=vs(n,e))==null?void 0:t.pos)!=o.pos)i(o,e),e.preventDefault();else if(!r)return;function i(a,c){let d=vs(n,c),u=ct.getState(n.state)==null;if(!d||!Bs(a,d))if(u)d=a;else return;let f=new $(a,d);if(u||!n.state.selection.eq(f)){let h=n.state.tr.setSelection(f);u&&h.setMeta(ct,a.pos),n.dispatch(h)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),ct.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(ct,-1))}function l(a){let c=a,d=ct.getState(n.state),u;if(d!=null)u=n.state.doc.resolve(d);else if(ru(n,c.target)!=r&&(u=vs(n,e),!u))return s();u&&i(u,c)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function wu(n,e,t){if(!(n.state.selection instanceof M))return null;let{$head:r}=n.state.selection;for(let o=r.depth-1;o>=0;o--){let i=r.node(o);if((t<0?r.index(o):r.indexAfter(o))!=(t<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){let l=r.before(o),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}function ru(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function vs(n,e){let t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?Zt(n.state.doc.resolve(t.pos)):null}var wy=class{constructor(n,e){this.node=n,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Ls(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!=this.node.type?!1:(this.node=n,Ls(n,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};function Ls(n,e,t,r,o,i){var s;let l=0,a=!0,c=e.firstChild,d=n.firstChild;if(d){for(let u=0,f=0;unew r(f,t,h)),new Cy(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{let l=xe.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{My(s,l,n,o)},mouseleave:s=>{Ty(s)},mousedown:(s,l)=>{Ay(s,l,e,t)}},decorations:s=>{let l=xe.getState(s);if(l&&l.activeHandle>-1)return Ry(s,l.activeHandle)},nodeViews:{}}});return i}var Cy=class ro{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){let t=this,r=e.getMeta(xe);if(r&&r.setHandle!=null)return new ro(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new ro(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let o=e.mapping.map(t.activeHandle,-1);return Is(e.doc.resolve(o))||(o=-1),new ro(o,t.dragging)}return t}};function My(n,e,t,r){let o=xe.getState(n.state);if(o&&!o.dragging){let i=Oy(e.target),s=-1;if(i){let{left:l,right:a}=i.getBoundingClientRect();e.clientX-l<=t?s=ou(n,e,"left",t):a-e.clientX<=t&&(s=ou(n,e,"right",t))}if(s!=o.activeHandle){if(!r&&s!==-1){let l=n.state.doc.resolve(s),a=l.node(-1),c=J.get(a),d=l.start(-1);if(c.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==c.width-1)return}Mu(n,s)}}}function Ty(n){let e=xe.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&Mu(n,-1)}function Ay(n,e,t,r){var o;let i=(o=n.dom.ownerDocument.defaultView)!=null?o:window,s=xe.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;let l=n.state.doc.nodeAt(s.activeHandle),a=Ey(n,s.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(xe,{setDragging:{startX:e.clientX,startWidth:a}}));function c(u){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",d);let f=xe.getState(n.state);f!=null&&f.dragging&&(Ny(n,f.activeHandle,iu(f.dragging,u,t)),n.dispatch(n.state.tr.setMeta(xe,{setDragging:null})))}function d(u){if(!u.which)return c(u);let f=xe.getState(n.state);if(f&&f.dragging){let h=iu(f.dragging,u,t);su(n,f.activeHandle,h,r)}}return su(n,s.activeHandle,a,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",d),e.preventDefault(),!0}function Ey(n,e,{colspan:t,colwidth:r}){let o=r&&r[r.length-1];if(o)return o;let i=n.domAtPos(e),l=i.node.childNodes[i.offset].offsetWidth,a=t;if(r)for(let c=0;c{let r=n.nodes[t];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),n.cached.tableNodeTypes=e,e}function Py(n,e,t,r,o){let i=Iy(n),s=[],l=[];for(let c=0;c{let{selection:e}=n.state;if(!Ly(e))return!1;let t=0,r=Kr(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},Ou=z.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:js,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){let{colgroup:t,tableWidth:r,tableMinWidth:o}=Dy(n,this.options.cellMinWidth);return["table",N(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${o}`}),t,["tbody",0]]},addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:r,dispatch:o,editor:i})=>{let s=Py(i.schema,n,e,t);if(o){let l=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(M.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>fu(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>hu(n,e),deleteColumn:()=>({state:n,dispatch:e})=>pu(n,e),addRowBefore:()=>({state:n,dispatch:e})=>gu(n,e),addRowAfter:()=>({state:n,dispatch:e})=>yu(n,e),deleteRow:()=>({state:n,dispatch:e})=>bu(n,e),deleteTable:()=>({state:n,dispatch:e})=>Su(n,e),mergeCells:()=>({state:n,dispatch:e})=>Fs(n,e),splitCell:()=>({state:n,dispatch:e})=>Hs(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>en("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>en("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>xu(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>Fs(n,e)?!0:Hs(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>ku(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>$s(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>$s(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&zs(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){let r=$.create(e.doc,n.anchorCell,n.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:io,"Mod-Backspace":io,Delete:io,"Mod-Delete":io}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Cu({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Tu({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){let e={name:n.name,options:n.options,storage:n.storage};return{tableRole:R(C(n,"tableRole",e))}}});var Nu=z.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{let e=n.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",N(this.options.HTMLAttributes,n),0]}});var vu=z.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{let e=n.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",N(this.options.HTMLAttributes,n),0]}});var Ru=z.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",N(this.options.HTMLAttributes,n),0]}});var j=(n,e=null,t=[])=>{let r=document.createElement(n);if(e)for(let[o,i]of Object.entries(e))/^data-|^aria-|^role/.test(o)?r.setAttribute(o,i):r[o]=i;return r.append(...t),r},_s;function It(){return _s||(_s=JSON.parse(document.querySelector("#django-prose-editor-settings").textContent)),_s}var By=([n,e])=>{let t;return e.format==="textarea"?t=j("textarea",{name:n,cols:80,rows:30}):e.enum?t=j("select",{name:n},e.enum.map(r=>j("option",{textContent:r}))):t=j("input",{name:n,type:e.format||"text",size:50}),j("p",{},[j("label",{textContent:e.title||n}),t])},so=n=>(e,t)=>{let{messages:r}=It();return new Promise(o=>{let i=j("button",{type:"submit",textContent:r.update}),s=j("button",{type:"button",value:"cancel",textContent:r.cancel}),l=j("div",{},[j("dialog",{className:"prose-editor-dialog"},[j("form",{},[...Object.entries(n).map(By),i,s])])]);e.view.dom.closest(".prose-editor").append(l);let a=l.querySelector("dialog"),c=l.querySelector("form");for(let[d,u]of Object.entries(n))c[d].value=t[d]||u.default||"";s.addEventListener("click",()=>{a.close()}),a.addEventListener("close",()=>{l.remove(),o(null)}),i.addEventListener("click",d=>{d.preventDefault(),c.reportValidity()&&(l.remove(),o(Object.fromEntries(Object.keys(n).map(u=>[u,c[u].value]))))}),a.showModal()})},Du=so({href:{type:"string",title:It().messages.url},title:{type:"string",title:It().messages.title}}),Iu=so({html:{type:"string",title:"HTML",format:"textarea"}});var Pu=H.create({name:"html",addCommands(){return{editHTML:()=>({editor:n})=>{Iu(n,{html:n.getHTML()}).then(e=>{e&&n.chain().focus().setContent(e.html,!0).run()})}}}});var zy="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Fy="\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2",nn=(n,e)=>{for(let t in e)n[t]=e[t];return n},Ys="numeric",Qs="ascii",Xs="alpha",Un="asciinumeric",Jn="alphanumeric",Zs="domain",Vu="emoji",Hy="scheme",$y="slashscheme",Ws="whitespace";function Vy(n,e){return n in e||(e[n]=[]),e[n]}function Pt(n,e,t){e[Ys]&&(e[Un]=!0,e[Jn]=!0),e[Qs]&&(e[Un]=!0,e[Xs]=!0),e[Un]&&(e[Jn]=!0),e[Xs]&&(e[Jn]=!0),e[Jn]&&(e[Zs]=!0),e[Vu]&&(e[Zs]=!0);for(let r in e){let o=Vy(r,t);o.indexOf(n)<0&&o.push(n)}}function jy(n,e){let t={};for(let r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function ye(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}ye.groups={};ye.prototype={accepts(){return!!this.t},go(n){let e=this,t=e.j[n];if(t)return t;for(let r=0;rn.ta(e,t,r,o),U=(n,e,t,r,o)=>n.tr(e,t,r,o),Lu=(n,e,t,r,o)=>n.ts(e,t,r,o),x=(n,e,t,r,o)=>n.tt(e,t,r,o),Ze="WORD",el="UWORD",ju="ASCIINUMERICAL",_u="ALPHANUMERICAL",Zn="LOCALHOST",tl="TLD",nl="UTLD",uo="SCHEME",tn="SLASH_SCHEME",ol="NUM",rl="WS",il="NL",qn="OPENBRACE",Gn="CLOSEBRACE",fo="OPENBRACKET",ho="CLOSEBRACKET",po="OPENPAREN",mo="CLOSEPAREN",go="OPENANGLEBRACKET",yo="CLOSEANGLEBRACKET",bo="FULLWIDTHLEFTPAREN",ko="FULLWIDTHRIGHTPAREN",xo="LEFTCORNERBRACKET",So="RIGHTCORNERBRACKET",wo="LEFTWHITECORNERBRACKET",Co="RIGHTWHITECORNERBRACKET",Mo="FULLWIDTHLESSTHAN",To="FULLWIDTHGREATERTHAN",Ao="AMPERSAND",sl="APOSTROPHE",Eo="ASTERISK",ut="AT",Oo="BACKSLASH",No="BACKTICK",vo="CARET",ft="COLON",ll="COMMA",Ro="DOLLAR",Fe="DOT",Do="EQUALS",al="EXCLAMATION",Ee="HYPHEN",Yn="PERCENT",Io="PIPE",Po="PLUS",Lo="POUND",Qn="QUERY",cl="QUOTE",Wu="FULLWIDTHMIDDLEDOT",dl="SEMI",He="SLASH",Xn="TILDE",Bo="UNDERSCORE",Ku="EMOJI",zo="SYM",Ju=Object.freeze({__proto__:null,WORD:Ze,UWORD:el,ASCIINUMERICAL:ju,ALPHANUMERICAL:_u,LOCALHOST:Zn,TLD:tl,UTLD:nl,SCHEME:uo,SLASH_SCHEME:tn,NUM:ol,WS:rl,NL:il,OPENBRACE:qn,CLOSEBRACE:Gn,OPENBRACKET:fo,CLOSEBRACKET:ho,OPENPAREN:po,CLOSEPAREN:mo,OPENANGLEBRACKET:go,CLOSEANGLEBRACKET:yo,FULLWIDTHLEFTPAREN:bo,FULLWIDTHRIGHTPAREN:ko,LEFTCORNERBRACKET:xo,RIGHTCORNERBRACKET:So,LEFTWHITECORNERBRACKET:wo,RIGHTWHITECORNERBRACKET:Co,FULLWIDTHLESSTHAN:Mo,FULLWIDTHGREATERTHAN:To,AMPERSAND:Ao,APOSTROPHE:sl,ASTERISK:Eo,AT:ut,BACKSLASH:Oo,BACKTICK:No,CARET:vo,COLON:ft,COMMA:ll,DOLLAR:Ro,DOT:Fe,EQUALS:Do,EXCLAMATION:al,HYPHEN:Ee,PERCENT:Yn,PIPE:Io,PLUS:Po,POUND:Lo,QUERY:Qn,QUOTE:cl,FULLWIDTHMIDDLEDOT:Wu,SEMI:dl,SLASH:He,TILDE:Xn,UNDERSCORE:Bo,EMOJI:Ku,SYM:zo}),Qe=/[a-z]/,Kn=new RegExp("\\p{L}","u"),Ks=new RegExp("\\p{Emoji}","u");var Xe=/\d/,Js=/\s/;var Bu="\r",Us=` -`,_y="\uFE0F",Wy="\u200D",qs="\uFFFC",lo=null,ao=null;function Ky(n=[]){let e={};ye.groups=e;let t=new ye;lo==null&&(lo=zu(zy)),ao==null&&(ao=zu(Fy)),x(t,"'",sl),x(t,"{",qn),x(t,"}",Gn),x(t,"[",fo),x(t,"]",ho),x(t,"(",po),x(t,")",mo),x(t,"<",go),x(t,">",yo),x(t,"\uFF08",bo),x(t,"\uFF09",ko),x(t,"\u300C",xo),x(t,"\u300D",So),x(t,"\u300E",wo),x(t,"\u300F",Co),x(t,"\uFF1C",Mo),x(t,"\uFF1E",To),x(t,"&",Ao),x(t,"*",Eo),x(t,"@",ut),x(t,"`",No),x(t,"^",vo),x(t,":",ft),x(t,",",ll),x(t,"$",Ro),x(t,".",Fe),x(t,"=",Do),x(t,"!",al),x(t,"-",Ee),x(t,"%",Yn),x(t,"|",Io),x(t,"+",Po),x(t,"#",Lo),x(t,"?",Qn),x(t,'"',cl),x(t,"/",He),x(t,";",dl),x(t,"~",Xn),x(t,"_",Bo),x(t,"\\",Oo),x(t,"\u30FB",Wu);let r=U(t,Xe,ol,{[Ys]:!0});U(r,Xe,r);let o=U(r,Qe,ju,{[Un]:!0}),i=U(r,Kn,_u,{[Jn]:!0}),s=U(t,Qe,Ze,{[Qs]:!0});U(s,Xe,o),U(s,Qe,s),U(o,Xe,o),U(o,Qe,o);let l=U(t,Kn,el,{[Xs]:!0});U(l,Qe),U(l,Xe,i),U(l,Kn,l),U(i,Xe,i),U(i,Qe),U(i,Kn,i);let a=x(t,Us,il,{[Ws]:!0}),c=x(t,Bu,rl,{[Ws]:!0}),d=U(t,Js,rl,{[Ws]:!0});x(t,qs,d),x(c,Us,a),x(c,qs,d),U(c,Js,d),x(d,Bu),x(d,Us),U(d,Js,d),x(d,qs,d);let u=U(t,Ks,Ku,{[Vu]:!0});x(u,"#"),U(u,Ks,u),x(u,_y,u);let f=x(u,Wy);x(f,"#"),U(f,Ks,u);let h=[[Qe,s],[Xe,o]],p=[[Qe,null],[Kn,l],[Xe,i]];for(let m=0;mm[0]>g[0]?1:-1);for(let m=0;m=0?w[Zs]=!0:Qe.test(g)?Xe.test(g)?w[Un]=!0:w[Qs]=!0:w[Ys]=!0,Lu(t,g,g,w)}return Lu(t,"localhost",Zn,{ascii:!0}),t.jd=new ye(zo),{start:t,tokens:nn({groups:e},Ju)}}function Uu(n,e){let t=Jy(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=t.length,o=[],i=0,s=0;for(;s=0&&(u+=t[s].length,f++),c+=t[s].length,i+=t[s].length,s++;i-=u,s-=f,c-=u,o.push({t:d.t,v:e.slice(i-c,i),s:i-c,e:i})}return o}function Jy(n){let e=[],t=n.length,r=0;for(;r56319||r+1===t||(i=n.charCodeAt(r+1))<56320||i>57343?n[r]:n.slice(r,r+2);e.push(s),r+=s.length}return e}function dt(n,e,t,r,o){let i,s=e.length;for(let l=0;l=0;)i++;if(i>0){e.push(t.join(""));for(let s=parseInt(n.substring(r,r+i),10);s>0;s--)t.pop();r+=i}else t.push(n[r]),r++}return e}var er={defaultProtocol:"http",events:null,format:Fu,formatHref:Fu,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ul(n,e=null){let t=nn({},er);n&&(t=nn(t,n instanceof ul?n.o:n));let r=t.ignoreTags,o=[];for(let i=0;it?r.substring(0,t)+"\u2026":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=er.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){let e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),o=n.get("tagName",t,e),i=this.toFormattedString(n),s={},l=n.get("className",t,e),a=n.get("target",t,e),c=n.get("rel",t,e),d=n.getObj("attributes",t,e),u=n.getObj("events",t,e);return s.href=r,l&&(s.class=l),a&&(s.target=a),c&&(s.rel=c),d&&nn(s,d),{tagName:o,attributes:s,content:i,eventListeners:u}}};function Fo(n,e){class t extends qu{constructor(o,i){super(o,i),this.t=n}}for(let r in e)t.prototype[r]=e[r];return t.t=n,t}var Hu=Fo("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),$u=Fo("text"),Uy=Fo("nl"),co=Fo("url",{isLink:!0,toHref(n=er.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){let n=this.tk;return n.length>=2&&n[0].t!==Zn&&n[1].t===ft}});var Ae=n=>new ye(n);function qy({groups:n}){let e=n.domain.concat([Ao,Eo,ut,Oo,No,vo,Ro,Do,Ee,ol,Yn,Io,Po,Lo,He,zo,Xn,Bo]),t=[ft,ll,Fe,al,Yn,Qn,cl,dl,go,yo,qn,Gn,ho,fo,po,mo,bo,ko,xo,So,wo,Co,Mo,To],r=[Ao,sl,Eo,Oo,No,vo,Ro,Do,Ee,qn,Gn,Yn,Io,Po,Lo,Qn,He,zo,Xn,Bo],o=Ae(),i=x(o,Xn);D(i,r,i),D(i,n.domain,i);let s=Ae(),l=Ae(),a=Ae();D(o,n.domain,s),D(o,n.scheme,l),D(o,n.slashscheme,a),D(s,r,i),D(s,n.domain,s);let c=x(s,ut);x(i,ut,c),x(l,ut,c),x(a,ut,c);let d=x(i,Fe);D(d,r,i),D(d,n.domain,i);let u=Ae();D(c,n.domain,u),D(u,n.domain,u);let f=x(u,Fe);D(f,n.domain,u);let h=Ae(Hu);D(f,n.tld,h),D(f,n.utld,h),x(c,Zn,h);let p=x(u,Ee);x(p,Ee,p),D(p,n.domain,u),D(h,n.domain,u),x(h,Fe,f),x(h,Ee,p);let m=x(h,ft);D(m,n.numeric,Hu);let g=x(s,Ee),y=x(s,Fe);x(g,Ee,g),D(g,n.domain,s),D(y,r,i),D(y,n.domain,s);let w=Ae(co);D(y,n.tld,w),D(y,n.utld,w),D(w,n.domain,s),D(w,r,i),x(w,Fe,y),x(w,Ee,g),x(w,ut,c);let O=x(w,ft),L=Ae(co);D(O,n.numeric,L);let E=Ae(co),I=Ae();D(E,e,E),D(E,t,I),D(I,e,E),D(I,t,I),x(w,He,E),x(L,He,E);let W=x(l,ft),q=x(a,ft),B=x(q,He),Se=x(B,He);D(l,n.domain,s),x(l,Fe,y),x(l,Ee,g),D(a,n.domain,s),x(a,Fe,y),x(a,Ee,g),D(W,n.domain,E),x(W,He,E),x(W,Qn,E),D(Se,n.domain,E),D(Se,e,E),x(Se,He,E);let ht=[[qn,Gn],[fo,ho],[po,mo],[go,yo],[bo,ko],[xo,So],[wo,Co],[Mo,To]];for(let on=0;on=0&&f++,o++,d++;if(f<0)o-=d,o0&&(i.push(Gs($u,e,s)),s=[]),o-=f,d-=f;let h=u.t,p=t.slice(o-d,o);i.push(Gs(h,e,p))}}return s.length>0&&i.push(Gs($u,e,s)),i}function Gs(n,e,t){let r=t[0].s,o=t[t.length-1].e,i=e.slice(r,o);return new n(i,t)}var Yy=typeof console!="undefined"&&console&&console.warn||(()=>{}),Qy="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",_={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Gu(){return ye.groups={},_.scanner=null,_.parser=null,_.tokenQueue=[],_.pluginQueue=[],_.customSchemes=[],_.initialized=!1,_}function fl(n,e=!1){if(_.initialized&&Yy(`linkifyjs: already initialized - will not register custom scheme "${n}" ${Qy}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format. +`);return!i||!s?!1:n.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;let{state:e}=n,{selection:t,doc:r}=e,{$from:o,empty:i}=t;if(!i||o.parent.type!==this.type||!(o.parentOffset===o.parent.nodeSize-2))return!1;let l=o.after();return l===void 0?!1:r.nodeAt(l)?n.commands.command(({tr:c})=>(c.setSelection(T.near(r.resolve(l))),!0)):n.commands.exitCode()}}},addInputRules(){return[Zt({find:jg,type:this.type,getAttributes:n=>({language:n[1]})}),Zt({find:_g,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new P({key:new V("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;let t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,i=o==null?void 0:o.mode;if(!t||!i)return!1;let{tr:s,schema:l}=n.state,a=l.text(t.replace(/\r\n?/g,` +`));return s.replaceSelectionWith(this.type.create({language:i},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(M.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),n.dispatch(s),!0}}})]}});var qd=K.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["span",N(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:n,commands:e})=>{let t=_n(n,this.type);return Object.entries(t).some(([,o])=>!!o)?!0:e.unsetMark(this.name)}}}});var Gd=H.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var e;return(e=n.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:e})=>e().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}});var Wg=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,Kg=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,Yd=K.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:n=>n.getAttribute("data-color")||n.style.backgroundColor,renderHTML:n=>n.color?{"data-color":n.color,style:`background-color: ${n.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:n}){return["mark",N(this.options.HTMLAttributes,n),0]},addCommands(){return{setHighlight:n=>({commands:e})=>e.setMark(this.name,n),toggleHighlight:n=>({commands:e})=>e.toggleMark(this.name,n),unsetHighlight:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[ke({find:Wg,type:this.type})]},addPasteRules(){return[pe({find:Kg,type:this.type})]}});var Qd=H.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>{let e=n.style.textAlign||this.options.defaultAlignment;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${n.textAlign}`}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).every(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).every(e=>e)}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}});var Rs,Ds;if(typeof WeakMap!="undefined"){let n=new WeakMap;Rs=e=>n.get(e),Ds=(e,t)=>(n.set(e,t),t)}else{let n=[],t=0;Rs=r=>{for(let o=0;o(t==10&&(t=0),n[t++]=r,n[t++]=o)}var J=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e=t){(i||(i=[])).push({type:"overlong_rowspan",pos:d,n:y-O});break}let L=o+O*e;for(let E=0;Er&&(i+=c.attrs.colspan)}}for(let s=0;s1&&(t=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function qg(n,e,t){n.problems||(n.problems=[]);let r={};for(let o=0;o0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function Yg(n){for(let e=n.depth;e>0;e--){let t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function ve(n){let e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function oo(n){let e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;let t=en(e.$head)||Qg(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function Qg(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function Is(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function Xg(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function Bs(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function lu(n,e,t){let r=n.node(-1),o=J.get(r),i=n.start(-1),s=o.nextCell(n.pos-i,e,t);return s==null?null:n.node(0).resolve(i+s)}function Dt(n,e,t=1){let r=v(b({},n),{colspan:n.colspan-t});return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}function au(n,e,t=1){let r=v(b({},n),{colspan:n.colspan+t});if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;od!=t.pos-i);a.unshift(t.pos-i);let c=a.map(d=>{let u=r.nodeAt(d);if(!u)throw RangeError(`No cell with offset ${d} found`);let f=i+d+1;return new jt(l.resolve(f),l.resolve(f+u.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){let r=e.resolve(t.map(this.$anchorCell.pos)),o=e.resolve(t.map(this.$headCell.pos));if(Is(r)&&Is(o)&&Bs(r,o)){let i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?Ye.rowSelection(r,o):i&&this.isColSelection()?Ye.colSelection(r,o):new Ye(r,o)}return M.between(r,o)}content(){let e=this.$anchorCell.node(-1),t=J.get(e),r=this.$anchorCell.start(-1),o=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},s=[];for(let a=o.top;a0||g>0){let y=p.attrs;if(m>0&&(y=Dt(y,0,m)),g>0&&(y=Dt(y,y.colspan-g,g)),h.lefto.bottom){let y=v(b({},p.attrs),{rowspan:Math.min(h.bottom,o.bottom)-Math.max(h.top,o.top)});h.top0)return!1;let r=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){let r=e.node(-1),o=J.get(r),i=e.start(-1),s=o.findCell(e.pos-i),l=o.findCell(t.pos-i),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(i+o.map[s.left])),l.bottom0&&(t=a.resolve(i+o.map[l.left])),s.bottom0)return!1;let s=o+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==t.width}eq(e){return e instanceof Ye&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){let r=e.node(-1),o=J.get(r),i=e.start(-1),s=o.findCell(e.pos-i),l=o.findCell(t.pos-i),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(i+o.map[s.top*o.width])),l.right0&&(t=a.resolve(i+o.map[l.top*o.width])),s.right{e.push(re.node(r,r+t.nodeSize,{class:"selectedCell"}))}),G.create(n.doc,e)}function ny({$from:n,$to:e}){if(n.pos==e.pos||n.pos=0&&!(n.after(o+1)=0&&!(e.before(i+1)>e.start(i));i--,r--);return t==r&&/row|table/.test(n.node(o).type.spec.tableRole)}function ry({$from:n,$to:e}){let t,r;for(let o=n.depth;o>0;o--){let i=n.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){t=i;break}}for(let o=e.depth;o>0;o--){let i=e.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return t!==r&&e.parentOffset===0}function oy(n,e,t){let r=(e||n).selection,o=(e||n).doc,i,s;if(r instanceof A&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=$.create(o,r.from);else if(s=="row"){let l=o.resolve(r.from+1);i=$.rowSelection(l,l)}else if(!t){let l=J.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];i=$.create(o,a+1,c)}}else r instanceof M&&ny(r)?i=M.create(o,r.from):r instanceof M&&ry(r)&&(i=M.create(o,r.$from.start(),r.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}var iy=new V("fix-tables");function du(n,e,t,r){let o=n.childCount,i=e.childCount;e:for(let s=0,l=0;s{o.type.spec.tableRole=="table"&&(t=sy(n,o,i,t))};return e?e.doc!=n.doc&&du(e.doc,n.doc,0,r):n.doc.descendants(r),t}function sy(n,e,t,r){let o=J.get(e);if(!o.problems)return r;r||(r=n.tr);let i=[];for(let a=0;a0){let h="cell";d.firstChild&&(h=d.firstChild.type.spec.tableRole);let p=[];for(let g=0;g0?-1:0;Zg(e,r,o+i)&&(i=o==0||o==e.width?null:0);for(let s=0;s0&&o0&&e.map[l-1]==a||o0?-1:0;ay(e,r,o+a)&&(a=o==0||o==e.height?null:0);for(let c=0,d=e.width*o;c0&&o0&&u==e.map[d-e.width]){let f=t.nodeAt(u).attrs;n.setNodeMarkup(n.mapping.slice(l).map(u+r),null,v(b({},f),{rowspan:f.rowspan-1})),c+=f.colspan-1}else if(o0&&t[i]==t[i-1]||r.right0&&t[o]==t[o-n]||r.bottomt[r.type.spec.tableRole])(n,e)}function uy(n){return(e,t)=>{var r;let o=e.selection,i,s;if(o instanceof $){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;i=o.$anchorCell.nodeAfter,s=o.$anchorCell.pos}else{if(i=Yg(o.$from),!i)return!1;s=(r=en(o.$from))==null?void 0:r.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(t){let l=i.attrs,a=[],c=l.colwidth;l.rowspan>1&&(l=v(b({},l),{rowspan:1})),l.colspan>1&&(l=v(b({},l),{colspan:1}));let d=ze(e),u=e.tr;for(let h=0;h{s.attrs[n]!==e&&i.setNodeMarkup(l,null,v(b({},s.attrs),{[n]:e}))}):i.setNodeMarkup(o.pos,null,v(b({},o.nodeAfter.attrs),{[n]:e})),r(i)}return!0}}function fy(n){return function(e,t){if(!ve(e))return!1;if(t){let r=de(e.schema),o=ze(e),i=e.tr,s=o.map.cellsInRect(n=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:n=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=s.map(a=>o.table.nodeAt(a));for(let a=0;a{let p=h+i.tableStart,m=s.doc.nodeAt(p);m&&s.setNodeMarkup(p,f,m.attrs)}),r(s)}return!0}}var Q1=tn("row",{useDeprecatedLogic:!0}),X1=tn("column",{useDeprecatedLogic:!0}),xu=tn("cell",{useDeprecatedLogic:!0});function hy(n,e){if(e<0){let t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,o=n.before();r>=0;r--){let i=n.node(-1).child(r),s=i.lastChild;if(s)return o-1-s.nodeSize;o-=i.nodeSize}}else{if(n.index()0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}function Zr(n,e){let t=n.selection;if(!(t instanceof $))return!1;if(e){let r=n.tr,o=de(n.schema).cell.createAndFill().content;t.forEachCell((i,s)=>{i.content.eq(o)||r.replace(r.mapping.map(s+1),r.mapping.map(s+i.nodeSize-1),new S(o,0,0))}),r.docChanged&&e(r)}return!0}function py(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;let o=e.child(0),i=o.type.spec.tableRole,s=o.type.schema,l=[];if(i=="row")for(let a=0;a=0;s--){let{rowspan:l,colspan:a}=i.child(s).attrs;for(let c=o;c=e.length&&e.push(k.empty),t[o]r&&(f=f.type.createChecked(Dt(f.attrs,f.attrs.colspan,d+f.attrs.colspan-r),f.content)),c.push(f),d+=f.attrs.colspan;for(let h=1;ho&&(u=u.type.create(v(b({},u.attrs),{rowspan:Math.max(1,o-u.attrs.rowspan)}),u.content)),a.push(u)}i.push(k.from(a))}t=i,e=o}return{width:n,height:e,rows:t}}function yy(n,e,t,r,o,i,s){let l=n.doc.type.schema,a=de(l),c,d;if(o>e.width)for(let u=0,f=0;ue.height){let u=[];for(let p=0,m=(e.height-1)*e.width;p=e.width?!1:t.nodeAt(e.map[m+p]).type==a.header_cell;u.push(g?d||(d=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}let f=a.row.create(null,k.from(u)),h=[];for(let p=e.height;p{if(!o)return!1;let i=t.selection;if(i instanceof $)return no(t,r,T.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;let s=wu(o,n,e);if(s==null)return!1;if(n=="horiz")return no(t,r,T.near(t.doc.resolve(i.head+e),e));{let l=t.doc.resolve(s),a=lu(l,n,e),c;return a?c=T.near(a,1):e<0?c=T.near(t.doc.resolve(l.before(-1)),-1):c=T.near(t.doc.resolve(l.after(-1)),1),no(t,r,c)}}}function to(n,e){return(t,r,o)=>{if(!o)return!1;let i=t.selection,s;if(i instanceof $)s=i;else{let a=wu(o,n,e);if(a==null)return!1;s=new $(t.doc.resolve(a))}let l=lu(s.$headCell,n,e);return l?no(t,r,new $(s.$anchorCell,l)):!1}}function ky(n,e){let t=n.state.doc,r=en(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new $(r))),!0):!1}function xy(n,e,t){if(!ve(n.state))return!1;let r=py(t),o=n.state.selection;if(o instanceof $){r||(r={width:1,height:1,rows:[k.from(Ps(de(n.state.schema).cell,t))]});let i=o.$anchorCell.node(-1),s=o.$anchorCell.start(-1),l=J.get(i).rectBetween(o.$anchorCell.pos-s,o.$headCell.pos-s);return r=gy(r,l.right-l.left,l.bottom-l.top),nu(n.state,n.dispatch,s,l,r),!0}else if(r){let i=oo(n.state),s=i.start(-1);return nu(n.state,n.dispatch,s,J.get(i.node(-1)).findCell(i.pos-s),r),!0}else return!1}function Sy(n,e){var t;if(e.ctrlKey||e.metaKey)return;let r=ru(n,e.target),o;if(e.shiftKey&&n.state.selection instanceof $)i(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=en(n.state.selection.$anchor))!=null&&((t=vs(n,e))==null?void 0:t.pos)!=o.pos)i(o,e),e.preventDefault();else if(!r)return;function i(a,c){let d=vs(n,c),u=ct.getState(n.state)==null;if(!d||!Bs(a,d))if(u)d=a;else return;let f=new $(a,d);if(u||!n.state.selection.eq(f)){let h=n.state.tr.setSelection(f);u&&h.setMeta(ct,a.pos),n.dispatch(h)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),ct.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(ct,-1))}function l(a){let c=a,d=ct.getState(n.state),u;if(d!=null)u=n.state.doc.resolve(d);else if(ru(n,c.target)!=r&&(u=vs(n,e),!u))return s();u&&i(u,c)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function wu(n,e,t){if(!(n.state.selection instanceof M))return null;let{$head:r}=n.state.selection;for(let o=r.depth-1;o>=0;o--){let i=r.node(o);if((t<0?r.index(o):r.indexAfter(o))!=(t<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){let l=r.before(o),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}function ru(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function vs(n,e){let t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?en(n.state.doc.resolve(t.pos)):null}var wy=class{constructor(n,e){this.node=n,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Ls(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!=this.node.type?!1:(this.node=n,Ls(n,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};function Ls(n,e,t,r,o,i){var s;let l=0,a=!0,c=e.firstChild,d=n.firstChild;if(d){for(let u=0,f=0;unew r(f,t,h)),new Cy(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{let l=xe.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{My(s,l,n,o)},mouseleave:s=>{Ty(s)},mousedown:(s,l)=>{Ay(s,l,e,t)}},decorations:s=>{let l=xe.getState(s);if(l&&l.activeHandle>-1)return Ry(s,l.activeHandle)},nodeViews:{}}});return i}var Cy=class ro{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){let t=this,r=e.getMeta(xe);if(r&&r.setHandle!=null)return new ro(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new ro(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let o=e.mapping.map(t.activeHandle,-1);return Is(e.doc.resolve(o))||(o=-1),new ro(o,t.dragging)}return t}};function My(n,e,t,r){let o=xe.getState(n.state);if(o&&!o.dragging){let i=Oy(e.target),s=-1;if(i){let{left:l,right:a}=i.getBoundingClientRect();e.clientX-l<=t?s=ou(n,e,"left",t):a-e.clientX<=t&&(s=ou(n,e,"right",t))}if(s!=o.activeHandle){if(!r&&s!==-1){let l=n.state.doc.resolve(s),a=l.node(-1),c=J.get(a),d=l.start(-1);if(c.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==c.width-1)return}Mu(n,s)}}}function Ty(n){let e=xe.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&Mu(n,-1)}function Ay(n,e,t,r){var o;let i=(o=n.dom.ownerDocument.defaultView)!=null?o:window,s=xe.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;let l=n.state.doc.nodeAt(s.activeHandle),a=Ey(n,s.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(xe,{setDragging:{startX:e.clientX,startWidth:a}}));function c(u){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",d);let f=xe.getState(n.state);f!=null&&f.dragging&&(Ny(n,f.activeHandle,iu(f.dragging,u,t)),n.dispatch(n.state.tr.setMeta(xe,{setDragging:null})))}function d(u){if(!u.which)return c(u);let f=xe.getState(n.state);if(f&&f.dragging){let h=iu(f.dragging,u,t);su(n,f.activeHandle,h,r)}}return su(n,s.activeHandle,a,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",d),e.preventDefault(),!0}function Ey(n,e,{colspan:t,colwidth:r}){let o=r&&r[r.length-1];if(o)return o;let i=n.domAtPos(e),l=i.node.childNodes[i.offset].offsetWidth,a=t;if(r)for(let c=0;c{let r=n.nodes[t];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),n.cached.tableNodeTypes=e,e}function Py(n,e,t,r,o){let i=Iy(n),s=[],l=[];for(let c=0;c{let{selection:e}=n.state;if(!Ly(e))return!1;let t=0,r=Kr(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},Ou=z.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:js,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){let{colgroup:t,tableWidth:r,tableMinWidth:o}=Dy(n,this.options.cellMinWidth);return["table",N(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${o}`}),t,["tbody",0]]},addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:r,dispatch:o,editor:i})=>{let s=Py(i.schema,n,e,t);if(o){let l=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(M.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>fu(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>hu(n,e),deleteColumn:()=>({state:n,dispatch:e})=>pu(n,e),addRowBefore:()=>({state:n,dispatch:e})=>gu(n,e),addRowAfter:()=>({state:n,dispatch:e})=>yu(n,e),deleteRow:()=>({state:n,dispatch:e})=>bu(n,e),deleteTable:()=>({state:n,dispatch:e})=>Su(n,e),mergeCells:()=>({state:n,dispatch:e})=>Fs(n,e),splitCell:()=>({state:n,dispatch:e})=>Hs(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>tn("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>tn("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>xu(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>Fs(n,e)?!0:Hs(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>ku(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>$s(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>$s(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&zs(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){let r=$.create(e.doc,n.anchorCell,n.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:io,"Mod-Backspace":io,Delete:io,"Mod-Delete":io}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Cu({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Tu({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){let e={name:n.name,options:n.options,storage:n.storage};return{tableRole:R(C(n,"tableRole",e))}}});var Nu=z.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{let e=n.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",N(this.options.HTMLAttributes,n),0]}});var vu=z.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{let e=n.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",N(this.options.HTMLAttributes,n),0]}});var Ru=z.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",N(this.options.HTMLAttributes,n),0]}});var j=(n,e=null,t=[])=>{let r=document.createElement(n);if(e)for(let[o,i]of Object.entries(e))/^data-|^aria-|^role/.test(o)?r.setAttribute(o,i):r[o]=i;return r.append(...t),r},_s;function It(){return _s||(_s=JSON.parse(document.querySelector("#django-prose-editor-settings").textContent)),_s}var By=([n,e])=>{let t;return e.format==="textarea"?t=j("textarea",{name:n,cols:80,rows:30}):e.enum?t=j("select",{name:n},e.enum.map(r=>j("option",{textContent:r}))):t=j("input",{name:n,type:e.format||"text",size:50}),j("p",{},[j("label",{textContent:e.title||n}),t])},so=n=>(e,t)=>{let{messages:r}=It();return new Promise(o=>{let i=j("button",{type:"submit",textContent:r.update}),s=j("button",{type:"button",value:"cancel",textContent:r.cancel}),l=j("div",{},[j("dialog",{className:"prose-editor-dialog"},[j("form",{},[...Object.entries(n).map(By),i,s])])]);e.view.dom.closest(".prose-editor").append(l);let a=l.querySelector("dialog"),c=l.querySelector("form");for(let[d,u]of Object.entries(n))c[d].value=t[d]||u.default||"";s.addEventListener("click",()=>{a.close()}),a.addEventListener("close",()=>{l.remove(),o(null)}),i.addEventListener("click",d=>{d.preventDefault(),c.reportValidity()&&(l.remove(),o(Object.fromEntries(Object.keys(n).map(u=>[u,c[u].value]))))}),a.showModal()})},Du=so({href:{type:"string",title:It().messages.url},title:{type:"string",title:It().messages.title}}),Iu=so({html:{type:"string",title:"HTML",format:"textarea"}});var Pu=H.create({name:"html",addCommands(){return{editHTML:()=>({editor:n})=>{Iu(n,{html:n.getHTML()}).then(e=>{e&&n.chain().focus().setContent(e.html,!0).run()})}}}});var zy="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Fy="\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2",rn=(n,e)=>{for(let t in e)n[t]=e[t];return n},Ys="numeric",Qs="ascii",Xs="alpha",qn="asciinumeric",Un="alphanumeric",Zs="domain",Vu="emoji",Hy="scheme",$y="slashscheme",Ws="whitespace";function Vy(n,e){return n in e||(e[n]=[]),e[n]}function Pt(n,e,t){e[Ys]&&(e[qn]=!0,e[Un]=!0),e[Qs]&&(e[qn]=!0,e[Xs]=!0),e[qn]&&(e[Un]=!0),e[Xs]&&(e[Un]=!0),e[Un]&&(e[Zs]=!0),e[Vu]&&(e[Zs]=!0);for(let r in e){let o=Vy(r,t);o.indexOf(n)<0&&o.push(n)}}function jy(n,e){let t={};for(let r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function ye(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}ye.groups={};ye.prototype={accepts(){return!!this.t},go(n){let e=this,t=e.j[n];if(t)return t;for(let r=0;rn.ta(e,t,r,o),U=(n,e,t,r,o)=>n.tr(e,t,r,o),Lu=(n,e,t,r,o)=>n.ts(e,t,r,o),x=(n,e,t,r,o)=>n.tt(e,t,r,o),Ze="WORD",el="UWORD",ju="ASCIINUMERICAL",_u="ALPHANUMERICAL",er="LOCALHOST",tl="TLD",nl="UTLD",uo="SCHEME",nn="SLASH_SCHEME",ol="NUM",rl="WS",il="NL",Gn="OPENBRACE",Yn="CLOSEBRACE",fo="OPENBRACKET",ho="CLOSEBRACKET",po="OPENPAREN",mo="CLOSEPAREN",go="OPENANGLEBRACKET",yo="CLOSEANGLEBRACKET",bo="FULLWIDTHLEFTPAREN",ko="FULLWIDTHRIGHTPAREN",xo="LEFTCORNERBRACKET",So="RIGHTCORNERBRACKET",wo="LEFTWHITECORNERBRACKET",Co="RIGHTWHITECORNERBRACKET",Mo="FULLWIDTHLESSTHAN",To="FULLWIDTHGREATERTHAN",Ao="AMPERSAND",sl="APOSTROPHE",Eo="ASTERISK",ut="AT",Oo="BACKSLASH",No="BACKTICK",vo="CARET",ft="COLON",ll="COMMA",Ro="DOLLAR",Fe="DOT",Do="EQUALS",al="EXCLAMATION",Ee="HYPHEN",Qn="PERCENT",Io="PIPE",Po="PLUS",Lo="POUND",Xn="QUERY",cl="QUOTE",Wu="FULLWIDTHMIDDLEDOT",dl="SEMI",He="SLASH",Zn="TILDE",Bo="UNDERSCORE",Ku="EMOJI",zo="SYM",Ju=Object.freeze({__proto__:null,WORD:Ze,UWORD:el,ASCIINUMERICAL:ju,ALPHANUMERICAL:_u,LOCALHOST:er,TLD:tl,UTLD:nl,SCHEME:uo,SLASH_SCHEME:nn,NUM:ol,WS:rl,NL:il,OPENBRACE:Gn,CLOSEBRACE:Yn,OPENBRACKET:fo,CLOSEBRACKET:ho,OPENPAREN:po,CLOSEPAREN:mo,OPENANGLEBRACKET:go,CLOSEANGLEBRACKET:yo,FULLWIDTHLEFTPAREN:bo,FULLWIDTHRIGHTPAREN:ko,LEFTCORNERBRACKET:xo,RIGHTCORNERBRACKET:So,LEFTWHITECORNERBRACKET:wo,RIGHTWHITECORNERBRACKET:Co,FULLWIDTHLESSTHAN:Mo,FULLWIDTHGREATERTHAN:To,AMPERSAND:Ao,APOSTROPHE:sl,ASTERISK:Eo,AT:ut,BACKSLASH:Oo,BACKTICK:No,CARET:vo,COLON:ft,COMMA:ll,DOLLAR:Ro,DOT:Fe,EQUALS:Do,EXCLAMATION:al,HYPHEN:Ee,PERCENT:Qn,PIPE:Io,PLUS:Po,POUND:Lo,QUERY:Xn,QUOTE:cl,FULLWIDTHMIDDLEDOT:Wu,SEMI:dl,SLASH:He,TILDE:Zn,UNDERSCORE:Bo,EMOJI:Ku,SYM:zo}),Qe=/[a-z]/,Jn=new RegExp("\\p{L}","u"),Ks=new RegExp("\\p{Emoji}","u");var Xe=/\d/,Js=/\s/;var Bu="\r",Us=` +`,_y="\uFE0F",Wy="\u200D",qs="\uFFFC",lo=null,ao=null;function Ky(n=[]){let e={};ye.groups=e;let t=new ye;lo==null&&(lo=zu(zy)),ao==null&&(ao=zu(Fy)),x(t,"'",sl),x(t,"{",Gn),x(t,"}",Yn),x(t,"[",fo),x(t,"]",ho),x(t,"(",po),x(t,")",mo),x(t,"<",go),x(t,">",yo),x(t,"\uFF08",bo),x(t,"\uFF09",ko),x(t,"\u300C",xo),x(t,"\u300D",So),x(t,"\u300E",wo),x(t,"\u300F",Co),x(t,"\uFF1C",Mo),x(t,"\uFF1E",To),x(t,"&",Ao),x(t,"*",Eo),x(t,"@",ut),x(t,"`",No),x(t,"^",vo),x(t,":",ft),x(t,",",ll),x(t,"$",Ro),x(t,".",Fe),x(t,"=",Do),x(t,"!",al),x(t,"-",Ee),x(t,"%",Qn),x(t,"|",Io),x(t,"+",Po),x(t,"#",Lo),x(t,"?",Xn),x(t,'"',cl),x(t,"/",He),x(t,";",dl),x(t,"~",Zn),x(t,"_",Bo),x(t,"\\",Oo),x(t,"\u30FB",Wu);let r=U(t,Xe,ol,{[Ys]:!0});U(r,Xe,r);let o=U(r,Qe,ju,{[qn]:!0}),i=U(r,Jn,_u,{[Un]:!0}),s=U(t,Qe,Ze,{[Qs]:!0});U(s,Xe,o),U(s,Qe,s),U(o,Xe,o),U(o,Qe,o);let l=U(t,Jn,el,{[Xs]:!0});U(l,Qe),U(l,Xe,i),U(l,Jn,l),U(i,Xe,i),U(i,Qe),U(i,Jn,i);let a=x(t,Us,il,{[Ws]:!0}),c=x(t,Bu,rl,{[Ws]:!0}),d=U(t,Js,rl,{[Ws]:!0});x(t,qs,d),x(c,Us,a),x(c,qs,d),U(c,Js,d),x(d,Bu),x(d,Us),U(d,Js,d),x(d,qs,d);let u=U(t,Ks,Ku,{[Vu]:!0});x(u,"#"),U(u,Ks,u),x(u,_y,u);let f=x(u,Wy);x(f,"#"),U(f,Ks,u);let h=[[Qe,s],[Xe,o]],p=[[Qe,null],[Jn,l],[Xe,i]];for(let m=0;mm[0]>g[0]?1:-1);for(let m=0;m=0?w[Zs]=!0:Qe.test(g)?Xe.test(g)?w[qn]=!0:w[Qs]=!0:w[Ys]=!0,Lu(t,g,g,w)}return Lu(t,"localhost",er,{ascii:!0}),t.jd=new ye(zo),{start:t,tokens:rn({groups:e},Ju)}}function Uu(n,e){let t=Jy(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=t.length,o=[],i=0,s=0;for(;s=0&&(u+=t[s].length,f++),c+=t[s].length,i+=t[s].length,s++;i-=u,s-=f,c-=u,o.push({t:d.t,v:e.slice(i-c,i),s:i-c,e:i})}return o}function Jy(n){let e=[],t=n.length,r=0;for(;r56319||r+1===t||(i=n.charCodeAt(r+1))<56320||i>57343?n[r]:n.slice(r,r+2);e.push(s),r+=s.length}return e}function dt(n,e,t,r,o){let i,s=e.length;for(let l=0;l=0;)i++;if(i>0){e.push(t.join(""));for(let s=parseInt(n.substring(r,r+i),10);s>0;s--)t.pop();r+=i}else t.push(n[r]),r++}return e}var tr={defaultProtocol:"http",events:null,format:Fu,formatHref:Fu,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ul(n,e=null){let t=rn({},tr);n&&(t=rn(t,n instanceof ul?n.o:n));let r=t.ignoreTags,o=[];for(let i=0;it?r.substring(0,t)+"\u2026":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=tr.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){let e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),o=n.get("tagName",t,e),i=this.toFormattedString(n),s={},l=n.get("className",t,e),a=n.get("target",t,e),c=n.get("rel",t,e),d=n.getObj("attributes",t,e),u=n.getObj("events",t,e);return s.href=r,l&&(s.class=l),a&&(s.target=a),c&&(s.rel=c),d&&rn(s,d),{tagName:o,attributes:s,content:i,eventListeners:u}}};function Fo(n,e){class t extends qu{constructor(o,i){super(o,i),this.t=n}}for(let r in e)t.prototype[r]=e[r];return t.t=n,t}var Hu=Fo("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),$u=Fo("text"),Uy=Fo("nl"),co=Fo("url",{isLink:!0,toHref(n=tr.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){let n=this.tk;return n.length>=2&&n[0].t!==er&&n[1].t===ft}});var Ae=n=>new ye(n);function qy({groups:n}){let e=n.domain.concat([Ao,Eo,ut,Oo,No,vo,Ro,Do,Ee,ol,Qn,Io,Po,Lo,He,zo,Zn,Bo]),t=[ft,ll,Fe,al,Qn,Xn,cl,dl,go,yo,Gn,Yn,ho,fo,po,mo,bo,ko,xo,So,wo,Co,Mo,To],r=[Ao,sl,Eo,Oo,No,vo,Ro,Do,Ee,Gn,Yn,Qn,Io,Po,Lo,Xn,He,zo,Zn,Bo],o=Ae(),i=x(o,Zn);D(i,r,i),D(i,n.domain,i);let s=Ae(),l=Ae(),a=Ae();D(o,n.domain,s),D(o,n.scheme,l),D(o,n.slashscheme,a),D(s,r,i),D(s,n.domain,s);let c=x(s,ut);x(i,ut,c),x(l,ut,c),x(a,ut,c);let d=x(i,Fe);D(d,r,i),D(d,n.domain,i);let u=Ae();D(c,n.domain,u),D(u,n.domain,u);let f=x(u,Fe);D(f,n.domain,u);let h=Ae(Hu);D(f,n.tld,h),D(f,n.utld,h),x(c,er,h);let p=x(u,Ee);x(p,Ee,p),D(p,n.domain,u),D(h,n.domain,u),x(h,Fe,f),x(h,Ee,p);let m=x(h,ft);D(m,n.numeric,Hu);let g=x(s,Ee),y=x(s,Fe);x(g,Ee,g),D(g,n.domain,s),D(y,r,i),D(y,n.domain,s);let w=Ae(co);D(y,n.tld,w),D(y,n.utld,w),D(w,n.domain,s),D(w,r,i),x(w,Fe,y),x(w,Ee,g),x(w,ut,c);let O=x(w,ft),L=Ae(co);D(O,n.numeric,L);let E=Ae(co),I=Ae();D(E,e,E),D(E,t,I),D(I,e,E),D(I,t,I),x(w,He,E),x(L,He,E);let W=x(l,ft),q=x(a,ft),B=x(q,He),Se=x(B,He);D(l,n.domain,s),x(l,Fe,y),x(l,Ee,g),D(a,n.domain,s),x(a,Fe,y),x(a,Ee,g),D(W,n.domain,E),x(W,He,E),x(W,Xn,E),D(Se,n.domain,E),D(Se,e,E),x(Se,He,E);let ht=[[Gn,Yn],[fo,ho],[po,mo],[go,yo],[bo,ko],[xo,So],[wo,Co],[Mo,To]];for(let sn=0;sn=0&&f++,o++,d++;if(f<0)o-=d,o0&&(i.push(Gs($u,e,s)),s=[]),o-=f,d-=f;let h=u.t,p=t.slice(o-d,o);i.push(Gs(h,e,p))}}return s.length>0&&i.push(Gs($u,e,s)),i}function Gs(n,e,t){let r=t[0].s,o=t[t.length-1].e,i=e.slice(r,o);return new n(i,t)}var Yy=typeof console!="undefined"&&console&&console.warn||(()=>{}),Qy="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",_={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Gu(){return ye.groups={},_.scanner=null,_.parser=null,_.tokenQueue=[],_.pluginQueue=[],_.customSchemes=[],_.initialized=!1,_}function fl(n,e=!1){if(_.initialized&&Yy(`linkifyjs: already initialized - will not register custom scheme "${n}" ${Qy}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format. 1. Must only contain digits, lowercase ASCII letters or "-" 2. Cannot start or end with "-" -3. "-" cannot repeat`);_.customSchemes.push([n,e])}function Xy(){_.scanner=Ky(_.customSchemes);for(let n=0;n<_.tokenQueue.length;n++)_.tokenQueue[n][1]({scanner:_.scanner});_.parser=qy(_.scanner.tokens);for(let n=0;n<_.pluginQueue.length;n++)_.pluginQueue[n][1]({scanner:_.scanner,parser:_.parser});return _.initialized=!0,_}function Ho(n){return _.initialized||Xy(),Gy(_.parser.start,n,Uu(_.scanner.start,n))}Ho.scan=Uu;function hl(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}let r=new ul(t),o=Ho(n),i=[];for(let s=0;s{let o=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!o||i)return;let{tr:s}=r,l=ys(t.doc,[...e]);if(xs(l).forEach(({newRange:c})=>{let d=bs(r.doc,c,h=>h.isTextblock),u,f;if(d.length>1?(u=d[0],f=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ")):d.length&&r.doc.textBetween(c.from,c.to," "," ").endsWith(" ")&&(u=d[0],f=r.doc.textBetween(u.pos,c.to,void 0," ")),u&&f){let h=f.split(" ").filter(y=>y!=="");if(h.length<=0)return!1;let p=h[h.length-1],m=u.pos+f.lastIndexOf(p);if(!p)return!1;let g=Ho(p).map(y=>y.toObject(n.defaultProtocol));if(!Zy(g))return!1;g.filter(y=>y.isLink).map(y=>v(b({},y),{from:m+y.start+1,to:m+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>n.validate(y.value)).filter(y=>n.shouldAutoLink(y.value)).forEach(y=>{Wn(y.from,y.to,r.doc).some(w=>w.mark.type===n.type)||s.addMark(y.from,y.to,n.type.create({href:y.href}))})}}),!!s.steps.length)return s}})}function t0(n){return new P({key:new V("handleClickLink"),props:{handleClick:(e,t,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=r.target,l=[];for(;s.nodeName!=="DIV";)l.push(s),s=s.parentNode;if(!l.find(f=>f.nodeName==="A"))return!1;let a=Ur(e.state,n.type.name),c=r.target,d=(o=c==null?void 0:c.href)!==null&&o!==void 0?o:a.href,u=(i=c==null?void 0:c.target)!==null&&i!==void 0?i:a.target;return c&&d?(window.open(d,u),!0):!1}}})}function n0(n){return new P({key:new V("handlePasteLink"),props:{handlePaste:(e,t,r)=>{let{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let l="";r.content.forEach(c=>{l+=c.textContent});let a=hl(l,{defaultProtocol:n.defaultProtocol}).find(c=>c.isLink&&c.value===l);return!l||!a?!1:(n.editor.commands.setMark(n.type,{href:a.href}),!0)}}})}var r0=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function tr(n,e){let t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{let o=typeof r=="string"?r:r.scheme;o&&t.push(o)}),!n||n.replace(r0,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Yu=K.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(n=>{if(typeof n=="string"){fl(n);return}fl(n.scheme,n.optionalSlashes)})},onDestroy(){Gu()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!tr(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{let e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!tr(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!tr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",N(this.options.HTMLAttributes,n),0]:["a",N(this.options.HTMLAttributes,v(b({},n),{href:""})),0]},addCommands(){return{setLink:n=>({chain:e})=>e().setMark(this.name,n).setMeta("preventAutolink",!0).run(),toggleLink:n=>({chain:e})=>e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[pe({find:n=>{let e=[];if(n){let{protocols:t,defaultProtocol:r}=this.options,o=hl(n).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!tr(s,t),protocols:t,defaultProtocol:r}));o.length&&o.forEach(i=>e.push({text:i.value,data:{href:i.href},index:i.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){let n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(e0({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!tr(o,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(t0({type:this.type})),this.options.linkOnPaste&&n.push(n0({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}});var Qu=Yu.extend({addOptions(){var n;return v(b({},(n=this.parent)==null?void 0:n.call(this)),{openOnClick:!1,HTMLAttributes:{target:null,rel:"noopener noreferrer nofollow",class:null}})},addCommands(){var n;return v(b({},(n=this.parent)==null?void 0:n.call(this)),{addLink:()=>({editor:e})=>{let t=e.getAttributes(this.name);Du(e,t).then(r=>{if(r){let o=e.chain().focus().extendMarkRange(this.name).unsetMark(this.name);o.setMark(this.name,r),o.run()}})}})},addKeyboardShortcuts(){return{"Mod-k":({editor:n})=>{let e;(e=window.event)&&e.preventDefault(),n.commands.addLink()}}}});var Xu=H.create({name:"noSpellCheck",addProseMirrorPlugins(){return[new P({view(n){return new pl(n)}})]}}),pl=class{constructor(e){this.editorView=e,this.editorView.dom.setAttribute("spellcheck","false")}update(){}destroy(){this.editorView.dom.removeAttribute("spellcheck")}};var Zu=H.create({name:"typographic",addProseMirrorPlugins(){return[nf]}});function ef(n,e,t,r){let o=n.childCount,i=e.childCount;e:for(let s=0,l=0;s{let t=[];if(n.text)for(let r of n.text.matchAll(/(\u00A0|\u00AD)/g)){let o=e+(r.index||0);t.push(re.inline(o,o+1,{class:o0[r[1]]}))}return t},i0=n=>{let e=[];return n.descendants((t,r)=>{e.push(tf(t,r))}),G.create(n,e.flat())},nf=new P({state:{init(n,{doc:e}){return i0(e)},apply(n,e,t){let r=e.map(n.mapping,n.doc);return ef(t.doc,n.doc,0,(o,i)=>{r=r.remove(r.find(i,i+o.content.size)),r=r.add(n.doc,tf(o,i))}),r}},props:{decorations(n){return nf.getState(n)}}});var nr=(n,e)=>n.extensionManager.extensions.find(t=>t.name===e),rf=n=>[a0(n),c0(n),u0(n),d0(n),h0(n),p0(n),f0(n),m0(n)].filter(Boolean),s0=H.create({name:"menu",addOptions(){return{menuItems:rf}},addProseMirrorPlugins(){let n=this.editor,e=this.options.menuItems(n);return[new P({view(){let t=new ml(n,e);return n.view.dom.parentNode.insertBefore(t.dom,n.view.dom),t}})]}}),ml=class{constructor(e,t){this.items=t.flat(),this.editor=e,this.dom=j("div",{className:"prose-menubar"}),t.filter(r=>r.length).forEach(r=>{let o=j("div",{className:"prose-menubar__group"});this.dom.append(o),r.forEach(({dom:i})=>o.append(i))}),this.update(),this.dom.addEventListener("mousedown",r=>{r.preventDefault(),e.view.focus(),this.items.forEach(({command:o,dom:i})=>{i.contains(r.target)&&o(e)})})}update(){this.items.forEach(({dom:e,enabled:t=()=>!0,active:r=()=>!1,hidden:o=()=>!1})=>{e.classList.toggle("disabled",!t(this.editor)),e.classList.toggle("active",!!r(this.editor)),e.classList.toggle("hidden",!!o(this.editor))})}destroy(){this.dom.remove()}};function rn(n,e=""){return j("span",{className:"prose-menubar__button",textContent:n,title:e})}function ee(n,e){return j("span",{className:"prose-menubar__button material-icons",textContent:n,title:e})}var l0=(n,e)=>{let t=j("span",{className:"prose-menubar__button prose-menubar__button--heading"});return t.append(j("span",{className:"material-icons",textContent:"title",title:`heading ${e}`}),j("span",{className:"level",textContent:`${e}`})),{command:r=>{r.chain().focus().toggleHeading({level:e}).run()},dom:t,active(r){return r.isActive("heading",{level:e})}}};function a0(n){let e=n.schema,t=nr(n,"heading"),o=(t?t.options.levels:[]).map(s=>l0(n,s)),i;return(i=e.nodes.bulletList)&&o.push({command(s){s.chain().focus().toggleBulletList().run()},dom:ee("format_list_bulleted","unordered list"),active(s){return!1}}),(i=e.nodes.orderedList)&&o.push({command(s){s.chain().focus().toggleOrderedList().run()},dom:ee("format_list_numbered","ordered list"),active(s){return!1}}),o.length?[...o,{command(s){s.chain().focus().setParagraph().run()},dom:ee("notes","paragraph"),active(s){return!1}}]:[]}function c0(n){let e=n.schema,t=[],r;return(r=e.nodes.blockquote)&&t.push({command(o){o.chain().focus().toggleBlockquote().run()},dom:ee("format_quote","blockquote"),active(o){return o.isActive("blockquote")}}),(r=e.nodes.horizontalRule)&&t.push({command(o){o.chain().focus().setHorizontalRule().run()},dom:ee("horizontal_rule","horizontal rule"),active(o){return!1}}),t}function d0(n){let e=(t,r)=>t in n.schema.marks?{command(o){o.chain().focus().toggleMark(t).run()},dom:r,active:o=>o.isActive(t)}:null;return[e("bold",ee("format_bold","bold")),e("italic",ee("format_italic","italic")),e("underline",ee("format_underline","underline")),e("strike",ee("format_strikethrough","strike")),e("subscript",ee("subscript","subscript")),e("superscript",ee("superscript","superscript"))].filter(Boolean)}function u0(n){let e=n.schema.marks.link;return e?[{command(t){t.chain().addLink().focus().run()},enabled(t){return!t.state.selection.empty||t.isActive("link")},dom:ee("insert_link","insert link"),active(t){return t.isActive(e)}},{command(t){t.chain().focus().unsetLink().run()},dom:ee("link_off","remove link"),hidden(t){return!t.isActive("link")}}]:[]}function f0(n){return nr(n,"history")?[{command(e){e.commands.undo()},enabled(e){return e.can().undo()},dom:ee("undo","undo"),active(){return!1}},{command(e){e.commands.redo()},enabled(e){return e.can().redo()},dom:ee("redo","redo"),active(){return!1}}]:null}function h0(n){let e=t=>({command(r){r.chain().focus().setTextAlign(t).run()},dom:ee(`format_align_${t}`,t),active(){return n.isActive({textAlign:t})}});return nr(n,"textAlign")?[e("left"),e("center"),e("right"),e("justify")]:null}function p0(n){if(!nr(n,"table"))return[];let e=(t,r)=>({command:t,dom:r,hidden(){return!n.isActive("table")}});return[{command(t){t.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!1}).run()},dom:ee("grid_on","Insert table")},e(t=>{t.chain().focus().addColumnAfter().run()},rn("+Col")),e(t=>{t.chain().focus().deleteColumn().run()},rn("-Col")),e(t=>{t.chain().focus().addRowAfter().run()},rn("+Row")),e(t=>{t.chain().focus().deleteRow().run()},rn("-Row")),e(t=>{t.chain().focus().mergeCells().run()},rn("Merge")),e(t=>{t.chain().focus().splitCell().run()},rn("Split"))]}function m0(n){return nr(n,"html")?[{command(e){e.commands.editHTML()},dom:ee("code","edit HTML")}]:null}function g0(n,e,{shadow:t=!1}={}){let r=n.hasAttribute("disabled"),o=j("div",{className:"prose-editor-wrapper"});n.before(o);let i=j("div",{className:`prose-editor ${r?"disabled":""}`});if(t){let l=o.attachShadow({mode:"open"});for(let a of It().stylesheets)l.append(j("link",{rel:"stylesheet",href:a}));l.append(i)}else o.append(i);return new Ln({element:i,editable:!r,extensions:e,content:n.value,onUpdate({editor:l}){n.value=l.getHTML(),n.dispatchEvent(new Event("input",{bubbles:!0}))},onDestroy(){o.remove()}})}function y0(n,e){function t(o){for(let i of o.querySelectorAll(e))i.id.includes("__prefix__")||n(i)}function r(){let o;(o=window.django)&&(o=o.jQuery)&&o(document).on("formset:added",i=>{t(i.target)})}t(document),r()}window.DjangoProseEditor=gl;})(); +3. "-" cannot repeat`);_.customSchemes.push([n,e])}function Xy(){_.scanner=Ky(_.customSchemes);for(let n=0;n<_.tokenQueue.length;n++)_.tokenQueue[n][1]({scanner:_.scanner});_.parser=qy(_.scanner.tokens);for(let n=0;n<_.pluginQueue.length;n++)_.pluginQueue[n][1]({scanner:_.scanner,parser:_.parser});return _.initialized=!0,_}function Ho(n){return _.initialized||Xy(),Gy(_.parser.start,n,Uu(_.scanner.start,n))}Ho.scan=Uu;function hl(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}let r=new ul(t),o=Ho(n),i=[];for(let s=0;s{let o=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!o||i)return;let{tr:s}=r,l=ys(t.doc,[...e]);if(xs(l).forEach(({newRange:c})=>{let d=bs(r.doc,c,h=>h.isTextblock),u,f;if(d.length>1?(u=d[0],f=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ")):d.length&&r.doc.textBetween(c.from,c.to," "," ").endsWith(" ")&&(u=d[0],f=r.doc.textBetween(u.pos,c.to,void 0," ")),u&&f){let h=f.split(" ").filter(y=>y!=="");if(h.length<=0)return!1;let p=h[h.length-1],m=u.pos+f.lastIndexOf(p);if(!p)return!1;let g=Ho(p).map(y=>y.toObject(n.defaultProtocol));if(!Zy(g))return!1;g.filter(y=>y.isLink).map(y=>v(b({},y),{from:m+y.start+1,to:m+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>n.validate(y.value)).filter(y=>n.shouldAutoLink(y.value)).forEach(y=>{Kn(y.from,y.to,r.doc).some(w=>w.mark.type===n.type)||s.addMark(y.from,y.to,n.type.create({href:y.href}))})}}),!!s.steps.length)return s}})}function t0(n){return new P({key:new V("handleClickLink"),props:{handleClick:(e,t,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=r.target,l=[];for(;s.nodeName!=="DIV";)l.push(s),s=s.parentNode;if(!l.find(f=>f.nodeName==="A"))return!1;let a=Ur(e.state,n.type.name),c=r.target,d=(o=c==null?void 0:c.href)!==null&&o!==void 0?o:a.href,u=(i=c==null?void 0:c.target)!==null&&i!==void 0?i:a.target;return c&&d?(window.open(d,u),!0):!1}}})}function n0(n){return new P({key:new V("handlePasteLink"),props:{handlePaste:(e,t,r)=>{let{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let l="";r.content.forEach(c=>{l+=c.textContent});let a=hl(l,{defaultProtocol:n.defaultProtocol}).find(c=>c.isLink&&c.value===l);return!l||!a?!1:(n.editor.commands.setMark(n.type,{href:a.href}),!0)}}})}var r0=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Lt(n,e){let t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{let o=typeof r=="string"?r:r.scheme;o&&t.push(o)}),!n||n.replace(r0,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Yu=K.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(n=>{if(typeof n=="string"){fl(n);return}fl(n.scheme,n.optionalSlashes)})},onDestroy(){Gu()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!Lt(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{let e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Lt(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!Lt(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",N(this.options.HTMLAttributes,n),0]:["a",N(this.options.HTMLAttributes,v(b({},n),{href:""})),0]},addCommands(){return{setLink:n=>({chain:e})=>{let{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Lt(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{let{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Lt(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[pe({find:n=>{let e=[];if(n){let{protocols:t,defaultProtocol:r}=this.options,o=hl(n).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Lt(s,t),protocols:t,defaultProtocol:r}));o.length&&o.forEach(i=>e.push({text:i.value,data:{href:i.href},index:i.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){let n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(e0({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Lt(o,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(t0({type:this.type})),this.options.linkOnPaste&&n.push(n0({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}});var Qu=Yu.extend({addOptions(){var n;return v(b({},(n=this.parent)==null?void 0:n.call(this)),{openOnClick:!1,HTMLAttributes:{target:null,rel:"noopener noreferrer nofollow",class:null}})},addCommands(){var n;return v(b({},(n=this.parent)==null?void 0:n.call(this)),{addLink:()=>({editor:e})=>{let t=e.getAttributes(this.name);Du(e,t).then(r=>{if(r){let o=e.chain().focus().extendMarkRange(this.name).unsetMark(this.name);o.setMark(this.name,r),o.run()}})}})},addKeyboardShortcuts(){return{"Mod-k":({editor:n})=>{let e;(e=window.event)&&e.preventDefault(),n.commands.addLink()}}}});var Xu=H.create({name:"noSpellCheck",addProseMirrorPlugins(){return[new P({view(n){return new pl(n)}})]}}),pl=class{constructor(e){this.editorView=e,this.editorView.dom.setAttribute("spellcheck","false")}update(){}destroy(){this.editorView.dom.removeAttribute("spellcheck")}};var Zu=H.create({name:"typographic",addProseMirrorPlugins(){return[nf]}});function ef(n,e,t,r){let o=n.childCount,i=e.childCount;e:for(let s=0,l=0;s{let t=[];if(n.text)for(let r of n.text.matchAll(/(\u00A0|\u00AD)/g)){let o=e+(r.index||0);t.push(re.inline(o,o+1,{class:o0[r[1]]}))}return t},i0=n=>{let e=[];return n.descendants((t,r)=>{e.push(tf(t,r))}),G.create(n,e.flat())},nf=new P({state:{init(n,{doc:e}){return i0(e)},apply(n,e,t){let r=e.map(n.mapping,n.doc);return ef(t.doc,n.doc,0,(o,i)=>{r=r.remove(r.find(i,i+o.content.size)),r=r.add(n.doc,tf(o,i))}),r}},props:{decorations(n){return nf.getState(n)}}});var nr=(n,e)=>n.extensionManager.extensions.find(t=>t.name===e),rf=n=>[a0(n),c0(n),u0(n),d0(n),h0(n),p0(n),f0(n),m0(n)].filter(Boolean),s0=H.create({name:"menu",addOptions(){return{menuItems:rf}},addProseMirrorPlugins(){let n=this.editor,e=this.options.menuItems(n);return[new P({view(){let t=new ml(n,e);return n.view.dom.parentNode.insertBefore(t.dom,n.view.dom),t}})]}}),ml=class{constructor(e,t){this.items=t.flat(),this.editor=e,this.dom=j("div",{className:"prose-menubar"}),t.filter(r=>r.length).forEach(r=>{let o=j("div",{className:"prose-menubar__group"});this.dom.append(o),r.forEach(({dom:i})=>o.append(i))}),this.update(),this.dom.addEventListener("mousedown",r=>{r.preventDefault(),e.view.focus(),this.items.forEach(({command:o,dom:i})=>{i.contains(r.target)&&o(e)})})}update(){this.items.forEach(({dom:e,enabled:t=()=>!0,active:r=()=>!1,hidden:o=()=>!1})=>{e.classList.toggle("disabled",!t(this.editor)),e.classList.toggle("active",!!r(this.editor)),e.classList.toggle("hidden",!!o(this.editor))})}destroy(){this.dom.remove()}};function on(n,e=""){return j("span",{className:"prose-menubar__button",textContent:n,title:e})}function ee(n,e){return j("span",{className:"prose-menubar__button material-icons",textContent:n,title:e})}var l0=(n,e)=>{let t=j("span",{className:"prose-menubar__button prose-menubar__button--heading"});return t.append(j("span",{className:"material-icons",textContent:"title",title:`heading ${e}`}),j("span",{className:"level",textContent:`${e}`})),{command:r=>{r.chain().focus().toggleHeading({level:e}).run()},dom:t,active(r){return r.isActive("heading",{level:e})}}};function a0(n){let e=n.schema,t=nr(n,"heading"),o=(t?t.options.levels:[]).map(s=>l0(n,s)),i;return(i=e.nodes.bulletList)&&o.push({command(s){s.chain().focus().toggleBulletList().run()},dom:ee("format_list_bulleted","unordered list"),active(s){return!1}}),(i=e.nodes.orderedList)&&o.push({command(s){s.chain().focus().toggleOrderedList().run()},dom:ee("format_list_numbered","ordered list"),active(s){return!1}}),o.length?[...o,{command(s){s.chain().focus().setParagraph().run()},dom:ee("notes","paragraph"),active(s){return!1}}]:[]}function c0(n){let e=n.schema,t=[],r;return(r=e.nodes.blockquote)&&t.push({command(o){o.chain().focus().toggleBlockquote().run()},dom:ee("format_quote","blockquote"),active(o){return o.isActive("blockquote")}}),(r=e.nodes.horizontalRule)&&t.push({command(o){o.chain().focus().setHorizontalRule().run()},dom:ee("horizontal_rule","horizontal rule"),active(o){return!1}}),t}function d0(n){let e=(t,r)=>t in n.schema.marks?{command(o){o.chain().focus().toggleMark(t).run()},dom:r,active:o=>o.isActive(t)}:null;return[e("bold",ee("format_bold","bold")),e("italic",ee("format_italic","italic")),e("underline",ee("format_underline","underline")),e("strike",ee("format_strikethrough","strike")),e("subscript",ee("subscript","subscript")),e("superscript",ee("superscript","superscript"))].filter(Boolean)}function u0(n){let e=n.schema.marks.link;return e?[{command(t){t.chain().addLink().focus().run()},enabled(t){return!t.state.selection.empty||t.isActive("link")},dom:ee("insert_link","insert link"),active(t){return t.isActive(e)}},{command(t){t.chain().focus().unsetLink().run()},dom:ee("link_off","remove link"),hidden(t){return!t.isActive("link")}}]:[]}function f0(n){return nr(n,"history")?[{command(e){e.commands.undo()},enabled(e){return e.can().undo()},dom:ee("undo","undo"),active(){return!1}},{command(e){e.commands.redo()},enabled(e){return e.can().redo()},dom:ee("redo","redo"),active(){return!1}}]:null}function h0(n){let e=t=>({command(r){r.chain().focus().setTextAlign(t).run()},dom:ee(`format_align_${t}`,t),active(){return n.isActive({textAlign:t})}});return nr(n,"textAlign")?[e("left"),e("center"),e("right"),e("justify")]:null}function p0(n){if(!nr(n,"table"))return[];let e=(t,r)=>({command:t,dom:r,hidden(){return!n.isActive("table")}});return[{command(t){t.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!1}).run()},dom:ee("grid_on","Insert table")},e(t=>{t.chain().focus().addColumnAfter().run()},on("+Col")),e(t=>{t.chain().focus().deleteColumn().run()},on("-Col")),e(t=>{t.chain().focus().addRowAfter().run()},on("+Row")),e(t=>{t.chain().focus().deleteRow().run()},on("-Row")),e(t=>{t.chain().focus().mergeCells().run()},on("Merge")),e(t=>{t.chain().focus().splitCell().run()},on("Split"))]}function m0(n){return nr(n,"html")?[{command(e){e.commands.editHTML()},dom:ee("code","edit HTML")}]:null}function g0(n,e,{shadow:t=!1}={}){let r=n.hasAttribute("disabled"),o=j("div",{className:"prose-editor-wrapper"});n.before(o);let i=j("div",{className:`prose-editor ${r?"disabled":""}`});if(t){let l=o.attachShadow({mode:"open"});for(let a of It().stylesheets)l.append(j("link",{rel:"stylesheet",href:a}));l.append(i)}else o.append(i);return new Bn({element:i,editable:!r,extensions:e,content:n.value,onUpdate({editor:l}){n.value=l.getHTML(),n.dispatchEvent(new Event("input",{bubbles:!0}))},onDestroy(){o.remove()}})}function y0(n,e){function t(o){for(let i of o.querySelectorAll(e))i.id.includes("__prefix__")||n(i)}function r(){let o;(o=window.django)&&(o=o.jQuery)&&o(document).on("formset:added",i=>{t(i.target)})}t(document),r()}window.DjangoProseEditor=gl;})(); diff --git a/package.json b/package.json index bab60c3..6feb8d6 100644 --- a/package.json +++ b/package.json @@ -4,25 +4,25 @@ "main": "index.js", "license": "MIT", "dependencies": { - "@tiptap/core": "^2.10.3", - "@tiptap/extension-code": "^2.10.3", - "@tiptap/extension-code-block": "^2.10.3", - "@tiptap/extension-color": "^2.10.3", - "@tiptap/extension-highlight": "^2.10.3", - "@tiptap/extension-link": "^2.10.3", - "@tiptap/extension-subscript": "^2.10.3", - "@tiptap/extension-superscript": "^2.10.3", - "@tiptap/extension-table": "^2.10.3", - "@tiptap/extension-table-cell": "^2.10.3", - "@tiptap/extension-table-header": "^2.10.3", - "@tiptap/extension-table-row": "^2.10.3", - "@tiptap/extension-text-align": "^2.10.3", - "@tiptap/extension-text-style": "^2.10.3", - "@tiptap/extension-underline": "^2.10.3", - "@tiptap/pm": "^2.10.3", - "@tiptap/starter-kit": "^2.10.3", + "@tiptap/core": "^2.10.4", + "@tiptap/extension-code": "^2.10.4", + "@tiptap/extension-code-block": "^2.10.4", + "@tiptap/extension-color": "^2.10.4", + "@tiptap/extension-highlight": "^2.10.4", + "@tiptap/extension-link": "^2.10.4", + "@tiptap/extension-subscript": "^2.10.4", + "@tiptap/extension-superscript": "^2.10.4", + "@tiptap/extension-table": "^2.10.4", + "@tiptap/extension-table-cell": "^2.10.4", + "@tiptap/extension-table-header": "^2.10.4", + "@tiptap/extension-table-row": "^2.10.4", + "@tiptap/extension-text-align": "^2.10.4", + "@tiptap/extension-text-style": "^2.10.4", + "@tiptap/extension-underline": "^2.10.4", + "@tiptap/pm": "^2.10.4", + "@tiptap/starter-kit": "^2.10.4", "autoprefixer": "^10.4.20", - "esbuild": "^0.24.0", + "esbuild": "^0.24.2", "esbuild-postcss": "^0.0.4", "postcss": "^8.4.49" }, diff --git a/yarn.lock b/yarn.lock index 5e6e73b..993ebd9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,292 +2,297 @@ # yarn lockfile v1 -"@esbuild/aix-ppc64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.24.0.tgz#b57697945b50e99007b4c2521507dc613d4a648c" - integrity sha512-WtKdFM7ls47zkKHFVzMz8opM7LkcsIp9amDUBIAWirg70RM71WRSjdILPsY5Uv1D42ZpUfaPILDlfactHgsRkw== - -"@esbuild/android-arm64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.24.0.tgz#1add7e0af67acefd556e407f8497e81fddad79c0" - integrity sha512-Vsm497xFM7tTIPYK9bNTYJyF/lsP590Qc1WxJdlB6ljCbdZKU9SY8i7+Iin4kyhV/KV5J2rOKsBQbB77Ab7L/w== - -"@esbuild/android-arm@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.24.0.tgz#ab7263045fa8e090833a8e3c393b60d59a789810" - integrity sha512-arAtTPo76fJ/ICkXWetLCc9EwEHKaeya4vMrReVlEIUCAUncH7M4bhMQ+M9Vf+FFOZJdTNMXNBrWwW+OXWpSew== - -"@esbuild/android-x64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.24.0.tgz#e8f8b196cfdfdd5aeaebbdb0110983460440e705" - integrity sha512-t8GrvnFkiIY7pa7mMgJd7p8p8qqYIz1NYiAoKc75Zyv73L3DZW++oYMSHPRarcotTKuSs6m3hTOa5CKHaS02TQ== - -"@esbuild/darwin-arm64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.24.0.tgz#2d0d9414f2acbffd2d86e98253914fca603a53dd" - integrity sha512-CKyDpRbK1hXwv79soeTJNHb5EiG6ct3efd/FTPdzOWdbZZfGhpbcqIpiD0+vwmpu0wTIL97ZRPZu8vUt46nBSw== - -"@esbuild/darwin-x64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.24.0.tgz#33087aab31a1eb64c89daf3d2cf8ce1775656107" - integrity sha512-rgtz6flkVkh58od4PwTRqxbKH9cOjaXCMZgWD905JOzjFKW+7EiUObfd/Kav+A6Gyud6WZk9w+xu6QLytdi2OA== - -"@esbuild/freebsd-arm64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.0.tgz#bb76e5ea9e97fa3c753472f19421075d3a33e8a7" - integrity sha512-6Mtdq5nHggwfDNLAHkPlyLBpE5L6hwsuXZX8XNmHno9JuL2+bg2BX5tRkwjyfn6sKbxZTq68suOjgWqCicvPXA== - -"@esbuild/freebsd-x64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.24.0.tgz#e0e2ce9249fdf6ee29e5dc3d420c7007fa579b93" - integrity sha512-D3H+xh3/zphoX8ck4S2RxKR6gHlHDXXzOf6f/9dbFt/NRBDIE33+cVa49Kil4WUjxMGW0ZIYBYtaGCa2+OsQwQ== - -"@esbuild/linux-arm64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.24.0.tgz#d1b2aa58085f73ecf45533c07c82d81235388e75" - integrity sha512-TDijPXTOeE3eaMkRYpcy3LarIg13dS9wWHRdwYRnzlwlA370rNdZqbcp0WTyyV/k2zSxfko52+C7jU5F9Tfj1g== - -"@esbuild/linux-arm@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.24.0.tgz#8e4915df8ea3e12b690a057e77a47b1d5935ef6d" - integrity sha512-gJKIi2IjRo5G6Glxb8d3DzYXlxdEj2NlkixPsqePSZMhLudqPhtZ4BUrpIuTjJYXxvF9njql+vRjB2oaC9XpBw== - -"@esbuild/linux-ia32@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.24.0.tgz#8200b1110666c39ab316572324b7af63d82013fb" - integrity sha512-K40ip1LAcA0byL05TbCQ4yJ4swvnbzHscRmUilrmP9Am7//0UjPreh4lpYzvThT2Quw66MhjG//20mrufm40mA== - -"@esbuild/linux-loong64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.24.0.tgz#6ff0c99cf647504df321d0640f0d32e557da745c" - integrity sha512-0mswrYP/9ai+CU0BzBfPMZ8RVm3RGAN/lmOMgW4aFUSOQBjA31UP8Mr6DDhWSuMwj7jaWOT0p0WoZ6jeHhrD7g== - -"@esbuild/linux-mips64el@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.24.0.tgz#3f720ccd4d59bfeb4c2ce276a46b77ad380fa1f3" - integrity sha512-hIKvXm0/3w/5+RDtCJeXqMZGkI2s4oMUGj3/jM0QzhgIASWrGO5/RlzAzm5nNh/awHE0A19h/CvHQe6FaBNrRA== - -"@esbuild/linux-ppc64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.24.0.tgz#9d6b188b15c25afd2e213474bf5f31e42e3aa09e" - integrity sha512-HcZh5BNq0aC52UoocJxaKORfFODWXZxtBaaZNuN3PUX3MoDsChsZqopzi5UupRhPHSEHotoiptqikjN/B77mYQ== - -"@esbuild/linux-riscv64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.24.0.tgz#f989fdc9752dfda286c9cd87c46248e4dfecbc25" - integrity sha512-bEh7dMn/h3QxeR2KTy1DUszQjUrIHPZKyO6aN1X4BCnhfYhuQqedHaa5MxSQA/06j3GpiIlFGSsy1c7Gf9padw== - -"@esbuild/linux-s390x@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.24.0.tgz#29ebf87e4132ea659c1489fce63cd8509d1c7319" - integrity sha512-ZcQ6+qRkw1UcZGPyrCiHHkmBaj9SiCD8Oqd556HldP+QlpUIe2Wgn3ehQGVoPOvZvtHm8HPx+bH20c9pvbkX3g== - -"@esbuild/linux-x64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.24.0.tgz#4af48c5c0479569b1f359ffbce22d15f261c0cef" - integrity sha512-vbutsFqQ+foy3wSSbmjBXXIJ6PL3scghJoM8zCL142cGaZKAdCZHyf+Bpu/MmX9zT9Q0zFBVKb36Ma5Fzfa8xA== - -"@esbuild/netbsd-x64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.24.0.tgz#1ae73d23cc044a0ebd4f198334416fb26c31366c" - integrity sha512-hjQ0R/ulkO8fCYFsG0FZoH+pWgTTDreqpqY7UnQntnaKv95uP5iW3+dChxnx7C3trQQU40S+OgWhUVwCjVFLvg== - -"@esbuild/openbsd-arm64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.0.tgz#5d904a4f5158c89859fd902c427f96d6a9e632e2" - integrity sha512-MD9uzzkPQbYehwcN583yx3Tu5M8EIoTD+tUgKF982WYL9Pf5rKy9ltgD0eUgs8pvKnmizxjXZyLt0z6DC3rRXg== - -"@esbuild/openbsd-x64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.24.0.tgz#4c8aa88c49187c601bae2971e71c6dc5e0ad1cdf" - integrity sha512-4ir0aY1NGUhIC1hdoCzr1+5b43mw99uNwVzhIq1OY3QcEwPDO3B7WNXBzaKY5Nsf1+N11i1eOfFcq+D/gOS15Q== - -"@esbuild/sunos-x64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.24.0.tgz#8ddc35a0ea38575fa44eda30a5ee01ae2fa54dd4" - integrity sha512-jVzdzsbM5xrotH+W5f1s+JtUy1UWgjU0Cf4wMvffTB8m6wP5/kx0KiaLHlbJO+dMgtxKV8RQ/JvtlFcdZ1zCPA== - -"@esbuild/win32-arm64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.24.0.tgz#6e79c8543f282c4539db684a207ae0e174a9007b" - integrity sha512-iKc8GAslzRpBytO2/aN3d2yb2z8XTVfNV0PjGlCxKo5SgWmNXx82I/Q3aG1tFfS+A2igVCY97TJ8tnYwpUWLCA== - -"@esbuild/win32-ia32@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.24.0.tgz#057af345da256b7192d18b676a02e95d0fa39103" - integrity sha512-vQW36KZolfIudCcTnaTpmLQ24Ha1RjygBo39/aLkM2kmjkWmZGEJ5Gn9l5/7tzXA42QGIoWbICfg6KLLkIw6yw== - -"@esbuild/win32-x64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.24.0.tgz#168ab1c7e1c318b922637fad8f339d48b01e1244" - integrity sha512-7IAFPrjSQIJrGsK6flwg7NFmwBoSTyF3rl7If0hNUFQU4ilTsEPL6GuMuU9BfIWVVGuRnuIidkSMC+c0Otu8IA== +"@esbuild/aix-ppc64@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.24.2.tgz#38848d3e25afe842a7943643cbcd387cc6e13461" + integrity sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA== + +"@esbuild/android-arm64@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.24.2.tgz#f592957ae8b5643129fa889c79e69cd8669bb894" + integrity sha512-cNLgeqCqV8WxfcTIOeL4OAtSmL8JjcN6m09XIgro1Wi7cF4t/THaWEa7eL5CMoMBdjoHOTh/vwTO/o2TRXIyzg== + +"@esbuild/android-arm@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.24.2.tgz#72d8a2063aa630308af486a7e5cbcd1e134335b3" + integrity sha512-tmwl4hJkCfNHwFB3nBa8z1Uy3ypZpxqxfTQOcHX+xRByyYgunVbZ9MzUUfb0RxaHIMnbHagwAxuTL+tnNM+1/Q== + +"@esbuild/android-x64@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.24.2.tgz#9a7713504d5f04792f33be9c197a882b2d88febb" + integrity sha512-B6Q0YQDqMx9D7rvIcsXfmJfvUYLoP722bgfBlO5cGvNVb5V/+Y7nhBE3mHV9OpxBf4eAS2S68KZztiPaWq4XYw== + +"@esbuild/darwin-arm64@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.24.2.tgz#02ae04ad8ebffd6e2ea096181b3366816b2b5936" + integrity sha512-kj3AnYWc+CekmZnS5IPu9D+HWtUI49hbnyqk0FLEJDbzCIQt7hg7ucF1SQAilhtYpIujfaHr6O0UHlzzSPdOeA== + +"@esbuild/darwin-x64@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.24.2.tgz#9ec312bc29c60e1b6cecadc82bd504d8adaa19e9" + integrity sha512-WeSrmwwHaPkNR5H3yYfowhZcbriGqooyu3zI/3GGpF8AyUdsrrP0X6KumITGA9WOyiJavnGZUwPGvxvwfWPHIA== + +"@esbuild/freebsd-arm64@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.2.tgz#5e82f44cb4906d6aebf24497d6a068cfc152fa00" + integrity sha512-UN8HXjtJ0k/Mj6a9+5u6+2eZ2ERD7Edt1Q9IZiB5UZAIdPnVKDoG7mdTVGhHJIeEml60JteamR3qhsr1r8gXvg== + +"@esbuild/freebsd-x64@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.24.2.tgz#3fb1ce92f276168b75074b4e51aa0d8141ecce7f" + integrity sha512-TvW7wE/89PYW+IevEJXZ5sF6gJRDY/14hyIGFXdIucxCsbRmLUcjseQu1SyTko+2idmCw94TgyaEZi9HUSOe3Q== + +"@esbuild/linux-arm64@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.24.2.tgz#856b632d79eb80aec0864381efd29de8fd0b1f43" + integrity sha512-7HnAD6074BW43YvvUmE/35Id9/NB7BeX5EoNkK9obndmZBUk8xmJJeU7DwmUeN7tkysslb2eSl6CTrYz6oEMQg== + +"@esbuild/linux-arm@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.24.2.tgz#c846b4694dc5a75d1444f52257ccc5659021b736" + integrity sha512-n0WRM/gWIdU29J57hJyUdIsk0WarGd6To0s+Y+LwvlC55wt+GT/OgkwoXCXvIue1i1sSNWblHEig00GBWiJgfA== + +"@esbuild/linux-ia32@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.24.2.tgz#f8a16615a78826ccbb6566fab9a9606cfd4a37d5" + integrity sha512-sfv0tGPQhcZOgTKO3oBE9xpHuUqguHvSo4jl+wjnKwFpapx+vUDcawbwPNuBIAYdRAvIDBfZVvXprIj3HA+Ugw== + +"@esbuild/linux-loong64@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.24.2.tgz#1c451538c765bf14913512c76ed8a351e18b09fc" + integrity sha512-CN9AZr8kEndGooS35ntToZLTQLHEjtVB5n7dl8ZcTZMonJ7CCfStrYhrzF97eAecqVbVJ7APOEe18RPI4KLhwQ== + +"@esbuild/linux-mips64el@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.24.2.tgz#0846edeefbc3d8d50645c51869cc64401d9239cb" + integrity sha512-iMkk7qr/wl3exJATwkISxI7kTcmHKE+BlymIAbHO8xanq/TjHaaVThFF6ipWzPHryoFsesNQJPE/3wFJw4+huw== + +"@esbuild/linux-ppc64@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.24.2.tgz#8e3fc54505671d193337a36dfd4c1a23b8a41412" + integrity sha512-shsVrgCZ57Vr2L8mm39kO5PPIb+843FStGt7sGGoqiiWYconSxwTiuswC1VJZLCjNiMLAMh34jg4VSEQb+iEbw== + +"@esbuild/linux-riscv64@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.24.2.tgz#6a1e92096d5e68f7bb10a0d64bb5b6d1daf9a694" + integrity sha512-4eSFWnU9Hhd68fW16GD0TINewo1L6dRrB+oLNNbYyMUAeOD2yCK5KXGK1GH4qD/kT+bTEXjsyTCiJGHPZ3eM9Q== + +"@esbuild/linux-s390x@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.24.2.tgz#ab18e56e66f7a3c49cb97d337cd0a6fea28a8577" + integrity sha512-S0Bh0A53b0YHL2XEXC20bHLuGMOhFDO6GN4b3YjRLK//Ep3ql3erpNcPlEFed93hsQAjAQDNsvcK+hV90FubSw== + +"@esbuild/linux-x64@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.24.2.tgz#8140c9b40da634d380b0b29c837a0b4267aff38f" + integrity sha512-8Qi4nQcCTbLnK9WoMjdC9NiTG6/E38RNICU6sUNqK0QFxCYgoARqVqxdFmWkdonVsvGqWhmm7MO0jyTqLqwj0Q== + +"@esbuild/netbsd-arm64@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-arm64/-/netbsd-arm64-0.24.2.tgz#65f19161432bafb3981f5f20a7ff45abb2e708e6" + integrity sha512-wuLK/VztRRpMt9zyHSazyCVdCXlpHkKm34WUyinD2lzK07FAHTq0KQvZZlXikNWkDGoT6x3TD51jKQ7gMVpopw== + +"@esbuild/netbsd-x64@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.24.2.tgz#7a3a97d77abfd11765a72f1c6f9b18f5396bcc40" + integrity sha512-VefFaQUc4FMmJuAxmIHgUmfNiLXY438XrL4GDNV1Y1H/RW3qow68xTwjZKfj/+Plp9NANmzbH5R40Meudu8mmw== + +"@esbuild/openbsd-arm64@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.2.tgz#58b00238dd8f123bfff68d3acc53a6ee369af89f" + integrity sha512-YQbi46SBct6iKnszhSvdluqDmxCJA+Pu280Av9WICNwQmMxV7nLRHZfjQzwbPs3jeWnuAhE9Jy0NrnJ12Oz+0A== + +"@esbuild/openbsd-x64@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.24.2.tgz#0ac843fda0feb85a93e288842936c21a00a8a205" + integrity sha512-+iDS6zpNM6EnJyWv0bMGLWSWeXGN/HTaF/LXHXHwejGsVi+ooqDfMCCTerNFxEkM3wYVcExkeGXNqshc9iMaOA== + +"@esbuild/sunos-x64@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.24.2.tgz#8b7aa895e07828d36c422a4404cc2ecf27fb15c6" + integrity sha512-hTdsW27jcktEvpwNHJU4ZwWFGkz2zRJUz8pvddmXPtXDzVKTTINmlmga3ZzwcuMpUvLw7JkLy9QLKyGpD2Yxig== + +"@esbuild/win32-arm64@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.24.2.tgz#c023afb647cabf0c3ed13f0eddfc4f1d61c66a85" + integrity sha512-LihEQ2BBKVFLOC9ZItT9iFprsE9tqjDjnbulhHoFxYQtQfai7qfluVODIYxt1PgdoyQkz23+01rzwNwYfutxUQ== + +"@esbuild/win32-ia32@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.24.2.tgz#96c356132d2dda990098c8b8b951209c3cd743c2" + integrity sha512-q+iGUwfs8tncmFC9pcnD5IvRHAzmbwQ3GPS5/ceCyHdjXubwQWI12MKWSNSMYLJMq23/IUCvJMS76PDqXe1fxA== + +"@esbuild/win32-x64@0.24.2": + version "0.24.2" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.24.2.tgz#34aa0b52d0fbb1a654b596acfa595f0c7b77a77b" + integrity sha512-7VTgWzgMGvup6aSqDPLiW5zHaxYJGTO4OokMjIlrCtf+VpEL+cXKtCvg723iguPYI5oaUNdS+/V7OU2gvXVWEg== "@remirror/core-constants@3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@remirror/core-constants/-/core-constants-3.0.0.tgz#96fdb89d25c62e7b6a5d08caf0ce5114370e3b8f" integrity sha512-42aWfPrimMfDKDi4YegyS7x+/0tlzaqwPQCULLanv3DMIlu96KTJR0fM5isWX2UViOqlGnX6YFgqWepcX+XMNg== -"@tiptap/core@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/core/-/core-2.10.3.tgz#7744abd4a954f35265af351f1be9b545e819c66d" - integrity sha512-wAG/0/UsLeZLmshWb6rtWNXKJftcmnned91/HLccHVQAuQZ1UWH+wXeQKu/mtodxEO7JcU2mVPR9mLGQkK0McQ== - -"@tiptap/extension-blockquote@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-blockquote/-/extension-blockquote-2.10.3.tgz#ee29925930ac9a5b129d3ad262bb45afcc23b318" - integrity sha512-u9Mq4r8KzoeGVT8ms6FQDIMN95dTh3TYcT7fZpwcVM96mIl2Oyt+Bk66mL8z4zuFptfRI57Cu9QdnHEeILd//w== - -"@tiptap/extension-bold@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-bold/-/extension-bold-2.10.3.tgz#6ffdeed5d1b2c7bd2a248b327083f3db89c02f87" - integrity sha512-xnF1tS2BsORenr11qyybW120gHaeHKiKq+ZOP14cGA0MsriKvWDnaCSocXP/xMEYHy7+2uUhJ0MsKkHVj4bPzQ== - -"@tiptap/extension-bullet-list@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-bullet-list/-/extension-bullet-list-2.10.3.tgz#0a17343aaf64679327de87785918bcdb04744edf" - integrity sha512-PTkwJOVlHi4RR4Wrs044tKMceweXwNmWA6EoQ93hPUVtQcwQL990Es5Izp+i88twTPLuGD9dH+o9QDyH9SkWdA== - -"@tiptap/extension-code-block@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-code-block/-/extension-code-block-2.10.3.tgz#5ff1b1e563c4eda44677df444c523de1e5258fa4" - integrity sha512-yiDVNg22fYkzsFk5kBlDSHcjwVJgajvO/M5fDXA+Hfxwo2oNcG6aJyyHXFe+UaXTVjdkPej0J6kcMKrTMCiFug== - -"@tiptap/extension-code@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-code/-/extension-code-2.10.3.tgz#b9fb04be2d51760f011ec7a060d4e2e3eefe392c" - integrity sha512-JyLbfyY3cPctq9sVdpcRWTcoUOoq3/MnGE1eP6eBNyMTHyBPcM9TPhOkgj+xkD1zW/884jfelB+wa70RT/AMxQ== - -"@tiptap/extension-color@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-color/-/extension-color-2.10.3.tgz#97e77235dc20adc96c1034b48cfe7ce20040864d" - integrity sha512-FC2hPMSQ4w9UmO9kJCAdoU7gHpDbJ6MeJAmikB9EPp16dbGwFLrZm9TZ/4pv74fGfVm0lv720316ALOEgPEDjQ== - -"@tiptap/extension-document@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-document/-/extension-document-2.10.3.tgz#2ba039932af67c85475870697495b099d9983a1d" - integrity sha512-6i8+xbS2zB6t8iFzli1O/QB01MmwyI5Hqiiv4m5lOxqavmJwLss2sRhoMC2hB3CyFg5UmeODy/f/RnI6q5Vixg== - -"@tiptap/extension-dropcursor@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-dropcursor/-/extension-dropcursor-2.10.3.tgz#c5484e16df98f3c43c9f585c5686b38808c4615b" - integrity sha512-wzWf82ixWzZQr0hxcf/A0ul8NNxgy1N63O+c56st6OomoLuKUJWOXF+cs9O7V+/5rZKWdbdYYoRB5QLvnDBAlQ== - -"@tiptap/extension-gapcursor@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-gapcursor/-/extension-gapcursor-2.10.3.tgz#6a68027d41fb77707104551b2886146253a9461b" - integrity sha512-FskZi2DqDSTH1WkgLF2OLy0xU7qj3AgHsKhVsryeAtld4jAK5EsonneWgaipbz0e/MxuIvc1oyacfZKABpLaNg== - -"@tiptap/extension-hard-break@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-hard-break/-/extension-hard-break-2.10.3.tgz#1fd1ea91e57c018747e54516eaca963e578af6a4" - integrity sha512-2rFlimUKAgKDwT6nqAMtPBjkrknQY8S7oBNyIcDOUGyFkvbDUl3Jd0PiC929S5F3XStJRppnMqhpNDAlWmvBLA== - -"@tiptap/extension-heading@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-heading/-/extension-heading-2.10.3.tgz#bf8efb3a580c75b86dce505a63f1ca7450a9aaea" - integrity sha512-AlxXXPCWIvw8hQUDFRskasj32iMNB8Sb19VgyFWqwvntGs2/UffNu8VdsVqxD2HpZ0g5rLYCYtSW4wigs9R3og== - -"@tiptap/extension-highlight@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-highlight/-/extension-highlight-2.10.3.tgz#d94667d435d9dc556b06e7b764449dc2a6c18743" - integrity sha512-srMOdpUTcp1yPGmUqgKOkbmTpCYOF6Q/8CnquDkhrvK7Gyphj+n8TocrKiloaRYZKcoQWtmb+kcVPaHhHMzsWQ== - -"@tiptap/extension-history@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-history/-/extension-history-2.10.3.tgz#86ddbdaaa1573d4461c3a925185c4ebd9aec8079" - integrity sha512-HaSiMdx9Im9Pb9qGlVud7W8bweRDRMez33Uzs5a2x0n1RWkelfH7TwYs41Y3wus8Ujs7kw6qh7jyhvPpQBKaSA== - -"@tiptap/extension-horizontal-rule@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-horizontal-rule/-/extension-horizontal-rule-2.10.3.tgz#b2b6e47896ad12ef6747816bc11b388a53480614" - integrity sha512-1a2IWhD00tgUNg/91RLnBvfENL7DLCui5L245+smcaLu+OXOOEpoBHawx59/M4hEpsjqvRRM79TzO9YXfopsPw== - -"@tiptap/extension-italic@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-italic/-/extension-italic-2.10.3.tgz#0efb940c572e47bd03e7e50a7ce745b60040771d" - integrity sha512-wAiO6ZxoHx2H90phnKttLWGPjPZXrfKxhOCsqYrK8BpRByhr48godOFRuGwYnKaiwoVjpxc63t+kDJDWvqmgMw== - -"@tiptap/extension-link@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-link/-/extension-link-2.10.3.tgz#ddf8c99cc2ce664c3b53d11184cbbde70120ee78" - integrity sha512-8esKlkZBzEiNcpt7I8Cd6l1mWmCc/66pPbUq9LfnIniDXE3U+ahBf4m3TJltYFBGbiiTR/xqMtJyVHOpuLDtAw== +"@tiptap/core@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/core/-/core-2.10.4.tgz#0b3ad822d71f5834b281590809f430e6fd41523c" + integrity sha512-fExFRTRgb6MSpg2VvR5qO2dPTQAZWuUoU4UsBCurIVcPWcyVv4FG1YzgMyoLDKy44rebFtwUGJbfU9NzX7Q/bA== + +"@tiptap/extension-blockquote@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-blockquote/-/extension-blockquote-2.10.4.tgz#0f9a26740009fc7430fabc423077c369feaebb42" + integrity sha512-4JSwAM3B92YWvGzu/Vd5rovPrCGwLSaSLD5rxcLyfxLSrTDQd3n7lp78pzVgGhunVECzaGF5A0ByWWpEyS0a3w== + +"@tiptap/extension-bold@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-bold/-/extension-bold-2.10.4.tgz#ac4a791fe9c4ccf0c4fb70c304e663cc07ba9397" + integrity sha512-SdO4oFQKaERCGfwOc1CLYQRtThENam2KWfWmvpsymknokt5qYzU57ft0SE1HQV9vVYEzZ9HrWIgv2xrgu0g9kg== + +"@tiptap/extension-bullet-list@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-bullet-list/-/extension-bullet-list-2.10.4.tgz#0b86fb2782b4a7fc012a23d3e265bcc798e70a12" + integrity sha512-JVwDPgOBYRU2ivaadOh4IaQYXQEiSw6sB36KT/bwqJF2GnEvLiMwptdRMn9Uuh6xYR3imjIZtV6uZAoneZdd6g== + +"@tiptap/extension-code-block@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-code-block/-/extension-code-block-2.10.4.tgz#a86a4477acc995c5185e32dd60188f4e173f9341" + integrity sha512-qS4jnbJqghNMT2+B+GQ807ATgqkL9OQ//NlL+ZwVSe+DPDduNA9B6IB9SrWENDfOnzekpi7kcEcm+RenELARRQ== + +"@tiptap/extension-code@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-code/-/extension-code-2.10.4.tgz#d6d1fd9e7f1b457700b6c47e115fb1cc9b9039f8" + integrity sha512-Vj/N0nbSQiV1o7X7pRySK9Fu72Dd266gm27TSlsts6IwJu5MklFvz7ezJUWoLjt2wmCV8/U/USmk/39ic9qjvg== + +"@tiptap/extension-color@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-color/-/extension-color-2.10.4.tgz#fc1a686d458c4cda39163e8c889c4441cb4c7d27" + integrity sha512-LgYECcWnTfonqzTUJQN+ujNlWQahGg4G6typRR44opNxwGTlmXHjc6h/JwgLiYxSMZke3EDP/17BSQDH9MMrIA== + +"@tiptap/extension-document@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-document/-/extension-document-2.10.4.tgz#68575c122f6d71556dae6f9df6173903b7cdfdf9" + integrity sha512-1Pqrl6Rr9bVEHJ3zO2dM7UUA0Qn/r70JQ9YLlestjW1sbMaMuY3Ifvu2uSyUE7SAGV3gvxwNVQCrv8f0VlVEaA== + +"@tiptap/extension-dropcursor@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-dropcursor/-/extension-dropcursor-2.10.4.tgz#6dea1c17878a8a0d68c7915f34b7b02980e91c90" + integrity sha512-0XEM/yNLaMc/sZlYOau7XpHyYiHT9LwXUe7kmze/L8eowIa/iLvmRbcnUd3rtlZ7x7wooE6UO9c7OtlREg4ZBw== + +"@tiptap/extension-gapcursor@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-gapcursor/-/extension-gapcursor-2.10.4.tgz#697f0f599c5fe90f584e3f94e4866959211c8688" + integrity sha512-KbJfoaqTZePpkWAN+klpK5j0UVtELxN7H5B0J556/UCB/rnq+OsdEFHPks2Ss9TidqWzRUqcxUE50UZ7b8h7Ug== + +"@tiptap/extension-hard-break@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-hard-break/-/extension-hard-break-2.10.4.tgz#57767f35950405c457789faa7b793830860096cc" + integrity sha512-nW9wubW1A/CO2Ssn9wNMP08tR9Oarg9VUGzJ5qNuz38DDNyntE1SyDS+XStkeMq5nKqJ3YKhukyAJH/PiRq4Mg== + +"@tiptap/extension-heading@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-heading/-/extension-heading-2.10.4.tgz#6df708f74f2f2d0716f6e3d32100c29c8be3fe68" + integrity sha512-7D0h0MIvE97Gx3Qwuo2xnPDK07WfCnyh4tpOPBOus4e1g6sgxVkwDwhbkYWiwvIrf4BUVJflnke/DEDCVp6/Eg== + +"@tiptap/extension-highlight@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-highlight/-/extension-highlight-2.10.4.tgz#932aac9052b7c97cbf79fd99b6f0c4b77cd350f9" + integrity sha512-0E/eK+eKx7I7UotELKPFsL/jiWFVtAkyXvcs1+OzcCr8ao2M6t5hGKh0McBG4WUQdxttnIwfQemGzIHU25pDog== + +"@tiptap/extension-history@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-history/-/extension-history-2.10.4.tgz#58e1b819149354538526475896a9904e954d02a6" + integrity sha512-fg6BNxbpMMtgKaiNI/GLcCzkxIQMwSYBhO9LA0CxLvmsWGU+My4r9W3DK6HwNoRJ9+6OleDPSLo1P73fbSTtEA== + +"@tiptap/extension-horizontal-rule@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-horizontal-rule/-/extension-horizontal-rule-2.10.4.tgz#a2099c156c4c691f4951def225e1102ad1f69f22" + integrity sha512-s9ycm/BOGoW3L0Epnj541vdngHbFbMM488HoODd1CmVSw1C+wBWFgsukgqKjlyE3VGfZXuSb1ur9zinW0RiLJQ== + +"@tiptap/extension-italic@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-italic/-/extension-italic-2.10.4.tgz#000cd53a5d54efe1c8bfa51a2bd6003268dcd01d" + integrity sha512-8MIQ+wsbyxNCZDCFTVTOXrS2AvFyOhtlBNgVU2+6r6xnJV4AcfEA3qclysqrjOlL117ped/nzDeoB0AeX0CI+Q== + +"@tiptap/extension-link@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-link/-/extension-link-2.10.4.tgz#0c43eb7dafec897fdd317a4bd9c3f08fdd576655" + integrity sha512-9lbtMUPc9IYCRMKV/B4k/no9J5OQQl/jJn9W2ce3NjJZSrOjuZs0CjJZgCESIaj6911s7nEJUvxKKmsbD3UC3Q== dependencies: linkifyjs "^4.1.0" -"@tiptap/extension-list-item@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-list-item/-/extension-list-item-2.10.3.tgz#a35c10a579acff63bb46a2fa9491b5f4edf00188" - integrity sha512-9sok81gvZfSta2K1Dwrq5/HSz1jk4zHBpFqCx0oydzodGslx6X1bNxdca+eXJpXZmQIWALK7zEr4X8kg3WZsgw== - -"@tiptap/extension-ordered-list@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-ordered-list/-/extension-ordered-list-2.10.3.tgz#5ee0feb2f06a59c50e413160840f244215cc4026" - integrity sha512-/SFuEDnbJxy3jvi72LeyiPHWkV+uFc0LUHTUHSh20vwyy+tLrzncJfXohGbTIv5YxYhzExQYZDRD4VbSghKdlw== - -"@tiptap/extension-paragraph@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-paragraph/-/extension-paragraph-2.10.3.tgz#128c8fcd46d2e854d214c7f566e6212f2ebff6f1" - integrity sha512-sNkTX/iN+YoleDiTJsrWSBw9D7c4vsYwnW5y/G5ydfuJMIRQMF78pWSIWZFDRNOMkgK5UHkhu9anrbCFYgBfaA== - -"@tiptap/extension-strike@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-strike/-/extension-strike-2.10.3.tgz#99e39c8156cad7a9dc88504ac43aa839c54ef7af" - integrity sha512-jYoPy6F6njYp3txF3u23bgdRy/S5ATcWDO9LPZLHSeikwQfJ47nqb+EUNo5M8jIOgFBTn4MEbhuZ6OGyhnxopA== - -"@tiptap/extension-subscript@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-subscript/-/extension-subscript-2.10.3.tgz#3d74cdbcd1dcd661791708559e88c7313202b577" - integrity sha512-GkOwXIruM7QksmlfqLTKTC6JBpWSBDN2eeoPwggxXuqetqYs4sIx1ul3LEGDQy0vglcFKGkbbO2IiHCO/0fSWA== - -"@tiptap/extension-superscript@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-superscript/-/extension-superscript-2.10.3.tgz#2b4f186ddb179bcdf2af68d4aebc5e1f3220de2b" - integrity sha512-4bXDPyT10ByVCLXFR8A70TcpFJ0H3PicRsxKJcQ+KZIauNUo5BBUpkF2cK+IOUp4UZ1W5ZBeuMQG5HWMuV9T1A== - -"@tiptap/extension-table-cell@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-table-cell/-/extension-table-cell-2.10.3.tgz#3d090c7b758428abc484e0c229318bce8bd08b5b" - integrity sha512-EYzBrnq7KUAcRhshIoTmC4ED8YoF4Ei5m8ZMPOctKX+QMAagKdcrw2UxuOf4tP2xgBYx+qDsKCautepZXQiL2g== - -"@tiptap/extension-table-header@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-table-header/-/extension-table-header-2.10.3.tgz#76f0f1b3eb1d8c01b0355fa704ad75a74cd2102b" - integrity sha512-zJqzivz+VITYIFXNH09leBbkwAPuvp504rCAFL2PMa1uaME6+oiiRqZvXQrOiRkjNpOWEXH4dqvVLwkSMZoWaw== - -"@tiptap/extension-table-row@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-table-row/-/extension-table-row-2.10.3.tgz#66302d52a02b675b7cb674d1a586e3c2c5ff119a" - integrity sha512-l6P6BAE4SuIFdPmsRd+zGP2Ks9AhLAua7nfDlHFMWDnfOeaJu7g/t4oG++9xTojDcVDHhcIe8TJYUXfhOt2anw== - -"@tiptap/extension-table@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-table/-/extension-table-2.10.3.tgz#6aaecabd7f2b58baef5082e17f1907cf45998bb7" - integrity sha512-XAvq0ptpHfuN7lQhTeew4Sqo8aKYHTqroa7cHL8I+gWJqYqKJSTGb4FAqdGIFEzHvnSsMCFbTL//kAHXvTdsHg== - -"@tiptap/extension-text-align@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-text-align/-/extension-text-align-2.10.3.tgz#f1144210e96219bd0d8c49c78f76c3a3ab543e9b" - integrity sha512-g75sNl73gtgjP3XIcl06kvv1qw3c0rGEUD848rUU1bvlBpU3IxjkcQLgYvHmv3vpuUp9cKUkA2wa7Sv6R3fjvw== - -"@tiptap/extension-text-style@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-text-style/-/extension-text-style-2.10.3.tgz#fcc93de8d0479b893c2a000ad7e3dc20b944f3dd" - integrity sha512-TalYIdlF7vBA4afFhmido7AORdBbu3sV+HCByda0FiNbM6cjng3Nr9oxHOCVJy+ChqrcgF4m54zDfLmamdyu5Q== - -"@tiptap/extension-text@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-text/-/extension-text-2.10.3.tgz#f985ebd37a2c86d621068927bceca0f05e842865" - integrity sha512-7p9XiRprsRZm8y9jvF/sS929FCELJ5N9FQnbzikOiyGNUx5mdI+exVZlfvBr9xOD5s7fBLg6jj9Vs0fXPNRkPg== - -"@tiptap/extension-underline@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/extension-underline/-/extension-underline-2.10.3.tgz#83d392bd4d0b2344c590c19736bb89d208c413df" - integrity sha512-VeGs0jeNiTnXddHHJEgOc/sKljZiyTEgSSuqMmsBACrr9aGFXbLTgKTvNjkZ9WzSnu7LwgJuBrwEhg8yYixUyQ== - -"@tiptap/pm@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/pm/-/pm-2.10.3.tgz#c6925bafd23868800bc71e06cdfe12add7bf4943" - integrity sha512-771p53aU0KFvujvKpngvq2uAxThlEsjYaXcVVmwrhf0vxSSg+psKQEvqvWvHv/3BwkPVCGwmEKNVJZjaXFKu4g== +"@tiptap/extension-list-item@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-list-item/-/extension-list-item-2.10.4.tgz#3ea8e597567d448b00ac4d7b0ef9d1b91bc1d306" + integrity sha512-8K3WUD5fPyw2poQKnJGGm7zlfeIbpld92+SRF4M9wkp95EzvgexTlodvxlrL3i8zKXcQQVyExWA8kCcGPFb9bA== + +"@tiptap/extension-ordered-list@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-ordered-list/-/extension-ordered-list-2.10.4.tgz#3da20e5087329a9999837b5860954bd14b14ef60" + integrity sha512-NaeEu+qFG2O0emc8WlwOM7DKNKOaqHWuNkuKrrmQzslgL+UQSEGlGMo6NEJ5sLLckPBDpIa0MuRm30407JE+cg== + +"@tiptap/extension-paragraph@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-paragraph/-/extension-paragraph-2.10.4.tgz#e2c94eaee7c69b7c38f98abd50927a8a6811dc49" + integrity sha512-SRNVhT8OXqjpZtcyuOtofbtOpXXFrQrjqqCc/yXebda//2SfUTOvB16Lss77vQOWi6xr7TF1mZuowJgSTkcczw== + +"@tiptap/extension-strike@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-strike/-/extension-strike-2.10.4.tgz#8c450d1cb26f6cb0b79403aed2bf0bd6d1d0cd98" + integrity sha512-OibipsomFpOJWTPVX/z4Z53HgwDA93lE/loHGa+ONJfML1dO6Zd6UTwzaVO1/g8WOwRgwkYu/6JnhxLKRlP8Lg== + +"@tiptap/extension-subscript@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-subscript/-/extension-subscript-2.10.4.tgz#918b0187075e3036413bedc64257e608eedfec6e" + integrity sha512-r/4oMBnMEeXqSP4GttKrd4N5FQgzuLtWdxuVBVUIV7C7TUg5l+YXsoFqhmODSWt/I6hSLTg0ArrQcox6TOV5cA== + +"@tiptap/extension-superscript@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-superscript/-/extension-superscript-2.10.4.tgz#6438360604b88fe8166fe53714338f951abe3573" + integrity sha512-QLmzpjawefaKzL0LAy/jMSNau18/YVe43w2pQ9JaZgBYsLmhmDIi4U1YFTBrryVhjv8lQubKd38f9Q7rie6ywg== + +"@tiptap/extension-table-cell@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-table-cell/-/extension-table-cell-2.10.4.tgz#cdbcc86d54a0f3f3393a73a242098118f48517e9" + integrity sha512-vYwRYt3xPaAU4hxoz3OMGPQzcAxaxEVri6VSRMWg4BN3x4DwWevBTAk59Ho9nkJpaRuXO6c5pIxcwWCZM0Aw0w== + +"@tiptap/extension-table-header@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-table-header/-/extension-table-header-2.10.4.tgz#a7b8177baeca97e075288724b446fb81bdd2bcc4" + integrity sha512-NVi/KMBh9IAzpukjptCsH+gibZB3VxgCc+wuFk41QqI5ABnTPKWflnQ0wRo7IC6wC/tUi4YBahh20dL/wBJn3w== + +"@tiptap/extension-table-row@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-table-row/-/extension-table-row-2.10.4.tgz#7106d407e8654eebfe884ffce2a1caf9877034d8" + integrity sha512-kpQQSZQNYHhencIk+lzs+zWtgg6nUXHIVQKZUg5dVT0VP2JNO7wPM6d8HgnscvxOkJNRVF/Q5dYe0Cb4tROIKg== + +"@tiptap/extension-table@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-table/-/extension-table-2.10.4.tgz#a60bb346c0a608f8b81cd6a3a182967d06f1e764" + integrity sha512-ak1RT8n0WQFNnVsZ9e6QFLWlRQP0IjT+Yp/PTsx5fSmqkiiwQKGs1ILCJWlBB3H0hV7N69aaOtK3h/35lmqoEg== + +"@tiptap/extension-text-align@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-text-align/-/extension-text-align-2.10.4.tgz#ffd9cd61bf7f00c6ed4b3b5f377a7d5bed56550b" + integrity sha512-rt2Hz3N081QAgkKKSMpyDZTKorBmXKpeHkYIw+ArVuvBYhi8x5wVyZgZ2SIMW9A5G4rx1M0czn7xNi+/P3NopQ== + +"@tiptap/extension-text-style@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-text-style/-/extension-text-style-2.10.4.tgz#07af922c266fef7da13cc83befbbd5da512b7402" + integrity sha512-ibq7avkcwHyUSG53Hf+P31rrwsKVbbiqbWZM4kXC7M2X3iUwFrtvaa+SWzyWQfE1jl2cCrD1+rfSkj/alcOKGg== + +"@tiptap/extension-text@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-text/-/extension-text-2.10.4.tgz#ca5c7618ec122cfd72399b8c593023cf4a5829d5" + integrity sha512-wPdVxCHrIS9S+8n08lgyyqRZPj9FBbyLlFt74/lV5yBC3LOorq1VKdjrTskmaj4jud7ImXoKDyBddAYTHdJ1xw== + +"@tiptap/extension-underline@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/extension-underline/-/extension-underline-2.10.4.tgz#5892a3dc7997818c0bbc0dde4e48b036d6786975" + integrity sha512-KhlCndQFMe/Gsz+3qkVn9z1utDy8y1igvdePijMjA5B8PTu0hPs2Q1d6szfLTBdtoFNkCokknxzXhSY0OFJEyQ== + +"@tiptap/pm@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/pm/-/pm-2.10.4.tgz#28909a528a3ac59e4f62055d5b9b2890f6f386fc" + integrity sha512-pZ4NEkRtYoDLe0spARvXZ1N3hNv/5u6vfPdPtEbmNpoOSjSNqDC1kVM+qJY0iaCYpxbxcv7cxn3kBumcFLQpJQ== dependencies: prosemirror-changeset "^2.2.1" prosemirror-collab "^1.3.1" @@ -308,32 +313,32 @@ prosemirror-transform "^1.10.2" prosemirror-view "^1.37.0" -"@tiptap/starter-kit@^2.10.3": - version "2.10.3" - resolved "https://registry.yarnpkg.com/@tiptap/starter-kit/-/starter-kit-2.10.3.tgz#2b6c3be565219eacd897f1c2d271b516d9ff6f87" - integrity sha512-oq8xdVIMqohSs91ofHSr7i5dCp2F56Lb9aYIAI25lZmwNwQJL2geGOYjMSfL0IC4cQHPylIuSKYCg7vRFdZmAA== +"@tiptap/starter-kit@^2.10.4": + version "2.10.4" + resolved "https://registry.yarnpkg.com/@tiptap/starter-kit/-/starter-kit-2.10.4.tgz#37f95fae7ea36b29825720706c49dd0533274b0b" + integrity sha512-tu/WCs9Mkr5Nt8c3/uC4VvAbQlVX0OY7ygcqdzHGUeG9zP3twdW7o5xM3kyDKR2++sbVzqu5Ll5qNU+1JZvPGQ== dependencies: - "@tiptap/core" "^2.10.3" - "@tiptap/extension-blockquote" "^2.10.3" - "@tiptap/extension-bold" "^2.10.3" - "@tiptap/extension-bullet-list" "^2.10.3" - "@tiptap/extension-code" "^2.10.3" - "@tiptap/extension-code-block" "^2.10.3" - "@tiptap/extension-document" "^2.10.3" - "@tiptap/extension-dropcursor" "^2.10.3" - "@tiptap/extension-gapcursor" "^2.10.3" - "@tiptap/extension-hard-break" "^2.10.3" - "@tiptap/extension-heading" "^2.10.3" - "@tiptap/extension-history" "^2.10.3" - "@tiptap/extension-horizontal-rule" "^2.10.3" - "@tiptap/extension-italic" "^2.10.3" - "@tiptap/extension-list-item" "^2.10.3" - "@tiptap/extension-ordered-list" "^2.10.3" - "@tiptap/extension-paragraph" "^2.10.3" - "@tiptap/extension-strike" "^2.10.3" - "@tiptap/extension-text" "^2.10.3" - "@tiptap/extension-text-style" "^2.10.3" - "@tiptap/pm" "^2.10.3" + "@tiptap/core" "^2.10.4" + "@tiptap/extension-blockquote" "^2.10.4" + "@tiptap/extension-bold" "^2.10.4" + "@tiptap/extension-bullet-list" "^2.10.4" + "@tiptap/extension-code" "^2.10.4" + "@tiptap/extension-code-block" "^2.10.4" + "@tiptap/extension-document" "^2.10.4" + "@tiptap/extension-dropcursor" "^2.10.4" + "@tiptap/extension-gapcursor" "^2.10.4" + "@tiptap/extension-hard-break" "^2.10.4" + "@tiptap/extension-heading" "^2.10.4" + "@tiptap/extension-history" "^2.10.4" + "@tiptap/extension-horizontal-rule" "^2.10.4" + "@tiptap/extension-italic" "^2.10.4" + "@tiptap/extension-list-item" "^2.10.4" + "@tiptap/extension-ordered-list" "^2.10.4" + "@tiptap/extension-paragraph" "^2.10.4" + "@tiptap/extension-strike" "^2.10.4" + "@tiptap/extension-text" "^2.10.4" + "@tiptap/extension-text-style" "^2.10.4" + "@tiptap/pm" "^2.10.4" "@types/linkify-it@^5": version "5.0.0" @@ -381,9 +386,9 @@ browserslist@^4.23.3: update-browserslist-db "^1.1.1" caniuse-lite@^1.0.30001646, caniuse-lite@^1.0.30001688: - version "1.0.30001689" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001689.tgz#67ca960dd5f443903e19949aeacc9d28f6e10910" - integrity sha512-CmeR2VBycfa+5/jOfnp/NpWPGd06nf1XYiefUvhXFfZE4GkRc9jv+eGPS4nT558WS/8lYCzV8SlANCIPvbWP1g== + version "1.0.30001690" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001690.tgz#f2d15e3aaf8e18f76b2b8c1481abde063b8104c8" + integrity sha512-5ExiE3qQN6oF8Clf8ifIDcMRCRE/dMGcETG/XGMD8/XiXm6HXQgQTh1yZYLXXpSOsEUlJm1Xr7kGULZTuGtP/w== crelt@^1.0.0: version "1.0.6" @@ -391,9 +396,9 @@ crelt@^1.0.0: integrity sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g== electron-to-chromium@^1.5.73: - version "1.5.73" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.73.tgz#f32956ce40947fa3c8606726a96cd8fb5bb5f720" - integrity sha512-8wGNxG9tAG5KhGd3eeA0o6ixhiNdgr0DcHWm85XPCphwZgD1lIEoi6t3VERayWao7SF7AAZTw6oARGJeVjH8Kg== + version "1.5.75" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.75.tgz#bba96eabf0e8ca36324679caa38b982800acc87d" + integrity sha512-Lf3++DumRE/QmweGjU+ZcKqQ+3bKkU/qjaKYhIJKEOhgIO9Xs6IiAQFkfFoj+RhgDk4LUeNsLo6plExHqSyu6Q== entities@^4.4.0: version "4.5.0" @@ -407,35 +412,36 @@ esbuild-postcss@^0.0.4: dependencies: postcss-load-config "^3.1.0" -esbuild@^0.24.0: - version "0.24.0" - resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.24.0.tgz#f2d470596885fcb2e91c21eb3da3b3c89c0b55e7" - integrity sha512-FuLPevChGDshgSicjisSooU0cemp/sGXR841D5LHMB7mTVOmsEHcAxaH3irL53+8YDIeVNQEySh4DaYU/iuPqQ== +esbuild@^0.24.2: + version "0.24.2" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.24.2.tgz#b5b55bee7de017bff5fb8a4e3e44f2ebe2c3567d" + integrity sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA== optionalDependencies: - "@esbuild/aix-ppc64" "0.24.0" - "@esbuild/android-arm" "0.24.0" - "@esbuild/android-arm64" "0.24.0" - "@esbuild/android-x64" "0.24.0" - "@esbuild/darwin-arm64" "0.24.0" - "@esbuild/darwin-x64" "0.24.0" - "@esbuild/freebsd-arm64" "0.24.0" - "@esbuild/freebsd-x64" "0.24.0" - "@esbuild/linux-arm" "0.24.0" - "@esbuild/linux-arm64" "0.24.0" - "@esbuild/linux-ia32" "0.24.0" - "@esbuild/linux-loong64" "0.24.0" - "@esbuild/linux-mips64el" "0.24.0" - "@esbuild/linux-ppc64" "0.24.0" - "@esbuild/linux-riscv64" "0.24.0" - "@esbuild/linux-s390x" "0.24.0" - "@esbuild/linux-x64" "0.24.0" - "@esbuild/netbsd-x64" "0.24.0" - "@esbuild/openbsd-arm64" "0.24.0" - "@esbuild/openbsd-x64" "0.24.0" - "@esbuild/sunos-x64" "0.24.0" - "@esbuild/win32-arm64" "0.24.0" - "@esbuild/win32-ia32" "0.24.0" - "@esbuild/win32-x64" "0.24.0" + "@esbuild/aix-ppc64" "0.24.2" + "@esbuild/android-arm" "0.24.2" + "@esbuild/android-arm64" "0.24.2" + "@esbuild/android-x64" "0.24.2" + "@esbuild/darwin-arm64" "0.24.2" + "@esbuild/darwin-x64" "0.24.2" + "@esbuild/freebsd-arm64" "0.24.2" + "@esbuild/freebsd-x64" "0.24.2" + "@esbuild/linux-arm" "0.24.2" + "@esbuild/linux-arm64" "0.24.2" + "@esbuild/linux-ia32" "0.24.2" + "@esbuild/linux-loong64" "0.24.2" + "@esbuild/linux-mips64el" "0.24.2" + "@esbuild/linux-ppc64" "0.24.2" + "@esbuild/linux-riscv64" "0.24.2" + "@esbuild/linux-s390x" "0.24.2" + "@esbuild/linux-x64" "0.24.2" + "@esbuild/netbsd-arm64" "0.24.2" + "@esbuild/netbsd-x64" "0.24.2" + "@esbuild/openbsd-arm64" "0.24.2" + "@esbuild/openbsd-x64" "0.24.2" + "@esbuild/sunos-x64" "0.24.2" + "@esbuild/win32-arm64" "0.24.2" + "@esbuild/win32-ia32" "0.24.2" + "@esbuild/win32-x64" "0.24.2" escalade@^3.2.0: version "3.2.0"