=c?a:c)),a}function Pn(a,c,p,g,E,_){var T,C=c&d,k=c&f,U=c&h;if(p&&(T=E?p(a,g,E,_):p(a)),T!==t)return T;if(!pt(a))return a;var $=Ne(a);if($){if(T=aM(a),!C)return bn(a,T)}else{var G=Qt(a),ne=G==_t||G==Xt;if(oi(a))return $g(a,C);if(G==Nt||G==Ue||ne&&!E){if(T=k||ne?{}:ab(a),!C)return k?XT(a,ET(T,a)):JT(a,yg(T,a))}else{if(!rt[G])return E?a:{};T=lM(a,G,C)}}_||(_=new jn);var de=_.get(a);if(de)return de;_.set(a,T),Pb(a)?a.forEach(function(ve){T.add(Pn(ve,c,p,ve,a,_))}):Db(a)&&a.forEach(function(ve,ze){T.set(ze,Pn(ve,c,p,ze,a,_))});var Ee=U?k?Ed:yd:k?En:Ht,Le=$?t:Ee(a);return In(Le||a,function(ve,ze){Le&&(ze=ve,ve=a[ze]),xs(T,ze,Pn(ve,c,p,ze,a,_))}),T}function vT(a){var c=Ht(a);return function(p){return Eg(p,a,c)}}function Eg(a,c,p){var g=p.length;if(a==null)return!g;for(a=tt(a);g--;){var E=p[g],_=c[E],T=a[E];if(T===t&&!(E in a)||!_(T))return!1}return!0}function vg(a,c,p){if(typeof a!="function")throw new Dn(i);return ks(function(){a.apply(t,p)},c)}function _s(a,c,p,g){var E=-1,_=Ca,T=!0,C=a.length,k=[],U=c.length;if(!C)return k;p&&(c=ut(c,Mn(p))),g?(_=Hu,T=!1):c.length>=n&&(_=gs,T=!1,c=new Ri(c));e:for(;++E 1&&Ge.reverse(),$&&k
=c?a:c)),a}function Pn(a,c,p,g,E,_){var T,C=c&d,k=c&f,U=c&h;if(p&&(T=E?p(a,g,E,_):p(a)),T!==t)return T;if(!pt(a))return a;var $=Ne(a);if($){if(T=lM(a),!C)return bn(a,T)}else{var G=Qt(a),ne=G==_t||G==Xt;if(oi(a))return Kg(a,C);if(G==Nt||G==Ue||ne&&!E){if(T=k||ne?{}:cb(a),!C)return k?ZT(a,vT(T,a)):XT(a,vg(T,a))}else{if(!it[G])return E?a:{};T=cM(a,G,C)}}_||(_=new jn);var de=_.get(a);if(de)return de;_.set(a,T),Fb(a)?a.forEach(function(ve){T.add(Pn(ve,c,p,ve,a,_))}):Pb(a)&&a.forEach(function(ve,ze){T.set(ze,Pn(ve,c,p,ze,a,_))});var Ee=U?k?vd:Ed:k?En:Ht,Le=$?t:Ee(a);return In(Le||a,function(ve,ze){Le&&(ze=ve,ve=a[ze]),xs(T,ze,Pn(ve,c,p,ze,a,_))}),T}function wT(a){var c=Ht(a);return function(p){return wg(p,a,c)}}function wg(a,c,p){var g=p.length;if(a==null)return!g;for(a=nt(a);g--;){var E=p[g],_=c[E],T=a[E];if(T===t&&!(E in a)||!_(T))return!1}return!0}function xg(a,c,p){if(typeof a!="function")throw new Dn(i);return ks(function(){a.apply(t,p)},c)}function _s(a,c,p,g){var E=-1,_=Ca,T=!0,C=a.length,k=[],U=c.length;if(!C)return k;p&&(c=ut(c,Mn(p))),g?(_=zu,T=!1):c.length>=n&&(_=gs,T=!1,c=new Ri(c));e:for(;++E 1&&Ge.reverse(),$&&ki&&Xd(t,e,i+1),s=r.depth>i&&Xd(n,r,i+1),l=[];return Os(null,t,i,l),o&&s&&e.index(i)==n.index(i)?(ly(o,s),Fi(Hi(o,cy(t,e,n,r,i+1)),l)):(o&&Fi(Hi(o,hl(t,e,i+1)),l),Os(e,n,i,l),s&&Fi(Hi(s,hl(n,r,i+1)),l)),Os(r,null,i,l),new V(l)}function hl(t,e,n){let r=[];if(Os(null,t,n,r),t.depth>n){let i=Xd(t,e,n+1);Fi(Hi(i,hl(t,e,n+1)),r)}return Os(e,null,n,r),new V(r)}function zN(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)i=e.node(o).copy(V.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}var ml=class t{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.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,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;or){let l=r+o.border,u=s-o.border;if(e>=l&&n<=u){this.dirty=e==r||n==s?qi:Gy,e==l&&n==u&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=mr:o.markDirty(e-l,n-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?qi:mr}r=s}this.dirty=qi}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?qi:Gy;n.dirty-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let u=Wo.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))o=this.top.children.indexOf(s,this.index);else for(let l=this.index,u=Math.min(this.top.children.length,l+5);l0;){let l;for(;;)if(r){let d=n.children[r-1];if(d instanceof Wo)n=d,r=d.children.length;else{l=d,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=l.node;if(u){if(u!=t.child(i-1))break;--i,o.set(l,i),s.push(l)}}return{index:i,matched:o,matches:s.reverse()}}function XO(t,e){return t.type.side-e.type.side}function ZO(t,e,n,r){let i=e.locals(t),o=0;if(i.length==0){for(let d=0;dw;y--)b-=i.child(y).nodeSize,r.delete(b-1,b+1);let o=r.doc.resolve(n.start),s=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,u=n.endIndex==i.childCount,d=o.node(-1),f=o.index(-1);if(!d.canReplace(f+(l?0:1),f+1,s.content.append(u?V.empty:V.from(i))))return!1;let h=o.pos,m=h+s.nodeSize;return r.step(new Tt(h-(l?1:0),m+(u?1:0),h+1,m-1,new Z((l?V.empty:V.from(i.copy(V.empty))).append(u?V.empty:V.from(i.copy(V.empty))),l?0:1,u?0:1),l?0:1)),e(r.scrollIntoView()),!0}function aE(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,d=>d.childCount>0&&d.firstChild.type==t);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let l=o.parent,u=l.child(s-1);if(u.type!=t)return!1;if(n){let d=u.lastChild&&u.lastChild.type==l.type,f=V.from(d?t.create():null),h=new Z(V.from(t.create(null,V.from(l.type.create(null,f)))),d?3:1,0),m=o.start,b=o.end;n(e.tr.step(new Tt(m-(d?3:1),b,m,b,h,1,!0)).scrollIntoView())}return!0}}function Yl(t){let{state:e,transaction:n}=t,{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),filterTransaction:e.filterTransaction,plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}var Vo=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:n,state:r}=this,{view:i}=n,{tr:o}=r,s=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([l,u])=>[l,(...f)=>{let h=u(...f)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),h}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){let{rawCommands:r,editor:i,state:o}=this,{view:s}=i,l=[],u=!!e,d=e||o.tr,f=()=>(!u&&n&&!d.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(d),l.every(m=>m===!0)),h={...Object.fromEntries(Object.entries(r).map(([m,b])=>[m,(...w)=>{let x=this.buildProps(d,n),M=b(...w)(x);return l.push(M),h}])),run:f};return h}createCan(e){let{rawCommands:n,state:r}=this,i=!1,o=e||r.tr,s=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(n).map(([u,d])=>[u,(...f)=>d(...f)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,n=!0){let{rawCommands:r,editor:i,state:o}=this,{view:s}=i,l={tr:e,editor:i,view:s,state:Yl({state:o,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([u,d])=>[u,(...f)=>d(...f)(l)]))}};return l}},ap=class{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){let r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,n)),this}off(e,n){let r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}};function ie(t,e,n){return t.config[e]===void 0&&t.parent?ie(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?ie(t.parent,e,n):null}):t.config[e]}function Jl(t){let e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function mE(t){let e=[],{nodeExtensions:n,markExtensions:r}=Jl(t),i=[...n,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{let l={name:s.name,options:s.options,storage:s.storage},u=ie(s,"addGlobalAttributes",l);if(!u)return;u().forEach(f=>{f.types.forEach(h=>{Object.entries(f.attributes).forEach(([m,b])=>{e.push({type:h,name:m,attribute:{...o,...b}})})})})}),i.forEach(s=>{let l={name:s.name,options:s.options,storage:s.storage},u=ie(s,"addAttributes",l);if(!u)return;let d=u();Object.entries(d).forEach(([f,h])=>{let m={...o,...h};typeof m?.default=="function"&&(m.default=m.default()),m?.isRequired&&m?.default===void 0&&delete m.default,e.push({type:s.name,name:f,attribute:m})})}),e}function Ut(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function j(...t){return t.filter(e=>!!e).reduce((e,n)=>{let r={...e};return Object.entries(n).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){let l=o?o.split(" "):[],u=r[i]?r[i].split(" "):[],d=l.filter(f=>!u.includes(f));r[i]=[...u,...d].join(" ")}else i==="style"?r[i]=[r[i],o].join("; "):r[i]=o}),r},{})}function lp(t,e){return e.filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>j(n,r),{})}function gE(t){return typeof t=="function"}function Se(t,e=void 0,...n){return gE(t)?e?t.bind(e)(...n):t(...n):t}function cI(t={}){return Object.keys(t).length===0&&t.constructor===Object}function uI(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function lE(t,e){return t.style?t:{...t,getAttrs:n=>{let r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;let i=e.reduce((o,s)=>{let l=s.attribute.parseHTML?s.attribute.parseHTML(n):uI(n.getAttribute(s.name));return l==null?o:{...o,[s.name]:l}},{});return{...r,...i}}}}function cE(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&cI(n)?!1:n!=null))}function dI(t,e){var n;let r=mE(t),{nodeExtensions:i,markExtensions:o}=Jl(t),s=(n=i.find(d=>ie(d,"topNode")))===null||n===void 0?void 0:n.name,l=Object.fromEntries(i.map(d=>{let f=r.filter(M=>M.type===d.name),h={name:d.name,options:d.options,storage:d.storage,editor:e},m=t.reduce((M,L)=>{let D=ie(L,"extendNodeSchema",h);return{...M,...D?D(d):{}}},{}),b=cE({...m,content:Se(ie(d,"content",h)),marks:Se(ie(d,"marks",h)),group:Se(ie(d,"group",h)),inline:Se(ie(d,"inline",h)),atom:Se(ie(d,"atom",h)),selectable:Se(ie(d,"selectable",h)),draggable:Se(ie(d,"draggable",h)),code:Se(ie(d,"code",h)),defining:Se(ie(d,"defining",h)),isolating:Se(ie(d,"isolating",h)),attrs:Object.fromEntries(f.map(M=>{var L;return[M.name,{default:(L=M?.attribute)===null||L===void 0?void 0:L.default}]}))}),y=Se(ie(d,"parseHTML",h));y&&(b.parseDOM=y.map(M=>lE(M,f)));let w=ie(d,"renderHTML",h);w&&(b.toDOM=M=>w({node:M,HTMLAttributes:lp(M,f)}));let x=ie(d,"renderText",h);return x&&(b.toText=x),[d.name,b]})),u=Object.fromEntries(o.map(d=>{let f=r.filter(x=>x.type===d.name),h={name:d.name,options:d.options,storage:d.storage,editor:e},m=t.reduce((x,M)=>{let L=ie(M,"extendMarkSchema",h);return{...x,...L?L(d):{}}},{}),b=cE({...m,inclusive:Se(ie(d,"inclusive",h)),excludes:Se(ie(d,"excludes",h)),group:Se(ie(d,"group",h)),spanning:Se(ie(d,"spanning",h)),code:Se(ie(d,"code",h)),attrs:Object.fromEntries(f.map(x=>{var M;return[x.name,{default:(M=x?.attribute)===null||M===void 0?void 0:M.default}]}))}),y=Se(ie(d,"parseHTML",h));y&&(b.parseDOM=y.map(x=>lE(x,f)));let w=ie(d,"renderHTML",h);return w&&(b.toDOM=x=>w({mark:x,HTMLAttributes:lp(x,f)})),[d.name,b]}));return new bl({topNode:s,nodes:l,marks:u})}function np(t,e){return e.nodes[t]||e.marks[t]||null}function uE(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}var fI=(t,e=500)=>{let n="",r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,l)=>{var u,d;let f=((d=(u=i.type.spec).toText)===null||d===void 0?void 0:d.call(u,{node:i,pos:o,parent:s,index:l}))||i.textContent||"%leaf%";n+=f.slice(0,Math.max(0,r-o))}),n};function pp(t){return Object.prototype.toString.call(t)==="[object RegExp]"}var Go=class{constructor(e){this.find=e.find,this.handler=e.handler}},pI=(t,e)=>{if(pp(e))return e.exec(t);let n=e(t);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function rp(t){var e;let{editor:n,from:r,to:i,text:o,rules:s,plugin:l}=t,{view:u}=n;if(u.composing)return!1;let d=u.state.doc.resolve(r);if(d.parent.type.spec.code||!((e=d.nodeBefore||d.nodeAfter)===null||e===void 0)&&e.marks.find(m=>m.type.spec.code))return!1;let f=!1,h=fI(d)+o;return s.forEach(m=>{if(f)return;let b=pI(h,m.find);if(!b)return;let y=u.state.tr,w=Yl({state:u.state,transaction:y}),x={from:r-(b[0].length-o.length),to:i},{commands:M,chain:L,can:D}=new Vo({editor:n,state:w});m.handler({state:w,range:x,match:b,commands:M,chain:L,can:D})===null||!y.steps.length||(y.setMeta(l,{transform:y,from:r,to:i,text:o}),u.dispatch(y),f=!0)}),f}function hI(t){let{editor:e,rules:n}=t,r=new Pe({state:{init(){return null},apply(i,o){let s=i.getMeta(r);return s||(i.selectionSet||i.docChanged?null:o)}},props:{handleTextInput(i,o,s,l){return rp({editor:e,from:o,to:s,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{let{$cursor:o}=i.state.selection;o&&rp({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;let{$cursor:s}=i.state.selection;return s?rp({editor:e,from:s.pos,to:s.pos,text:`
-`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function mI(t){return typeof t=="number"}var cp=class{constructor(e){this.find=e.find,this.handler=e.handler}},gI=(t,e)=>{if(pp(e))return[...t.matchAll(e)];let n=e(t);return n?n.map(r=>{let i=[r.text];return i.index=r.index,i.input=t,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function bI(t){let{editor:e,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:l}=t,{commands:u,chain:d,can:f}=new Vo({editor:e,state:n}),h=[];return n.doc.nodesBetween(r,i,(b,y)=>{if(!b.isTextblock||b.type.spec.code)return;let w=Math.max(r,y),x=Math.min(i,y+b.content.size),M=b.textBetween(w-y,x-y,void 0,"\uFFFC");gI(M,o.find).forEach(D=>{if(D.index===void 0)return;let S=w+D.index+1,z=S+D[0].length,O={from:n.tr.mapping.map(S),to:n.tr.mapping.map(z)},q=o.handler({state:n,range:O,match:D,commands:u,chain:d,can:f,pasteEvent:s,dropEvent:l});h.push(q)})}),h.every(b=>b!==null)}function yI(t){let{editor:e,rules:n}=t,r=null,i=!1,o=!1,s=new ClipboardEvent("paste"),l=new DragEvent("drop");return n.map(d=>new Pe({view(f){let h=m=>{var b;r=!((b=f.dom.parentElement)===null||b===void 0)&&b.contains(m.target)?f.dom.parentElement:null};return window.addEventListener("dragstart",h),{destroy(){window.removeEventListener("dragstart",h)}}},props:{handleDOMEvents:{drop:(f,h)=>(o=r===f.dom.parentElement,l=h,!1),paste:(f,h)=>{var m;let b=(m=h.clipboardData)===null||m===void 0?void 0:m.getData("text/html");return s=h,i=!!b?.includes("data-pm-slice"),!1}}},appendTransaction:(f,h,m)=>{let b=f[0],y=b.getMeta("uiEvent")==="paste"&&!i,w=b.getMeta("uiEvent")==="drop"&&!o;if(!y&&!w)return;let x=h.doc.content.findDiffStart(m.doc.content),M=h.doc.content.findDiffEnd(m.doc.content);if(!mI(x)||!M||x===M.b)return;let L=m.tr,D=Yl({state:m,transaction:L});if(!(!bI({editor:e,state:D,from:Math.max(x-1,0),to:M.b-1,rule:d,pasteEvent:s,dropEvent:l})||!L.steps.length))return l=new DragEvent("drop"),s=new ClipboardEvent("paste"),L}}))}function EI(t){let e=t.filter((n,r)=>t.indexOf(n)!==r);return[...new Set(e)]}var up=class t{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=t.resolve(e),this.schema=dI(this.extensions,n),this.extensions.forEach(r=>{var i;this.editor.extensionStorage[r.name]=r.storage;let o={name:r.name,options:r.options,storage:r.storage,editor:this.editor,type:np(r.name,this.schema)};r.type==="mark"&&(!((i=Se(ie(r,"keepOnSplit",o)))!==null&&i!==void 0)||i)&&this.splittableMarks.push(r.name);let s=ie(r,"onBeforeCreate",o);s&&this.editor.on("beforeCreate",s);let l=ie(r,"onCreate",o);l&&this.editor.on("create",l);let u=ie(r,"onUpdate",o);u&&this.editor.on("update",u);let d=ie(r,"onSelectionUpdate",o);d&&this.editor.on("selectionUpdate",d);let f=ie(r,"onTransaction",o);f&&this.editor.on("transaction",f);let h=ie(r,"onFocus",o);h&&this.editor.on("focus",h);let m=ie(r,"onBlur",o);m&&this.editor.on("blur",m);let b=ie(r,"onDestroy",o);b&&this.editor.on("destroy",b)})}static resolve(e){let n=t.sort(t.flatten(e)),r=EI(n.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{let r={name:n.name,options:n.options,storage:n.storage},i=ie(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{let o=ie(r,"priority")||100,s=ie(i,"priority")||100;return o>s?-1:o{let r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:np(n.name,this.schema)},i=ie(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){let{editor:e}=this,n=t.sort([...this.extensions].reverse()),r=[],i=[],o=n.map(s=>{let l={name:s.name,options:s.options,storage:s.storage,editor:e,type:np(s.name,this.schema)},u=[],d=ie(s,"addKeyboardShortcuts",l),f={};if(s.type==="mark"&&s.config.exitable&&(f.ArrowRight=()=>et.handleExit({editor:e,mark:s})),d){let w=Object.fromEntries(Object.entries(d()).map(([x,M])=>[x,()=>M({editor:e})]));f={...f,...w}}let h=Y0(f);u.push(h);let m=ie(s,"addInputRules",l);uE(s,e.options.enableInputRules)&&m&&r.push(...m());let b=ie(s,"addPasteRules",l);uE(s,e.options.enablePasteRules)&&b&&i.push(...b());let y=ie(s,"addProseMirrorPlugins",l);if(y){let w=y();u.push(...w)}return u}).flat();return[hI({editor:e,rules:r}),...yI({editor:e,rules:i}),...o]}get attributes(){return mE(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:n}=Jl(this.extensions);return Object.fromEntries(n.filter(r=>!!ie(r,"addNodeView")).map(r=>{let i=this.attributes.filter(u=>u.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:e,type:Ut(r.name,this.schema)},s=ie(r,"addNodeView",o);if(!s)return[];let l=(u,d,f,h)=>{let m=lp(u,i);return s()({editor:e,node:u,getPos:f,decorations:h,HTMLAttributes:m,extension:r})};return[r.name,l]}))}};function vI(t){return Object.prototype.toString.call(t).slice(8,-1)}function ip(t){return vI(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Xl(t,e){let n={...t};return ip(t)&&ip(e)&&Object.keys(e).forEach(r=>{ip(e[r])?r in t?n[r]=Xl(t[r],e[r]):Object.assign(n,{[r]:e[r]}):Object.assign(n,{[r]:e[r]})}),n}var it=class t{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&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=Se(ie(this,"addOptions",{name:this.name}))),this.storage=Se(ie(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new t(e)}configure(e={}){let n=this.extend();return n.options=Xl(this.options,e),n.storage=Se(ie(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){let n=new t(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Se(ie(n,"addOptions",{name:n.name})),n.storage=Se(ie(n,"addStorage",{name:n.name,options:n.options})),n}};function bE(t,e,n){let{from:r,to:i}=e,{blockSeparator:o=`
-
-`,textSerializers:s={}}=n||{},l="",u=!0;return t.nodesBetween(r,i,(d,f,h,m)=>{var b;let y=s?.[d.type.name];y?(d.isBlock&&!u&&(l+=o,u=!0),h&&(l+=y({node:d,pos:f,parent:h,index:m,range:e}))):d.isText?(l+=(b=d?.text)===null||b===void 0?void 0:b.slice(Math.max(r,f)-f,i-f),u=!1):d.isBlock&&!u&&(l+=o,u=!0)}),l}function yE(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}var wI=it.create({name:"clipboardTextSerializer",addProseMirrorPlugins(){return[new Pe({key:new qe("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:o}=i,s=Math.min(...o.map(f=>f.$from.pos)),l=Math.max(...o.map(f=>f.$to.pos)),u=yE(n);return bE(r,{from:s,to:l},{textSerializers:u})}}})]}}),xI=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),_I=(t=!1)=>({commands:e})=>e.setContent("",t),SI=()=>({state:t,tr:e,dispatch:n})=>{let{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:o,$to:s})=>{t.doc.nodesBetween(o.pos,s.pos,(l,u)=>{if(l.type.isText)return;let{doc:d,mapping:f}=e,h=d.resolve(f.map(u)),m=d.resolve(f.map(u+l.nodeSize)),b=h.blockRange(m);if(!b)return;let y=Lr(b);if(l.type.isTextblock){let{defaultType:w}=h.parent.contentMatchAt(h.index());e.setNodeMarkup(b.start,w)}(y||y===0)&&e.lift(b,y)})}),!0},TI=t=>e=>t(e),MI=()=>({state:t,dispatch:e})=>Xf(t,e),CI=(t,e)=>({editor:n,tr:r})=>{let{state:i}=n,o=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);let s=r.mapping.map(e);return r.insert(s,o.content),r.setSelection(new ce(r.doc.resolve(s-1))),!0},AI=()=>({tr:t,dispatch:e})=>{let{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;let i=t.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){let l=i.before(o),u=i.after(o);t.delete(l,u).scrollIntoView()}return!0}return!1},kI=t=>({tr:e,state:n,dispatch:r})=>{let i=Ut(t,n.schema),o=e.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===i){if(r){let u=o.before(s),d=o.after(s);e.delete(u,d).scrollIntoView()}return!0}return!1},NI=t=>({tr:e,dispatch:n})=>{let{from:r,to:i}=t;return n&&e.delete(r,i),!0},OI=()=>({state:t,dispatch:e})=>Wl(t,e),RI=()=>({commands:t})=>t.keyboardShortcut("Enter"),II=()=>({state:t,dispatch:e})=>Jf(t,e);function Vl(t,e,n={strict:!0}){let r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:pp(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function dp(t,e,n={}){return t.find(r=>r.type===e&&Vl(r.attrs,n))}function DI(t,e,n={}){return!!dp(t,e,n)}function hp(t,e,n={}){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if(t.parentOffset===r.offset&&r.offset!==0&&(r=t.parent.childBefore(t.parentOffset)),!r.node)return;let i=dp([...r.node.marks],e,n);if(!i)return;let o=r.index,s=t.start()+r.offset,l=o+1,u=s+r.node.nodeSize;for(dp([...r.node.marks],e,n);o>0&&i.isInSet(t.parent.child(o-1).marks);)o-=1,s-=t.parent.child(o).nodeSize;for(;li&&Zd(t,e,i+1),s=r.depth>i&&Zd(n,r,i+1),l=[];return Os(null,t,i,l),o&&s&&e.index(i)==n.index(i)?(uy(o,s),Fi(Hi(o,dy(t,e,n,r,i+1)),l)):(o&&Fi(Hi(o,hl(t,e,i+1)),l),Os(e,n,i,l),s&&Fi(Hi(s,hl(n,r,i+1)),l)),Os(r,null,i,l),new V(l)}function hl(t,e,n){let r=[];if(Os(null,t,n,r),t.depth>n){let i=Zd(t,e,n+1);Fi(Hi(i,hl(t,e,n+1)),r)}return Os(e,null,n,r),new V(r)}function UN(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)i=e.node(o).copy(V.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}var ml=class t{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.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,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o