1import{p as id,F as sd}from"../base-Ci7vLHE_.js";import{p as ld}from"../internals--3vI9LC5.js";import"../preload-helper-BVLnHgTN.js";var ad=Object.defineProperty,ta=n=>{throw TypeError(n)},cd=(n,t,e)=>t in n?ad(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,vs=(n,t,e)=>cd(n,typeof t!="symbol"?t+"":t,e),Hi=(n,t,e)=>t.has(n)||ta("Cannot "+e),y=(n,t,e)=>(Hi(n,t,"read from private field"),e?e.call(n):t.get(n)),rt=(n,t,e)=>t.has(n)?ta("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),dt=(n,t,e,o)=>(Hi(n,t,"write to private field"),t.set(n,e),e),R=(n,t,e)=>(Hi(n,t,"access private method"),e);function it(n){this.content=n}it.prototype={constructor:it,find:function(n){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===n)return t;return-1},get:function(n){var t=this.find(n);return t==-1?void 0:this.content[t+1]},update:function(n,t,e){var o=e&&e!=n?this.remove(e):this,r=o.find(n),i=o.content.slice();return r==-1?i.push(e||n,t):(i[r+1]=t,e&&(i[r]=e)),new it(i)},remove:function(n){var t=this.find(n);if(t==-1)return this;var e=this.content.slice();return e.splice(t,2),new it(e)},addToStart:function(n,t){return new it([n,t].concat(this.remove(n).content))},addToEnd:function(n,t){var e=this.remove(n).content.slice();return e.push(n,t),new it(e)},addBefore:function(n,t,e){var o=this.remove(t),r=o.content.slice(),i=o.find(n);return r.splice(i==-1?r.length:i,0,t,e),new it(r)}
vendor: 9,483 bytes, line 1
1,forEach:function(n){for(var t=0;t<this.content.length;t+=2)n(this.content[t],this.content[t+1])},prepend:function(n){return n=it.from(n),n.size?new it(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=it.from(n),n.size?new it(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var t=this;n=it.from(n);for(var e=0;e<n.content.length;e+=2)t=t.remove(n.content[e]);return t},toObject:function(){var n={};return this.forEach(function(t,e){n[t]=e}),n},get size(){return this.content.length>>1}};it.from=function(n){if(n instanceof it)return n;var t=[];if(n)for(var e in n)t.push(e,n[e]);return new it(t)};function ea(n,t,e){for(let o=0;;o++){if(o==n.childCount||o==t.childCount)return n.childCount==t.childCount?null:e;let r=n.child(o),i=t.child(o);if(r==i){e+=r.nodeSize;continue}if(!r.sameMarkup(i))return e;if(r.isText&&r.text!=i.text){for(let s=0;r.text[s]==i.text[s];s++)e++;return e}if(r.content.size||i.content.size){let s=ea(r.content,i.content,e+1);if(s!=null)return s}e+=r.nodeSize}}function na(n,t,e,o){for(let r=n.childCount,i=t.childCount;;){if(r==0||i==0)return r==i?null:{a:e,b:o};let s=n.child(--r),l=t.child(--i),a=s.nodeSize;if(s==l){e-=a,o-=a;continue}if(!s.sameMarkup(l))return{a:e,b:o};if(s.isText&&s.text!=l.text){let c=0,d=Math.min(s.text.length,l.text.length);for(;c<d&&s.text[s.text.length-c-1]==l.text[l.text.length-c-1];)c++,e--,o--;return{a:e,b:o}}if(s.content.size||l.content.size){let c=na(s.content,l.content,e-1,o-1);if(c)return c}e-=a,o-=a}}class v{constructor(t,e){if(this.content=t,this.size=e||0,e==null)for(let o=0;o<t.length;o++)this.size+=t[o].nodeSize}nodesBetween(t,e,o,r=0,i){for(let s=0,l=0;l<e;s++){let a=this.content[s],c=l+a.nodeSize;if(c>t&&o(a,r+l,i||null,s)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,t-d),Math.min(a.content.size,e-d),o,r+d)}l=c}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,e,o,r){let i="",s=!0;return this.nodesBetween(t,e,(l,a)=>{let c=l.isText?l.text.slice(Math.max(t,a)-a,e-a):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&o&&(s?s=!1:i+=o),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let e=this.lastChild,o=t.firstChild,r=this.content.slice(),i=0;for(e.isText&&e.sameMarkup(o)&&(r[r.length-1]=e.withText(e.text+o.text),i=1);i<t.content.length;i++)r.push(t.content[i]);return new v(r,this.size+t.size)}cut(t,e=this.size){if(t==0&&e==this.size)return this;let o=[],r=0;if(e>t)for(let i=0,s=0;s<e;i++){let l=this.content[i],a=s+l.nodeSize;a>t&&((s<t||a>e)&&(l.isText?l=l.cut(Math.max(0,t-s),Math.min(l.text.length,e-s)):l=l.cut(Math.max(0,t-s-1),Math.min(l.content.size,e-s-1))),o.push(l),r+=l.nodeSize),s=a}return new v(o,r)}cutByIndex(t,e){return t==e?v.empty:t==0&&e==this.content.length?this:new v(this.content.slice(t,e))}replaceChild(t,e){let o=this.content[t];if(o==e)return this;let r=this.content.slice(),i=this.size+e.nodeSize-o.nodeSize;return r[t]=e,new v(r,i)}addToStart(t){return new v([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new v(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e}maybeChild(t){return this.content[t]||null}forEach(t){for(let e=0,o=0;e<this.content.length;e++){let r=this.content[e];t(r,o,e),o+=r.nodeSize}}findDiffStart(t,e=0){return ea(this,t,e)}findDiffEnd(t,e=this.size,o=t.size){return na(this,t,e,o)}findIndex(t,e=-1){if(t==0)return Un(0,t);if(t==this.size)return Un(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let o=0,r=0;;o++){let i=this.child(o),s=r+i.nodeSize;if(s>=t)return s==t||e>0?Un(o+1,s):Un(o,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,e){if(!e)return v.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new v(e.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return v.empty;let e,o=0;for(let r=0;r<t.length;r++){let i=t[r];o+=i.nodeSize,r&&i.isText&&t[r-1].sameMarkup(i)?(e||(e=t.slice(0,r)),e[e.length-1]=i.withText(e[e.length-1].text+i.text)):e&&e.push(i)}return new v(e||t,o)}static from(t){if(!t)return v.empty;if(t instanceof v)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new v([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}v.empty=new v([],0);const Sr={index:0,offset:0};function Un(n,t){return Sr.index=n,Sr.offset=t,Sr}function bo(n,t){if(n===t)return!0;if(!(n&&typeof n=="object")||!(t&&typeof t=="object"))return!1;let e=Array.isArray(n);if(Array.isArray(t)!=e)return!1;if(e){if(n.length!=t.length)return!1;for(let o=0;o<n.length;o++)if(!bo(n[o],t[o]))return!1}else{for(let o in n)if(!(o in t)||!bo(n[o],t[o]))return!1;for(let o in t)if(!(o in n))return!1}return!0}let V=class ti{constructor(t,e){this.type=t,this.attrs=e}addToSet(t){let e,o=!1;for(let r=0;r<t.length;r++){let i=t[r];if(this.eq(i))return t;if(this.type.excludes(i.type))e||(e=t.slice(0,r));else{if(i.type.excludes(this.type))return t;!o&&i.type.rank>this.type.rank&&(e||(e=t.slice(0,r)),e.push(this),o=!0),e&&e.push(i)}}return e||(e=t.slice()),o||e.push(this),e}removeFromSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t}isInSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1}eq(t){return this==t||this.type==t.type&&bo(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");let o=t.marks[e.type];if(!o)throw new RangeError(`There is no mark type ${e.type} in this schema`);let r=o.create(e.attrs);return o.checkAttrs(r.attrs),r}static sameSet(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(let o=0;o<t.length;o++)if(!t[o].eq(e[o]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return ti.none;if(t instanceof ti)return[t];let e=t.slice();return e.sort((o,r)=>o.type.rank-r.type.rank),e}};V.none=[];class ko extends Error{}class k{constructor(t,e,o){this.content=t,this.openStart=e,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,e){let o=ra(this.content,t+this.openStart,e);return o&&new k(o,this.openStart,this.openEnd)}removeBetween(t,e){return new k(oa(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,e){if(!e)return k.empty;let o=e.openStart||0,r=e.openEnd||0;if(typeof o!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new k(v.fromJSON(t,e.content),o,r)}static maxOpen(t,e=!0){let o=0,r=0;for(let i=t.firstChild;i&&!i.isLeaf&&(e||!i.type.spec.isolating);i=i.firstChild)o++;for(let i=t.lastChild;i&&!i.isLeaf&&(e||!i.type.spec.isolating);i=i.lastChild)r++;return new k(t,o,r)}}k.empty=new k(v.empty,0,0);function oa(n,t,e){let{index:o,offset:r}=n.findIndex(t),i=n.maybeChild(o),{index:s,offset:l}=n.findIndex(e);if(r==t||i.isText){if(l!=e&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,t).append(n.cut(e))}if(o!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(o,i.copy(oa(i.content,t-r-1,e-r-1)))}function ra(n,t,e,o){let{index:r,offset:i}=n.findIndex(t),s=n.maybeChild(r);if(i==t||s.isText)return n.cut(0,t).append(e).append(n.cut(t));let l=ra(s.content,t-i-1,e);return l&&n.replaceChild(r,s.copy(l))}function dd(n,t,e){if(e.openStart>n.depth)throw new ko("Inserted content deeper than insertion position");if(n.depth-e.openStart!=t.depth-e.openEnd)throw new ko("Inconsistent open depths");return ia(n,t,e,0)}function ia(n,t,e,o){let r=n.index(o),i=n.node(o);if(r==t.index(o)&&o<n.depth-e.openStart){let s=ia(n,t,e,o+1);return i.copy(i.content.replaceChild(r,s))}else if(e.content.size)if(!e.openStart&&!e.openEnd&&n.depth==o&&t.depth==o){let s=n.parent,l=s.content;return Re(s,l.cut(0,n.parentOffset).append(e.content).append(l.cut(t.parentOffset)))}else{let{start:s,end:l}=hd(e,n);return Re(i,la(n,s,l,t,o))}else return Re(i,xo(n,t,o))}function sa(n,t){if(!t.type.compatibleContent(n.type))throw new ko("Cannot join "+t.type.name+" onto "+n.type.name)}function ei(n,t,e){let o=n.node(e);return sa(o,t.node(e)),o}function De(n,t){let e=t.length-1;e>=0&&n.isText&&n.sameMarkup(t[e])?t[e]=n.withText(t[e].text+n.text):t.push(n)}function vn(n,t,e,o){let r=(t||n).node(e),i=0,s=t?t.index(e):r.childCount;n&&(i=n.index(e),n.depth>
vendor: 11,657 bytes, line 1
1e?i++:n.textOffset&&(De(n.nodeAfter,o),i++));for(let l=i;l<s;l++)De(r.child(l),o);t&&t.depth==e&&t.textOffset&&De(t.nodeBefore,o)}function Re(n,t){return n.type.checkContent(t),n.copy(t)}function la(n,t,e,o,r){let i=n.depth>r&&ei(n,t,r+1),s=o.depth>r&&ei(e,o,r+1),l=[];return vn(null,n,r,l),i&&s&&t.index(r)==e.index(r)?(sa(i,s),De(Re(i,la(n,t,e,o,r+1)),l)):(i&&De(Re(i,xo(n,t,r+1)),l),vn(t,e,r,l),s&&De(Re(s,xo(e,o,r+1)),l)),vn(o,null,r,l),new v(l)}function xo(n,t,e){let o=[];if(vn(null,n,e,o),n.depth>e){let r=ei(n,t,e+1);De(Re(r,xo(n,t,e+1)),o)}return vn(t,null,e,o),new v(o)}function hd(n,t){let e=t.depth-n.openStart,o=t.node(e).copy(n.content);for(let r=e-1;r>=0;r--)o=t.node(r).copy(v.from(o));return{start:o.resolveNoCache(n.openStart+e),end:o.resolveNoCache(o.content.size-n.openEnd-e)}}class Nn{constructor(t,e,o){this.pos=t,this.path=e,this.parentOffset=o,this.depth=e.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;let o=this.pos-this.path[this.path.length-1],r=t.child(e);return o?t.child(e).cut(o):r}get nodeBefore(){let t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):t==0?null:this.parent.child(t-1)}posAtIndex(t,e){e=this.resolveDepth(e);let o=this.path[e*3],r=e==0?0:this.path[e*3-1]+1;for(let i=0;i<t;i++)r+=o.child(i).nodeSize;return r}marks(){let t=this.parent,e=this.index();if(t.content.size==0)return V.none;if(this.textOffset)return t.child(e).marks;let o=t.maybeChild(e-1),r=t.maybeChild(e);if(!o){let l=o;o=r,r=l}let i=o.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!r||!i[s].isInSet(r.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(t){let e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;let o=e.marks,r=t.parent.maybeChild(t.index());for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!r||!o[i].isInSet(r.marks))&&(o=o[i--].removeFromSet(o));return o}sharedDepth(t){for(let e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0}blockRange(t=this,e){if(t.pos<this.pos)return t.blockRange(this);for(let o=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);o>=0;o--)if(t.pos<=this.end(o)&&(!e||e(this.node(o))))return new Co(this,t,o);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset}static resolve(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");let o=[],r=0,i=e;for(let s=t;;){let{index:l,offset:a}=s.content.findIndex(i),c=i-a;if(o.push(s,l,r+a),!c||(s=s.child(l),s.isText))break;i=c-1,r+=a+1}return new Nn(e,o,i)}static resolveCached(t,e){let o=bs.get(t);if(o)for(let i=0;i<o.elts.length;i++){let s=o.elts[i];if(s.pos==e)return s}else bs.set(t,o=new pd);let r=o.elts[o.i]=Nn.resolve(t,e);return o.i=(o.i+1)%ud,r}}class pd{constructor(){this.elts=[],this.i=0}}const ud=12,bs=new WeakMap;class Co{constructor(t,e,o){this.$from=t,this.$to=e,this.depth=o}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const fd=Object.create(null);let ge=class ni{constructor(t,e,o,r=V.none){this.type=t,this.attrs=e,this.marks=r,this.content=o||v.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,e,o,r=0){this.content.nodesBetween(t,e,o,r,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,e,o,r){return this.content.textBetween(t,e,o,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,e,o){return this.type==t&&bo(this.attrs,e||t.defaultAttrs||fd)&&V.sameSet(this.marks,o||V.none)}copy(t=null){return t==this.content?this:new ni(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new ni(this.type,this.attrs,this.content,t)}cut(t,e=this.content.size){return t==0&&e==this.content.size?this:this.copy(this.content.cut(t,e))}slice(t,e=this.content.size,o=!1){if(t==e)return k.empty;let r=this.resolve(t),i=this.resolve(e),s=o?0:r.sharedDepth(e),l=r.start(s),a=r.node(s).content.cut(r.pos-l,i.pos-l);return new k(a,r.depth-s,i.depth-s)}replace(t,e,o){return dd(this.resolve(t),this.resolve(e),o)}nodeAt(t){for(let e=this;;){let{index:o,offset:r}=e.content.findIndex(t);if(e=e.maybeChild(o),!e)return null;if(r==t||e.isText)return e;t-=r+1}}childAfter(t){let{index:e,offset:o}=this.content.findIndex(t);return{node:this.content.maybeChild(e),index:e,offset:o}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:e,offset:o}=this.content.findIndex(t);if(o<t)return{node:this.content.child(e),index:e,offset:o};let r=this.content.child(e-1);return{node:r,index:e-1,offset:o-r.nodeSize}}resolve(t){return Nn.resolveCached(this,t)}resolveNoCache(t){return Nn.resolve(this,t)}rangeHasMark(t,e,o){let r=!1;return e>t&&this.nodesBetween(t,e,i=>(o.isInSet(i.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),aa(this.marks,t)}contentMatchAt(t){let e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e}canReplace(t,e,o=v.empty,r=0,i=o.childCount){let s=this.contentMatchAt(t).matchFragment(o,r,i),l=s&&s.matchFragment(this.content,e);if(!l||!l.validEnd)return!1;for(let a=r;a<i;a++)if(!this.type.allowsMarks(o.child(a).marks))return!1;return!0}canReplaceWith(t,e,o,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(t).matchType(o),s=i&&i.matchFragment(this.content,e);return s?s.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=V.none;for(let e=0;e<this.marks.length;e++){let o=this.marks[e];o.type.checkAttrs(o.attrs),t=o.addToSet(t)}if(!V.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(e=>e.toJSON())),t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");let o;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=e.marks.map(t.markFromJSON)}if(e.type=="text"){if(typeof e.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(e.text,o)}let r=v.fromJSON(t,e.content),i=t.nodeType(e.type).create(e.attrs,r,o);return i.type.checkAttrs(i.attrs),i}};ge.prototype.text=void 0;class Mo extends ge{constructor(t,e,o,r){if(super(t,e,null,r),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):aa(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,e){return this.text.slice(t,e)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new Mo(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new Mo(this.type,this.attrs,t,this.marks)}cut(t=0,e=this.text.length){return t==0&&e==this.text.length?this:this.withText(this.text.slice(t,e))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function aa(n,t){for(let e=n.length-1;e>=0;e--)t=n[e].type.name+"("+t+")";return t}class $e{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,e){let o=new md(t,e);if(o.next==null)return $e.empty;let r=ca(o);o.next&&o.err("Unexpected trailing text");let i=xd(kd(r));return Cd(i,o),i}matchType(t){for(let e=0;e<this.next.length;e++)if(this.next[e].type==t)return this.next[e].next;return null}matchFragment(t,e=0,o=t.childCount){let r=this;for(let i=e;r&&i<o;i++)r=r.matchType(t.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:e}=this.next[t];if(!(e.isText||e.hasRequiredAttrs()))return e}return null}compatible(t){for(let e=0;e<this.next.length;e++)for(let o=0;o<t.next.length;o++)if(this.next[e].type==t.next[o].type)return!0;return!1}fillBefore(t,e=!1,o=0){let r=[this];function i(s,l){let a=s.matchFragment(t,o);if(a&&(!e||a.validEnd))return v.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:d,next:h}=s.next[c];if(!(d.isText||d.hasRequiredAttrs())&&r.indexOf(h)==-1){r.push(h);let p=i(h,l.concat(d));if(p)return p}}return null}return i(this,[])}findWrapping(t){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==t)return this.wrapCache[o+1];let e=this.computeWrapping(t);return this.wrapCache.push(t,e),e}computeWrapping(t){let e=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let r=o.shift(),i=r.match;if(i.matchType(t)){let s=[];for(let l=r;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in e)&&(!r.type||a.validEnd)&&(o.push({match:l.contentMatch,type:l,via:r}),e[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function e(o){t.push(o);for(let r=0;r<o.next.length;r++)t.indexOf(o.next[r].next)==-1&&e(o.next[r].next)}return e(this),t.map((o,r)=>
vendor: 56,575 bytes, lines 1-5
1{let i=r+(o.validEnd?"*":" ")+" ";for(let s=0;s<o.next.length;s++)i+=(s?", ":"")+o.next[s].type.name+"->"+t.indexOf(o.next[s].next);return i}).join(` 2`)}}$e.empty=new $e(!0);class md{constructor(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function ca(n){let t=[];do t.push(gd(n));while(n.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function gd(n){let t=[];do t.push(yd(n));while(n.next&&n.next!=")"&&n.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function yd(n){let t=bd(n);for(;;)if(n.eat("+"))t={type:"plus",expr:t};else if(n.eat("*"))t={type:"star",expr:t};else if(n.eat("?"))t={type:"opt",expr:t};else if(n.eat("{"))t=wd(n,t);else break;return t}function ks(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let t=Number(n.next);return n.pos++,t}function wd(n,t){let e=ks(n),o=e;return n.eat(",")&&(n.next!="}"?o=ks(n):o=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:e,max:o,expr:t}}function vd(n,t){let e=n.nodeTypes,o=e[t];if(o)return[o];let r=[];for(let i in e){let s=e[i];s.isInGroup(t)&&r.push(s)}return r.length==0&&n.err("No node type or group '"+t+"' found"),r}function bd(n){if(n.eat("(")){let t=ca(n);return n.eat(")")||n.err("Missing closing paren"),t}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let t=vd(n,n.next).map(e=>(n.inline==null?n.inline=e.isInline:n.inline!=e.isInline&&n.err("Mixing inline and block content"),{type:"name",value:e}));return n.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function kd(n){let t=[[]];return r(i(n,0),e()),t;function e(){return t.push([])-1}function o(s,l,a){let c={term:a,to:l};return t[s].push(c),c}function r(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;r(c,l=e())}else if(s.type=="star"){let a=e();return o(l,a),r(i(s.expr,a),a),[o(a)]}else if(s.type=="plus"){let a=e();return r(i(s.expr,l),a),r(i(s.expr,a),a),[o(a)]}else{if(s.type=="opt")return[o(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let d=e();r(i(s.expr,a),d),a=d}if(s.max==-1)r(i(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let d=e();o(a,d),r(i(s.expr,a),d),a=d}return[o(a)]}else{if(s.type=="name")return[o(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function da(n,t){return t-n}function xs(n,t){let e=[];return o(t),e.sort(da);function o(r){let i=n[r];if(i.length==1&&!i[0].term)return o(i[0].to);e.push(r);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&e.indexOf(a)==-1&&o(a)}}}function xd(n){let t=Object.create(null);return e(xs(n,0));function e(o){let r=[];o.forEach(s=>{n[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let d=0;d<r.length;d++)r[d][0]==l&&(c=r[d][1]);xs(n,a).forEach(d=>{c||r.push([l,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let i=t[o.join(",")]=new $e(o.indexOf(n.length-1)>-1);for(let s=0;s<r.length;s++){let l=r[s][1].sort(da);i.next.push({type:r[s][0],next:t[l.join(",")]||e(l)})}return i}}function Cd(n,t){for(let e=0,o=[n];e<o.length;e++){let r=o[e],i=!r.validEnd,s=[];for(let l=0;l<r.next.length;l++){let{type:a,next:c}=r.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),o.indexOf(c)==-1&&o.push(c)}i&&t.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ha(n){let t=Object.create(null);for(let e in n){let o=n[e];if(!o.hasDefault)return null;t[e]=o.default}return t}function pa(n,t){let e=Object.create(null);for(let o in n){let r=t&&t[o];if(r===void 0){let i=n[o];if(i.hasDefault)r=i.default;else throw new RangeError("No value supplied for attribute "+o)}e[o]=r}return e}function ua(n,t,e,o){for(let r in t)if(!(r in n))throw new RangeError(`Unsupported attribute ${r} for ${e} of type ${r}`);for(let r in n){let i=n[r];i.validate&&i.validate(t[r])}}function fa(n,t){let e=Object.create(null);if(t)for(let o in t)e[o]=new Sd(n,o,t[o]);return e}let Cs=class ma{constructor(t,e,o){this.name=t,this.schema=e,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=fa(t,o.attrs),this.defaultAttrs=ha(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==$e.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:pa(this.attrs,t)}create(t=null,e,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ge(this,this.computeAttrs(t),v.from(e),V.setFrom(o))}createChecked(t=null,e,o){return e=v.from(e),this.checkContent(e),new ge(this,this.computeAttrs(t),e,V.setFrom(o))}createAndFill(t=null,e,o){if(t=this.computeAttrs(t),e=v.from(e),e.size){let s=this.contentMatch.fillBefore(e);if(!s)return null;e=s.append(e)}let r=this.contentMatch.matchFragment(e),i=r&&r.fillBefore(v.empty,!0);return i?new ge(this,t,e.append(i),V.setFrom(o)):null}validContent(t){let e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(let o=0;o<t.childCount;o++)if(!this.allowsMarks(t.child(o).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){ua(this.attrs,t,"node",this.name)}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let e;for(let o=0;o<t.length;o++)this.allowsMarkType(t[o].type)?e&&e.push(t[o]):e||(e=t.slice(0,o));return e?e.length?e:V.none:t}static compile(t,e){let o=Object.create(null);t.forEach((i,s)=>o[i]=new ma(i,e,s));let r=e.spec.topNode||"doc";if(!o[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let i in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function Md(n,t,e){let o=e.split("|");return r=>{let i=r===null?"null":typeof r;if(o.indexOf(i)<0)throw new RangeError(`Expected value of type ${o} for attribute ${t} on type ${n}, got ${i}`)}}class Sd{constructor(t,e,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?Md(t,e,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class ar{constructor(t,e,o,r){this.name=t,this.rank=e,this.schema=o,this.spec=r,this.attrs=fa(t,r.attrs),this.excluded=null;let i=ha(this.attrs);this.instance=i?new V(this,i):null}create(t=null){return!t&&this.instance?this.instance:new V(this,pa(this.attrs,t))}static compile(t,e){let o=Object.create(null),r=0;return t.forEach((i,s)=>o[i]=new ar(i,r++,e,s)),o}removeFromSet(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t}isInSet(t){for(let e=0;e<t.length;e++)if(t[e].type==this)return t[e]}checkAttrs(t){ua(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}class ga{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let e=this.spec={};for(let r in t)e[r]=t[r];e.nodes=it.from(t.nodes),e.marks=it.from(t.marks||{}),this.nodes=Cs.compile(this.spec.nodes,this),this.marks=ar.compile(this.spec.marks,this);let o=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let i=this.nodes[r],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=o[s]||(o[s]=$e.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?Ms(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let r in this.marks){let i=this.marks[r],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:Ms(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(t,e=null,o,r){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof Cs){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(e,o,r)}text(t,e){let o=this.nodes.text;return new Mo(o,o.defaultAttrs,t,V.setFrom(e))}mark(t,e){return typeof t=="string"&&(t=this.marks[t]),t.create(e)}nodeFromJSON(t){return ge.fromJSON(this,t)}markFromJSON(t){return V.fromJSON(this,t)}nodeType(t){let e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e}}function Ms(n,t){let e=[];for(let o=0;o<t.length;o++){let r=t[o],i=n.marks[r],s=i;if(i)e.push(i);else for(let l in n.marks){let a=n.marks[l];(r=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(r)>-1)&&e.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[o]+"'")}return e}function Ad(n){return n.tag!=null}function Ed(n){return n.style!=null}let bn=class oi{constructor(t,e){this.schema=t,this.rules=e,this.tags=[],this.styles=[];let o=this.matchedStyles=[];e.forEach(r=>{if(Ad(r))this.tags.push(r);else if(Ed(r)){let i=/[^=]*/.exec(r.style)[0];o.indexOf(i)<0&&o.push(i),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=t.nodes[r.node];return i.contentMatch.matchType(i)})}parse(t,e={}){let o=new As(this,e,!1);return o.addAll(t,V.none,e.from,e.to),o.finish()}parseSlice(t,e={}){let o=new As(this,e,!0);return o.addAll(t,V.none,e.from,e.to),k.maxOpen(o.finish())}matchTag(t,e,o){for(let r=o?this.tags.indexOf(o)+1:0;r<this.tags.length;r++){let i=this.tags[r];if(Nd(t,i.tag)&&(i.namespace===void 0||t.namespaceURI==i.namespace)&&(!i.context||e.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(t);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(t,e,o,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(t)!=0||s.context&&!o.matchesContext(s.context)||l.length>t.length&&(l.charCodeAt(t.length)!=61||l.slice(t.length+1)!=e))){if(s.getAttrs){let a=s.getAttrs(e);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(t){let e=[];function o(r){let i=r.priority==null?50:r.priority,s=0;for(;s<e.length;s++){let l=e[s];if((l.priority==null?50:l.priority)<i)break}e.splice(s,0,r)}for(let r in t.marks){let i=t.marks[r].spec.parseDOM;i&&i.forEach(s=>{o(s=Es(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in t.nodes){let i=t.nodes[r].spec.parseDOM;i&&i.forEach(s=>{o(s=Es(s)),s.node||s.ignore||s.mark||(s.node=r)})}return e}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new oi(t,oi.schemaRules(t)))}};const ya={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},Od={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},wa={ol:!0,ul:!0},Dn=1,ri=2,lo=4;function Ss(n,t,e){return t!=null?(t?Dn:0)|(t==="full"?ri:0):n&&n.whitespace=="pre"?Dn|ri:e&-5}class Zn{constructor(t,e,o,r,i,s){this.type=t,this.attrs=e,this.marks=o,this.solid=r,this.options=s,this.content=[],this.activeMarks=V.none,this.match=i||(s&lo?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let e=this.type.contentMatch.fillBefore(v.from(t));if(e)this.match=this.type.contentMatch.matchFragment(e);else{let o=this.type.contentMatch,r;return(r=o.findWrapping(t.type))?(this.match=o,r):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&Dn)){let o=this.content[this.content.length-1],r;if(o&&o.isText&&(r=/[ \t\r\n\u000c]+$/.exec(o.text))){let i=o;o.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-r[0].length))}}let e=v.from(this.content);return!t&&this.match&&(e=e.append(this.match.fillBefore(v.empty,!0))),this.type?this.type.create(this.attrs,e,this.marks):e}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!ya.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class As{constructor(t,e,o){this.parser=t,this.options=e,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let r=e.topNode,i,s=Ss(null,e.preserveWhitespace,0)|(o?lo:0);r?i=new Zn(r.type,r.attrs,V.none,!0,e.topMatch||r.type.contentMatch,s):o?i=new Zn(null,null,V.none,!0,null,s):i=new Zn(t.schema.topNodeType,null,V.none,!0,null,s),this.nodes=[i],this.find=e.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,e){t.nodeType==3?this.addTextNode(t,e):t.nodeType==1&&this.addElement(t,e)}addTextNode(t,e){let o=t.nodeValue,r=this.top,i=r.options&ri?"full":this.localPreserveWS||(r.options&Dn)>0;if(i==="full"||r.inlineContext(t)||/[^ \t\r\n\u000c]/.test(o)){if(i)i!=="full"?o=o.replace(/\r?\n|\r/g," "):o=o.replace(/\r\n?/g,` 3`);else if(o=o.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(o)&&this.open==this.nodes.length-1){let s=r.content[r.content.length-1],l=t.previousSibling;(!s||l&&l.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.text))&&(o=o.slice(1))}o&&this.insertNode(this.parser.schema.text(o),e),this.findInText(t)}else this.findInside(t)}addElement(t,e,o){let r=this.localPreserveWS,i=this.top;(t.tagName=="PRE"||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=!0);let s=t.nodeName.toLowerCase(),l;wa.hasOwnProperty(s)&&this.parser.normalizeLists&&Td(t);let a=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(l=this.parser.matchTag(t,this,o));t:if(a?a.ignore:Od.hasOwnProperty(s))this.findInside(t),this.ignoreFallback(t,e);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(t=a.skip);let c,d=this.needsBlock;if(ya.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(!t.firstChild){this.leafFallback(t,e);break t}let h=a&&a.skip?e:this.readStyles(t,e);h&&this.addAll(t,h),c&&this.sync(i),this.needsBlock=d}else{let c=this.readStyles(t,e);c&&this.addElementByRule(t,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=r}leafFallback(t,e){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(` 4`),e)}ignoreFallback(t,e){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),e)}readStyles(t,e){let o=t.style;if(o&&o.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let i=this.parser.matchedStyles[r],s=o.getPropertyValue(i);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(i,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?e=e.filter(c=>!a.clearMark(c)):e=e.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return e}addElementByRule(t,e,o,r){let i,s;if(e.node)if(s=this.parser.schema.nodes[e.node],s.isLeaf)this.insertNode(s.create(e.attrs),o)||this.leafFallback(t,o);else{let a=this.enter(s,e.attrs||null,o,e.preserveWhitespace);a&&(i=!0,o=a)}else{let a=this.parser.schema.marks[e.mark];o=o.concat(a.create(e.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(t);else if(r)this.addElement(t,o,r);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach(a=>this.insertNode(a,o));else{let a=t;typeof e.contentElement=="string"?a=t.querySelector(e.contentElement):typeof e.contentElement=="function"?a=e.contentElement(t):e.contentElement&&(a=e.contentElement),this.findAround(t,a,!0),this.addAll(a,o),this.findAround(t,a,!1)}i&&this.sync(l)&&this.open--}addAll(t,e,o,r){let i=o||0;for(let s=o?t.childNodes[o]:t.firstChild,l=r==null?null:t.childNodes[r];s!=l;s=s.nextSibling,++i)this.findAtPoint(t,i),this.addDOM(s,e);this.findAtPoint(t,i)}findPlace(t,e){let o,r;for(let i=this.open;i>=0;i--){let s=this.nodes[i],l=s.findWrapping(t);if(l&&(!o||o.length>l.length)&&(o=l,r=s,!l.length)||s.solid)break}if(!o)return null;this.sync(r);for(let i=0;i<o.length;i++)e=this.enterInner(o[i],null,e,!1);return e}insertNode(t,e){if(t.isInline&&this.needsBlock&&!this.top.type){let r=this.textblockFromContext();r&&(e=this.enterInner(r,null,e))}let o=this.findPlace(t,e);if(o){this.closeExtra();let r=this.top;r.match&&(r.match=r.match.matchType(t.type));let i=V.none;for(let s of o.concat(t.marks))(r.type?r.type.allowsMarkType(s.type):Os(s.type,t.type))&&(i=s.addToSet(i));return r.content.push(t.mark(i)),!0}return!1}enter(t,e,o,r){let i=this.findPlace(t.create(e),o);return i&&(i=this.enterInner(t,e,o,!0,r)),i}enterInner(t,e,o,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(t);let l=Ss(t,i,s.options);s.options&lo&&s.content.length==0&&(l|=lo);let a=V.none;return o=o.filter(c=>(s.type?s.type.allowsMarkType(c.type):Os(c.type,t))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Zn(t,e,a,r,null,l)),this.open++,o}closeExtra(t=!1){let e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(t){for(let e=this.open;e>=0;e--){if(this.nodes[e]==t)return this.open=e,!0;this.localPreserveWS&&(this.nodes[e].options|=Dn)}return!1}get currentPos(){this.closeExtra();let t=0;for(let e=this.open;e>=0;e--){let o=this.nodes[e].content;for(let r=o.length-1;r>=0;r--)t+=o[r].nodeSize;e&&t++}return t}findAtPoint(t,e){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==t&&this.find[o].offset==e&&(this.find[o].pos=this.currentPos)}findInside(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].pos==null&&t.nodeType==1&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)}findAround(t,e,o){if(t!=e&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&t.nodeType==1&&t.contains(this.find[r].node)&&e.compareDocumentPosition(this.find[r].node)&(o?2:4)&&(this.find[r].pos=this.currentPos)}findInText(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let e=t.split("/"),o=this.options.context,r=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),i=-(o?o.depth+1:0)+(r?0:1),s=(l,a)=>{for(;l>=0;l--){let c=e[l];if(c==""){if(l==e.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&&r?this.nodes[a].type:o&&a>=i?o.node(a-i).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;a--}}return!0};return s(e.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let e=t.depth;e>=0;e--){let o=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let e in this.parser.schema.nodes){let o=this.parser.schema.nodes[e];if(o.isTextblock&&o.defaultAttrs)return o}}}function Td(n){for(let t=n.firstChild,e=null;t;t=t.nextSibling){let o=t.nodeType==1?t.nodeName.toLowerCase():null;o&&wa.hasOwnProperty(o)&&e?(e.appendChild(t),t=e):o=="li"?e=t:o&&(e=null)}}function Nd(n,t){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,t)}function Es(n){let t={};for(let e in n)t[e]=n[e];return t}function Os(n,t){let e=t.schema.nodes;for(let o in e){let r=e[o];if(!r.allowsMarkType(n))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:d}=l.edge(a);if(c==t||i.indexOf(d)<0&&s(d))return!0}};if(s(r.contentMatch))return!0}}class Fe{constructor(t,e){this.nodes=t,this.marks=e}serializeFragment(t,e={},o){o||(o=Ar(e).createDocumentFragment());let r=o,i=[];return t.forEach(s=>{if(i.length||s.marks.length){let l=0,a=0;for(;l<i.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)r=i.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],d=this.serializeMark(c,s.isInline,e);d&&(i.push([c,r]),r.appendChild(d.dom),r=d.contentDOM||d.dom)}}r.appendChild(this.serializeNodeInner(s,e))}),o}serializeNodeInner(t,e){let{dom:o,contentDOM:r}=ao(Ar(e),this.nodes[t.type.name](t),null,t.attrs);if(r){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,e,r)}return o}serializeNode(t,e={}){let o=this.serializeNodeInner(t,e);for(let r=t.marks.length-1;r>=0;r--){let i=this.serializeMark(t.marks[r],t.isInline,e);i&&((i.contentDOM||i.dom).appendChild(o),o=i.dom)}return o}serializeMark(t,e,o={}){let r=this.marks[t.type.name];return r&&ao(Ar(o),r(t,e),null,t.attrs)}static renderSpec(t,e,o=null,r){return ao(t,e,o,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new Fe(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let e=Ts(t.nodes);return e.text||(e.text=o=>o.text),e}static marksFromSchema(t){return Ts(t.marks)}}function Ts(n){let t={};for(let e in n){let o=n[e].spec.toDOM;o&&(t[e]=o)}return t}function Ar(n){return n.document||window.document}const Ns=new WeakMap;function Dd(n){let t=Ns.get(n);return t===void 0&&Ns.set(n,t=Rd(n)),t}function Rd(n){let t=null;function e(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")t||(t=[]),t.push(o);else for(let r=0;r<o.length;r++)e(o[r]);else for(let r in o)e(o[r])}return e(n),t}function ao(n,t,e,o){if(typeof t=="string")return{dom:n.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let r=t[0],i;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(o&&(i=Dd(o))&&i.indexOf(t)>-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=r.indexOf(" ");s>0&&(e=r.slice(0,s),r=r.slice(s+1));let l,a=e?n.createElementNS(e,r):n.createElement(r),c=t[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let h in c)if(c[h]!=null){let p=h.indexOf(" ");p>0?a.setAttributeNS(h.slice(0,p),h.slice(p+1),c[h]):a.setAttribute(h,c[h])}}for(let h=d;h<t.length;h++){let p=t[h];if(p===0){if(h<t.length-1||h>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:u,contentDOM:f}=ao(n,p,e,o);if(a.appendChild(u),f){if(l)throw new RangeError("Multiple content holes");l=f}}}return{dom:a,contentDOM:l}}const va=65535,ba=Math.pow(2,16);function Ld(n,t){return n+t*ba}function Ds(n){return n&va}function Id(n){return(n-(n&va))/ba}const ka=1,xa=2,co=4,Ca=8;class ii{constructor(t,e,o){this.pos=t,this.delInfo=e,this.recover=o}get deleted(){return(this.delInfo&Ca)>0}get deletedBefore(){return(this.delInfo&(ka|co))>0}get deletedAfter(){return(this.delInfo&(xa|co))>0}get deletedAcross(){return(this.delInfo&co)>0}}class Mt{constructor(t,e=!1){if(this.ranges=t,this.inverted=e,!t.length&&Mt.empty)return Mt.empty}recover(t){let e=0,o=Ds(t);if(!this.inverted)for(let r=0;r<o;r++)e+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[o*3]+e+Id(t)}mapResult(t,e=1){return this._map(t,e,!1)}map(t,e=1){return this._map(t,e,!0)}_map(t,e,o){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>t)break;let c=this.ranges[l+i],d=this.ranges[l+s],h=a+c;if(t<=h){let p=c?t==a?-1:t==h?1:e:e,u=a+r+(p<0?0:d);if(o)return u;let f=t==(e<0?a:h)?null:Ld(l/3,t-a),m=t==a?xa:t==h?ka:co;return(e<0?t!=a:t!=h)&&(m|=Ca),new ii(u,m,f)}r+=d-c}return o?t+r:new ii(t+r,0,null)}touches(t,e){let o=0,r=Ds(e),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>t)break;let c=this.ranges[l+i],d=a+c;if(t<=d&&l==r*3)return!0;o+=this.ranges[l+s]-c}return!1}forEach(t){let e=this.inverted?2:1,o=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),c=this.ranges[r+e],d=this.ranges[r+o];t(l,l+c,a,a+d),i+=d-c}}invert(){return new Mt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?Mt.empty:new Mt(t<0?[0,-t,0]:[0,0,t])}}Mt.empty=new Mt([]);class Rn{constructor(t,e,o=0,r=t?t.length:0){this.mirror=e,this.from=o,this.to=r,this._maps=t||[],this.ownData=!(t||e)}get maps(){return this._maps}slice(t=0,e=this.maps.length){return new Rn(this._maps,this.mirror,t,e)}appendMap(t,e){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(t),e!=null&&this.setMirror(this._maps.length-1,e)}appendMapping(t){for(let e=0,o=this._maps.length;e<t._maps.length;e++){let r=t.getMirror(e);this.appendMap(t._maps[e],r!=null&&r<e?o+r:void 0)}}getMirror(t){if(this.mirror){for(let e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]}}setMirror(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)}appendMappingInverted(t){for(let e=t.maps.length-1,o=this._maps.length+t._maps.length;e>=0;e--){let r=t.getMirror(e);this.appendMap(t._maps[e].invert(),r!=null&&r>e?o-r-1:void 0)}}invert(){let t=new Rn;return t.appendMappingInverted(this),t}map(t,e=1){if(this.mirror)return this._map(t,e,!0);for(let o=this.from;o<this.to;o++)t=this._maps[o].map(t,e);return t}mapResult(t,e=1){return this._map(t,e,!1)}_map(t,e,o){let r=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(t,e);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,t=this._maps[a].recover(l.recover);continue}}r|=l.delInfo,t=l.pos}return o?t:new ii(t,r,null)}}const Er=Object.create(null);class mt{getMap(){return Mt.empty}merge(t){return null}static fromJSON(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=Er[e.stepType];if(!o)throw new RangeError(`No step type ${e.stepType} defined`);return o.fromJSON(t,e)}static jsonID(t,e){if(t in Er)throw new RangeError("Duplicate use of step JSON ID "+t);return Er[t]=e,e.prototype.jsonID=t,e}}class X{constructor(t,e){this.doc=t,this.failed=e}static ok(t){return new X(t,null)}static fail(t){return new X(null,t)}static fromReplace(t,e,o,r){try{return X.ok(t.replace(e,o,r))}catch(i){if(i instanceof ko)return X.fail(i.message);throw i}}}function zi(n,t,e){let o=[];for(let r=0;r<n.childCount;r++){let i=n.child(r);i.content.size&&(i=i.copy(zi(i.content,t,i))),i.isInline&&(i=t(i,e,r)),o.push(i)}return v.fromArray(o)}class ue extends mt{constructor(t,e,o){super(),this.from=t,this.to=e,this.mark=o}apply(t){let e=t.slice(this.from,this.to),o=t.resolve(this.from),r=o.node(o.sharedDepth(this.to)),i=new k(zi(e.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),e.openStart,e.openEnd);return X.fromReplace(t,this.from,this.to,i)}invert(){return new jt(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),o=t.mapResult(this.to,-1);return e.deleted&&o.deleted||e.pos>=o.pos?null:new ue(e.pos,o.pos,this.mark)}merge(t){return t instanceof ue&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new ue(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ue(e.from,e.to,t.markFromJSON(e.mark))}}mt.jsonID("addMark",ue);class jt extends mt{constructor(t,e,o){super(),this.from=t,this.to=e,this.mark=o}apply(t){let e=t.slice(this.from,this.to),o=new k(zi(e.content,r=>r.mark(this.mark.removeFromSet(r.marks)),t),e.openStart,e.openEnd);return X.fromReplace(t,this.from,this.to,o)}invert(){return new ue(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),o=t.mapResult(this.to,-1);return e.deleted&&o.deleted||e.pos>=o.pos?null:new jt(e.pos,o.pos,this.mark)}merge(t){return t instanceof jt&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new jt(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new jt(e.from,e.to,t.markFromJSON(e.mark))}}mt.jsonID("removeMark",jt);class fe extends mt{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return X.fail("No node at mark step's position");let o=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return X.fromReplace(t,this.pos,this.pos+1,new k(v.from(o),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);if(e){let o=this.mark.addToSet(e.marks);if(o.length==e.marks.length){for(let r=0;r<e.marks.length;r++)if(!e.marks[r].isInSet(o))return new fe(this.pos,e.marks[r]);return new fe(this.pos,this.mark)}}return new Ye(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new fe(e.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new fe(e.pos,t.markFromJSON(e.mark))}}mt.jsonID("addNodeMark",fe);class Ye extends mt{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return X.fail("No node at mark step's position");let o=e.type.create(e.attrs,null,this.mark.removeFromSet(e.marks));return X.fromReplace(t,this.pos,this.pos+1,new k(v.from(o),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);return!e||!this.mark.isInSet(e.marks)?this:new fe(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Ye(e.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Ye(e.pos,t.markFromJSON(e.mark))}}mt.jsonID("removeNodeMark",Ye);class tt extends mt{constructor(t,e,o,r=!1){super(),this.from=t,this.to=e,this.slice=o,this.structure=r}apply(t){return this.structure&&si(t,this.from,this.to)?X.fail("Structure replace would overwrite content"):X.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Mt([this.from,this.to-this.from,this.slice.size])}invert(t){return new tt(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let e=t.mapResult(this.from,1),o=t.mapResult(this.to,-1);return e.deletedAcross&&o.deletedAcross?null:new tt(e.pos,Math.max(e.pos,o.pos),this.slice)}merge(t){if(!(t instanceof tt)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let e=this.slice.size+t.slice.size==0?k.empty:new k(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new tt(this.from,this.to+(t.to-t.from),e,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let e=this.slice.size+t.slice.size==0?k.empty:new k(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new tt(t.from,this.to,e,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new tt(e.from,e.to,k.fromJSON(t,e.slice),!!e.structure)}}mt.jsonID("replace",tt);class et extends mt{constructor(t,e,o,r,i,s,l=!1){super(),this.from=t,this.to=e,this.gapFrom=o,this.gapTo=r,this.slice=i,this.insert=s,this.structure=l}apply(t){if(this.structure&&(si(t,this.from,this.gapFrom)||si(t,this.gapTo,this.to)))return X.fail("Structure gap-replace would overwrite content");let e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return X.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,e.content);return o?X.fromReplace(t,this.from,this.to,o):X.fail("Content does not fit in gap")}getMap(){return new Mt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let e=this.gapTo-this.gapFrom;return new et(this.from,this.from+this.slice.size+e,this.from+this.insert,this.from+this.insert+e,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let e=t.mapResult(this.from,1),o=t.mapResult(this.to,-1),r=this.from==this.gapFrom?e.pos:t.map(this.gapFrom,-1),i=this.to==this.gapTo?o.pos:t.map(this.gapTo,1);return e.deletedAcross&&o.deletedAcross||r<e.pos||i>o.pos?null:new et(e.pos,o.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number"||typeof e.gapFrom!="number"||typeof e.gapTo!="number"||typeof e.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new et(e.from,e.to,e.gapFrom,e.gapTo,k.fromJSON(t,e.slice),e.insert,!!e.structure)}}mt.jsonID("replaceAround",et);function si(n,t,e){let o=n.resolve(t),r=e-t,i=o.depth;for(;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0){let s=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function Pd(n,t,e,o){let r=[],i=[],s,l;n.doc.nodesBetween(t,e,(a,c,d)=>{if(!a.isInline)return;let h=a.marks;if(!o.isInSet(h)&&d.type.allowsMarkType(o.type)){let p=Math.max(c,t),u=Math.min(c+a.nodeSize,e),f=o.addToSet(h);for(let m=0;m<h.length;m++)h[m].isInSet(f)||(s&&s.to==p&&s.mark.eq(h[m])?s.to=u:r.push(s=new jt(p,u,h[m])));l&&l.to==p?l.to=u:i.push(l=new ue(p,u,o))}}),r.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function $d(n,t,e,o){let r=[],i=0;n.doc.nodesBetween(t,e,(s,l)=>{if(!s.isInline)return;i++;let a=null;if(o instanceof ar){let c=s.marks,d;for(;d=o.isInSet(c);)(a||(a=[])).push(d),c=d.removeFromSet(c)}else o?o.isInSet(s.marks)&&(a=[o]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,e);for(let d=0;d<a.length;d++){let h=a[d],p;for(let u=0;u<r.length;u++){let f=r[u];f.step==i-1&&h.eq(r[u].style)&&(p=f)}p?(p.to=c,p.step=i):r.push({style:h,from:Math.max(l,t),to:c,step:i})}}}),r.forEach(s=>n.step(new jt(s.from,s.to,s.style)))}function Bi(n,t,e,o=e.contentMatch,r=!0){let i=n.doc.nodeAt(t),s=[],l=t+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),d=l+c.nodeSize,h=o.matchType(c.type);if(!h)s.push(new tt(l,d,k.empty));else{o=h;for(let p=0;p<c.marks.length;p++)e.allowsMarkType(c.marks[p].type)||n.step(new jt(l,d,c.marks[p]));if(r&&c.isText&&e.whitespace!="pre"){let p,u=/\r?\n|\r/g,f;for(;p=u.exec(c.text);)f||(f=new k(v.from(e.schema.text(" ",e.allowedMarks(c.marks))),0,0)),s.push(new tt(l+p.index,l+p.index+p[0].length,f))}}l=d}if(!o.validEnd){let a=o.fillBefore(v.empty,!0);n.replace(l,l,new k(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function Hd(n,t,e){return(t==0||n.canReplace(t,n.childCount))&&(e==n.childCount||n.canReplace(0,e))}function ln(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let e=n.depth;;--e){let o=n.$from.node(e),r=n.$from.index(e),i=n.$to.indexAfter(e);if(e<n.depth&&o.canReplace(r,i,t))return e;if(e==0||o.type.spec.isolating||!Hd(o,r,i))break}return null}function zd(n,t,e){let{$from:o,$to:r,depth:i}=t,s=o.before(i+1),l=r.after(i+1),a=s,c=l,d=v.empty,h=0;for(let f=i,m=!1;f>e;f--)m||o.index(f)>0?(m=!0,d=v.from(o.node(f).copy(d)),h++):a--;let p=v.empty,u=0;for(let f=i,m=!1;f>e;f--)m||r.after(f+1)<r.end(f)?(m=!0,p=v.from(r.node(f).copy(p)),u++):c++;n.step(new et(a,c,s,l,new k(d.append(p),h,u),d.size-h,!0))}function Vi(n,t,e=null,o=n){let r=Bd(n,t),i=r&&Vd(o,t);return i?r.map(Rs).concat({type:t,attrs:e}).concat(i.map(Rs)):null}function Rs(n){return{type:n,attrs:null}}function Bd(n,t){let{parent:e,startIndex:o,endIndex:r}=n,i=e.contentMatchAt(o).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return e.canReplaceWith(o,r,s)?i:null}function Vd(n,t){let{parent:e,startIndex:o,endIndex:r}=n,i=e.child(o),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let l=(s.length?s[s.length-1]:t).contentMatch;for(let a=o;l&&a<r;a++)l=l.matchType(e.child(a).type);return!l||!l.validEnd?null:s}function Fd(n,t,e){let o=v.empty;for(let s=e.length-1;s>=0;s--){if(o.size){let l=e[s].type.contentMatch.matchFragment(o);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=v.from(e[s].type.create(e[s].attrs,o))}let r=t.start,i=t.end;n.step(new et(r,i,r,i,new k(o,0,0),e.length,!0))}function jd(n,t,e,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(t,e,(s,l)=>{let a=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(o,a)&&Wd(n.doc,n.mapping.slice(i).map(l),o)){let c=null;if(o.schema.linebreakReplacement){let u=o.whitespace=="pre",f=!!o.contentMatch.matchType(o.schema.linebreakReplacement);u&&!f?c=!1:!u&&f&&(c=!0)}c===!1&&Sa(n,s,l,i),Bi(n,n.mapping.slice(i).map(l,1),o,void 0,c===null);let d=n.mapping.slice(i),h=d.map(l,1),p=d.map(l+s.nodeSize,1);return n.step(new et(h,p,h+1,p-1,new k(v.from(o.create(a,null,s.marks)),0,0),1,!0)),c===!0&&Ma(n,s,l,i),!1}})}function Ma(n,t,e,o){t.forEach((r,i)=>{if(r.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(r.text);){let a=n.mapping.slice(o).map(e+1+i+s.index);n.replaceWith(a,a+1,t.type.schema.linebreakReplacement.create())}}})}function Sa(n,t,e,o){t.forEach((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let s=n.mapping.slice(o).map(e+1+i);n.replaceWith(s,s+1,t.type.schema.text(` 5`))}})}function Wd(n,t,e){let o=n.resolve(t),r=o.index();return o.parent.canReplaceWith(r,r+1,e)}function qd(n,t,e,o,r){let i=n.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");e||(e=i.type);let s=e.create(o,null,r||i.marks);if(i.isLeaf)return n.replaceWith(t,t+i.nodeSize,s);if(!e.validContent(i.content))throw new RangeError("Invalid content for node type "+e.name);n.step(new et(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new k(v.from(s),0,0),1,!0))}function Ge(n,t,e=1,o){let r=n.resolve(t),i=r.depth-e,s=o&&o[o.length-1]||r.parent;if(i<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!s.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let c=r.depth-1,d=e-2;c>i;c--,d--){let h=r.node(c),p=r.index(c);if(h.type.spec.isolating)return!1;let u=h.content.cutByIndex(p,h.childCount),f=o&&o[d+1];f&&(u=u.replaceChild(0,f.type.create(f.attrs)));let m=o&&o[d]||h;if(!h.canReplace(p+1,h.childCount)||!m.type.validContent(u))return!1}let l=r.indexAfter(i),a=o&&o[0];return r.node(i).canReplaceWith(l,l,a?a.type:r.node(i+1).type)}function Kd(n,t,e=1,o){let r=n.doc.resolve(t),i=v.empty,s=v.empty;for(let l=r.depth,a=r.depth-e,c=e-1;l>a;l--,c--){i=v.from(r.node(l).copy(i));let d=o&&o[c];s=v.from(d?d.type.create(d.attrs,s):r.node(l).copy(s))}n.step(new tt(t,t,new k(i.append(s),e,e),!0))}function ke(n,t){let e=n.resolve(t),o=e.index();return Aa(e.nodeBefore,e.nodeAfter)&&e.parent.canReplace(o,o+1)}function Jd(n,t){t.content.size||n.type.compatibleContent(t.type);let e=n.contentMatchAt(n.childCount),{linebreakReplacement:o}=n.type.schema;for(let r=0;r<t.childCount;r++){let i=t.child(r),s=i.type==o?n.type.schema.nodes.text:i.type;if(e=e.matchType(s),!e||!n.type.allowsMarks(i.marks))return!1}return e.validEnd}function Aa(n,t){return!!(n&&t&&!n.isLeaf&&Jd(n,t))}function cr(n,t,e=-1){let o=n.resolve(t);for(let r=o.depth;;r--){let i,s,l=o.index(r);if(r==o.depth?(i=o.nodeBefore,s=o.nodeAfter):e>0?(i=o.node(r+1),l++,s=o.node(r).maybeChild(l)):(i=o.node(r).maybeChild(l-1),s=o.node(r+1)),i&&!i.isTextblock&&Aa(i,s)&&o.node(r).canReplace(l,l+1))return t;if(r==0)break;t=e<0?o.before(r):o.after(r)}}function Ud(n,t,e){let o=null,{linebreakReplacement:r}=n.doc.type.schema,i=n.doc.resolve(t-e),s=i.node().type;if(r&&s.inlineContent){let d=s.whitespace=="pre",h=!!s.contentMatch.matchType(r);d&&!h?o=!1:!d&&h&&(o=!0)}let l=n.steps.length;if(o===!1){let d=n.doc.resolve(t+e);Sa(n,d.node(),d.before(),l)}s.inlineContent&&Bi(n,t+e-1,s,i.node().contentMatchAt(i.index()),o==null);let a=n.mapping.slice(l),c=a.map(t-e);if(n.step(new tt(c,a.map(t+e,-1),k.empty,!0)),o===!0){let d=n.doc.resolve(c);Ma(n,d.node(),d.before(),n.steps.length)}return n}function Zd(n,t,e){let o=n.resolve(t);if(o.parent.canReplaceWith(o.index(),o.index(),e))return t;if(o.parentOffset==0)for(let r=o.depth-1;r>=0;r--){let i=o.index(r);if(o.node(r).canReplaceWith(i,i,e))return o.before(r+1);if(i>0)return null}if(o.parentOffset==o.parent.content.size)for(let r=o.depth-1;r>=0;r--){let i=o.indexAfter(r);if(o.node(r).canReplaceWith(i,i,e))return o.after(r+1);if(i<o.node(r).childCount)return null}return null}function Ea(n,t,e){let o=n.resolve(t);if(!e.content.size)return t;let r=e.content;for(let i=0;i<e.openStart;i++)r=r.firstChild.content;for(let i=1;i<=(e.openStart==0&&e.size?2:1);i++)for(let s=o.depth;s>=0;s--){let l=s==o.depth?0:o.pos<=(o.start(s+1)+o.end(s+1))/2?-1:1,a=o.index(s)+(l>0?1:0),c=o.node(s),d=!1;if(i==1)d=c.canReplace(a,a,r);else{let h=c.contentMatchAt(a).findWrapping(r.firstChild.type);d=h&&c.canReplaceWith(a,a,h[0])}if(d)return l==0?o.pos:l<0?o.before(s+1):o.after(s+1)}return null}function dr(n,t,e=t,o=k.empty){if(t==e&&!o.size)return null;let r=n.resolve(t),i=n.resolve(e);return Oa(r,i,o)?new tt(t,e,o):new _d(r,i,o).fit()}function Oa(n,t,e){return!e.openStart&&!e.openEnd&&n.start()==t.start()&&n.parent.canReplace(n.index(),t.index(),e.content)}class _d{constructor(t,e,o){this.$from=t,this.$to=e,this.unplaced=o,this.frontier=[],this.placed=v.empty;for(let r=0;r<=t.depth;r++){let i=t.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(t.indexAfter(r))})}for(let r=t.depth;r>0;r--)this.placed=v.from(t.node(r).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 t=this.mustMoveInline(),e=this.placed.size-this.depth-this.$from.depth,o=this.$from,r=this.close(t<0?this.$to:o.doc.resolve(t));if(!r)return null;let i=this.placed,s=o.depth,l=r.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new k(i,s,l);return t>-1?new et(o.pos,t,this.$to.pos,this.$to.end(),a,e):a.size||o.pos!=this.$to.pos?new tt(o.pos,r.pos,a):null}findFittable(){let t=this.unplaced.openStart;for(let e=this.unplaced.content,o=0,r=this.unplaced.openEnd;o<t;o++){let i=e.firstChild;if(e.childCount>1&&(r=0),i.type.spec.isolating&&r<=o){t=o;break}e=i.content}for(let e=1;e<=2;e++)for(let o=e==1?t:this.unplaced.openStart;o>=0;o--){let r,i=null;o?(i=Or(this.unplaced.content,o-1).firstChild,r=i.content):r=this.unplaced.content;let s=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],d,h=null;if(e==1&&(s?c.matchType(s.type)||(h=c.fillBefore(v.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:h};if(e==2&&s&&(d=c.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:l,parent:i,wrap:d};if(i&&c.matchType(i.type))break}}}openMore(){let{content:t,openStart:e,openEnd:o}=this.unplaced,r=Or(t,e);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new k(t,e+1,Math.max(o,r.size+e>=t.size-o?e+1:0)),!0)}dropNode(){let{content:t,openStart:e,openEnd:o}=this.unplaced,r=Or(t,e);if(r.childCount<=1&&e>0){let i=t.size-e<=e+r.size;this.unplaced=new k(un(t,e-1,1),e-1,i?e-1:o)}else this.unplaced=new k(un(t,e,1),e,o)}placeNodes({sliceDepth:t,frontierDepth:e,parent:o,inject:r,wrap:i}){for(;this.depth>e;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let s=this.unplaced,l=o?o.content:s.content,a=s.openStart-t,c=0,d=[],{match:h,type:p}=this.frontier[e];if(r){for(let m=0;m<r.childCount;m++)d.push(r.child(m));h=h.matchFragment(r)}let u=l.size+t-(s.content.size-s.openEnd);for(;c<l.childCount;){let m=l.child(c),g=h.matchType(m.type);if(!g)break;c++,(c>1||a==0||m.content.size)&&(h=g,d.push(Ta(m.mark(p.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?u:-1)))}let f=c==l.childCount;f||(u=-1),this.placed=fn(this.placed,e,v.from(d)),this.frontier[e].match=h,f&&u<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m<u;m++){let w=g.lastChild;this.frontier.push({type:w.type,match:w.contentMatchAt(w.childCount)}),g=w.content}this.unplaced=f?t==0?k.empty:new k(un(s.content,t-1,1),t-1,u<0?s.openEnd:t-1):new k(un(s.content,t,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],e;if(!t.type.isTextblock||!Tr(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:o}=this.$to,r=this.$to.after(o);for(;o>1&&r==this.$to.end(--o);)++r;return r}findCloseLevel(t){t:for(let e=Math.min(this.depth,t.depth);e>=0;e--){let{match:o,type:r}=this.frontier[e],i=e<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1)),s=Tr(t,e,r,o,i);if(s){for(let l=e-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],d=Tr(t,l,c,a,!0);if(!d||d.childCount)continue t}return{depth:e,fit:s,move:i?t.doc.resolve(t.after(e+1)):t}}}}close(t){let e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=fn(this.placed,e.depth,e.fit)),t=e.move;for(let o=e.depth+1;o<=t.depth;o++){let r=t.node(o),i=r.type.contentMatch.fillBefore(r.content,!0,t.index(o));this.openFrontierNode(r.type,r.attrs,i)}return t}openFrontierNode(t,e=null,o){let r=this.frontier[this.depth];r.match=r.match.matchType(t),this.placed=fn(this.placed,this.depth,v.from(t.create(e,o))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(v.empty,!0);t.childCount&&(this.placed=fn(this.placed,this.frontier.length,t))}}function un(n,t,e){return t==0?n.cutByIndex(e,n.childCount):n.replaceChild(0,n.firstChild.copy(un(n.firstChild.content,t-1,e)))}function fn(n,t,e){return t==0?n.append(e):n.replaceChild(n.childCount-1,n.lastChild.copy(fn(n.lastChild.content,t-1,e)))}function Or(n,t){for(let e=0;e<t;e++)n=n.firstChild.content;return n}function Ta(n,t,e){if(t<=0)return n;let o=n.content;return t>1&&(o=o.replaceChild(0,Ta(o.firstChild,t-1,o.childCount==1?e-1:0))),t>0&&(o=n.type.contentMatch.fillBefore(o).append(o),e<=0&&(o=o.append(n.type.contentMatch.matchFragment(o).fillBefore(v.empty,!0)))),n.copy(o)}function Tr(n,t,e,o,r){let i=n.node(t),s=r?n.indexAfter(t):n.index(t);if(s==i.childCount&&!e.compatibleContent(i.type))return null;let l=o.fillBefore(i.content,!0,s);return l&&!Gd(e,i.content,s)?l:null}function Gd(n,t,e){for(let o=e;o<t.childCount;o++)if(!n.allowsMarks(t.child(o).marks))return!0;return!1}function Xd(n){return n.spec.defining||n.spec.definingForContent}function Qd(n,t,e,o){if(!o.size)return n.deleteRange(t,e);let r=n.doc.resolve(t),i=n.doc.resolve(e);if(Oa(r,i,o))return n.step(new tt(t,e,o));let s=Da(r,n.doc.resolve(e));s[s.length-1]==0&&s.pop();let l=-(r.depth+1);s.unshift(l);for(let p=r.depth,u=r.pos-1;p>0;p--,u--){let f=r.node(p).type.spec;if(f.defining||f.definingAsContext||f.isolating)break;s.indexOf(p)>-1?l=p:r.before(p)==u&&s.splice(1,0,-p)}let a=s.indexOf(l),c=[],d=o.openStart;for(let p=o.content,u=0;;u++){let f=p.firstChild;if(c.push(f),u==o.openStart)break;p=f.content}for(let p=d-1;p>=0;p--){let u=c[p],f=Xd(u.type);if(f&&!u.sameMarkup(r.node(Math.abs(l)-1)))d=p;else if(f||!u.type.isTextblock)break}for(let p=o.openStart;p>=0;p--){let u=(p+d+1)%(o.openStart+1),f=c[u];if(f)for(let m=0;m<s.length;m++){let g=s[(m+a)%s.length],w=!0;g<0&&(w=!1,g=-g);let x=r.node(g-1),T=r.index(g-1);if(x.canReplaceWith(T,T,f.type,f.marks))return n.replace(r.before(g),w?i.after(g):e,new k(Na(o.content,0,o.openStart,u),u,o.openEnd))}}let h=n.steps.length;for(let p=s.length-1;p>=0&&(n.replace(t,e,o),!(n.steps.length>h));p--){let u=s[p];u<0||(t=r.before(u),e=i.after(u))}}function Na(n,t,e,o,r){if(t<e){let i=n.firstChild;n=n.replaceChild(0,i.copy(Na(i.content,t+1,e,o,i)))}if(t>o){let i=r.contentMatchAt(0),s=i.fillBefore(n).append(n);n=s.append(i.matchFragment(s).fillBefore(v.empty,!0))}return n}function Yd(n,t,e,o){if(!o.isInline&&t==e&&n.doc.resolve(t).parent.content.size){let r=Zd(n.doc,t,o.type);r!=null&&(t=e=r)}n.replaceRange(t,e,new k(v.from(o),0,0))}function th(n,t,e){let o=n.doc.resolve(t),r=n.doc.resolve(e),i=Da(o,r);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||o.node(l).type.contentMatch.validEnd)return n.delete(o.start(l),r.end(l));if(l>0&&(a||o.node(l-1).canReplace(o.index(l-1),r.indexAfter(l-1))))return n.delete(o.before(l),r.after(l))}for(let s=1;s<=o.depth&&s<=r.depth;s++)if(t-o.start(s)==o.depth-s&&e>o.end(s)&&r.end(s)-e!=r.depth-s&&o.start(s-1)==r.start(s-1)&&o.node(s-1).canReplace(o.index(s-1),r.index(s-1)))return n.delete(o.before(s),e);n.delete(t,e)}function Da(n,t){let e=[],o=Math.min(n.depth,t.depth);for(let r=o;r>=0;r--){let i=n.start(r);if(i<n.pos-(n.depth-r)||t.end(r)>t.pos+(t.depth-r)||n.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(i==t.start(r)||r==n.depth&&r==t.depth&&n.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==i-1)&&e.push(r)}return e}class Xe extends mt{constructor(t,e,o){super(),this.pos=t,this.attr=e,this.value=o}apply(t){let e=t.nodeAt(this.pos);if(!e)return X.fail("No node at attribute step's position");let o=Object.create(null);for(let i in e.attrs)o[i]=e.attrs[i];o[this.attr]=this.value;let r=e.type.create(o,null,e.marks);return X.fromReplace(t,this.pos,this.pos+1,new k(v.from(r),0,e.isLeaf?0:1))}getMap(){return Mt.empty}invert(t){return new Xe(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Xe(e.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,e){if(typeof e.pos!="number"||typeof e.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Xe(e.pos,e.attr,e.value)}}mt.jsonID("attr",Xe);class Ln extends mt{constructor(t,e){super(),this.attr=t,this.value=e}apply(t){let e=Object.create(null);for(let r in t.attrs)e[r]=t.attrs[r];e[this.attr]=this.value;let o=t.type.create(e,t.content,t.marks);return X.ok(o)}getMap(){return Mt.empty}invert(t){return new Ln(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,e){if(typeof e.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Ln(e.attr,e.value)}}mt.jsonID("docAttr",Ln);let tn=class extends Error{};tn=function n(t){let e=Error.call(this,t);return e.__proto__=n.prototype,e};tn.prototype=Object.create(Error.prototype);tn.prototype.constructor=tn;tn.prototype.name="TransformError";class Fi{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new Rn}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let e=this.maybeStep(t);if(e.failed)throw new tn(e.failed);return this}maybeStep(t){let e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e}get docChanged(){return this.steps.length>0}addStep(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e}replace(t,e=t,o=k.empty){let r=dr(this.doc,t,e,o);return r&&this.step(r),this}replaceWith(t,e,o){return this.replace(t,e,new k(v.from(o),0,0))}delete(t,e){return this.replace(t,e,k.empty)}insert(t,e){return this.replaceWith(t,t,e)}replaceRange(t,e,o){return Qd(this,t,e,o),this}replaceRangeWith(t,e,o){return Yd(this,t,e,o),this}deleteRange(t,e){return th(this,t,e),this}lift(t,e){return zd(this,t,e),this}join(t,e=1){return Ud(this,t,e),this}wrap(t,e){return Fd(this,t,e),this}setBlockType(t,e=t,o,r=null){return jd(this,t,e,o,r),this}setNodeMarkup(t,e,o=null,r){return qd(this,t,e,o,r),this}setNodeAttribute(t,e,o){return this.step(new Xe(t,e,o)),this}setDocAttribute(t,e){return this.step(new Ln(t,e)),this}addNodeMark(t,e){return this.step(new fe(t,e)),this}removeNodeMark(t,e){if(!(e instanceof V)){let o=this.doc.nodeAt(t);if(!o)throw new RangeError("No node at position "+t);if(e=e.isInSet(o.marks),!e)return this}return this.step(new Ye(t,e)),this}split(t,e=1,o){return Kd(this,t,e,o),this}addMark(t,e,o){return Pd(this,t,e,o),this}removeMark(t,e,o){return $d(this,t,e,o),this}clearIncompatible(t,e,o){return Bi(this,t,e,o),this}}const Nr=Object.create(null);class N{constructor(t,e,o){this.$anchor=t,this.$head=e,this.ranges=o||[new Ra(t.min(e),t.max(e))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,e=k.empty){let o=e.content.lastChild,r=null;for(let l=0;l<e.openEnd;l++)r=o,o=o.lastChild;let i=t.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],d=t.mapping.slice(i);t.replaceRange(d.map(a.pos),d.map(c.pos),l?k.empty:e),l==0&&Ps(t,i,(o?o.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(t,e){let o=t.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:l}=r[i],a=t.mapping.slice(o),c=a.map(s.pos),d=a.map(l.pos);i?t.deleteRange(c,d):(t.replaceRangeWith(c,d,e),Ps(t,o,e.isInline?-1:1))}}static findFrom(t,e,o=!1){let r=t.parent.inlineContent?new E(t):qe(t.node(0),t.parent,t.pos,t.index(),e,o);if(r)return r;for(let i=t.depth-1;i>=0;i--){let s=e<0?qe(t.node(0),t.node(i),t.before(i+1),t.index(i),e,o):qe(t.node(0),t.node(i),t.after(i+1),t.index(i)+1,e,o);if(s)return s}return null}static near(t,e=1){return this.findFrom(t,e)||this.findFrom(t,-e)||new Rt(t.node(0))}static atStart(t){return qe(t,t,0,0,1)||new Rt(t)}static atEnd(t){return qe(t,t,t.content.size,t.childCount,-1)||new Rt(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=Nr[e.type];if(!o)throw new RangeError(`No selection type ${e.type} defined`);return o.fromJSON(t,e)}static jsonID(t,e){if(t in Nr)throw new RangeError("Duplicate use of selection JSON ID "+t);return Nr[t]=e,e.prototype.jsonID=t,e}getBookmark(){return E.between(this.$anchor,this.$head).getBookmark()}}N.prototype.visible=!0;class Ra{constructor(t,e){this.$from=t,this.$to=e}}let Ls=!1;function Is(n){!Ls&&!n.parent.inlineContent&&(Ls=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class E extends N{constructor(t,e=t){Is(t),Is(e),super(t,e)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,e){let o=t.resolve(e.map(this.head));if(!o.parent.inlineContent)return N.near(o);let r=t.resolve(e.map(this.anchor));return new E(r.parent.inlineContent?r:o,o)}
vendor: 6,293 bytes, line 5
5replace(t,e=k.empty){if(super.replace(t,e),e==k.empty){let o=this.$from.marksAcross(this.$to);o&&t.ensureMarks(o)}}eq(t){return t instanceof E&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new hr(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,e){if(typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new E(t.resolve(e.anchor),t.resolve(e.head))}static create(t,e,o=e){let r=t.resolve(e);return new this(r,o==e?r:t.resolve(o))}static between(t,e,o){let r=t.pos-e.pos;if((!o||r)&&(o=r>=0?1:-1),!e.parent.inlineContent){let i=N.findFrom(e,o,!0)||N.findFrom(e,-o,!0);if(i)e=i.$head;else return N.near(e,o)}return t.parent.inlineContent||(r==0?t=e:(t=(N.findFrom(t,-o,!0)||N.findFrom(t,o,!0)).$anchor,t.pos<e.pos!=r<0&&(t=e))),new E(t,e)}}N.jsonID("text",E);class hr{constructor(t,e){this.anchor=t,this.head=e}map(t){return new hr(t.map(this.anchor),t.map(this.head))}resolve(t){return E.between(t.resolve(this.anchor),t.resolve(this.head))}}class A extends N{constructor(t){let e=t.nodeAfter,o=t.node(0).resolve(t.pos+e.nodeSize);super(t,o),this.node=e}map(t,e){let{deleted:o,pos:r}=e.mapResult(this.anchor),i=t.resolve(r);return o?N.near(i):new A(i)}content(){return new k(v.from(this.node),0,0)}eq(t){return t instanceof A&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ji(this.anchor)}static fromJSON(t,e){if(typeof e.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new A(t.resolve(e.anchor))}static create(t,e){return new A(t.resolve(e))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}A.prototype.visible=!1;N.jsonID("node",A);class ji{constructor(t){this.anchor=t}map(t){let{deleted:e,pos:o}=t.mapResult(this.anchor);return e?new hr(o,o):new ji(o)}resolve(t){let e=t.resolve(this.anchor),o=e.nodeAfter;return o&&A.isSelectable(o)?new A(e):N.near(e)}}class Rt extends N{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,e=k.empty){if(e==k.empty){t.delete(0,t.doc.content.size);let o=N.atStart(t.doc);o.eq(t.selection)||t.setSelection(o)}else super.replace(t,e)}toJSON(){return{type:"all"}}static fromJSON(t){return new Rt(t)}map(t){return new Rt(t)}eq(t){return t instanceof Rt}getBookmark(){return eh}}N.jsonID("all",Rt);const eh={map(){return this},resolve(n){return new Rt(n)}};function qe(n,t,e,o,r,i=!1){if(t.inlineContent)return E.create(n,e);for(let s=o-(r>0?0:1);r>0?s<t.childCount:s>=0;s+=r){let l=t.child(s);if(l.isAtom){if(!i&&A.isSelectable(l))return A.create(n,e-(r<0?l.nodeSize:0))}else{let a=qe(n,l,e+r,r<0?l.childCount:0,r,i);if(a)return a}e+=l.nodeSize*r}return null}function Ps(n,t,e){let o=n.steps.length-1;if(o<t)return;let r=n.steps[o];if(!(r instanceof tt||r instanceof et))return;let i=n.mapping.maps[o],s;i.forEach((l,a,c,d)=>{s==null&&(s=d)}),n.setSelection(N.near(n.doc.resolve(s),e))}const $s=1,Hs=2,zs=4;class nh extends Fi{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=(this.updated|$s)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&$s)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=Hs,this}ensureMarks(t){return V.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Hs)>0}addStep(t,e){super.addStep(t,e),this.updated=this.updated&-3,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,e=!0){let o=this.selection;return e&&(t=t.mark(this.storedMarks||(o.empty?o.$from.marks():o.$from.marksAcross(o.$to)||V.none))),o.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,e,o){let r=this.doc.type.schema;if(e==null)return t?this.replaceSelectionWith(r.text(t),!0):this.deleteSelection();{if(o==null&&(o=e),o=o??e,!t)return this.deleteRange(e,o);let i=this.storedMarks;if(!i){let s=this.doc.resolve(e);i=o==e?s.marks():s.marksAcross(this.doc.resolve(o))}return this.replaceRangeWith(e,o,r.text(t,i)),this.selection.empty||this.setSelection(N.near(this.selection.$to)),this}}setMeta(t,e){return this.meta[typeof t=="string"?t:t.key]=e,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=zs,this}get scrolledIntoView(){return(this.updated&zs)>0}}function Bs(n,t){return!t||!n?n:n.bind(t)}class mn{constructor(t,e,o){this.name=t,this.init=Bs(e.init,o),this.apply=Bs(e.apply,o)}}const oh=[new mn("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new mn("selection",{init(n,t){return n.selection||N.atStart(t.doc)},apply(n){return n.selection}}),new mn("storedMarks",{init(n){return n.storedMarks||null},apply(n,t,e,o){return o.selection.$cursor?n.storedMarks:null}}),new mn("scrollToSelection",{init(){return 0},apply(n,t){return n.scrolledIntoView?t+1:t}})];class Dr{constructor(t,e){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=oh.slice(),e&&e.forEach(o=>{if(this.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");this.plugins.push(o),this.pluginsByKey[o.key]=o,o.spec.state&&this.fields.push(new mn(o.key,o.spec.state,o))})}}class Ze{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}
vendor: 106,676 bytes, lines 5-10
5apply(t){return this.applyTransaction(t).state}filterTransaction(t,e=-1){for(let o=0;o<this.config.plugins.length;o++)if(o!=e){let r=this.config.plugins[o];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let e=[t],o=this.applyInner(t),r=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=r?r[s].n:0,c=r?r[s].state:this,d=a<e.length&&l.spec.appendTransaction.call(l,a?e.slice(a):e,c,o);if(d&&o.filterTransaction(d,s)){if(d.setMeta("appendedTransaction",t),!r){r=[];for(let h=0;h<this.config.plugins.length;h++)r.push(h<s?{state:o,n:e.length}:{state:this,n:0})}e.push(d),o=o.applyInner(d),i=!0}r&&(r[s]={state:o,n:e.length})}}if(!i)return{state:o,transactions:e}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let e=new Ze(this.config),o=this.config.fields;for(let r=0;r<o.length;r++){let i=o[r];e[i.name]=i.apply(t,this[i.name],this,e)}return e}get tr(){return new nh(this)}static create(t){let e=new Dr(t.doc?t.doc.type.schema:t.schema,t.plugins),o=new Ze(e);for(let r=0;r<e.fields.length;r++)o[e.fields[r].name]=e.fields[r].init(t,o);return o}reconfigure(t){let e=new Dr(this.schema,t.plugins),o=e.fields,r=new Ze(e);for(let i=0;i<o.length;i++){let s=o[i].name;r[s]=this.hasOwnProperty(s)?this[s]:o[i].init(t,r)}return r}toJSON(t){let e={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(e.storedMarks=this.storedMarks.map(o=>o.toJSON())),t&&typeof t=="object")for(let o in t){if(o=="doc"||o=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=t[o],i=r.spec.state;i&&i.toJSON&&(e[o]=i.toJSON.call(r,this[r.key]))}return e}static fromJSON(t,e,o){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let r=new Dr(t.schema,t.plugins),i=new Ze(r);return r.fields.forEach(s=>{if(s.name=="doc")i.doc=ge.fromJSON(t.schema,e.doc);else if(s.name=="selection")i.selection=N.fromJSON(i.doc,e.selection);else if(s.name=="storedMarks")e.storedMarks&&(i.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(o)for(let l in o){let a=o[l],c=a.spec.state;if(a.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(e,l)){i[s.name]=c.fromJSON.call(a,t,e[l],i);return}}i[s.name]=s.init(t,i)}}),i}}function La(n,t,e){for(let o in n){let r=n[o];r instanceof Function?r=r.bind(t):o=="handleDOMEvents"&&(r=La(r,t,{})),e[o]=r}return e}class Q{constructor(t){this.spec=t,this.props={},t.props&&La(t.props,this,this.props),this.key=t.key?t.key.key:Ia("plugin")}getState(t){return t[this.key]}}const Rr=Object.create(null);function Ia(n){return n in Rr?n+"$"+ ++Rr[n]:(Rr[n]=0,n+"$")}class at{constructor(t="key"){this.key=Ia(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const st=function(n){for(var t=0;;t++)if(n=n.previousSibling,!n)return t},en=function(n){let t=n.assignedSlot||n.parentNode;return t&&t.nodeType==11?t.host:t};let li=null;const Yt=function(n,t,e){let o=li||(li=document.createRange());return o.setEnd(n,e??n.nodeValue.length),o.setStart(n,t||0),o},rh=function(){li=null},He=function(n,t,e,o){return e&&(Vs(n,t,e,o,-1)||Vs(n,t,e,o,1))},ih=/^(img|br|input|textarea|hr)$/i;function Vs(n,t,e,o,r){for(;;){if(n==e&&t==o)return!0;if(t==(r<0?0:Dt(n))){let i=n.parentNode;if(!i||i.nodeType!=1||Wn(n)||ih.test(n.nodeName)||n.contentEditable=="false")return!1;t=st(n)+(r<0?0:1),n=i}else if(n.nodeType==1){if(n=n.childNodes[t+(r<0?-1:0)],n.contentEditable=="false")return!1;t=r<0?Dt(n):0}else return!1}}function Dt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function sh(n,t){for(;;){if(n.nodeType==3&&t)return n;if(n.nodeType==1&&t>0){if(n.contentEditable=="false")return null;n=n.childNodes[t-1],t=Dt(n)}else if(n.parentNode&&!Wn(n))t=st(n),n=n.parentNode;else return null}}function lh(n,t){for(;;){if(n.nodeType==3&&t<n.nodeValue.length)return n;if(n.nodeType==1&&t<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[t],t=0}else if(n.parentNode&&!Wn(n))t=st(n)+1,n=n.parentNode;else return null}}function ah(n,t,e){for(let o=t==0,r=t==Dt(n);o||r;){if(n==e)return!0;let i=st(n);if(n=n.parentNode,!n)return!1;o=o&&i==0,r=r&&i==Dt(n)}}function Wn(n){let t;for(let e=n;e&&!(t=e.pmViewDesc);e=e.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==n||t.contentDOM==n)}const pr=function(n){return n.focusNode&&He(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Se(n,t){let e=document.createEvent("Event");return e.initEvent("keydown",!0,!0),e.keyCode=n,e.key=e.code=t,e}function ch(n){let t=n.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function dh(n,t,e){if(n.caretPositionFromPoint)try{let o=n.caretPositionFromPoint(t,e);if(o)return{node:o.offsetNode,offset:Math.min(Dt(o.offsetNode),o.offset)}}catch{}if(n.caretRangeFromPoint){let o=n.caretRangeFromPoint(t,e);if(o)return{node:o.startContainer,offset:Math.min(Dt(o.startContainer),o.startOffset)}}}const Wt=typeof navigator<"u"?navigator:null,Fs=typeof document<"u"?document:null,xe=Wt&&Wt.userAgent||"",ai=/Edge\/(\d+)/.exec(xe),Pa=/MSIE \d/.exec(xe),ci=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(xe),xt=!!(Pa||ci||ai),ye=Pa?document.documentMode:ci?+ci[1]:ai?+ai[1]:0,$t=!xt&&/gecko\/(\d+)/i.test(xe);$t&&+(/Firefox\/(\d+)/.exec(xe)||[0,0])[1];const di=!xt&&/Chrome\/(\d+)/.exec(xe),pt=!!di,$a=di?+di[1]:0,wt=!xt&&!!Wt&&/Apple Computer/.test(Wt.vendor),nn=wt&&(/Mobile\/\w+/.test(xe)||!!Wt&&Wt.maxTouchPoints>2),Nt=nn||(Wt?/Mac/.test(Wt.platform):!1),hh=Wt?/Win/.test(Wt.platform):!1,te=/Android \d/.test(xe),qn=!!Fs&&"webkitFontSmoothing"in Fs.documentElement.style,ph=qn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function uh(n){let t=n.defaultView&&n.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Jt(n,t){return typeof n=="number"?n:n[t]}function fh(n){let t=n.getBoundingClientRect(),e=t.width/n.offsetWidth||1,o=t.height/n.offsetHeight||1;return{left:t.left,right:t.left+n.clientWidth*e,top:t.top,bottom:t.top+n.clientHeight*o}}function js(n,t,e){let o=n.someProp("scrollThreshold")||0,r=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let s=e||n.dom;s;){if(s.nodeType!=1){s=en(s);continue}let l=s,a=l==i.body,c=a?uh(i):fh(l),d=0,h=0;if(t.top<c.top+Jt(o,"top")?h=-(c.top-t.top+Jt(r,"top")):t.bottom>c.bottom-Jt(o,"bottom")&&(h=t.bottom-t.top>c.bottom-c.top?t.top+Jt(r,"top")-c.top:t.bottom-c.bottom+Jt(r,"bottom")),t.left<c.left+Jt(o,"left")?d=-(c.left-t.left+Jt(r,"left")):t.right>c.right-Jt(o,"right")&&(d=t.right-c.right+Jt(r,"right")),d||h)if(a)i.defaultView.scrollBy(d,h);else{let u=l.scrollLeft,f=l.scrollTop;h&&(l.scrollTop+=h),d&&(l.scrollLeft+=d);let m=l.scrollLeft-u,g=l.scrollTop-f;t={left:t.left-m,top:t.top-g,right:t.right-m,bottom:t.bottom-g}}let p=a?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(p))break;s=p=="absolute"?s.offsetParent:en(s)}}function mh(n){let t=n.dom.getBoundingClientRect(),e=Math.max(0,t.top),o,r;for(let i=(t.left+t.right)/2,s=e+1;s<Math.min(innerHeight,t.bottom);s+=5){let l=n.root.elementFromPoint(i,s);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=e-20){o=l,r=a.top;break}}return{refDOM:o,refTop:r,stack:Ha(n.dom)}}function Ha(n){let t=[],e=n.ownerDocument;for(let o=n;o&&(t.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),n!=e);o=en(o));return t}function gh({refDOM:n,refTop:t,stack:e}){let o=n?n.getBoundingClientRect().top:0;za(e,o==0?0:o-t)}function za(n,t){for(let e=0;e<n.length;e++){let{dom:o,top:r,left:i}=n[e];o.scrollTop!=r+t&&(o.scrollTop=r+t),o.scrollLeft!=i&&(o.scrollLeft=i)}}let je=null;function yh(n){if(n.setActive)return n.setActive();if(je)return n.focus(je);let t=Ha(n);n.focus(je==null?{get preventScroll(){return je={preventScroll:!0},!0}}:void 0),je||(je=!1,za(t,0))}function Ba(n,t){let e,o=2e8,r,i=0,s=t.top,l=t.top,a,c;for(let d=n.firstChild,h=0;d;d=d.nextSibling,h++){let p;if(d.nodeType==1)p=d.getClientRects();else if(d.nodeType==3)p=Yt(d).getClientRects();else continue;for(let u=0;u<p.length;u++){let f=p[u];if(f.top<=s&&f.bottom>=l){s=Math.max(f.bottom,s),l=Math.min(f.top,l);let m=f.left>t.left?f.left-t.left:f.right<t.left?t.left-f.right:0;if(m<o){e=d,o=m,r=m&&e.nodeType==3?{left:f.right<t.left?f.right:f.left,top:t.top}:t,d.nodeType==1&&m&&(i=h+(t.left>=(f.left+f.right)/2?1:0));continue}}else f.top>t.top&&!a&&f.left<=t.left&&f.right>=t.left&&(a=d,c={left:Math.max(f.left,Math.min(f.right,t.left)),top:f.top});!e&&(t.left>=f.right&&t.top>=f.top||t.left>=f.left&&t.top>=f.bottom)&&(i=h+1)}}return!e&&a&&(e=a,r=c,o=0),e&&e.nodeType==3?wh(e,r):!e||o&&e.nodeType==1?{node:n,offset:i}:Ba(e,r)}function wh(n,t){let e=n.nodeValue.length,o=document.createRange();for(let r=0;r<e;r++){o.setEnd(n,r+1),o.setStart(n,r);let i=ie(o,1);if(i.top!=i.bottom&&Wi(t,i))return{node:n,offset:r+(t.left>=(i.left+i.right)/2?1:0)}}return{node:n,offset:0}}function Wi(n,t){return n.left>=t.left-1&&n.left<=t.right+1&&n.top>=t.top-1&&n.top<=t.bottom+1}function vh(n,t){let e=n.parentNode;return e&&/^li$/i.test(e.nodeName)&&t.left<n.getBoundingClientRect().left?e:n}function bh(n,t,e){let{node:o,offset:r}=Ba(t,e),i=-1;if(o.nodeType==1&&!o.firstChild){let s=o.getBoundingClientRect();i=s.left!=s.right&&e.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(o,r,i)}function kh(n,t,e,o){let r=-1;for(let i=t,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>o.left||a.top>o.top?r=l.posBefore:(!s&&a.right<o.left||a.bottom<o.top)&&(r=l.posAfter),s=!0),!l.contentDOM&&r<0&&!l.node.isText))return(l.node.isBlock?o.top<(a.top+a.bottom)/2:o.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return r>-1?r:n.docView.posFromDOM(t,e,-1)}function Va(n,t,e){let o=n.childNodes.length;if(o&&e.top<e.bottom)for(let r=Math.max(0,Math.min(o-1,Math.floor(o*(t.top-e.top)/(e.bottom-e.top))-2)),i=r;;){let s=n.childNodes[i];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(Wi(t,c))return Va(s,t,c)}}if((i=(i+1)%o)==r)break}return n}function xh(n,t){let e=n.dom.ownerDocument,o,r=0,i=dh(e,t.left,t.top);i&&({node:o,offset:r}=i);let s=(n.root.elementFromPoint?n.root:e).elementFromPoint(t.left,t.top),l;if(!s||!n.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=n.dom.getBoundingClientRect();if(!Wi(t,c)||(s=Va(n.dom,t,c),!s))return null}if(wt)for(let c=s;o&&c;c=en(c))c.draggable&&(o=void 0);if(s=vh(s,t),o){if($t&&o.nodeType==1&&(r=Math.min(r,o.childNodes.length),r<o.childNodes.length)){let d=o.childNodes[r],h;d.nodeName=="IMG"&&(h=d.getBoundingClientRect()).right<=t.left&&h.bottom>t.top&&r++}let c;qn&&r&&o.nodeType==1&&(c=o.childNodes[r-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=t.top&&r--,o==n.dom&&r==o.childNodes.length-1&&o.lastChild.nodeType==1&&t.top>o.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(r==0||o.nodeType!=1||o.childNodes[r-1].nodeName!="BR")&&(l=kh(n,o,r,t))}l==null&&(l=bh(n,s,t));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Ws(n){return n.top<n.bottom||n.left<n.right}function ie(n,t){let e=n.getClientRects();if(e.length){let o=e[t<0?0:e.length-1];if(Ws(o))return o}return Array.prototype.find.call(e,Ws)||n.getBoundingClientRect()}const Ch=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Fa(n,t,e){let{node:o,offset:r,atom:i}=n.docView.domFromPos(t,e<0?-1:1),s=qn||$t;if(o.nodeType==3)if(s&&(Ch.test(o.nodeValue)||(e<0?!r:r==o.nodeValue.length))){let l=ie(Yt(o,r,r),e);if($t&&r&&/\s/.test(o.nodeValue[r-1])&&r<o.nodeValue.length){let a=ie(Yt(o,r-1,r-1),-1);if(a.top==l.top){let c=ie(Yt(o,r,r+1),-1);if(c.top!=l.top)return hn(c,c.left<a.left)}}return l}else{let l=r,a=r,c=e<0?1:-1;return e<0&&!r?(a++,c=-1):e>=0&&r==o.nodeValue.length?(l--,c=1):e<0?l--:a++,hn(ie(Yt(o,l,a),c),c<0)}if(!n.state.doc.resolve(t-(i||0)).parent.inlineContent){if(i==null&&r&&(e<0||r==Dt(o))){let l=o.childNodes[r-1];if(l.nodeType==1)return Lr(l.getBoundingClientRect(),!1)}if(i==null&&r<Dt(o)){let l=o.childNodes[r];if(l.nodeType==1)return Lr(l.getBoundingClientRect(),!0)}return Lr(o.getBoundingClientRect(),e>=0)}if(i==null&&r&&(e<0||r==Dt(o))){let l=o.childNodes[r-1],a=l.nodeType==3?Yt(l,Dt(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(a)return hn(ie(a,1),!1)}if(i==null&&r<Dt(o)){let l=o.childNodes[r];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let a=l?l.nodeType==3?Yt(l,0,s?0:1):l.nodeType==1?l:null:null;if(a)return hn(ie(a,-1),!0)}return hn(ie(o.nodeType==3?Yt(o):o,-e),e>=0)}function hn(n,t){if(n.width==0)return n;let e=t?n.left:n.right;return{top:n.top,bottom:n.bottom,left:e,right:e}}function Lr(n,t){if(n.height==0)return n;let e=t?n.top:n.bottom;return{top:e,bottom:e,left:n.left,right:n.right}}function ja(n,t,e){let o=n.state,r=n.root.activeElement;o!=t&&n.updateState(t),r!=n.dom&&n.focus();try{return e()}finally{o!=t&&n.updateState(o),r!=n.dom&&r&&r.focus()}}function Mh(n,t,e){let o=t.selection,r=e=="up"?o.$from:o.$to;return ja(n,t,()=>{let{node:i}=n.docView.domFromPos(r.pos,e=="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=Fa(n,r.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=Yt(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let d=a[c];if(d.bottom>d.top+1&&(e=="up"?s.top-d.top>(d.bottom-s.top)*2:d.bottom-s.bottom>(s.bottom-d.top)*2))return!1}}return!0})}const Sh=/[\u0590-\u08ac]/;function Ah(n,t,e){let{$head:o}=t.selection;if(!o.parent.isTextblock)return!1;let r=o.parentOffset,i=!r,s=r==o.parent.content.size,l=n.domSelection();return l?!Sh.test(o.parent.textContent)||!l.modify?e=="left"||e=="backward"?i:s:ja(n,t,()=>{let{focusNode:a,focusOffset:c,anchorNode:d,anchorOffset:h}=n.domSelectionRange(),p=l.caretBidiLevel;l.modify("move",e,"character");let u=o.depth?n.docView.domAfterPos(o.before()):n.dom,{focusNode:f,focusOffset:m}=n.domSelectionRange(),g=f&&!u.contains(f.nodeType==1?f:f.parentNode)||a==f&&c==m;try{l.collapse(d,h),a&&(a!=d||c!=h)&&l.extend&&l.extend(a,c)}catch{}return p!=null&&(l.caretBidiLevel=p),g}):o.pos==o.start()||o.pos==o.end()}let qs=null,Ks=null,Js=!1;function Eh(n,t,e){return qs==t&&Ks==e?Js:(qs=t,Ks=e,Js=e=="up"||e=="down"?Mh(n,t,e):Ah(n,t,e))}const Lt=0,Us=1,Ee=2,qt=3;class Kn{constructor(t,e,o,r){this.parent=t,this.children=e,this.dom=o,this.contentDOM=r,this.dirty=Lt,o.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,e,o){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let e=0;e<this.children.length;e++)t+=this.children[e].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let e=0,o=this.posAtStart;;e++){let r=this.children[e];if(r==t)return o;o+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(t,e,o){if(this.contentDOM&&this.contentDOM.contains(t.nodeType==1?t:t.parentNode))if(o<0){let i,s;if(t==this.contentDOM)i=t.childNodes[e-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(t==this.contentDOM)i=t.childNodes[e];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let r;if(t==this.dom&&this.contentDOM)r=e>st(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(e==0)for(let i=t;;i=i.parentNode){if(i==this.dom){r=!1;break}if(i.previousSibling)break}if(r==null&&e==t.childNodes.length)for(let i=t;;i=i.parentNode){if(i==this.dom){r=!0;break}if(i.nextSibling)break}}return r??o>0?this.posAtEnd:this.posAtStart}nearestDesc(t,e=!1){for(let o=!0,r=t;r;r=r.parentNode){let i=this.getDesc(r),s;if(i&&(!e||i.node))if(o&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(t.nodeType==1?t:t.parentNode):s==t))o=!1;else return i}}getDesc(t){let e=t.pmViewDesc;for(let o=e;o;o=o.parent)if(o==this)return e}posFromDOM(t,e,o){for(let r=t;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(t,e,o)}return-1}descAt(t){for(let e=0,o=0;e<this.children.length;e++){let r=this.children[e],i=o+r.size;if(o==t&&i!=o){for(;!r.border&&r.children.length;)for(let s=0;s<r.children.length;s++){let l=r.children[s];if(l.size){r=l;break}}return r}if(t<i)return r.descAt(t-o-r.border);o=i}}domFromPos(t,e){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let o=0,r=0;for(let i=0;o<this.children.length;o++){let s=this.children[o],l=i+s.size;if(l>t||s instanceof qa){r=t-i;break}i=l}if(r)return this.children[o].domFromPos(r-this.children[o].border,e);for(let i;o&&!(i=this.children[o-1]).size&&i instanceof Wa&&i.side>=0;o--);if(e<=0){let i,s=!0;for(;i=o?this.children[o-1]:null,!(!i||i.dom.parentNode==this.contentDOM);o--,s=!1);return i&&e&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,e):{node:this.contentDOM,offset:i?st(i.dom)+1:0}}else{let i,s=!0;for(;i=o<this.children.length?this.children[o]:null,!(!i||i.dom.parentNode==this.contentDOM);o++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,e):{node:this.contentDOM,offset:i?st(i.dom):this.contentDOM.childNodes.length}}}parseRange(t,e,o=0){if(this.children.length==0)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let s=o,l=0;;l++){let a=this.children[l],c=s+a.size;if(r==-1&&t<=c){let d=s+a.border;if(t>=d&&e<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(t,e,d);t=s;for(let h=l;h>0;h--){let p=this.children[h-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=st(p.dom)+1;break}t-=p.size}r==-1&&(r=0)}if(r>-1&&(c>e||l==this.children.length-1)){e=c;for(let d=l+1;d<this.children.length;d++){let h=this.children[d];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(-1)){i=st(h.dom);break}e+=h.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:t,to:e,fromOffset:r,toOffset:i}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let e=this.children[t<0?0:this.children.length-1];return e.size==0||e.emptyChildAt(t)}domAfterPos(t){let{node:e,offset:o}=this.domFromPos(t,0);if(e.nodeType!=1||o==e.childNodes.length)throw new RangeError("No node after pos "+t);return e.childNodes[o]}setSelection(t,e,o,r=!1){let i=Math.min(t,e),s=Math.max(t,e);for(let u=0,f=0;u<this.children.length;u++){let m=this.children[u],g=f+m.size;if(i>f&&s<g)return m.setSelection(t-f-m.border,e-f-m.border,o,r);f=g}let l=this.domFromPos(t,t?-1:1),a=e==t?l:this.domFromPos(e,e?-1:1),c=o.root.getSelection(),d=o.domSelectionRange(),h=!1;if(($t||wt)&&t==e){let{node:u,offset:f}=l;if(u.nodeType==3){if(h=!!(f&&u.nodeValue[f-1]==` 6`),h&&f==u.nodeValue.length)for(let m=u,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(l=a={node:g.parentNode,offset:st(g)+1});break}let w=m.pmViewDesc;if(w&&w.node&&w.node.isBlock)break}}else{let m=u.childNodes[f-1];h=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if($t&&d.focusNode&&d.focusNode!=a.node&&d.focusNode.nodeType==1){let u=d.focusNode.childNodes[d.focusOffset];u&&u.contentEditable=="false"&&(r=!0)}if(!(r||h&&wt)&&He(l.node,l.offset,d.anchorNode,d.anchorOffset)&&He(a.node,a.offset,d.focusNode,d.focusOffset))return;let p=!1;if((c.extend||t==e)&&!h){c.collapse(l.node,l.offset);try{t!=e&&c.extend(a.node,a.offset),p=!0}catch{}}if(!p){if(t>e){let f=l;l=a,a=f}let u=document.createRange();u.setEnd(a.node,a.offset),u.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(u)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,e){for(let o=0,r=0;r<this.children.length;r++){let i=this.children[r],s=o+i.size;if(o==s?t<=s&&e>=o:t<s&&e>o){let l=o+i.border,a=s-i.border;if(t>=l&&e<=a){this.dirty=t==o||e==s?Ee:Us,t==l&&e==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=qt:i.markDirty(t-l,e-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Ee:qt}o=s}this.dirty=Ee}markParentsDirty(){let t=1;for(let e=this.parent;e;e=e.parent,t++){let o=t==1?Ee:Us;e.dirty<o&&(e.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(t){return!1}}class Wa extends Kn{constructor(t,e,o,r){let i,s=e.type.toDOM;if(typeof s=="function"&&(s=s(o,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!e.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(t,[],s,null),this.widget=e,this.widget=e,i=this}matchesWidget(t){return this.dirty==Lt&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let e=this.widget.spec.stopEvent;return e?e(t):!1}ignoreMutation(t){return t.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}}class Oh extends Kn{constructor(t,e,o,r){super(t,[],e,null),this.textDOM=o,this.text=r}get size(){return this.text.length}localPosFromDOM(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class ze extends Kn{constructor(t,e,o,r,i){super(t,[],o,r),this.mark=e,this.spec=i}static create(t,e,o,r){let i=r.nodeViews[e.type.name],s=i&&i(e,r,o);return(!s||!s.dom)&&(s=Fe.renderSpec(document,e.type.spec.toDOM(e,o),null,e.attrs)),new ze(t,e,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&qt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=qt&&this.mark.eq(t)}markDirty(t,e){if(super.markDirty(t,e),this.dirty!=Lt){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=Lt}}slice(t,e,o){let r=ze.create(this.parent,this.mark,!0,o),i=this.children,s=this.size;e<s&&(i=pi(i,e,s,o)),t>0&&(i=pi(i,0,t,o));for(let l=0;l<i.length;l++)i[l].parent=r;return r.children=i,r}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class we extends Kn{constructor(t,e,o,r,i,s,l,a,c){super(t,[],i,s),this.node=e,this.outerDeco=o,this.innerDeco=r,this.nodeDOM=l}static create(t,e,o,r,i,s){let l=i.nodeViews[e.type.name],a,c=l&&l(e,i,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},o,r),d=c&&c.dom,h=c&&c.contentDOM;if(e.isText){if(!d)d=document.createTextNode(e.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:h}=Fe.renderSpec(document,e.type.spec.toDOM(e),null,e.attrs));!h&&!e.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),e.type.spec.draggable&&(d.draggable=!0));let p=d;return d=Ua(d,o,e),c?a=new Th(t,e,o,r,d,h||null,p,c,i,s+1):e.isText?new ur(t,e,o,r,d,p,i):new we(t,e,o,r,d,h||null,p,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let e=this.children.length-1;e>=0;e--){let o=this.children[e];if(this.dom.contains(o.dom.parentNode)){t.contentElement=o.dom.parentNode;break}}t.contentElement||(t.getContent=()=>v.empty)}return t}matchesNode(t,e,o){return this.dirty==Lt&&t.eq(this.node)&&So(e,this.outerDeco)&&o.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,e){let o=this.node.inlineContent,r=e,i=t.composing?this.localCompositionInfo(t,e):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new Dh(this,s&&s.node,t);Ih(this.node,this.innerDeco,(c,d,h)=>{c.spec.marks?a.syncToMarks(c.spec.marks,o,t):c.type.side>=0&&!h&&a.syncToMarks(d==this.node.childCount?V.none:this.node.child(d).marks,o,t),a.placeWidget(c,t,r)},(c,d,h,p)=>{a.syncToMarks(c.marks,o,t);let u;a.findNodeMatch(c,d,h,p)||l&&t.state.selection.from>r&&t.state.selection.to<r+c.nodeSize&&(u=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(c,d,h,u,t)||a.updateNextNode(c,d,h,t,p,r)||a.addNode(c,d,h,t,r),r+=c.nodeSize}),a.syncToMarks([],o,t),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Ee)&&(s&&this.protectLocalComposition(t,s),Ka(this.contentDOM,this.children,t),nn&&Ph(this.dom))}localCompositionInfo(t,e){let{from:o,to:r}=t.state.selection;if(!(t.state.selection instanceof E)||o<e||r>e+this.node.content.size)return null;let i=t.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=$h(this.node.content,s,o-e,r-e);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(t,{node:e,pos:o,text:r}){if(this.getDesc(e))return;let i=e;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 Oh(this,i,e,r);t.input.compositionNodes.push(s),this.children=pi(this.children,o,o+r.length,t,s)}update(t,e,o,r){return this.dirty==qt||!t.sameMarkup(this.node)?!1:(this.updateInner(t,e,o,r),!0)}updateInner(t,e,o,r){this.updateOuterDeco(e),this.node=t,this.innerDeco=o,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=Lt}updateOuterDeco(t){if(So(t,this.outerDeco))return;let e=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=Ja(this.dom,this.nodeDOM,hi(this.outerDeco,this.node,e),hi(t,this.node,e)),this.dom!=o&&(o.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}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 Zs(n,t,e,o,r){Ua(o,t,n);let i=new we(void 0,n,t,e,o,o,o,r,0);return i.contentDOM&&i.updateChildren(r,0),i}class ur extends we{constructor(t,e,o,r,i,s,l){super(t,e,o,r,i,null,s,l,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,e,o,r){return this.dirty==qt||this.dirty!=Lt&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(e),(this.dirty!=Lt||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=t,this.dirty=Lt,!0)}inParent(){let t=this.parent.contentDOM;for(let e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,e,o){return t==this.nodeDOM?this.posAtStart+Math.min(e,this.node.text.length):super.localPosFromDOM(t,e,o)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,e,o){let r=this.node.cut(t,e),i=document.createTextNode(r.text);return new ur(this.parent,r,this.outerDeco,this.innerDeco,i,i,o)}markDirty(t,e){super.markDirty(t,e),this.dom!=this.nodeDOM&&(t==0||e==this.nodeDOM.nodeValue.length)&&(this.dirty=qt)}get domAtom(){return!1}isText(t){return this.node.text==t}}class qa extends Kn{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==Lt&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Th extends we{constructor(t,e,o,r,i,s,l,a,c,d){super(t,e,o,r,i,s,l,c,d),this.spec=a}update(t,e,o,r){if(this.dirty==qt)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let i=this.spec.update(t,e,o);return i&&this.updateInner(t,e,o,r),i}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,e,o,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,e,o,r){this.spec.setSelection?this.spec.setSelection(t,e,o.root):super.setSelection(t,e,o,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function Ka(n,t,e){let o=n.firstChild,r=!1;for(let i=0;i<t.length;i++){let s=t[i],l=s.dom;if(l.parentNode==n){for(;l!=o;)o=_s(o),r=!0;o=o.nextSibling}else r=!0,n.insertBefore(l,o);if(s instanceof ze){let a=o?o.previousSibling:n.lastChild;Ka(s.contentDOM,s.children,e),o=a?a.nextSibling:n.firstChild}}for(;o;)o=_s(o),r=!0;r&&e.trackWrites==n&&(e.trackWrites=null)}const kn=function(n){n&&(this.nodeName=n)};kn.prototype=Object.create(null);const Oe=[new kn];function hi(n,t,e){if(n.length==0)return Oe;let o=e?Oe[0]:new kn,r=[o];for(let i=0;i<n.length;i++){let s=n[i].type.attrs;if(s){s.nodeName&&r.push(o=new kn(s.nodeName));for(let l in s){let a=s[l];a!=null&&(e&&r.length==1&&r.push(o=new kn(t.isInline?"span":"div")),l=="class"?o.class=(o.class?o.class+" ":"")+a:l=="style"?o.style=(o.style?o.style+";":"")+a:l!="nodeName"&&(o[l]=a))}}}return r}function Ja(n,t,e,o){if(e==Oe&&o==Oe)return t;let r=t;for(let i=0;i<o.length;i++){let s=o[i],l=e[i];if(i){let a;l&&l.nodeName==s.nodeName&&r!=n&&(a=r.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(r),l=Oe[0]),r=a}Nh(r,l||Oe[0],s)}return r}function Nh(n,t,e){for(let o in t)o!="class"&&o!="style"&&o!="nodeName"&&!(o in e)&&n.removeAttribute(o);for(let o in e)o!="class"&&o!="style"&&o!="nodeName"&&e[o]!=t[o]&&n.setAttribute(o,e[o]);if(t.class!=e.class){let o=t.class?t.class.split(" ").filter(Boolean):[],r=e.class?e.class.split(" ").filter(Boolean):[];for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&n.classList.remove(o[i]);for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&n.classList.add(r[i]);n.classList.length==0&&n.removeAttribute("class")}if(t.style!=e.style){if(t.style){let o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=o.exec(t.style);)n.style.removeProperty(r[1])}e.style&&(n.style.cssText+=e.style)}}function Ua(n,t,e){return Ja(n,n,Oe,hi(t,e,n.nodeType!=1))}function So(n,t){if(n.length!=t.length)return!1;for(let e=0;e<n.length;e++)if(!n[e].type.eq(t[e].type))return!1;return!0}function _s(n){let t=n.nextSibling;return n.parentNode.removeChild(n),t}class Dh{constructor(t,e,o){this.lock=e,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=Rh(t.node.content,t)}destroyBetween(t,e){if(t!=e){for(let o=t;o<e;o++)this.top.children[o].destroy();this.top.children.splice(t,e-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,e,o){let r=0,i=this.stack.length>>1,s=Math.min(i,t.length);for(;r<s&&(r==i-1?this.top:this.stack[r+1<<1]).matchesMark(t[r])&&t[r].type.spec.spanning!==!1;)r++;for(;r<i;)this.destroyRest(),this.top.dirty=Lt,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<t.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let c=this.top.children[a];if(c.matchesMark(t[i])&&!this.isLocked(c.dom)){l=a;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=ze.create(this.top,t[i],e,o);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,i++}}findNodeMatch(t,e,o,r){let i=-1,s;if(r>=this.preMatch.index&&(s=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&s.matchesNode(t,e,o))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(t,e,o)&&!this.preMatch.matched.has(c)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(t,e,o,r,i){let s=this.top.children[r];return s.dirty==qt&&s.dom==s.contentDOM&&(s.dirty=Ee),s.update(t,e,o,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(t){for(;;){let e=t.parentNode;if(!e)return-1;if(e==this.top.contentDOM){let o=t.pmViewDesc;if(o){for(let r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==o)return r}return-1}t=e}}updateNextNode(t,e,o,r,i,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof we){let c=this.preMatch.matched.get(a);if(c!=null&&c!=i)return!1;let d=a.dom,h,p=this.isLocked(d)&&!(t.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==t.text&&a.dirty!=qt&&So(e,a.outerDeco));if(!p&&a.update(t,e,o,r))return this.destroyBetween(this.index,l),a.dom!=d&&(this.changed=!0),this.index++,!0;if(!p&&(h=this.recreateWrapper(a,t,e,o,r,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=h,h.contentDOM&&(h.dirty=Ee,h.updateChildren(r,s+1),h.dirty=Lt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,e,o,r,i,s){if(t.dirty||e.isAtom||!t.children.length||!t.node.content.eq(e.content)||!So(o,t.outerDeco)||!r.eq(t.innerDeco))return null;let l=we.create(this.top,e,o,r,i,s);if(l.contentDOM){l.children=t.children,t.children=[];for(let a of l.children)a.parent=l}return t.destroy(),l}addNode(t,e,o,r,i){let s=we.create(this.top,t,e,o,r,i);s.contentDOM&&s.updateChildren(r,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(t,e,o){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(t)&&(t==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let i=new Wa(this.top,t,e,o);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let t=this.top.children[this.index-1],e=this.top;for(;t instanceof ze;)e=t,t=e.children[e.children.length-1];(!t||!(t instanceof ur)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((wt||pt)&&t&&t.dom.contentEditable=="false"&&this.addHackNode("IMG",e),this.addHackNode("BR",this.top))}addHackNode(t,e){if(e==this.top&&this.index<e.children.length&&e.children[this.index].matchesHack(t))this.index++;else{let o=document.createElement(t);t=="IMG"&&(o.className="ProseMirror-separator",o.alt=""),t=="BR"&&(o.className="ProseMirror-trailingBreak");let r=new qa(this.top,[],o,null);e!=this.top?e.children.push(r):e.children.splice(this.index++,0,r),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||t.nodeType==1&&t.contains(this.lock.parentNode))}}function Rh(n,t){let e=t,o=e.children.length,r=n.childCount,i=new Map,s=[];t:for(;r>0;){let l;for(;;)if(o){let c=e.children[o-1];if(c instanceof ze)e=c,o=c.children.length;else{l=c,o--;break}}else{if(e==t)break t;o=e.parent.children.indexOf(e),e=e.parent}let a=l.node;if(a){if(a!=n.child(r-1))break;--r,i.set(l,r),s.push(l)}}return{index:r,matched:i,matches:s.reverse()}}function Lh(n,t){return n.type.side-t.type.side}function Ih(n,t,e,o){let r=t.locals(n),i=0;if(r.length==0){for(let c=0;c<n.childCount;c++){let d=n.child(c);o(d,r,t.forChild(i,d),c),i+=d.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let d,h;for(;s<r.length&&r[s].to==i;){let g=r[s++];g.widget&&(d?(h||(h=[d])).push(g):d=g)}if(d)if(h){h.sort(Lh);for(let g=0;g<h.length;g++)e(h[g],c,!!a)}else e(d,c,!!a);let p,u;if(a)u=-1,p=a,a=null;else if(c<n.childCount)u=c,p=n.child(c++);else break;for(let g=0;g<l.length;g++)l[g].to<=i&&l.splice(g--,1);for(;s<r.length&&r[s].from<=i&&r[s].to>i;)l.push(r[s++]);let f=i+p.nodeSize;if(p.isText){let g=f;s<r.length&&r[s].from<g&&(g=r[s].from);for(let w=0;w<l.length;w++)l[w].to<g&&(g=l[w].to);g<f&&(a=p.cut(g-i),p=p.cut(0,g-i),f=g,u=-1)}else for(;s<r.length&&r[s].to<f;)s++;let m=p.isInline&&!p.isLeaf?l.filter(g=>!g.inline):l.slice();o(p,m,t.forChild(i,p),u),i=f}}function Ph(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let t=n.style.cssText;n.style.cssText=t+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=t}}function $h(n,t,e,o){for(let r=0,i=0;r<n.childCount&&i<=o;){let s=n.child(r++),l=i;if(i+=s.nodeSize,!s.isText)continue;let a=s.text;for(;r<n.childCount;){let c=n.child(r++);if(i+=c.nodeSize,!c.isText)break;a+=c.text}if(i>=e){if(i>=o&&a.slice(o-t.length-l,o-l)==t)return o-t.length;let c=l<o?a.lastIndexOf(t,o-l-1):-1;if(c>=0&&c+t.length+l>=e)return l+c;if(e==o&&a.length>=o+t.length-l&&a.slice(o-l,o-l+t.length)==t)return o}}return-1}function pi(n,t,e,o,r){let i=[];for(let s=0,l=0;s<n.length;s++){let a=n[s],c=l,d=l+=a.size;c>=e||d<=t?i.push(a):(c<t&&i.push(a.slice(0,t-c,o)),r&&(i.push(r),r=void 0),d>e&&i.push(a.slice(e-c,a.size,o)))}return i}function qi(n,t=null){let e=n.domSelectionRange(),o=n.state.doc;if(!e.focusNode)return null;let r=n.docView.nearestDesc(e.focusNode),i=r&&r.size==0,s=n.docView.posFromDOM(e.focusNode,e.focusOffset,1);if(s<0)return null;let l=o.resolve(s),a,c;if(pr(e)){for(a=s;r&&!r.node;)r=r.parent;let h=r.node;if(r&&h.isAtom&&A.isSelectable(h)&&r.parent&&!(h.isInline&&ah(e.focusNode,e.focusOffset,r.dom))){let p=r.posBefore;c=new A(s==p?l:o.resolve(p))}}else{if(e instanceof n.dom.ownerDocument.defaultView.Selection&&e.rangeCount>1){let h=s,p=s;for(let u=0;u<e.rangeCount;u++){let f=e.getRangeAt(u);h=Math.min(h,n.docView.posFromDOM(f.startContainer,f.startOffset,1)),p=Math.max(p,n.docView.posFromDOM(f.endContainer,f.endOffset,-1))}if(h<0)return null;[a,s]=p==n.state.selection.anchor?[p,h]:[h,p],l=o.resolve(s)}else a=n.docView.posFromDOM(e.anchorNode,e.anchorOffset,1);if(a<0)return null}let d=o.resolve(a);if(!c){let h=t=="pointer"||n.state.selection.head<l.pos&&!i?1:-1;c=Ki(n,d,l,h)}return c}function Za(n){return n.editable?n.hasFocus():Ga(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function ee(n,t=!1){let e=n.state.selection;if(_a(n,e),!!Za(n)){if(!t&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&pt){let o=n.domSelectionRange(),r=n.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&He(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)zh(n);else{let{anchor:o,head:r}=e,i,s;Gs&&!(e instanceof E)&&(e.$from.parent.inlineContent||(i=Xs(n,e.from)),!e.empty&&!e.$from.parent.inlineContent&&(s=Xs(n,e.to))),n.docView.setSelection(o,r,n,t),Gs&&(i&&Qs(i),s&&Qs(s)),e.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Hh(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Gs=wt||pt&&$a<63;function Xs(n,t){let{node:e,offset:o}=n.docView.domFromPos(t,0),r=o<e.childNodes.length?e.childNodes[o]:null,i=o?e.childNodes[o-1]:null;if(wt&&r&&r.contentEditable=="false")return Ir(r);if((!r||r.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(r)return Ir(r);if(i)return Ir(i)}}function Ir(n){return n.contentEditable="true",wt&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Qs(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Hh(n){let t=n.dom.ownerDocument;t.removeEventListener("selectionchange",n.input.hideSelectionGuard);let e=n.domSelectionRange(),o=e.anchorNode,r=e.anchorOffset;t.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(e.anchorNode!=o||e.anchorOffset!=r)&&(t.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Za(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function zh(n){let t=n.domSelection(),e=document.createRange();if(!t)return;let o=n.cursorWrapper.dom,r=o.nodeName=="IMG";r?e.setStart(o.parentNode,st(o)+1):e.setStart(o,0),e.collapse(!0),t.removeAllRanges(),t.addRange(e),!r&&!n.state.selection.visible&&xt&&ye<=11&&(o.disabled=!0,o.disabled=!1)}function _a(n,t){if(t instanceof A){let e=n.docView.descAt(t.from);e!=n.lastSelectedViewDesc&&(Ys(n),e&&e.selectNode(),n.lastSelectedViewDesc=e)}else Ys(n)}function Ys(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Ki(n,t,e,o){return n.someProp("createSelectionBetween",r=>r(n,t,e))||E.between(t,e,o)}function tl(n){return n.editable&&!n.hasFocus()?!1:Ga(n)}function Ga(n){let t=n.domSelectionRange();if(!t.anchorNode)return!1;try{return n.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(n.editable||n.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function Bh(n){let t=n.docView.domFromPos(n.state.selection.anchor,0),e=n.domSelectionRange();return He(t.node,t.offset,e.anchorNode,e.anchorOffset)}function ui(n,t){let{$anchor:e,$head:o}=n.selection,r=t>0?e.max(o):e.min(o),i=r.parent.inlineContent?r.depth?n.doc.resolve(t>0?r.after():r.before()):null:r;return i&&N.findFrom(i,t)}function le(n,t){return n.dispatch(n.state.tr.setSelection(t).scrollIntoView()),!0}function el(n,t,e){let o=n.state.selection;if(o instanceof E)if(e.indexOf("s")>-1){let{$head:r}=o,i=r.textOffset?null:t<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=n.state.doc.resolve(r.pos+i.nodeSize*(t<0?-1:1));return le(n,new E(o.$anchor,s))}else if(o.empty){if(n.endOfTextblock(t>0?"forward":"backward")){let r=ui(n.state,t);return r&&r instanceof A?le(n,r):!1}else if(!(Nt&&e.indexOf("m")>-1)){let r=o.$head,i=r.textOffset?null:t<0?r.nodeBefore:r.nodeAfter,s;if(!i||i.isText)return!1;let l=t<0?r.pos-i.nodeSize:r.pos;return i.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?A.isSelectable(i)?le(n,new A(t<0?n.state.doc.resolve(r.pos-i.nodeSize):r)):qn?le(n,new E(n.state.doc.resolve(t<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(o instanceof A&&o.node.isInline)return le(n,new E(t>0?o.$to:o.$from));{let r=ui(n.state,t);return r?le(n,r):!1}}}function Ao(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function xn(n,t){let e=n.pmViewDesc;return e&&e.size==0&&(t<0||n.nextSibling||n.nodeName!="BR")}function We(n,t){return t<0?Vh(n):Fh(n)}function Vh(n){let t=n.domSelectionRange(),e=t.focusNode,o=t.focusOffset;if(!e)return;let r,i,s=!1;for($t&&e.nodeType==1&&o<Ao(e)&&xn(e.childNodes[o],-1)&&(s=!0);;)if(o>0){if(e.nodeType!=1)break;{let l=e.childNodes[o-1];if(xn(l,-1))r=e,i=--o;else if(l.nodeType==3)e=l,o=e.nodeValue.length;else break}}else{if(Xa(e))break;{let l=e.previousSibling;for(;l&&xn(l,-1);)r=e.parentNode,i=st(l),l=l.previousSibling;if(l)e=l,o=Ao(e);else{if(e=e.parentNode,e==n.dom)break;o=0}}}s?fi(n,e,o):r&&fi(n,r,i)}function Fh(n){let t=n.domSelectionRange(),e=t.focusNode,o=t.focusOffset;if(!e)return;let r=Ao(e),i,s;for(;;)if(o<r){if(e.nodeType!=1)break;let l=e.childNodes[o];if(xn(l,1))i=e,s=++o;else break}else{if(Xa(e))break;{let l=e.nextSibling;for(;l&&xn(l,1);)i=l.parentNode,s=st(l)+1,l=l.nextSibling;if(l)e=l,o=0,r=Ao(e);else{if(e=e.parentNode,e==n.dom)break;o=r=0}}}i&&fi(n,i,s)}function Xa(n){let t=n.pmViewDesc;return t&&t.node&&t.node.isBlock}function jh(n,t){for(;n&&t==n.childNodes.length&&!Wn(n);)t=st(n)+1,n=n.parentNode;for(;n&&t<n.childNodes.length;){let e=n.childNodes[t];if(e.nodeType==3)return e;if(e.nodeType==1&&e.contentEditable=="false")break;n=e,t=0}}function Wh(n,t){for(;n&&!t&&!Wn(n);)t=st(n),n=n.parentNode;for(;n&&t;){let e=n.childNodes[t-1];if(e.nodeType==3)return e;if(e.nodeType==1&&e.contentEditable=="false")break;n=e,t=n.childNodes.length}}function fi(n,t,e){if(t.nodeType!=3){let i,s;(s=jh(t,e))?(t=s,e=0):(i=Wh(t,e))&&(t=i,e=i.nodeValue.length)}let o=n.domSelection();if(!o)return;if(pr(o)){let i=document.createRange();i.setEnd(t,e),i.setStart(t,e),o.removeAllRanges(),o.addRange(i)}else o.extend&&o.extend(t,e);n.domObserver.setCurSelection();let{state:r}=n;setTimeout(()=>{n.state==r&&ee(n)},50)}function nl(n,t){let e=n.state.doc.resolve(t);if(!(pt||hh)&&e.parent.inlineContent){let o=n.coordsAtPos(t);if(t>e.start()){let r=n.coordsAtPos(t-1),i=(r.top+r.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(r.left-o.left)>1)return r.left<o.left?"ltr":"rtl"}if(t<e.end()){let r=n.coordsAtPos(t+1),i=(r.top+r.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(r.left-o.left)>1)return r.left>o.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function ol(n,t,e){let o=n.state.selection;if(o instanceof E&&!o.empty||e.indexOf("s")>-1||Nt&&e.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||n.endOfTextblock(t<0?"up":"down")){let s=ui(n.state,t);if(s&&s instanceof A)return le(n,s)}if(!r.parent.inlineContent){let s=t<0?r:i,l=o instanceof Rt?N.near(s,t):N.findFrom(s,t);return l?le(n,l):!1}return!1}function rl(n,t){if(!(n.state.selection instanceof E))return!0;let{$head:e,$anchor:o,empty:r}=n.state.selection;if(!e.sameParent(o))return!0;if(!r)return!1;if(n.endOfTextblock(t>0?"forward":"backward"))return!0;let i=!e.textOffset&&(t<0?e.nodeBefore:e.nodeAfter);if(i&&!i.isText){let s=n.state.tr;return t<0?s.delete(e.pos-i.nodeSize,e.pos):s.delete(e.pos,e.pos+i.nodeSize),n.dispatch(s),!0}return!1}function il(n,t,e){n.domObserver.stop(),t.contentEditable=e,n.domObserver.start()}function qh(n){if(!wt||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:e}=n.domSelectionRange();if(t&&t.nodeType==1&&e==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let o=t.firstChild;il(n,o,"true"),setTimeout(()=>il(n,o,"false"),20)}return!1}function Kh(n){let t="";return n.ctrlKey&&(t+="c"),n.metaKey&&(t+="m"),n.altKey&&(t+="a"),n.shiftKey&&(t+="s"),t}function Jh(n,t){let e=t.keyCode,o=Kh(t);if(e==8||Nt&&e==72&&o=="c")return rl(n,-1)||We(n,-1);if(e==46&&!t.shiftKey||Nt&&e==68&&o=="c")return rl(n,1)||We(n,1);if(e==13||e==27)return!0;if(e==37||Nt&&e==66&&o=="c"){let r=e==37?nl(n,n.state.selection.from)=="ltr"?-1:1:-1;return el(n,r,o)||We(n,r)}else if(e==39||Nt&&e==70&&o=="c"){let r=e==39?nl(n,n.state.selection.from)=="ltr"?1:-1:1;return el(n,r,o)||We(n,r)}else{if(e==38||Nt&&e==80&&o=="c")return ol(n,-1,o)||We(n,-1);if(e==40||Nt&&e==78&&o=="c")return qh(n)||ol(n,1,o)||We(n,1);if(o==(Nt?"m":"c")&&(e==66||e==73||e==89||e==90))return!0}return!1}function Ji(n,t){n.someProp("transformCopied",u=>{t=u(t,n)});let e=[],{content:o,openStart:r,openEnd:i}=t;for(;r>1&&i>1&&o.childCount==1&&o.firstChild.childCount==1;){r--,i--;let u=o.firstChild;e.push(u.type.name,u.attrs!=u.type.defaultAttrs?u.attrs:null),o=u.content}let s=n.someProp("clipboardSerializer")||Fe.fromSchema(n.state.schema),l=oc(),a=l.createElement("div");a.appendChild(s.serializeFragment(o,{document:l}));let c=a.firstChild,d,h=0;for(;c&&c.nodeType==1&&(d=nc[c.nodeName.toLowerCase()]);){for(let u=d.length-1;u>=0;u--){let f=l.createElement(d[u]);for(;a.firstChild;)f.appendChild(a.firstChild);a.appendChild(f),h++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${r} ${i}${h?` -${h}`:""} ${JSON.stringify(e)}`);let p=n.someProp("clipboardTextSerializer",u=>u(t,n))||t.content.textBetween(0,t.content.size,` 7 8`);return{dom:a,text:p,slice:t}}function Qa(n,t,e,o,r){let i=r.parent.type.spec.code,s,l;if(!e&&!t)return null;let a=t&&(o||i||!e);if(a){if(n.someProp("transformPastedText",p=>{t=p(t,i||o,n)}),i)return t?new k(v.from(n.state.schema.text(t.replace(/\r\n?/g,` 9`))),0,0):k.empty;let h=n.someProp("clipboardTextParser",p=>p(t,r,o,n));if(h)l=h;else{let p=r.marks(),{schema:u}=n.state,f=Fe.fromSchema(u);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=s.appendChild(document.createElement("p"));m&&g.appendChild(f.serializeNode(u.text(m,p)))})}}else n.someProp("transformPastedHTML",h=>{e=h(e,n)}),s=Gh(e),qn&&Xh(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 h=+d[3];h>0;h--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||bn.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||d),context:r,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!Uh.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)l=Qh(sl(l,+d[1],+d[2]),d[4]);else if(l=k.maxOpen(Zh(l.content,r),!0),l.openStart||l.openEnd){let h=0,p=0;for(let u=l.content.firstChild;h<l.openStart&&!u.type.spec.isolating;h++,u=u.firstChild);for(let u=l.content.lastChild;p<l.openEnd&&!u.type.spec.isolating;p++,u=u.lastChild);l=sl(l,h,p)}return n.someProp("transformPasted",h=>{l=h(l,n)}),l}const Uh=/^(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 Zh(n,t){if(n.childCount<2)return n;for(let e=t.depth;e>=0;e--){let o=t.node(e).contentMatchAt(t.index(e)),r,i=[];if(n.forEach(s=>{if(!i)return;let l=o.findWrapping(s.type),a;if(!l)return i=null;if(a=i.length&&r.length&&tc(l,r,s,i[i.length-1],0))i[i.length-1]=a;else{i.length&&(i[i.length-1]=ec(i[i.length-1],r.length));let c=Ya(s,l);i.push(c),o=o.matchType(c.type),r=l}}),i)return v.from(i)}return n}function Ya(n,t,e=0){for(let o=t.length-1;o>=e;o--)n=t[o].create(null,v.from(n));return n}function tc(n,t,e,o,r){if(r<n.length&&r<t.length&&n[r]==t[r]){let i=tc(n,t,e,o.lastChild,r+1);if(i)return o.copy(o.content.replaceChild(o.childCount-1,i));if(o.contentMatchAt(o.childCount).matchType(r==n.length-1?e.type:n[r+1]))return o.copy(o.content.append(v.from(Ya(e,n,r+1))))}}function ec(n,t){if(t==0)return n;let e=n.content.replaceChild(n.childCount-1,ec(n.lastChild,t-1)),o=n.contentMatchAt(n.childCount).fillBefore(v.empty,!0);return n.copy(e.append(o))}function mi(n,t,e,o,r,i){let s=t<0?n.firstChild:n.lastChild,l=s.content;return n.childCount>1&&(i=0),r<o-1&&(l=mi(l,t,e,o,r+1,i)),r>=e&&(l=t<0?s.contentMatchAt(0).fillBefore(l,i<=r).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(v.empty,!0))),n.replaceChild(t<0?0:n.childCount-1,s.copy(l))}function sl(n,t,e){return t<n.openStart&&(n=new k(mi(n.content,-1,t,n.openStart,0,n.openEnd),t,n.openEnd)),e<n.openEnd&&(n=new k(mi(n.content,1,e,n.openEnd,0,0),n.openStart,e)),n}const nc={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let ll=null;function oc(){return ll||(ll=document.implementation.createHTMLDocument("title"))}let Pr=null;function _h(n){let t=window.trustedTypes;return t?(Pr||(Pr=t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})),Pr.createHTML(n)):n}function Gh(n){let t=/^(\s*<meta [^>]*>)*/.exec(n);t&&(n=n.slice(t[0].length));let e=oc().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(n),r;if((r=o&&nc[o[1].toLowerCase()])&&(n=r.map(i=>"<"+i+">").join("")+n+r.map(i=>"</"+i+">").reverse().join("")),e.innerHTML=_h(n),r)for(let i=0;i<r.length;i++)e=e.querySelector(r[i])||e;return e}function Xh(n){let t=n.querySelectorAll(pt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let e=0;e<t.length;e++){let o=t[e];o.childNodes.length==1&&o.textContent=="Â "&&o.parentNode&&o.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),o)}}function Qh(n,t){if(!n.size)return n;let e=n.content.firstChild.type.schema,o;try{o=JSON.parse(t)}catch{return n}let{content:r,openStart:i,openEnd:s}=n;for(let l=o.length-2;l>=0;l-=2){let a=e.nodes[o[l]];if(!a||a.hasRequiredAttrs())break;r=v.from(a.create(o[l+1],r)),i++,s++}return new k(r,i,s)}const vt={},bt={},Yh={touchstart:!0,touchmove:!0};class tp{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 ep(n){for(let t in vt){let e=vt[t];n.dom.addEventListener(t,n.input.eventHandlers[t]=o=>{op(n,o)&&!Ui(n,o)&&(n.editable||!(o.type in bt))&&e(n,o)},Yh[t]?{passive:!0}:void 0)}wt&&n.dom.addEventListener("input",()=>null),gi(n)}function me(n,t){n.input.lastSelectionOrigin=t,n.input.lastSelectionTime=Date.now()}function np(n){n.domObserver.stop();for(let t in n.input.eventHandlers)n.dom.removeEventListener(t,n.input.eventHandlers[t]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function gi(n){n.someProp("handleDOMEvents",t=>{for(let e in t)n.input.eventHandlers[e]||n.dom.addEventListener(e,n.input.eventHandlers[e]=o=>Ui(n,o))})}function Ui(n,t){return n.someProp("handleDOMEvents",e=>{let o=e[t.type];return o?o(n,t)||t.defaultPrevented:!1})}function op(n,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let e=t.target;e!=n.dom;e=e.parentNode)if(!e||e.nodeType==11||e.pmViewDesc&&e.pmViewDesc.stopEvent(t))return!1;return!0}function rp(n,t){!Ui(n,t)&&vt[t.type]&&(n.editable||!(t.type in bt))&&vt[t.type](n,t)}bt.keydown=(n,t)=>{let e=t;if(n.input.shiftKey=e.keyCode==16||e.shiftKey,!ic(n,e)&&(n.input.lastKeyCode=e.keyCode,n.input.lastKeyCodeTime=Date.now(),!(te&&pt&&e.keyCode==13)))if(e.keyCode!=229&&n.domObserver.forceFlush(),nn&&e.keyCode==13&&!e.ctrlKey&&!e.altKey&&!e.metaKey){let o=Date.now();n.input.lastIOSEnter=o,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==o&&(n.someProp("handleKeyDown",r=>r(n,Se(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",o=>o(n,e))||Jh(n,e)?e.preventDefault():me(n,"key")};bt.keyup=(n,t)=>{t.keyCode==16&&(n.input.shiftKey=!1)};bt.keypress=(n,t)=>{let e=t;if(ic(n,e)||!e.charCode||e.ctrlKey&&!e.altKey||Nt&&e.metaKey)return;if(n.someProp("handleKeyPress",r=>r(n,e))){e.preventDefault();return}let o=n.state.selection;if(!(o instanceof E)||!o.$from.sameParent(o.$to)){let r=String.fromCharCode(e.charCode);!/[\r\n]/.test(r)&&!n.someProp("handleTextInput",i=>i(n,o.$from.pos,o.$to.pos,r))&&n.dispatch(n.state.tr.insertText(r).scrollIntoView()),e.preventDefault()}};function fr(n){return{left:n.clientX,top:n.clientY}}function ip(n,t){let e=t.x-n.clientX,o=t.y-n.clientY;return e*e+o*o<100}function Zi(n,t,e,o,r){if(o==-1)return!1;let i=n.state.doc.resolve(o);for(let s=i.depth+1;s>0;s--)if(n.someProp(t,l=>s>i.depth?l(n,e,i.nodeAfter,i.before(s),r,!0):l(n,e,i.node(s),i.before(s),r,!1)))return!0;return!1}function Qe(n,t,e){if(n.focused||n.focus(),n.state.selection.eq(t))return;let o=n.state.tr.setSelection(t);o.setMeta("pointer",!0),n.dispatch(o)}function sp(n,t){if(t==-1)return!1;let e=n.state.doc.resolve(t),o=e.nodeAfter;return o&&o.isAtom&&A.isSelectable(o)?(Qe(n,new A(e)),!0):!1}function lp(n,t){if(t==-1)return!1;let e=n.state.selection,o,r;e instanceof A&&(o=e.node);let i=n.state.doc.resolve(t);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(A.isSelectable(l)){o&&e.$from.depth>0&&s>=e.$from.depth&&i.before(e.$from.depth+1)==e.$from.pos?r=i.before(e.$from.depth):r=i.before(s);break}}return r!=null?(Qe(n,A.create(n.state.doc,r)),!0):!1}function ap(n,t,e,o,r){return Zi(n,"handleClickOn",t,e,o)||n.someProp("handleClick",i=>i(n,t,o))||(r?lp(n,e):sp(n,e))}function cp(n,t,e,o){return Zi(n,"handleDoubleClickOn",t,e,o)||n.someProp("handleDoubleClick",r=>r(n,t,o))}function dp(n,t,e,o){return Zi(n,"handleTripleClickOn",t,e,o)||n.someProp("handleTripleClick",r=>r(n,t,o))||hp(n,e,o)}function hp(n,t,e){if(e.button!=0)return!1;let o=n.state.doc;if(t==-1)return o.inlineContent?(Qe(n,E.create(o,0,o.content.size)),!0):!1;let r=o.resolve(t);for(let i=r.depth+1;i>0;i--){let s=i>r.depth?r.nodeAfter:r.node(i),l=r.before(i);if(s.inlineContent)Qe(n,E.create(o,l+1,l+1+s.content.size));else if(A.isSelectable(s))Qe(n,A.create(o,l));else continue;return!0}}function _i(n){return Eo(n)}const rc=Nt?"metaKey":"ctrlKey";vt.mousedown=(n,t)=>{let e=t;n.input.shiftKey=e.shiftKey;let o=_i(n),r=Date.now(),i="singleClick";r-n.input.lastClick.time<500&&ip(e,n.input.lastClick)&&!e[rc]&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:r,x:e.clientX,y:e.clientY,type:i};let s=n.posAtCoords(fr(e));s&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new pp(n,s,e,!!o)):(i=="doubleClick"?cp:dp)(n,s.pos,s.inside,e)?e.preventDefault():me(n,"pointer"))};class pp{constructor(t,e,o,r){this.view=t,this.pos=e,this.event=o,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!o[rc],this.allowDefault=o.shiftKey;let i,s;if(e.inside>-1)i=t.state.doc.nodeAt(e.inside),s=e.inside;else{let d=t.state.doc.resolve(e.pos);i=d.parent,s=d.depth?d.before():0}const l=r?null:o.target,a=l?t.docView.nearestDesc(l,!0):null;this.target=a&&a.dom.nodeType==1?a.dom:null;let{selection:c}=t.state;(o.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&&$t&&!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()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),me(t,"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(()=>ee(this.view)),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(fr(t))),this.updateAllowDefault(t),this.allowDefault||!e?me(this.view,"pointer"):ap(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||wt&&this.mightDrag&&!this.mightDrag.node.isAtom||pt&&!this.view.state.selection.visible&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(Qe(this.view,N.near(this.view.state.doc.resolve(e.pos))),t.preventDefault()):me(this.view,"pointer")}move(t){this.updateAllowDefault(t),me(this.view,"pointer"),t.buttons==0&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}vt.touchstart=n=>{n.input.lastTouch=Date.now(),_i(n),me(n,"pointer")};vt.touchmove=n=>{n.input.lastTouch=Date.now(),me(n,"pointer")};vt.contextmenu=n=>_i(n);function ic(n,t){return n.composing?!0:wt&&Math.abs(t.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const up=te?5e3:-1;bt.compositionstart=bt.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:t}=n,e=t.selection.$to;if(t.selection instanceof E&&(t.storedMarks||!e.textOffset&&e.parentOffset&&e.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||e.marks(),Eo(n,!0),n.markCursor=null;else if(Eo(n,!t.selection.empty),$t&&t.selection.empty&&e.parentOffset&&!e.textOffset&&e.nodeBefore.marks.length){let o=n.domSelectionRange();for(let r=o.focusNode,i=o.focusOffset;r&&r.nodeType==1&&i!=0;){let s=i<0?r.lastChild:r.childNodes[i-1];if(!s)break;if(s.nodeType==3){let l=n.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else r=s,i=-1}}n.input.composing=!0}sc(n,up)};bt.compositionend=(n,t)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=t.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++,sc(n,20))};function sc(n,t){clearTimeout(n.input.composingTimeout),t>-1&&(n.input.composingTimeout=setTimeout(()=>Eo(n),t))}function lc(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=mp());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function fp(n){let t=n.domSelectionRange();if(!t.focusNode)return null;let e=sh(t.focusNode,t.focusOffset),o=lh(t.focusNode,t.focusOffset);if(e&&o&&e!=o){let r=o.pmViewDesc,i=n.domObserver.lastChangedTextNode;if(e==i||o==i)return i;if(!r||!r.isText(o.nodeValue))return o;if(n.input.compositionNode==o){let s=e.pmViewDesc;if(!(!s||!s.isText(e.nodeValue)))return o}}return e||o}function mp(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Eo(n,t=!1){if(!(te&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),lc(n),t||n.docView&&n.docView.dirty){let e=qi(n);return e&&!e.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(e)):(n.markCursor||t)&&!n.state.selection.empty?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function gp(n,t){if(!n.dom.parentNode)return;let e=n.dom.parentNode.appendChild(document.createElement("div"));e.appendChild(t),e.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),r=document.createRange();r.selectNodeContents(t),n.dom.blur(),o.removeAllRanges(),o.addRange(r),setTimeout(()=>{e.parentNode&&e.parentNode.removeChild(e),n.focus()},50)}const In=xt&&ye<15||nn&&ph<604;vt.copy=bt.cut=(n,t)=>{let e=t,o=n.state.selection,r=e.type=="cut";if(o.empty)return;let i=In?null:e.clipboardData,s=o.content(),{dom:l,text:a}=Ji(n,s);i?(e.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):gp(n,l),r&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function yp(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function wp(n,t){if(!n.dom.parentNode)return;let e=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,o=n.dom.parentNode.appendChild(document.createElement(e?"textarea":"div"));e||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let r=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),o.parentNode&&o.parentNode.removeChild(o),e?Pn(n,o.value,null,r,t):Pn(n,o.textContent,o.innerHTML,r,t)},50)}function Pn(n,t,e,o,r){let i=Qa(n,t,e,o,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,r,i||k.empty)))return!0;if(!i)return!1;let s=yp(i),l=s?n.state.tr.replaceSelectionWith(s,o):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ac(n){let t=n.getData("text/plain")||n.getData("Text");if(t)return t;let e=n.getData("text/uri-list");return e?e.replace(/\r?\n/g," "):""}bt.paste=(n,t)=>{let e=t;if(n.composing&&!te)return;let o=In?null:e.clipboardData,r=n.input.shiftKey&&n.input.lastKeyCode!=45;o&&Pn(n,ac(o),o.getData("text/html"),r,e)?e.preventDefault():wp(n,e)};class cc{constructor(t,e,o){this.slice=t,this.move=e,this.node=o}}const vp=Nt?"altKey":"ctrlKey";function dc(n,t){return n.someProp("dragCopies",o=>!o(t))??!t[vp]}vt.dragstart=(n,t)=>{let e=t,o=n.input.mouseDown;if(o&&o.done(),!e.dataTransfer)return;let r=n.state.selection,i=r.empty?null:n.posAtCoords(fr(e)),s;if(!(i&&i.pos>=r.from&&i.pos<=(r instanceof A?r.to-1:r.to))){if(o&&o.mightDrag)s=A.create(n.state.doc,o.mightDrag.pos);else if(e.target&&e.target.nodeType==1){let h=n.docView.nearestDesc(e.target,!0);h&&h.node.type.spec.draggable&&h!=n.docView&&(s=A.create(n.state.doc,h.posBefore))}}let l=(s||n.state.selection).content(),{dom:a,text:c,slice:d}=Ji(n,l);(!e.dataTransfer.files.length||!pt||$a>120)&&e.dataTransfer.clearData(),e.dataTransfer.setData(In?"Text":"text/html",a.innerHTML),e.dataTransfer.effectAllowed="copyMove",In||e.dataTransfer.setData("text/plain",c),n.dragging=new cc(d,dc(n,e),s)};vt.dragend=n=>{let t=n.dragging;window.setTimeout(()=>{n.dragging==t&&(n.dragging=null)},50)};bt.dragover=bt.dragenter=(n,t)=>t.preventDefault();bt.drop=(n,t)=>{let e=t,o=n.dragging;if(n.dragging=null,!e.dataTransfer)return;let r=n.posAtCoords(fr(e));if(!r)return;let i=n.state.doc.resolve(r.pos),s=o&&o.slice;s?n.someProp("transformPasted",f=>{s=f(s,n)}):s=Qa(n,ac(e.dataTransfer),In?null:e.dataTransfer.getData("text/html"),!1,i);let l=!!(o&&dc(n,e));if(n.someProp("handleDrop",f=>f(n,e,s||k.empty,l))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?Ea(n.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let c=n.state.tr;if(l){let{node:f}=o;f?f.replace(c):c.deleteSelection()}let d=c.mapping.map(a),h=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,p=c.doc;if(h?c.replaceRangeWith(d,d,s.content.firstChild):c.replaceRange(d,d,s),c.doc.eq(p))return;let u=c.doc.resolve(d);if(h&&A.isSelectable(s.content.firstChild)&&u.nodeAfter&&u.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new A(u));else{let f=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,w,x)=>f=x),c.setSelection(Ki(n,u,c.doc.resolve(f)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};vt.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())&&ee(n)},20))};vt.blur=(n,t)=>{let e=t;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),e.relatedTarget&&n.dom.contains(e.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};vt.beforeinput=(n,t)=>{if(pt&&te&&t.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:e}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=e||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",r=>r(n,Se(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 bt)vt[n]=bt[n];function $n(n,t){if(n==t)return!0;for(let e in n)if(n[e]!==t[e])return!1;for(let e in t)if(!(e in n))return!1;return!0}class Oo{constructor(t,e){this.toDOM=t,this.spec=e||Le,this.side=this.spec.side||0}map(t,e,o,r){let{pos:i,deleted:s}=t.mapResult(e.from+r,this.side<0?-1:1);return s?null:new yt(i-o,i-o,this)}valid(){return!0}eq(t){return this==t||t instanceof Oo&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&$n(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class ve{constructor(t,e){this.attrs=t,this.spec=e||Le}map(t,e,o,r){let i=t.map(e.from+r,this.spec.inclusiveStart?-1:1)-o,s=t.map(e.to+r,this.spec.inclusiveEnd?1:-1)-o;return i>=s?null:new yt(i,s,this)}valid(t,e){return e.from<e.to}eq(t){return this==t||t instanceof ve&&$n(this.attrs,t.attrs)&&$n(this.spec,t.spec)}static is(t){return t.type instanceof ve}destroy(){}}class Gi{constructor(t,e){this.attrs=t,this.spec=e||Le}map(t,e,o,r){let i=t.mapResult(e.from+r,1);if(i.deleted)return null;let s=t.mapResult(e.to+r,-1);return s.deleted||s.pos<=i.pos?null:new yt(i.pos-o,s.pos-o,this)}valid(t,e){let{index:o,offset:r}=t.content.findIndex(e.from),i;return r==e.from&&!(i=t.child(o)).isText&&r+i.nodeSize==e.to}eq(t){return this==t||t instanceof Gi&&$n(this.attrs,t.attrs)&&$n(this.spec,t.spec)}destroy(){}}class yt{constructor(t,e,o){this.from=t,this.to=e,this.type=o}copy(t,e){return new yt(t,e,this.type)}eq(t,e=0){return this.type.eq(t.type)&&this.from+e==t.from&&this.to+e==t.to}map(t,e,o){return this.type.map(t,this,e,o)}static widget(t,e,o){return new yt(t,t,new Oo(e,o))}static inline(t,e,o,r){return new yt(t,e,new ve(o,r))}static node(t,e,o,r){return new yt(t,e,new Gi(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof ve}get widget(){return this.type instanceof Oo}}const Ke=[],Le={};class U{constructor(t,e){this.local=t.length?t:Ke,this.children=e.length?e:Ke}static create(t,e){return e.length?To(e,t,0,Le):ht}find(t,e,o){let r=[];return this.findInner(t??0,e??1e9,r,0,o),r}findInner(t,e,o,r,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=e&&l.to>=t&&(!i||i(l.spec))&&o.push(l.copy(l.from+r,l.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<e&&this.children[s+1]>t){let l=this.children[s]+1;this.children[s+2].findInner(t-l,e-l,o,r+l,i)}}map(t,e,o){return this==ht||t.maps.length==0?this:this.mapInner(t,e,0,0,o||Le)}mapInner(t,e,o,r,i){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(t,o,r);a&&a.type.valid(e,a)?(s||(s=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?bp(this.children,s||[],t,e,o,r,i):s?new U(s.sort(Ie),Ke):ht}add(t,e){return e.length?this==ht?U.create(t,e):this.addInner(t,e,0):this}addInner(t,e,o){let r,i=0;t.forEach((l,a)=>{let c=a+o,d;if(d=pc(e,l,c)){for(r||(r=this.children.slice());i<r.length&&r[i]<a;)i+=3;r[i]==a?r[i+2]=r[i+2].addInner(l,d,c+1):r.splice(i,0,a,a+l.nodeSize,To(d,l,c+1,Le)),i+=3}});let s=hc(i?uc(e):e,-o);for(let l=0;l<s.length;l++)s[l].type.valid(t,s[l])||s.splice(l--,1);return new U(s.length?this.local.concat(s).sort(Ie):this.local,r||this.children)}remove(t){return t.length==0||this==ht?this:this.removeInner(t,0)}removeInner(t,e){let o=this.children,r=this.local;for(let i=0;i<o.length;i+=3){let s,l=o[i]+e,a=o[i+1]+e;for(let d=0,h;d<t.length;d++)(h=t[d])&&h.from>l&&h.to<a&&(t[d]=null,(s||(s=[])).push(h));if(!s)continue;o==this.children&&(o=this.children.slice());let c=o[i+2].removeInner(s,l+1);c!=ht?o[i+2]=c:(o.splice(i,3),i-=3)}if(r.length){for(let i=0,s;i<t.length;i++)if(s=t[i])for(let l=0;l<r.length;l++)r[l].eq(s,e)&&(r==this.local&&(r=this.local.slice()),r.splice(l--,1))}return o==this.children&&r==this.local?this:r.length||o.length?new U(r,o):ht}forChild(t,e){if(this==ht)return this;if(e.isLeaf)return U.empty;let o,r;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=t){this.children[l]==t&&(o=this.children[l+2]);break}let i=t+1,s=i+e.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>i&&a.type instanceof ve){let c=Math.max(i,a.from)-i,d=Math.min(s,a.to)-i;c<d&&(r||(r=[])).push(a.copy(c,d))}}if(r){let l=new U(r.sort(Ie),Ke);return o?new de([l,o]):l}return o||ht}eq(t){if(this==t)return!0;if(!(t instanceof U)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(t){return Xi(this.localsInner(t))}localsInner(t){if(this==ht)return Ke;if(t.inlineContent||!this.local.some(ve.is))return this.local;let e=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof ve||e.push(this.local[o]);return e}forEachSet(t){t(this)}}U.empty=new U([],[]);U.removeOverlap=Xi;const ht=U.empty;class de{constructor(t){this.members=t}map(t,e){const o=this.members.map(r=>r.map(t,e,Le));return de.from(o)}forChild(t,e){if(e.isLeaf)return U.empty;let o=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(t,e);i!=ht&&(i instanceof de?o=o.concat(i.members):o.push(i))}return de.from(o)}eq(t){if(!(t instanceof de)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(t){let e,o=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(t);if(i.length)if(!e)e=i;else{o&&(e=e.slice(),o=!1);for(let s=0;s<i.length;s++)e.push(i[s])}}return e?Xi(o?e:e.sort(Ie)):Ke}static from(t){switch(t.length){case 0:return ht;case 1:return t[0];default:return new de(t.every(e=>e instanceof U)?t:t.reduce((e,o)=>e.concat(o instanceof U?o:o.members),[]))}}forEachSet(t){for(let e=0;e<this.members.length;e++)this.members[e].forEachSet(t)}}function bp(n,t,e,o,r,i,s){let l=n.slice();for(let c=0,d=i;c<e.maps.length;c++){let h=0;e.maps[c].forEach((p,u,f,m)=>{let g=m-f-(u-p);for(let w=0;w<l.length;w+=3){let x=l[w+1];if(x<0||p>x+d-h)continue;let T=l[w]+d-h;u>=T?l[w+1]=p<=T?-2:-1:p>=d&&g&&(l[w]+=g,l[w+1]+=g)}h+=g}),d=e.maps[c].map(d,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let d=e.map(n[c]+i),h=d-r;if(h<0||h>=o.content.size){a=!0;continue}let p=e.map(n[c+1]+i,-1),u=p-r,{index:f,offset:m}=o.content.findIndex(h),g=o.maybeChild(f);if(g&&m==h&&m+g.nodeSize==u){let w=l[c+2].mapInner(e,g,d+1,n[c]+i+1,s);w!=ht?(l[c]=h,l[c+1]=u,l[c+2]=w):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=kp(l,n,t,e,r,i,s),d=To(c,o,0,s);t=d.local;for(let h=0;h<l.length;h+=3)l[h+1]<0&&(l.splice(h,3),h-=3);for(let h=0,p=0;h<d.children.length;h+=3){let u=d.children[h];for(;p<l.length&&l[p]<u;)p+=3;l.splice(p,0,d.children[h],d.children[h+1],d.children[h+2])}}return new U(t.sort(Ie),l)}function hc(n,t){if(!t||!n.length)return n;let e=[];for(let o=0;o<n.length;o++){let r=n[o];e.push(new yt(r.from+t,r.to+t,r.type))}return e}function kp(n,t,e,o,r,i,s){function l(a,c){for(let d=0;d<a.local.length;d++){let h=a.local[d].map(o,r,c);h?e.push(h):s.onRemove&&s.onRemove(a.local[d].spec)}for(let d=0;d<a.children.length;d+=3)l(a.children[d+2],a.children[d]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],t[a]+i+1);return e}function pc(n,t,e){if(t.isLeaf)return null;let o=e+t.nodeSize,r=null;for(let i=0,s;i<n.length;i++)(s=n[i])&&s.from>e&&s.to<o&&((r||(r=[])).push(s),n[i]=null);return r}function uc(n){let t=[];for(let e=0;e<n.length;e++)n[e]!=null&&t.push(n[e]);return t}function To(n,t,e,o){let r=[],i=!1;t.forEach((l,a)=>{let c=pc(n,l,a+e);if(c){i=!0;let d=To(c,l,e+a+1,o);d!=ht&&r.push(a,a+l.nodeSize,d)}});let s=hc(i?uc(n):n,-e).sort(Ie);for(let l=0;l<s.length;l++)s[l].type.valid(t,s[l])||(o.onRemove&&o.onRemove(s[l].spec),s.splice(l--,1));return s.length||r.length?new U(s,r):ht}function Ie(n,t){return n.from-t.from||n.to-t.to}function Xi(n){let t=n;for(let e=0;e<t.length-1;e++){let o=t[e];if(o.from!=o.to)for(let r=e+1;r<t.length;r++){let i=t[r];if(i.from==o.from){i.to!=o.to&&(t==n&&(t=n.slice()),t[r]=i.copy(i.from,o.to),al(t,r+1,i.copy(o.to,i.to)));continue}else{i.from<o.to&&(t==n&&(t=n.slice()),t[e]=o.copy(o.from,i.from),al(t,r,o.copy(i.from,o.to)));break}}}return t}function al(n,t,e){for(;t<n.length&&Ie(e,n[t])>0;)t++;n.splice(t,0,e)}function $r(n){let t=[];return n.someProp("decorations",e=>{let o=e(n.state);o&&o!=ht&&t.push(o)}),n.cursorWrapper&&t.push(U.create(n.state.doc,[n.cursorWrapper.deco])),de.from(t)}const xp={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Cp=xt&&ye<=11;class Mp{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class Sp{constructor(t,e){this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Mp,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(o=>{for(let r=0;r<o.length;r++)this.queue.push(o[r]);xt&&ye<=11&&o.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),Cp&&(this.onCharData=o=>{this.queue.push({target:o.target,type:"characterData",oldValue:o.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,xp)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let e=0;e<t.length;e++)this.queue.push(t[e]);window.setTimeout(()=>this.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(tl(this.view)){if(this.suppressingSelectionUpdates)return ee(this.view);if(xt&&ye<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&He(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let e=new Set,o;for(let i=t.focusNode;i;i=en(i))e.add(i);for(let i=t.anchorNode;i;i=en(i))if(e.has(i)){o=i;break}let r=o&&this.view.docView.nearestDesc(o);if(r&&r.ignoreMutation({type:"selection",target:o.nodeType==3?o.parentNode:o}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let e=this.pendingRecords();e.length&&(this.queue=[]);let o=t.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(o)&&tl(t)&&!this.ignoreSelectionChange(o),i=-1,s=-1,l=!1,a=[];if(t.editable)for(let d=0;d<e.length;d++){let h=this.registerMutation(e[d],a);h&&(i=i<0?h.from:Math.min(h.from,i),s=s<0?h.to:Math.max(h.to,s),h.typeOver&&(l=!0))}if($t&&a.length){let d=a.filter(h=>h.nodeName=="BR");if(d.length==2){let[h,p]=d;h.parentNode&&h.parentNode.parentNode==p.parentNode?p.remove():h.remove()}else{let{focusNode:h}=this.currentSelection;for(let p of d){let u=p.parentNode;u&&u.nodeName=="LI"&&(!h||Op(t,h)!=u)&&p.remove()}}}let c=null;i<0&&r&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&pr(o)&&(c=qi(t))&&c.eq(N.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,ee(t),this.currentSelection.set(o),t.scrollToSelection()):(i>-1||r)&&(i>-1&&(t.docView.markDirty(i,s),Ap(t)),this.handleDOMChange(i,s,l,a),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(o)||ee(t),this.currentSelection.set(o))}registerMutation(t,e){if(e.indexOf(t.target)>-1)return null;let o=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(o==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!o||o.ignoreMutation(t))return null;if(t.type=="childList"){for(let d=0;d<t.addedNodes.length;d++){let h=t.addedNodes[d];e.push(h),h.nodeType==3&&(this.lastChangedTextNode=h)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(t.target))return{from:o.posBefore,to:o.posAfter};let r=t.previousSibling,i=t.nextSibling;if(xt&&ye<=11&&t.addedNodes.length)for(let d=0;d<t.addedNodes.length;d++){let{previousSibling:h,nextSibling:p}=t.addedNodes[d];(!h||Array.prototype.indexOf.call(t.addedNodes,h)<0)&&(r=h),(!p||Array.prototype.indexOf.call(t.addedNodes,p)<0)&&(i=p)}let s=r&&r.parentNode==t.target?st(r)+1:0,l=o.localPosFromDOM(t.target,s,-1),a=i&&i.parentNode==t.target?st(i):t.target.childNodes.length,c=o.localPosFromDOM(t.target,a,1);return{from:l,to:c}}else return t.type=="attributes"?{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}:(this.lastChangedTextNode=t.target,{from:o.posAtStart,to:o.posAtEnd,typeOver:t.target.nodeValue==t.oldValue})}}let cl=new WeakMap,dl=!1;function Ap(n){if(!cl.has(n)&&(cl.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=$t,dl)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),dl=!0}}function hl(n,t){let e=t.startContainer,o=t.startOffset,r=t.endContainer,i=t.endOffset,s=n.domAtPos(n.state.selection.anchor);return He(s.node,s.offset,r,i)&&([e,o,r,i]=[r,i,e,o]),{anchorNode:e,anchorOffset:o,focusNode:r,focusOffset:i}}function Ep(n,t){if(t.getComposedRanges){let r=t.getComposedRanges(n.root)[0];if(r)return hl(n,r)}let e;function o(r){r.preventDefault(),r.stopImmediatePropagation(),e=r.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",o,!0),e?hl(n,e):null}function Op(n,t){for(let e=t.parentNode;e&&e!=n.dom;e=e.parentNode){let o=n.docView.nearestDesc(e,!0);if(o&&o.node.isBlock)return e}return null}function Tp(n,t,e){let{node:o,fromOffset:r,toOffset:i,from:s,to:l}=n.docView.parseRange(t,e),a=n.domSelectionRange(),c,d=a.anchorNode;if(d&&n.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:a.anchorOffset}],pr(a)||c.push({node:a.focusNode,offset:a.focusOffset})),pt&&n.input.lastKeyCode===8)for(let g=i;g>r;g--){let w=o.childNodes[g-1],x=w.pmViewDesc;if(w.nodeName=="BR"&&!x){i=g;break}if(!x||x.size)break}let h=n.state.doc,p=n.someProp("domParser")||bn.fromSchema(n.state.schema),u=h.resolve(s),f=null,m=p.parse(o,{topNode:u.parent,topMatch:u.parent.contentMatchAt(u.index()),topOpen:!0,from:r,to:i,preserveWhitespace:u.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Np,context:u});if(c&&c[0].pos!=null){let g=c[0].pos,w=c[1]&&c[1].pos;w==null&&(w=g),f={anchor:g+s,head:w+s}}return{doc:m,sel:f,from:s,to:l}}function Np(n){let t=n.pmViewDesc;if(t)return t.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(wt&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}else if(n.parentNode.lastChild==n||wt&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Dp=/^(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 Rp(n,t,e,o,r){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,t<0){let P=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,gt=qi(n,P);if(gt&&!n.state.selection.eq(gt)){if(pt&&te&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",oe=>oe(n,Se(13,"Enter"))))return;let zt=n.state.tr.setSelection(gt);P=="pointer"?zt.setMeta("pointer",!0):P=="key"&&zt.scrollIntoView(),i&&zt.setMeta("composition",i),n.dispatch(zt)}return}let s=n.state.doc.resolve(t),l=s.sharedDepth(e);t=s.before(l+1),e=n.state.doc.resolve(e).after(l+1);let a=n.state.selection,c=Tp(n,t,e),d=n.state.doc,h=d.slice(c.from,c.to),p,u;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(p=n.state.selection.to,u="end"):(p=n.state.selection.from,u="start"),n.input.lastKeyCode=null;let f=Pp(h.content,c.doc.content,c.from,p,u);if(f&&n.input.domChangeCount++,(nn&&n.input.lastIOSEnter>Date.now()-225||te)&&r.some(P=>P.nodeType==1&&!Dp.test(P.nodeName))&&(!f||f.endA>=f.endB)&&n.someProp("handleKeyDown",P=>P(n,Se(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!f)if(o&&a instanceof E&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))f={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let P=pl(n,n.state.doc,c.sel);if(P&&!P.eq(n.state.selection)){let gt=n.state.tr.setSelection(P);i&>.setMeta("composition",i),n.dispatch(gt)}}return}n.state.selection.from<n.state.selection.to&&f.start==f.endB&&n.state.selection instanceof E&&(f.start>n.state.selection.from&&f.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?f.start=n.state.selection.from:f.endA<n.state.selection.to&&f.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(f.endB+=n.state.selection.to-f.endA,f.endA=n.state.selection.to)),xt&&ye<=11&&f.endB==f.start+1&&f.endA==f.start&&f.start>c.from&&c.doc.textBetween(f.start-c.from-1,f.start-c.from+1)==" Â "&&(f.start--,f.endA--,f.endB--);let m=c.doc.resolveNoCache(f.start-c.from),g=c.doc.resolveNoCache(f.endB-c.from),w=d.resolve(f.start),x=m.sameParent(g)&&m.parent.inlineContent&&w.end()>=f.endA,T;if((nn&&n.input.lastIOSEnter>Date.now()-225&&(!x||r.some(P=>P.nodeName=="DIV"||P.nodeName=="P"))||!x&&m.pos<c.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&(T=N.findFrom(c.doc.resolve(m.pos+1),1,!0))&&T.head>m.pos)&&n.someProp("handleKeyDown",P=>P(n,Se(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>f.start&&Ip(d,f.start,f.endA,m,g)&&n.someProp("handleKeyDown",P=>P(n,Se(8,"Backspace")))){te&&pt&&n.domObserver.suppressSelectionUpdates();return}pt&&f.endB==f.start&&(n.input.lastChromeDelete=Date.now()),te&&!x&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==f.endA&&(f.endB-=2,g=c.doc.resolveNoCache(f.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(P){return P(n,Se(13,"Enter"))})},20));let $=f.start,O=f.endA,H,j,K;if(x){if(m.pos==g.pos)xt&&ye<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>ee(n),20)),H=n.state.tr.delete($,O),j=d.resolve(f.start).marksAcross(d.resolve(f.endA));else if(f.endA==f.endB&&(K=Lp(m.parent.content.cut(m.parentOffset,g.parentOffset),w.parent.content.cut(w.parentOffset,f.endA-w.start()))))H=n.state.tr,K.type=="add"?H.addMark($,O,K.mark):H.removeMark($,O,K.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let P=m.parent.textBetween(m.parentOffset,g.parentOffset);if(n.someProp("handleTextInput",gt=>gt(n,$,O,P)))return;H=n.state.tr.insertText(P,$,O)}}if(H||(H=n.state.tr.replace($,O,c.doc.slice(f.start-c.from,f.endB-c.from))),c.sel){let P=pl(n,H.doc,c.sel);P&&!(pt&&n.composing&&P.empty&&(f.start!=f.endB||n.input.lastChromeDelete<Date.now()-100)&&(P.head==$||P.head==H.mapping.map(O)-1)||xt&&P.empty&&P.head==$)&&H.setSelection(P)}j&&H.ensureMarks(j),i&&H.setMeta("composition",i),n.dispatch(H.scrollIntoView())}function pl(n,t,e){return Math.max(e.anchor,e.head)>t.content.size?null:Ki(n,t.resolve(e.anchor),t.resolve(e.head))}function Lp(n,t){let e=n.firstChild.marks,o=t.firstChild.marks,r=e,i=o,s,l,a;for(let d=0;d<o.length;d++)r=o[d].removeFromSet(r);for(let d=0;d<e.length;d++)i=e[d].removeFromSet(i);if(r.length==1&&i.length==0)l=r[0],s="add",a=d=>d.mark(l.addToSet(d.marks));else if(r.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;d<t.childCount;d++)c.push(a(t.child(d)));if(v.from(c).eq(n))return{mark:l,type:s}}function Ip(n,t,e,o,r){if(e-t<=r.pos-o.pos||Hr(o,!0,!1)<r.pos)return!1;let i=n.resolve(t);if(!o.parent.isTextblock){let l=i.nodeAfter;return l!=null&&e==t+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=n.resolve(Hr(i,!0,!0));return!s.parent.isTextblock||s.pos>e||Hr(s,!0,!1)<e?!1:o.parent.content.cut(o.parentOffset).eq(s.parent.content)}function Hr(n,t,e){let o=n.depth,r=t?n.end():n.pos;for(;o>0&&(t||n.indexAfter(o)==n.node(o).childCount);)o--,r++,t=!1;if(e){let i=n.node(o).maybeChild(n.indexAfter(o));for(;i&&!i.isLeaf;)i=i.firstChild,r++}return r}function Pp(n,t,e,o,r){let i=n.findDiffStart(t,e);if(i==null)return null;let{a:s,b:l}=n.findDiffEnd(t,e+n.size,e+t.size);if(r=="end"){let a=Math.max(0,i-Math.min(s,l));o-=s+a-i}if(s<i&&n.size<t.size){let a=o<=i&&o>=s?i-o:0;i-=a,i&&i<t.size&&ul(t.textBetween(i-1,i+1))&&(i+=a?1:-1),l=i+(l-s),s=i}else if(l<i){let a=o<=i&&o>=l?i-o:0;i-=a,i&&i<n.size&&ul(n.textBetween(i-1,i+1))&&(i+=a?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}function ul(n){if(n.length!=2)return!1;let t=n.charCodeAt(0),e=n.charCodeAt(1);return t>=56320&&t<=57343&&e>=55296&&e<=56319}class $p{constructor(t,e){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 tp,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=e,this.state=e.state,this.directPlugins=e.plugins||[],this.directPlugins.forEach(wl),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=gl(this),ml(this),this.nodeViews=yl(this),this.docView=Zs(this.state.doc,fl(this),$r(this),this.dom,this),this.domObserver=new Sp(this,(o,r,i,s)=>Rp(this,o,r,i,s)),this.domObserver.start(),ep(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let e in t)this._props[e]=t[e];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&gi(this);let e=this._props;this._props=t,t.plugins&&(t.plugins.forEach(wl),this.directPlugins=t.plugins),this.updateStateInner(t.state,e)}setProps(t){let e={};for(let o in this._props)e[o]=this._props[o];e.state=this.state;for(let o in t)e[o]=t[o];this.update(e)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,e){var o;let r=this.state,i=!1,s=!1;t.storedMarks&&this.composing&&(lc(this),s=!0),this.state=t;let l=r.plugins!=t.plugins||this._props.plugins!=e.plugins;if(l||this._props.plugins!=e.plugins||this._props.nodeViews!=e.nodeViews){let u=yl(this);zp(u,this.nodeViews)&&(this.nodeViews=u,i=!0)}(l||e.handleDOMEvents!=this._props.handleDOMEvents)&&gi(this),this.editable=gl(this),ml(this);let a=$r(this),c=fl(this),d=r.plugins!=t.plugins&&!r.doc.eq(t.doc)?"reset":t.scrollToSelection>r.scrollToSelection?"to selection":"preserve",h=i||!this.docView.matchesNode(t.doc,c,a);(h||!t.selection.eq(r.selection))&&(s=!0);let p=d=="preserve"&&s&&this.dom.style.overflowAnchor==null&&mh(this);if(s){this.domObserver.stop();let u=h&&(xt||pt)&&!this.composing&&!r.selection.empty&&!t.selection.empty&&Hp(r.selection,t.selection);if(h){let f=pt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=fp(this)),(i||!this.docView.update(t.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Zs(t.doc,c,a,this.dom,this)),f&&!this.trackWrites&&(u=!0)}u||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Bh(this))?ee(this,u):(_a(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),!((o=this.dragging)===null||o===void 0)&&o.node&&!r.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,r),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():p&&gh(p)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!(!t||!this.dom.contains(t.nodeType==1?t:t.parentNode))&&!this.someProp("handleScrollToSelection",e=>e(this)))if(this.state.selection instanceof A){let e=this.docView.domAfterPos(this.state.selection.from);e.nodeType==1&&js(this,e.getBoundingClientRect(),t)}else js(this,this.coordsAtPos(this.state.selection.head,1),t)}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let o=this.directPlugins[e];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let o=this.state.plugins[e];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}else for(let e=0;e<this.pluginViews.length;e++){let o=this.pluginViews[e];o.update&&o.update(this,t)}}updateDraggedNode(t,e){let o=t.node,r=-1;if(this.state.doc.nodeAt(o.from)==o.node)r=o.from;else{let i=o.from+(this.state.doc.content.size-e.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==o.node&&(r=i)}this.dragging=new cc(t.slice,t.move,r<0?void 0:A.create(this.state.doc,r))}someProp(t,e){let o=this._props&&this._props[t],r;if(o!=null&&(r=e?e(o):o))return r;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[t];if(l!=null&&(r=e?e(l):l))return r}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[t];if(l!=null&&(r=e?e(l):l))return r}}hasFocus(){if(xt){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if(t.contentEditable=="false")return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&yh(this.dom),ee(this),this.domObserver.start()}get root(){let t=this._root;if(t==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return t||document}updateRoot(){this._root=null}posAtCoords(t){return xh(this,t)}coordsAtPos(t,e=1){return Fa(this,t,e)}domAtPos(t,e=0){return this.docView.domFromPos(t,e)}nodeDOM(t){let e=this.docView.descAt(t);return e?e.nodeDOM:null}posAtDOM(t,e,o=-1){let r=this.docView.posFromDOM(t,e,o);if(r==null)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(t,e){return Eh(this,e||this.state,t)}pasteHTML(t,e){return Pn(this,"",t,!1,e||new ClipboardEvent("paste"))}pasteText(t,e){return Pn(this,t,null,!0,e||new ClipboardEvent("paste"))}serializeForClipboard(t){return Ji(this,t)}destroy(){this.docView&&(np(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],$r(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,rh())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return rp(this,t)}dispatch(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))}domSelectionRange(){let t=this.domSelection();return t?wt&&this.root.nodeType===11&&ch(this.dom.ownerDocument)==this.dom&&Ep(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function fl(n){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(n.editable),n.someProp("attributes",e=>{if(typeof e=="function"&&(e=e(n.state)),e)for(let o in e)o=="class"?t.class+=" "+e[o]:o=="style"?t.style=(t.style?t.style+";":"")+e[o]:!t[o]&&o!="contenteditable"&&o!="nodeName"&&(t[o]=String(e[o]))}),t.translate||(t.translate="no"),[yt.node(0,n.state.doc.content.size,t)]}function ml(n){if(n.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),n.cursorWrapper={dom:t,deco:yt.widget(n.state.selection.from,t,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function gl(n){return!n.someProp("editable",t=>t(n.state)===!1)}function Hp(n,t){let e=Math.min(n.$anchor.sharedDepth(n.head),t.$anchor.sharedDepth(t.head));return n.$anchor.start(e)!=t.$anchor.start(e)}function yl(n){let t=Object.create(null);function e(o){for(let r in o)Object.prototype.hasOwnProperty.call(t,r)||(t[r]=o[r])}return n.someProp("nodeViews",e),n.someProp("markViews",e),t}function zp(n,t){let e=0,o=0;for(let r in n){if(n[r]!=t[r])return!0;e++}for(let r in t)o++;return e!=o}function wl(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 be={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:"'"},No={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Bp=typeof navigator<"u"&&/Mac/.test(navigator.platform),Vp=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var lt=0;lt<10;lt++)be[48+lt]=be[96+lt]=String(lt);for(var lt=1;lt<=24;lt++)be[lt+111]="F"+lt;for(var lt=65;lt<=90;lt++)be[lt]=String.fromCharCode(lt+32),No[lt]=String.fromCharCode(lt);for(var zr in be)No.hasOwnProperty(zr)||(No[zr]=be[zr]);function Fp(n){var t=Bp&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Vp&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",e=!t&&n.key||(n.shiftKey?No:be)[n.keyCode]||n.key||"Unidentified";return e=="Esc"&&(e="Escape"),e=="Del"&&(e="Delete"),e=="Left"&&(e="ArrowLeft"),e=="Up"&&(e="ArrowUp"),e=="Right"&&(e="ArrowRight"),e=="Down"&&(e="ArrowDown"),e}const jp=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Wp(n){let t=n.split(/-(?!$)/),e=t[t.length-1];e=="Space"&&(e=" ");let o,r,i,s;for(let l=0;l<t.length-1;l++){let a=t[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))o=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))jp?s=!0:r=!0;else throw new Error("Unrecognized modifier name: "+a)}return o&&(e="Alt-"+e),r&&(e="Ctrl-"+e),s&&(e="Meta-"+e),i&&(e="Shift-"+e),e}function qp(n){let t=Object.create(null);for(let e in n)t[Wp(e)]=n[e];return t}function Br(n,t,e=!0){return t.altKey&&(n="Alt-"+n),t.ctrlKey&&(n="Ctrl-"+n),t.metaKey&&(n="Meta-"+n),e&&t.shiftKey&&(n="Shift-"+n),n}function Kp(n){return new Q({props:{handleKeyDown:Qi(n)}})}function Qi(n){let t=qp(n);return function(e,o){let r=Fp(o),i,s=t[Br(r,o)];if(s&&s(e.state,e.dispatch,e))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let l=t[Br(r,o,!1)];if(l&&l(e.state,e.dispatch,e))return!0}if((o.shiftKey||o.altKey||o.metaKey||r.charCodeAt(0)>127)&&(i=be[o.keyCode])&&i!=r){let l=t[Br(i,o)];if(l&&l(e.state,e.dispatch,e))return!0}}return!1}}const Jp=(n,t)=>n.selection.empty?!1:(t&&t(n.tr.deleteSelection().scrollIntoView()),!0);function fc(n,t){let{$cursor:e}=n.selection;return!e||(t?!t.endOfTextblock("backward",n):e.parentOffset>0)?null:e}const Up=(n,t,e)=>{let o=fc(n,e);if(!o)return!1;let r=Yi(o);if(!r){let s=o.blockRange(),l=s&&ln(s);return l==null?!1:(t&&t(n.tr.lift(s,l).scrollIntoView()),!0)}let i=r.nodeBefore;if(wc(n,r,t,-1))return!0;if(o.parent.content.size==0&&(on(i,"end")||A.isSelectable(i)))for(let s=o.depth;;s--){let l=dr(n.doc,o.before(s),o.after(s),k.empty);if(l&&l.slice.size<l.to-l.from){if(t){let a=n.tr.step(l);a.setSelection(on(i,"end")?N.findFrom(a.doc.resolve(a.mapping.map(r.pos,-1)),-1):A.create(a.doc,r.pos-i.nodeSize)),t(a.scrollIntoView())}return!0}if(s==1||o.node(s-1).childCount>1)break}return i.isAtom&&r.depth==o.depth-1?(t&&t(n.tr.delete(r.pos-i.nodeSize,r.pos).scrollIntoView()),!0):!1},Zp=(n,t,e)=>{let o=fc(n,e);if(!o)return!1;let r=Yi(o);return r?mc(n,r,t):!1},_p=(n,t,e)=>{let o=gc(n,e);if(!o)return!1;let r=ts(o);return r?mc(n,r,t):!1};function mc(n,t,e){let o=t.nodeBefore,r=o,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let d=r.lastChild;if(!d)return!1;r=d}let s=t.nodeAfter,l=s,a=t.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=dr(n.doc,i,a,k.empty);if(!c||c.from!=i||c instanceof tt&&c.slice.size>=a-i)return!1;if(e){let d=n.tr.step(c);d.setSelection(E.create(d.doc,i)),e(d.scrollIntoView())}return!0}function on(n,t,e=!1){for(let o=n;o;o=t=="start"?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(e&&o.childCount!=1)return!1}return!1}const Gp=(n,t,e)=>{let{$head:o,empty:r}=n.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(e?!e.endOfTextblock("backward",n):o.parentOffset>0)return!1;i=Yi(o)}let s=i&&i.nodeBefore;return!s||!A.isSelectable(s)?!1:(t&&t(n.tr.setSelection(A.create(n.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function Yi(n){if(!n.parent.type.spec.isolating)for(let t=n.depth-1;t>=0;t--){if(n.index(t)>0)return n.doc.resolve(n.before(t+1));if(n.node(t).type.spec.isolating)break}return null}function gc(n,t){let{$cursor:e}=n.selection;return!e||(t?!t.endOfTextblock("forward",n):e.parentOffset<e.parent.content.size)?null:e}const Xp=(n,t,e)=>{let o=gc(n,e);if(!o)return!1;let r=ts(o);if(!r)return!1;let i=r.nodeAfter;if(wc(n,r,t,1))return!0;if(o.parent.content.size==0&&(on(i,"start")||A.isSelectable(i))){let s=dr(n.doc,o.before(),o.after(),k.empty);if(s&&s.slice.size<s.to-s.from){if(t){let l=n.tr.step(s);l.setSelection(on(i,"start")?N.findFrom(l.doc.resolve(l.mapping.map(r.pos)),1):A.create(l.doc,l.mapping.map(r.pos))),t(l.scrollIntoView())}return!0}}return i.isAtom&&r.depth==o.depth-1?(t&&t(n.tr.delete(r.pos,r.pos+i.nodeSize).scrollIntoView()),!0):!1},Qp=(n,t,e)=>{let{$head:o,empty:r}=n.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(e?!e.endOfTextblock("forward",n):o.parentOffset<o.parent.content.size)return!1;i=ts(o)}let s=i&&i.nodeAfter;return!s||!A.isSelectable(s)?!1:(t&&t(n.tr.setSelection(A.create(n.doc,i.pos)).scrollIntoView()),!0)};function ts(n){if(!n.parent.type.spec.isolating)for(let t=n.depth-1;t>=0;t--){let e=n.node(t);if(n.index(t)+1<e.childCount)return n.doc.resolve(n.after(t+1));if(e.type.spec.isolating)break}return null}const Yp=(n,t)=>{let e=n.selection,o=e instanceof A,r;if(o){if(e.node.isTextblock||!ke(n.doc,e.from))return!1;r=e.from}else if(r=cr(n.doc,e.from,-1),r==null)return!1;if(t){let i=n.tr.join(r);o&&i.setSelection(A.create(i.doc,r-n.doc.resolve(r).nodeBefore.nodeSize)),t(i.scrollIntoView())}return!0},tu=(n,t)=>{let e=n.selection,o;if(e instanceof A){if(e.node.isTextblock||!ke(n.doc,e.to))return!1;o=e.to}else if(o=cr(n.doc,e.to,1),o==null)return!1;return t&&t(n.tr.join(o).scrollIntoView()),!0},eu=(n,t)=>{let{$from:e,$to:o}=n.selection,r=e.blockRange(o),i=r&&ln(r);return i==null?!1:(t&&t(n.tr.lift(r,i).scrollIntoView()),!0)},nu=(n,t)=>{let{$head:e,$anchor:o}=n.selection;return!e.parent.type.spec.code||!e.sameParent(o)?!1:(t&&t(n.tr.insertText(` 10`).scrollIntoView()),!0)};function yc(n){for(let t=0;t<n.edgeCount;t++){let{type:e}=n.edge(t);if(e.isTextblock&&!e.hasRequiredAttrs())return e}return null}const ou=(n,t)=>{let{$head:e,$anchor:o}=n.selection;if(!e.parent.type.spec.code||!e.sameParent(o))return!1;let r=e.node(-1),i=e.indexAfter(-1),s=yc(r.contentMatchAt(i));if(!s||!r.canReplaceWith(i,i,s))return!1;if(t){let l=e.after(),a=n.tr.replaceWith(l,l,s.createAndFill());a.setSelection(N.near(a.doc.resolve(l),1)),t(a.scrollIntoView())}return!0},ru=(n,t)=>{let e=n.selection,{$from:o,$to:r}=e;if(e instanceof Rt||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=yc(r.parent.contentMatchAt(r.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let s=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,l=n.tr.insert(s,i.createAndFill());l.setSelection(E.create(l.doc,s+1)),t(l.scrollIntoView())}return!0},iu=(n,t)=>{let{$cursor:e}=n.selection;if(!e||e.parent.content.size)return!1;if(e.depth>1&&e.after()!=e.end(-1)){let i=e.before();if(Ge(n.doc,i))return t&&t(n.tr.split(i).scrollIntoView()),!0}let o=e.blockRange(),r=o&&ln(o);return r==null?!1:(t&&t(n.tr.lift(o,r).scrollIntoView()),!0)},su=(n,t)=>{let{$from:e,to:o}=n.selection,r,i=e.sharedDepth(o);return i==0?!1:(r=e.before(i),t&&t(n.tr.setSelection(A.create(n.doc,r))),!0)};function lu(n,t,e){let o=t.nodeBefore,r=t.nodeAfter,i=t.index();return!o||!r||!o.type.compatibleContent(r.type)?!1:!o.content.size&&t.parent.canReplace(i-1,i)?(e&&e(n.tr.delete(t.pos-o.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(i,i+1)||!(r.isTextblock||ke(n.doc,t.pos))?!1:(e&&e(n.tr.join(t.pos).scrollIntoView()),!0)}function wc(n,t,e,o){let r=t.nodeBefore,i=t.nodeAfter,s,l,a=r.type.spec.isolating||i.type.spec.isolating;if(!a&&lu(n,t,e))return!0;let c=!a&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(s=(l=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(e){let u=t.pos+i.nodeSize,f
vendor: 23,146 bytes, lines 10-12
10=v.empty;for(let w=s.length-1;w>=0;w--)f=v.from(s[w].create(null,f));f=v.from(r.copy(f));let m=n.tr.step(new et(t.pos-1,u,t.pos,u,new k(f,1,0),s.length,!0)),g=m.doc.resolve(u+2*s.length);g.nodeAfter&&g.nodeAfter.type==r.type&&ke(m.doc,g.pos)&&m.join(g.pos),e(m.scrollIntoView())}return!0}let d=i.type.spec.isolating||o>0&&a?null:N.findFrom(t,1),h=d&&d.$from.blockRange(d.$to),p=h&&ln(h);if(p!=null&&p>=t.depth)return e&&e(n.tr.lift(h,p).scrollIntoView()),!0;if(c&&on(i,"start",!0)&&on(r,"end")){let u=r,f=[];for(;f.push(u),!u.isTextblock;)u=u.lastChild;let m=i,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(u.canReplace(u.childCount,u.childCount,m.content)){if(e){let w=v.empty;for(let T=f.length-1;T>=0;T--)w=v.from(f[T].copy(w));let x=n.tr.step(new et(t.pos-f.length,t.pos+i.nodeSize,t.pos+g,t.pos+i.nodeSize-g,new k(w,f.length,0),0,!0));e(x.scrollIntoView())}return!0}}return!1}function vc(n){return function(t,e){let o=t.selection,r=n<0?o.$from:o.$to,i=r.depth;for(;r.node(i).isInline;){if(!i)return!1;i--}return r.node(i).isTextblock?(e&&e(t.tr.setSelection(E.create(t.doc,n<0?r.start(i):r.end(i)))),!0):!1}}const au=vc(-1),cu=vc(1);function du(n,t=null){return function(e,o){let{$from:r,$to:i}=e.selection,s=r.blockRange(i),l=s&&Vi(s,n,t);return l?(o&&o(e.tr.wrap(s,l).scrollIntoView()),!0):!1}}function vl(n,t=null){return function(e,o){let r=!1;for(let i=0;i<e.selection.ranges.length&&!r;i++){let{$from:{pos:s},$to:{pos:l}}=e.selection.ranges[i];e.doc.nodesBetween(s,l,(a,c)=>{if(r)return!1;if(!(!a.isTextblock||a.hasMarkup(n,t)))if(a.type==n)r=!0;else{let d=e.doc.resolve(c),h=d.index();r=d.parent.canReplaceWith(h,h+1,n)}})}if(!r)return!1;if(o){let i=e.tr;for(let s=0;s<e.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=e.selection.ranges[s];i.setBlockType(l,a,n,t)}o(i.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function hu(n,t=null){return function(e,o){let{$from:r,$to:i}=e.selection,s=r.blockRange(i);if(!s)return!1;let l=o?e.tr:null;return pu(l,s,n,t)?(o&&o(l.scrollIntoView()),!0):!1}}function pu(n,t,e,o=null){let r=!1,i=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(e)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let a=s.resolve(t.start-2);i=new Co(a,a,t.depth),t.endIndex<t.parent.childCount&&(t=new Co(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),r=!0}let l=Vi(i,e,o,t);return l?(n&&uu(n,t,l,r,e),!0):!1}function uu(n,t,e,o,r){let i=v.empty;for(let d=e.length-1;d>=0;d--)i=v.from(e[d].type.create(e[d].attrs,i));n.step(new et(t.start-(o?2:0),t.end,t.start,t.end,new k(i,0,0),e.length,!0));let s=0;for(let d=0;d<e.length;d++)e[d].type==r&&(s=d+1);let l=e.length-s,a=t.start+e.length-(o?2:0),c=t.parent;for(let d=t.startIndex,h=t.endIndex,p=!0;d<h;d++,p=!1)!p&&Ge(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=c.child(d).nodeSize;return n}function fu(n){return function(t,e){let{$from:o,$to:r}=t.selection,i=o.blockRange(r,s=>s.childCount>0&&s.firstChild.type==n);return i?e?o.node(i.depth-1).type==n?mu(t,e,n,i):gu(t,e,i):!0:!1}}function mu(n,t,e,o){let r=n.tr,i=o.end,s=o.$to.end(o.depth);i<s&&(r.step(new et(i-1,s,i,s,new k(v.from(e.create(null,o.parent.copy())),1,0),1,!0)),o=new Co(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));const l=ln(o);if(l==null)return!1;r.lift(o,l);let a=r.doc.resolve(r.mapping.map(i,-1)-1);return ke(r.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&r.join(a.pos),t(r.scrollIntoView()),!0}function gu(n,t,e){let o=n.tr,r=e.parent;for(let u=e.end,f=e.endIndex-1,m=e.startIndex;f>m;f--)u-=r.child(f).nodeSize,o.delete(u-1,u+1);let i=o.doc.resolve(e.start),s=i.nodeAfter;if(o.mapping.map(e.end)!=e.start+i.nodeAfter.nodeSize)return!1;let l=e.startIndex==0,a=e.endIndex==r.childCount,c=i.node(-1),d=i.index(-1);if(!c.canReplace(d+(l?0:1),d+1,s.content.append(a?v.empty:v.from(r))))return!1;let h=i.pos,p=h+s.nodeSize;return o.step(new et(h-(l?1:0),p+(a?1:0),h+1,p-1,new k((l?v.empty:v.from(r.copy(v.empty))).append(a?v.empty:v.from(r.copy(v.empty))),l?0:1,a?0:1),l?0:1)),t(o.scrollIntoView()),!0}function yu(n){return function(t,e){let{$from:o,$to:r}=t.selection,i=o.blockRange(r,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(e){let c=a.lastChild&&a.lastChild.type==l.type,d=v.from(c?n.create():null),h=new k(v.from(n.create(null,v.from(l.type.create(null,d)))),c?3:1,0),p=i.start,u=i.end;e(t.tr.step(new et(p-(c?3:1),u,p,u,h,1,!0)).scrollIntoView())}return!0}}function mr(n){const{state:t,transaction:e}=n;let{selection:o}=e,{doc:r}=e,{storedMarks:i}=e;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return i},get selection(){return o},get doc(){return r},get tr(){return o=e.selection,r=e.doc,i=e.storedMarks,e}}}class gr{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:o}=this,{view:r}=e,{tr:i}=o,s=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([l,a])=>[l,(...c)=>{const d=a(...c)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:o,editor:r,state:i}=this,{view:s}=r,l=[],a=!!t,c=t||i.tr,d=()=>(!a&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),l.every(p=>p===!0)),h={...Object.fromEntries(Object.entries(o).map(([p,u])=>[p,(...f)=>{const m=this.buildProps(c,e),g=u(...f)(m);return l.push(g),h}])),run:d};return h}createCan(t){const{rawCommands:e,state:o}=this,r=!1,i=t||o.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...c)=>a(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(t,e=!0){const{rawCommands:o,editor:r,state:i}=this,{view:s}=r,l={tr:t,editor:r,view:s,state:mr({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(o).map(([a,c])=>[a,(...d)=>c(...d)(l)]))}};return l}}class wu{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const o=this.callbacks[t];return o&&o.forEach(r=>r.apply(this,e)),this}off(t,e){const o=this.callbacks[t];return o&&(e?this.callbacks[t]=o.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const o=(...r)=>{this.off(t,o),e.apply(this,r)};return this.on(t,o)}removeAllListeners(){this.callbacks={}}}function C(n,t,e){return n.config[t]===void 0&&n.parent?C(n.parent,t,e):typeof n.config[t]=="function"?n.config[t].bind({...e,parent:n.parent?C(n.parent,t,e):null}):n.config[t]}function yr(n){const t=n.filter(r=>r.type==="extension"),e=n.filter(r=>r.type==="node"),o=n.filter(r=>r.type==="mark");return{baseExtensions:t,nodeExtensions:e,markExtensions:o}}function bc(n){const t=[],{nodeExtensions:e,markExtensions:o}=yr(n),r=[...e,...o],i={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage,extensions:r},a=C(s,"addGlobalAttributes",l);a&&a().forEach(c=>{c.types.forEach(d=>{Object.entries(c.attributes).forEach(([h,p])=>{t.push({type:d,name:h,attribute:{...i,...p}})})})})}),r.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},a=C(s,"addAttributes",l);if(!a)return;const c=a();Object.entries(c).forEach(([d,h])=>{const p={...i,...h};typeof(p==null?void 0:p.default)=="function"&&(p.default=p.default()),p!=null&&p.isRequired&&(p==null?void 0:p.default)===void 0&&delete p.default,t.push({type:s.name,name:d,attribute:p})})}),t}function ot(n,t){if(typeof n=="string"){if(!t.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return t.nodes[n]}return n}function G(...n){return n.filter(t=>!!t).reduce((t,e)=>{const o={...t};return Object.entries(e).forEach(([r,i])=>{if(!o[r]){o[r]=i;return}if(r==="class"){const s=i?String(i).split(" "):[],l=o[r]?o[r].split(" "):[],a=s.filter(c=>!l.includes(c));o[r]=[...l,...a].join(" ")}else if(r==="style"){const s=i?i.split(";").map(c=>c.trim()).filter(Boolean):[],l=o[r]?o[r].split(";").map(c=>c.trim()).filter(Boolean):[],a=new Map;l.forEach(c=>{const[d,h]=c.split(":").map(p=>p.trim());a.set(d,h)}),s.forEach(c=>{const[d,h]=c.split(":").map(p=>p.trim());a.set(d,h)}),o[r]=Array.from(a.entries()).map(([c,d])=>`${c}: ${d}`).join("; ")}else o[r]=i}),o},{})}function yi(n,t){return t.filter(e=>e.type===n.type.name).filter(e=>e.attribute.rendered).map(e=>e.attribute.renderHTML?e.attribute.renderHTML(n.attrs)||{}:{[e.name]:n.attrs[e.name]}).reduce((e,o)=>G(e,o),{})}function kc(n){return typeof n=="function"}function I(n,t=void 0,...e){return kc(n)?t?n.bind(t)(...e):n(...e):n}function vu(n={}){return Object.keys(n).length===0&&n.constructor===Object}function bu(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function bl(n,t){return"style"in n?n:{...n,getAttrs:e=>{const o=n.getAttrs?n.getAttrs(e):n.attrs;if(o===!1)return!1;const r=t.reduce((i,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(e):bu(e.getAttribute(s.name));return l==null?i:{...i,[s.name]:l}},{});return{...o,...r}}}}function kl(n){return Object.fromEntries(Object.entries(n).filter(([t,e])=>t==="attrs"&&vu(e)?!1:e!=null))}function ku(n,t){var e;const o=bc(n),{nodeExtensions:r,markExtensions:i}=yr(n),s=(e=r.find(c=>C(c,"topNode")))===null||e===void 0?void 0:e.name,l=Object.fromEntries(r.map(c=>{const d=o.filter(w=>w.type===c.name),h={name:c.name,options:c.options,storage:c.storage,editor:t},p=n.reduce((w,x)=>{const T=C(x,"extendNodeSchema",h);return{...w,...T?T(c):{}}},{}),u=kl({...p,content:I(C(c,"content",h)),marks:I(C(c,"marks",h)),group:I(C(c,"group",h)),inline:I(C(c,"inline",h)),atom:I(C(c,"atom",h)),selectable:I(C(c,"selectable",h)),draggable:I(C(c,"draggable",h)),code:I(C(c,"code",h)),whitespace:I(C(c,"whitespace",h)),linebreakReplacement:I(C(c,"linebreakReplacement",h)),defining:I(C(c,"defining",h)),isolating:I(C(c,"isolating",h)),attrs:Object.fromEntries(d.map(w=>{var x;return[w.name,{default:(x=w==null?void 0:w.attribute)===null||x===void 0?void 0:x.default}]}))}),f=I(C(c,"parseHTML",h));f&&(u.parseDOM=f.map(w=>bl(w,d)));const m=C(c,"renderHTML",h);m&&(u.toDOM=w=>m({node:w,HTMLAttributes:yi(w,d)}));const g=C(c,"renderText",h);return g&&(u.toText=g),[c.name,u]})),a=Object.fromEntries(i.map(c=>{const d=o.filter(g=>g.type===c.name),h={name:c.name,options:c.options,storage:c.storage,editor:t},p=n.reduce((g,w)=>{const x=C(w,"extendMarkSchema",h);return{...g,...x?x(c):{}}},{}),u=kl({...p,inclusive:I(C(c,"inclusive",h)),excludes:I(C(c,"excludes",h)),group:I(C(c,"group",h)),spanning:I(C(c,"spanning",h)),code:I(C(c,"code",h)),attrs:Object.fromEntries(d.map(g=>{var w;return[g.name,{default:(w=g==null?void 0:g.attribute)===null||w===void 0?void 0:w.default}]}))}),f=I(C(c,"parseHTML",h));f&&(u.parseDOM=f.map(g=>bl(g,d)));const m=C(c,"renderHTML",h);return m&&(u.toDOM=g=>m({mark:g,HTMLAttributes:yi(g,d)})),[c.name,u]}));return new ga({topNode:s,nodes:l,marks:a})}function Vr(n,t){return t.nodes[n]||t.marks[n]||null}function xl(n,t){return Array.isArray(t)?t.some(e=>(typeof e=="string"?e:e.name)===n.name):t}function es(n,t){const e=Fe.fromSchema(t).serializeFragment(n),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(e),o.innerHTML}const xu=(n,t=500)=>{let e="";const o=n.parentOffset;return n.parent.nodesBetween(Math.max(0,o-t),o,(r,i,s,l)=>{var a,c;const d=((c=(a=r.type.spec).toText)===null||c===void 0?void 0:c.call(a,{node:r,pos:i,parent:s,index:l}))||r.textContent||"%leaf%";e+=r.isAtom&&!r.isText?d:d.slice(0,Math.max(0,o-i))}),e};function ns(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class wr{constructor(t){this.find=t.find,this.handler=t.handler}}const Cu=(n,t)=>{if(ns(t))return t.exec(n);const e=t(n);if(!e)return null;const o=[e.text];return o.index=e.index,o.input=n,o.data=e.data,e.replaceWith&&(e.text.includes(e.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),o.push(e.replaceWith)),o};function _n(n){var t;const{editor:e,from:o,to:r,text:i,rules:s,plugin:l}=n,{view:a}=e;if(a.composing)return!1;const c=a.state.doc.resolve(o);if(c.parent.type.spec.code||!((t=c.nodeBefore||c.nodeAfter)===null||t===void 0)&&t.marks.find(p=>p.type.spec.code))return!1;let d=!1;const h=xu(c)+i;return s.forEach(p=>{if(d)return;const u=Cu(h,p.find);if(!u)return;const f=a.state.tr,m=mr({state:a.state,transaction:f}),g={from:o-(u[0].length-i.length),to:r},{commands:w,chain:x,can:T}=new gr({editor:e,state:m});p.handler({state:m,range:g,match:u,commands:w,chain:x,can:T})===null||!f.steps.length||(f.setMeta(l,{transform:f,from:o,to:r,text:i}),a.dispatch(f),d=!0)}),d}function Mu(n){const{editor:t,rules:e}=n,o=new Q({state:{init(){return null},apply(r,i,s){const l=r.getMeta(o);if(l)return l;const a=r.getMeta("applyInputRules");return a&&setTimeout(()=>{let{text:c}=a;typeof c=="string"?c=c:c=es(v.from(c),s.schema);const{from:d}=a,h=d+c.length;_n({editor:t,from:d,to:h,text:c,rules:e,plugin:o})}),r.selectionSet||r.docChanged?null:i}},props:{handleTextInput(r,i,s,l){return _n({editor:t,from:i,to:s,text:l,rules:e,plugin:o})},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{const{$cursor:i}=r.state.selection;i&&_n({editor:t,from:i.pos,to:i.pos,text:"",rules:e,plugin:o})}),!1)},handleKeyDown(r,i){if(i.key!=="Enter")return!1;const{$cursor:s}=r.state.selection;return s?_n({editor:t,from:s.pos,to:s.pos,text:` 11`,rules:e,plugin:o}):!1}},isInputRules:!0});return o}function Su(n){return Object.prototype.toString.call(n).slice(8,-1)}function Gn(n){return Su(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function vr(n,t){const e={...n};return Gn(n)&&Gn(t)&&Object.keys(t).forEach(o=>{Gn(t[o])&&Gn(n[o])?e[o]=vr(n[o],t[o]):e[o]=t[o]}),e}class ne{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.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=I(C(this,"addOptions",{name:this.name}))),this.storage=I(C(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new ne(t)}configure(t={}){const e=this.extend({...this.config,addOptions:()=>vr(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new ne(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=I(C(e,"addOptions",{name:e.name})),e.storage=I(C(e,"addStorage",{name:e.name,options:e.options})),e}static handleExit({editor:t,mark:e}){const{tr:o}=t.state,r=t.state.selection.$from;if(r.pos===r.end()){const i=r.marks();if(!i.find(l=>(l==null?void 0:l.type.name)===e.name))return!1;const s=i.find(l=>(l==null?void 0:l.type.name)===e.name);return s&&o.removeStoredMark(s),o.insertText(" ",r.pos),t.view.dispatch(o),!0}return!1}}function Au(n){return typeof n=="number"}class Eu{constructor(t){this.find=t.find,this.handler=t.handler}}const Ou=(n,t,e)=>{if(ns(t))return[...n.matchAll(t)];const o=t(n,e);return o?o.map(r=>{const i=[r.text];return i.index=r.index,i.input=n,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 Tu(n){const{editor:t,state:e,from:o,to:r,rule:i,pasteEvent:s,dropEvent:l}=n,{commands:a,chain:c,can:d}=new gr({editor:t,state:e}),h=[];return e.doc.nodesBetween(o,r,(p,u)=>{if(!p.isTextblock||p.type.spec.code)return;const f=Math.max(o,u),m=Math.min(r,u+p.content.size),g=p.textBetween(f-u,m-u,void 0,"");Ou(g,i.find,s).forEach(w=>{if(w.index===void 0)return;const x=f+w.index+1,T=x+w[0].length,$={from:e.tr.mapping.map(x),to:e.tr.mapping.map(T)},O=i.handler({state:e,range:$,match:w,commands:a,chain:c,can:d,pasteEvent:s,dropEvent:l});h.push(O)})}),h.every(p=>p!==null)}let Xn=null;const Nu=n=>{var t;const e=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(t=e.clipboardData)===null||t===void 0||t.setData("text/html",n),e};function Du(n){const{editor:t,rules:e}=n;let o=null,r=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:c,from:d,to:h,rule:p,pasteEvt:u})=>{const f=c.tr,m=mr({state:c,transaction:f});if(!(!Tu({editor:t,state:m,from:Math.max(d-1,0),to:h.b-1,rule:p,pasteEvent:u,dropEvent:l})||!f.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,f}};return e.map(c=>new Q({view(d){const h=u=>{var f;o=!((f=d.dom.parentElement)===null||f===void 0)&&f.contains(u.target)?d.dom.parentElement:null,o&&(Xn=t)},p=()=>{Xn&&(Xn=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(d,h)=>{if(i=o===d.dom.parentElement,l=h,!i){const p=Xn;p!=null&&p.isEditable&&setTimeout(()=>{const u=p.state.selection;u&&p.commands.deleteRange({from:u.from,to:u.to})},10)}return!1},paste:(d,h)=>{var p;const u=(p=h.clipboardData)===null||p===void 0?void 0:p.getData("text/html");return s=h,r=!!(u!=null&&u.includes("data-pm-slice")),!1}}},appendTransaction:(d,h,p)=>{const u=d[0],f=u.getMeta("uiEvent")==="paste"&&!r,m=u.getMeta("uiEvent")==="drop"&&!i,g=u.getMeta("applyPasteRules"),w=!!g;if(!f&&!m&&!w)return;if(w){let{text:$}=g;typeof $=="string"?$=$:$=es(v.from($),p.schema);const{from:O}=g,H=O+$.length,j=Nu($);return a({rule:c,state:p,from:O,to:{b:H},pasteEvt:j})}const x=h.doc.content.findDiffStart(p.doc.content),T=h.doc.content.findDiffEnd(p.doc.content);if(!(!Au(x)||!T||x===T.b))return a({rule:c,state:p,from:x,to:T,pasteEvt:s})}}))}function Ru(n){const t=n.filter((e,o)=>n.indexOf(e)!==o);return Array.from(new Set(t))}class _e{constructor(t,e){this.splittableMarks=[],this.editor=e,this.extensions=_e.resolve(t),this.schema=ku(this.extensions,e),this.setupExtensions()}static resolve(t){const e=_e.sort(_e.flatten(t)),o=Ru(e.map(r=>r.name));return o.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${o.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}static flatten(t){return t.map(e=>{const o={name:e.name,options:e.options,storage:e.storage},r=C(e,"addExtensions",o);return r?[e,...this.flatten(r())]:e}).flat(10)}static sort(t){return t.sort((e,o)=>{const r=C(e,"priority")||100,i=C(o,"priority")||100;return r>i?-1:r<i?1:0})}get commands(){return this.extensions.reduce((t,e)=>{const o={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Vr(e.name,this.schema)},r=C(e,"addCommands",o);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this,e=_e.sort([...this.extensions].reverse()),o=[],r=[],i=e.map(s=>{const l={name:s.name,options:s.options,storage:s.storage,editor:t,type:Vr(s.name,this.schema)},a=[],c=C(s,"addKeyboardShortcuts",l);let d={};if(s.type==="mark"&&C(s,"exitable",l)&&(d.ArrowRight=()=>ne.handleExit({editor:t,mark:s})),c){const m=Object.fromEntries(Object.entries(c()).map(([g,w])=>[g,()=>w({editor:t})]));d={...d,...m}}const h=Kp(d);a.push(h);const p=C(s,"addInputRules",l);xl(s,t.options.enableInputRules)&&p&&o.push(...p());const u=C(s,"addPasteRules",l);xl(s,t.options.enablePasteRules)&&u&&r.push(...u());const f=C(s,"addProseMirrorPlugins",l);if(f){const m=f();a.push(...m)}return a}).flat();return[Mu({editor:t,rules:o}),...Du({editor:t,rules:r}),...i]}get attributes(){return bc(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=yr(this.extensions);return Object.fromEntries(e.filter(o=>!!C(o,"addNodeView")).map(o=>{const r=this.attributes.filter(a=>a.type===o.name),i={name:o.name,options:o.options,storage:o.storage,editor:t,type:ot(o.name,this.schema)},s=C(o,"addNodeView",i);if(!s)return[];const l=(a,c,d,h,p)=>{const u=yi(a,r);return s()({node:a,view:c,getPos:d,decorations:h,innerDecorations:p,editor:t,extension:o,HTMLAttributes:u})};return[o.name,l]}))}setupExtensions(){this.extensions.forEach(t=>{var e;this.editor.extensionStorage[t.name]=t.storage;const o={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:Vr(t.name,this.schema)};t.type==="mark"&&(!((e=I(C(t,"keepOnSplit",o)))!==null&&e!==void 0)||e)&&this.splittableMarks.push(t.name);const r=C(t,"onBeforeCreate",o),i=C(t,"onCreate",o),s=C(t,"onUpdate",o),l=C(t,"onSelectionUpdate",o),a=C(t,"onTransaction",o),c=C(t,"onFocus",o),d=C(t,"onBlur",o),h=C(t,"onDestroy",o);r&&this.editor.on("beforeCreate",r),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),h&&this.editor.on("destroy",h)})}}class ut{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.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=I(C(this,"addOptions",{name:this.name}))),this.storage=I(C(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new ut(t)}configure(t={}){const e=this.extend({...this.config,addOptions:()=>vr(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new ut({...this.config,...t});return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=I(C(e,"addOptions",{name:e.name})),e.storage=I(C(e,"addStorage",{name:e.name,options:e.options})),e}}function xc(n,t,e){const{from:o,to:r}=t,{blockSeparator:i=` 12
13`,textSerializers:s={}}=e||{};let l="";return n.nodesBetween(o,r,(a,c,d,h)=>{var p;a.isBlock&&c>o&&(l+=i);const u=s==null?void 0:s[a.type.name];if(u)return d&&(l+=u({node:a,pos:c,parent:d,index:h,range:t})),!1;a.isText&&(l+=(p=a==null?void 0:a.text)===null||p===void 0?void 0:p.slice(Math.max(o,c)-c,r-c))}),l}function Cc(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,t])=>t.spec.toText).map(([t,e])=>[t,e.spec.toText]))}const Lu=ut.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Q({key:new at("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:t,schema:e}=n,{doc:o,selection:r}=t,{ranges:i}=r,s=Math.min(...i.map(c=>c.$from.pos)),l=Math.max(...i.map(c=>c.$to.pos)),a=Cc(e);return xc(o,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),Iu=()=>({editor:n,view:t})=>(requestAnimationFrame(()=>{var e;n.isDestroyed||(t.dom.blur(),(e=window==null?void 0:window.getSelection())===null||e===void 0||e.removeAllRanges())}),!0),Pu=(n=!1)=>({commands:t})=>t.setContent("",n),$u=()=>({state:n,tr:t,dispatch:e})=>{const{selection:o}=t,{ranges:r}=o;return e&&r.forEach(({$from:i,$to:s})=>{n.doc.nodesBetween(i.pos,s.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:d}=t,h=c.resolve(d.map(a)),p=c.resolve(d.map(a+l.nodeSize)),u=h.blockRange(p);if(!u)return;const f=ln(u);if(l.type.isTextblock){const{defaultType:m}=h.parent.contentMatchAt(h.index());t.setNodeMarkup(u.start,m)}(f||f===0)&&t.lift(u,f)})}),!0},Hu=n=>t=>n(t),zu=()=>({state:n,dispatch:t})=>ru(n,t),Bu=(n,t)=>({editor:e,tr:o})=>{const{state:r}=e,i=r.doc.slice(n.from,n.to);o.deleteRange(n.from,n.to);const s=o.mapping.map(t);return o.insert(s,i.content),o.setSelection(new E(o.doc.resolve(Math.max(s-1,0)))),!0},Vu=()=>({tr:n,dispatch:t})=>{const{selection:e}=n,o=e.$anchor.node();if(o.content.size>0)return!1;const r=n.selection.$anchor;for(let i=r.depth;i>0;i-=1)if(r.node(i).type===o.type){if(t){const s=r.before(i),l=r.after(i);n.delete(s,l).scrollIntoView()}return!0}return!1},Fu=n=>({tr:t,state:e,dispatch:o})=>{const r=ot(n,e.schema),i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r){if(o){const l=i.before(s),a=i.after(s);t.delete(l,a).scrollIntoView()}return!0}return!1},ju=n=>({tr:t,dispatch:e})=>{const{from:o,to:r}=n;return e&&t.delete(o,r),!0},Wu=()=>({state:n,dispatch:t})=>Jp(n,t),qu=()=>({commands:n})=>n.keyboardShortcut("Enter"),Ku=()=>({state:n,dispatch:t})=>ou(n,t);function Do(n,t,e={strict:!0}){const o=Object.keys(t);return o.length?o.every(r=>e.strict?t[r]===n[r]:ns(t[r])?t[r].test(n[r]):t[r]===n[r]):!0}function Mc(n,t,e={}){return n.find(o=>o.type===t&&Do(Object.fromEntries(Object.keys(e).map(r=>[r,o.attrs[r]])),e))}function Cl(n,t,e={}){return!!Mc(n,t,e)}function rs(n,t,e){var o;if(!n||!t)return;let r=n.parent.childAfter(n.parentOffset);if((!r.node||!r.node.marks.some(c=>c.type===t))&&(r=n.parent.childBefore(n.parentOffset)),!r.node||!r.node.marks.some(c=>c.type===t)||(e=e||((o=r.node.marks[0])===null||o===void 0?void 0:o.attrs),!Mc([...r.node.marks],t,e)))return;let i=r.index,s=n.start()+r.offset,l=i+1,a=s+r.node.nodeSize;for(;i>0&&Cl([...n.parent.child(i-1).marks],t,e);)i-=1,s-=n.parent.child(i).nodeSize;for(;l<n.parent.childCount&&Cl([...n.parent.child(l).marks],t,e);)a+=n.parent.child(l).nodeSize,l+=1;return{from:s,to:a}}function Ce(n,t){if(typeof n=="string"){if(!t.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return t.marks[n]}return n}const Ju=(n,t={})=>({tr:e,state:o,dispatch:r})=>{const i=Ce(n,o.schema),{doc:s,selection:l}=e,{$from:a,from:c,to:d}=l;if(r){const h=rs(a,i,t);if(h&&h.from<=c&&h.to>=d){const p=E.create(s,h.from,h.to);e.setSelection(p)}}return!0},Uu=n=>t=>{const e=typeof n=="function"?n(t):n;for(let o=0;o<e.length;o+=1)if(e[o](t))return!0;return!1};function Sc(n){return n instanceof E}function Te(n=0,t=0,e=0){return Math.min(Math.max(n,t),e)}function Ac(n,t=null){if(!t)return null;const e=N.atStart(n),o=N.atEnd(n);if(t==="start"||t===!0)return e;if(t==="end")return o;const r=e.from,i=o.to;return t==="all"?E.create(n,Te(0,r,i),Te(n.content.size,r,i)):E.create(n,Te(t,r,i),Te(t,r,i))}function Zu(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function is(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const _u=(n=null,t={})=>({editor:e,view:o,tr:r,dispatch:i})=>{t={scrollIntoView:!0,...t};const s=()=>{(is()||Zu())&&o.dom.focus(),requestAnimationFrame(()=>{e.isDestroyed||(o.focus(),t!=null&&t.scrollIntoView&&e.commands.scrollIntoView())})};if(o.hasFocus()&&n===null||n===!1)return!0;
vendor: 13,955 bytes, line 13
13if(i&&n===null&&!Sc(e.state.selection))return s(),!0;const l=Ac(r.doc,n)||e.state.selection,a=e.state.selection.eq(l);return i&&(a||r.setSelection(l),a&&r.storedMarks&&r.setStoredMarks(r.storedMarks),s()),!0},Gu=(n,t)=>e=>n.every((o,r)=>t(o,{...e,index:r})),Xu=(n,t)=>({tr:e,commands:o})=>o.insertContentAt({from:e.selection.from,to:e.selection.to},n,t),Ec=n=>{const t=n.childNodes;for(let e=t.length-1;e>=0;e-=1){const o=t[e];o.nodeType===3&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?n.removeChild(o):o.nodeType===1&&Ec(o)}return n};function Qn(n){const t=`<body>${n}</body>`,e=new window.DOMParser().parseFromString(t,"text/html").body;return Ec(e)}function Hn(n,t,e){if(n instanceof ge||n instanceof v)return n;e={slice:!0,parseOptions:{},...e};const o=typeof n=="object"&&n!==null,r=typeof n=="string";if(o)try{if(Array.isArray(n)&&n.length>0)return v.fromArray(n.map(s=>t.nodeFromJSON(s)));const i=t.nodeFromJSON(n);return e.errorOnInvalidContent&&i.check(),i}catch(i){if(e.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",i),Hn("",t,e)}if(r){if(e.errorOnInvalidContent){let s=!1,l="";const a=new ga({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(e.slice?bn.fromSchema(a).parseSlice(Qn(n),e.parseOptions):bn.fromSchema(a).parse(Qn(n),e.parseOptions),e.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=bn.fromSchema(t);return e.slice?i.parseSlice(Qn(n),e.parseOptions).content:i.parse(Qn(n),e.parseOptions)}return Hn("",t,e)}function Qu(n,t,e){const o=n.steps.length-1;if(o<t)return;const r=n.steps[o];if(!(r instanceof tt||r instanceof et))return;const i=n.mapping.maps[o];let s=0;i.forEach((l,a,c,d)=>{s===0&&(s=d)}),n.setSelection(N.near(n.doc.resolve(s),e))}const Yu=n=>!("type"in n),tf=(n,t,e)=>({tr:o,dispatch:r,editor:i})=>{var s;if(r){e={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...e};let l;const a=m=>{i.emit("contentError",{editor:i,error:m,disableCollaboration:()=>{i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...e.parseOptions};if(!e.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Hn(t,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(m){a(m)}try{l=Hn(t,i.schema,{parseOptions:c,errorOnInvalidContent:(s=e.errorOnInvalidContent)!==null&&s!==void 0?s:i.options.enableContentCheck})}catch(m){return a(m),!1}let{from:d,to:h}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},p=!0,u=!0;if((Yu(l)?l:[l]).forEach(m=>{m.check(),p=p?m.isText&&m.marks.length===0:!1,u=u?m.isBlock:!1}),d===h&&u){const{parent:m}=o.doc.resolve(d);m.isTextblock&&!m.type.spec.code&&!m.childCount&&(d-=1,h+=1)}let f;if(p){if(Array.isArray(t))f=t.map(m=>m.text||"").join("");else if(t instanceof v){let m="";t.forEach(g=>{g.text&&(m+=g.text)}),f=m}else typeof t=="object"&&t&&t.text?f=t.text:f=t;o.insertText(f,d,h)}else f=l,o.replaceWith(d,h,f);e.updateSelection&&Qu(o,o.steps.length-1,-1),e.applyInputRules&&o.setMeta("applyInputRules",{from:d,text:f}),e.applyPasteRules&&o.setMeta("applyPasteRules",{from:d,text:f})}return!0},ef=()=>({state:n,dispatch:t})=>Yp(n,t),nf=()=>({state:n,dispatch:t})=>tu(n,t),of=()=>({state:n,dispatch:t})=>Up(n,t),rf=()=>({state:n,dispatch:t})=>Xp(n,t),sf=()=>({state:n,dispatch:t,tr:e})=>{try{const o=cr(n.doc,n.selection.$from.pos,-1);return o==null?!1:(e.join(o,2),t&&t(e),!0)}catch{return!1}},lf=()=>({state:n,dispatch:t,tr:e})=>{try{const o=cr(n.doc,n.selection.$from.pos,1);return o==null?!1:(e.join(o,2),t&&t(e),!0)}catch{return!1}},af=()=>({state:n,dispatch:t})=>Zp(n,t),cf=()=>({state:n,dispatch:t})=>_p(n,t);function Oc(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function df(n){const t=n.split(/-(?!$)/);let e=t[t.length-1];e==="Space"&&(e=" ");let o,r,i,s;for(let l=0;l<t.length-1;l+=1){const a=t[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))o=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))is()||Oc()?s=!0:r=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return o&&(e=`Alt-${e}`),r&&(e=`Ctrl-${e}`),s&&(e=`Meta-${e}`),i&&(e=`Shift-${e}`),e}const hf=n=>({editor:t,view:e,tr:o,dispatch:r})=>{const i=df(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=t.captureTransaction(()=>{e.someProp("handleKeyDown",c=>c(e,l))});return a==null||a.steps.forEach(c=>{const d=c.map(o.mapping);d&&r&&o.maybeStep(d)}),!0};function zn(n,t,e={}){const{from:o,to:r,empty:i}=n.selection,s=t?ot(t,n.schema):null,l=[];n.doc.nodesBetween(o,r,(d,h)=>{if(d.isText)return;const p=Math.max(o,h),u=Math.min(r,h+d.nodeSize);l.push({node:d,from:p,to:u})});const a=r-o,c=l.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>Do(d.node.attrs,e,{strict:!1}));return i?!!c.length:c.reduce((d,h)=>d+h.to-h.from,0)>=a}const pf=(n,t={})=>({state:e,dispatch:o})=>{const r=ot(n,e.schema);return zn(e,r,t)?eu(e,o):!1},uf=()=>({state:n,dispatch:t})=>iu(n,t),ff=n=>({state:t,dispatch:e})=>{const o=ot(n,t.schema);return fu(o)(t,e)},mf=()=>({state:n,dispatch:t})=>nu(n,t);function br(n,t){return t.nodes[n]?"node":t.marks[n]?"mark":null}function Ml(n,t){const e=typeof t=="string"?[t]:t;return Object.keys(n).reduce((o,r)=>(e.includes(r)||(o[r]=n[r]),o),{})}const gf=(n,t)=>({tr:e,state:o,dispatch:r})=>{let i=null,s=null;const l=br(typeof n=="string"?n:n.name,o.schema);return l?(l==="node"&&(i=ot(n,o.schema)),l==="mark"&&(s=Ce(n,o.schema)),r&&e.selection.ranges.forEach(a=>{o.doc.nodesBetween(a.$from.pos,a.$to.pos,(c,d)=>{i&&i===c.type&&e.setNodeMarkup(d,void 0,Ml(c.attrs,t)),s&&c.marks.length&&c.marks.forEach(h=>{s===h.type&&e.addMark(d,d+c.nodeSize,s.create(Ml(h.attrs,t)))})})}),!0):!1},yf=()=>({tr:n,dispatch:t})=>(t&&n.scrollIntoView(),!0),wf=()=>({tr:n,dispatch:t})=>{if(t){const e=new Rt(n.doc);n.setSelection(e)}return!0},vf=()=>({state:n,dispatch:t})=>Gp(n,t),bf=()=>({state:n,dispatch:t})=>Qp(n,t),kf=()=>({state:n,dispatch:t})=>su(n,t),xf=()=>({state:n,dispatch:t})=>cu(n,t),Cf=()=>({state:n,dispatch:t})=>au(n,t);function wi(n,t,e={},o={}){return Hn(n,t,{slice:!1,parseOptions:e,errorOnInvalidContent:o.errorOnInvalidContent})}const Mf=(n,t=!1,e={},o={})=>({editor:r,tr:i,dispatch:s,commands:l})=>{var a,c;const{doc:d}=i;if(e.preserveWhitespace!=="full"){const h=wi(n,r.schema,e,{errorOnInvalidContent:(a=o.errorOnInvalidContent)!==null&&a!==void 0?a:r.options.enableContentCheck});return s&&i.replaceWith(0,d.content.size,h).setMeta("preventUpdate",!t),!0}return s&&i.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:d.content.size},n,{parseOptions:e,errorOnInvalidContent:(c=o.errorOnInvalidContent)!==null&&c!==void 0?c:r.options.enableContentCheck})};function Tc(n,t){const e=Ce(t,n.schema),{from:o,to:r,empty:i}=n.selection,s=[];i?(n.storedMarks&&s.push(...n.storedMarks),s.push(...n.selection.$head.marks())):n.doc.nodesBetween(o,r,a=>{s.push(...a.marks)});const l=s.find(a=>a.type.name===e.name);return l?{...l.attrs}:{}}function Sf(n,t){const e=new Fi(n);return t.forEach(o=>{o.steps.forEach(r=>{e.step(r)})}),e}function Af(n){for(let t=0;t<n.edgeCount;t+=1){const{type:e}=n.edge(t);if(e.isTextblock&&!e.hasRequiredAttrs())return e}return null}function Ef(n,t,e){const o=[];return n.nodesBetween(t.from,t.to,(r,i)=>{e(r)&&o.push({node:r,pos:i})}),o}function Nc(n,t){for(let e=n.depth;e>0;e-=1){const o=n.node(e);if(t(o))return{pos:e>0?n.before(e):0,start:n.start(e),depth:e,node:o}}}function kr(n){return t=>Nc(t.$from,n)}function Of(n,t){const e={from:0,to:n.content.size};return xc(n,e,t)}function Tf(n,t){const e=ot(t,n.schema),{from:o,to:r}=n.selection,i=[];n.doc.nodesBetween(o,r,l=>{i.push(l)});const s=i.reverse().find(l=>l.type.name===e.name);return s?{...s.attrs}:{}}function Dc(n,t){const e=br(typeof t=="string"?t:t.name,n.schema);return e==="node"?Tf(n,t):e==="mark"?Tc(n,t):{}}function Nf(n,t=JSON.stringify){const e={};return n.filter(o=>{const r=t(o);return Object.prototype.hasOwnProperty.call(e,r)?!1:e[r]=!0})}function Df(n){const t=Nf(n);return t.length===1?t:t.filter((e,o)=>!t.filter((r,i)=>i!==o).some(r=>e.oldRange.from>=r.oldRange.from&&e.oldRange.to<=r.oldRange.to&&e.newRange.from>=r.newRange.from&&e.newRange.to<=r.newRange.to))}function Rf(n){const{mapping:t,steps:e}=n,o=[];return t.maps.forEach((r,i)=>{const s=[];if(r.ranges.length)r.forEach((l,a)=>{s.push({from:l,to:a})});else{const{from:l,to:a}=e[i];if(l===void 0||a===void 0)return;s.push({from:l,to:a})}s.forEach(({from:l,to:a})=>{const c=t.slice(i).map(l,-1),d=t.slice(i).map(a),h=t.invert().map(c,-1),p=t.invert().map(d);o.push({oldRange:{from:h,to:p},newRange:{from:c,to:d}})})}),Df(o)}function ss(n,t,e){const o=[];return n===t?e.resolve(n).marks().forEach(r=>{const i=e.resolve(n),s=rs(i,r.type);s&&o.push({mark:r,...s})}):e.nodesBetween(n,t,(r,i)=>{!r||(r==null?void 0:r.nodeSize)===void 0||o.push(...r.marks.map(s=>({from:i,to:i+r.nodeSize,mark:s})))}),o}function ho(n,t,e){return Object.fromEntries(Object.entries(e).filter(([o])=>{const r=n.find(i=>i.type===t&&i.name===o);return r?r.attribute.keepOnSplit:!1}))}function vi(n,t,e={}){const{empty:o,ranges:r}=n.selection,i=t?Ce(t,n.schema):null;if(o)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>Do(d.attrs,e,{strict:!1}));let s=0;const l=[];if(r.forEach(({$from:d,$to:h})=>{const p=d.pos,u=h.pos;n.doc.nodesBetween(p,u,(f,m)=>{if(!f.isText&&!f.marks.length)return;const g=Math.max(p,m),w=Math.min(u,m+f.nodeSize),x=w-g;s+=x,l.push(...f.marks.map(T=>({mark:T,from:g,to:w})))})}),s===0)return!1;const a=l.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>Do(d.mark.attrs,e,{strict:!1})).reduce((d,h)=>d+h.to-h.from,0),c=l.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,h)=>d+h.to-h.from,0);return(a>0?a+c:a)>=s}function Lf(n,t,e={}){if(!t)return zn(n,null,e)||vi(n,null,e);const o=br(t,n.schema);return o==="node"?zn(n,t,e):o==="mark"?vi(n,t,e):!1}function bi(n,t){const{nodeExtensions:e}=yr(t),o=e.find(s=>s.name===n);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=I(C(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function ls(n,{checkChildren:t=!0,ignoreWhitespace:e=!1}={}){var o;if(e){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((o=n.text)!==null&&o!==void 0?o:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(t){let r=!0;return n.content.forEach(i=>{r!==!1&&(ls(i,{ignoreWhitespace:e,checkChildren:t})||(r=!1))}),r}return!1}function If(n){return n instanceof A}function Pf(n,t,e){var o;const{selection:r}=t;let i=null;if(Sc(r)&&(i=r.$cursor),i){const l=(o=n.storedMarks)!==null&&o!==void 0?o:i.marks();return!!e.isInSet(l)||!l.some(a=>a.type.excludes(e))}const{ranges:s}=r;return s.some(({$from:l,$to:a})=>{let c=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(e):!1;return n.doc.nodesBetween(l.pos,a.pos,(d,h,p)=>{if(c)return!1;if(d.isInline){const u=!p||p.type.allowsMarkType(e),f=!!e.isInSet(d.marks)||!d.marks.some(m=>m.type.excludes(e));c=u&&f}return!c}),c})}const $f=(n,t={})=>({tr:e,state:o,dispatch:r})=>{const{selection:i}=e,{empty:s,ranges:l}=i,a=Ce(n,o.schema);if(r)if(s){const c=Tc(o,a);e.addStoredMark(a.create({...c,...t}))}else l.forEach(c=>{const d=c.$from.pos,h=c.$to.pos;o.doc.nodesBetween(d,h,(p,u)=>{const f=Math.max(u,d),m=Math.min(u+p.nodeSize,h);p.marks.find(g=>g.type===a)?p.marks.forEach(g=>{a===g.type&&e.addMark(f,m,a.create({...g.attrs,...t}))}):e.addMark(f,m,a.create(t))})});return Pf(o,e,a)},Hf=(n,t)=>({tr:e})=>(e.setMeta(n,t),!0),zf=(n,t={})=>({state:e,dispatch:o,chain:r})=>{const i=ot(n,e.schema);let s;return e.selection.$anchor.sameParent(e.selection.$head)&&(s=e.selection.$anchor.parent.attrs),i.isTextblock?r().command(({commands:l})=>vl(i,{...s,...t})(e)?!0:l.clearNodes()).command(({state:l})=>vl(i,{...s,...t})(l,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Bf=n=>({tr:t,dispatch:e})=>{if(e){const{doc:o}=t,r=Te(n,0,o.content.size),i=A.create(o,r);t.setSelection(i)}return!0},Vf=n=>({tr:t,dispatch:e})=>{if(e){const{doc:o}=t,{from:r,to:i}=typeof n=="number"?{from:n,to:n}:n,s=E.atStart(o).from,l=E.atEnd(o).to,a=Te(r,s,l),c=Te(i,s,l),d=E.create(o,a,c);t.setSelection(d)}return!0},Ff=n=>({state:t,dispatch:e})=>{const o=ot(n,t.schema);return yu(o)(t,e)};function Sl(n,t){const e=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(e){const o=e.filter(r=>t==null?void 0:t.includes(r.type.name));n.tr.ensureMarks(o)}}const jf=({keepMarks:n=!0}={})=>({tr:t,state:e,dispatch:o,editor:r})=>{const{selection:i,doc:s}=t,{$from:l,$to:a}=i,c=r.extensionManager.attributes,d=ho(c,l.node().type.name,l.node().attrs);if(i instanceof A&&i.node.isBlock)return!l.parentOffset||!Ge(s,l.pos)?!1:(o&&(n&&Sl(e,r.extensionManager.splittableMarks),t.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const h=a.parentOffset===a.parent.content.size,p=l.depth===0?void 0:Af(l.node(-1).contentMatchAt(l.indexAfter(-1)));let u=h&&p?[{type:p,attrs:d}]:void 0,f=Ge(t.doc,t.mapping.map(l.pos),1,u);if(!u&&!f&&Ge(t.doc,t.mapping.map(l.pos),1,p?[{type:p}]:void 0)&&(f=!0,u=p?[{type:p,attrs:d}]:void 0),o){if(f&&(i instanceof E&&t.deleteSelection(),t.split(t.mapping.map(l.pos),1,u),p&&!h&&!l.parentOffset&&l.parent.type!==p)){const m=t.mapping.map(l.before()),g=t.doc.resolve(m);
vendor: 4,167 bytes, line 13
13l.node(-1).canReplaceWith(g.index(),g.index()+1,p)&&t.setNodeMarkup(t.mapping.map(l.before()),p)}n&&Sl(e,r.extensionManager.splittableMarks),t.scrollIntoView()}return f},Wf=(n,t={})=>({tr:e,state:o,dispatch:r,editor:i})=>{var s;const l=ot(n,o.schema),{$from:a,$to:c}=o.selection,d=o.selection.node;if(d&&d.isBlock||a.depth<2||!a.sameParent(c))return!1;const h=a.node(-1);if(h.type!==l)return!1;const p=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(r){let w=v.empty;const x=a.index(-1)?1:a.index(-2)?2:3;for(let K=a.depth-x;K>=a.depth-3;K-=1)w=v.from(a.node(K).copy(w));const T=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,$={...ho(p,a.node().type.name,a.node().attrs),...t},O=((s=l.contentMatch.defaultType)===null||s===void 0?void 0:s.createAndFill($))||void 0;w=w.append(v.from(l.createAndFill(null,O)||void 0));const H=a.before(a.depth-(x-1));e.replace(H,a.after(-T),new k(w,4-x,0));let j=-1;e.doc.nodesBetween(H,e.doc.content.size,(K,P)=>{if(j>-1)return!1;K.isTextblock&&K.content.size===0&&(j=P+1)}),j>-1&&e.setSelection(E.near(e.doc.resolve(j))),e.scrollIntoView()}return!0}const u=c.pos===a.end()?h.contentMatchAt(0).defaultType:null,f={...ho(p,h.type.name,h.attrs),...t},m={...ho(p,a.node().type.name,a.node().attrs),...t};e.delete(a.pos,c.pos);const g=u?[{type:l,attrs:f},{type:u,attrs:m}]:[{type:l,attrs:f}];if(!Ge(e.doc,a.pos,2))return!1;if(r){const{selection:w,storedMarks:x}=o,{splittableMarks:T}=i.extensionManager,$=x||w.$to.parentOffset&&w.$from.marks();if(e.split(a.pos,2,g).scrollIntoView(),!$||!r)return!0;const O=$.filter(H=>T.includes(H.type.name));e.ensureMarks(O)}return!0},Fr=(n,t)=>{const e=kr(i=>i.type===t)(n.selection);if(!e)return!0;const o=n.doc.resolve(Math.max(0,e.pos-1)).before(e.depth);if(o===void 0)return!0;const r=n.doc.nodeAt(o);return e.node.type===(r==null?void 0:r.type)&&ke(n.doc,e.pos)&&n.join(e.pos),!0},jr=(n,t)=>{const e=kr(i=>i.type===t)(n.selection);if(!e)return!0;const o=n.doc.resolve(e.start).after(e.depth);if(o===void 0)return!0;const r=n.doc.nodeAt(o);return e.node.type===(r==null?void 0:r.type)&&ke(n.doc,o)&&n.join(o),!0},qf=(n,t,e,o={})=>({editor:r,tr:i,state:s,dispatch:l,chain:a,commands:c,can:d})=>{const{extensions:h,splittableMarks:p}=r.extensionManager,u=ot(n,s.schema),f=ot(t,s.schema),{selection:m,storedMarks:g}=s,{$from:w,$to:x}=m,T=w.blockRange(x),$=g||m.$to.parentOffset&&m.$from.marks();if(!T)return!1;const O=kr(H=>bi(H.type.name,h))(m);if(T.depth>=1&&O&&T.depth-O.depth<=1){if(O.node.type===u)return c.liftListItem(f);if(bi(O.node.type.name,h)&&u.validContent(O.node.content)&&l)return a().command(()=>(i.setNodeMarkup(O.pos,u),!0)).command(()=>Fr(i,u)).command(()=>jr(i,u)).run()}return!e||!$||!l?a().command(()=>d().wrapInList(u,o)?!0:c.clearNodes()).wrapInList(u,o).command(()=>Fr(i,u)).command(()=>jr(i,u)).run():a().command(()=>{const H=d().wrapInList(u,o),j=$.filter(K=>p.includes(K.type.name));return i.ensureMarks(j),H?!0:c.clearNodes()}).wrapInList(u,o).command(()=>Fr(i,u)).command(()=>jr(i,u)).run()},Kf=(n,t={},e={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=e,s=Ce(n,o.schema);return vi(o,s,t)?r.unsetMark(s,{extendEmptyMarkRange:i}):r.setMark(s,t)},Jf=(n,t,e={})=>({state:o,commands:r})=>{const i=ot(n,o.schema),s=ot(t,o.schema),l=zn(o,i,e);let a;return o.selection.$anchor.sameParent(o.selection.$head)&&(a=o.selection.$anchor.parent.attrs),l?r.setNode(s,a):r.setNode(i,{...a,...e})},Uf=(n,t={})=>({state:e,commands:o})=>{const r=ot(n,e.schema);return zn(e,r,t)?o.lift(r):o.wrapIn(r,t)},Zf=()=>({state:n,dispatch:t})=>{const e=n.plugins;for(let o=0;o<e.length;o+=1){const r=e[o];let i;if(r.spec.isInputRules&&(i=r.getState(n))){if(t){const s=n.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(i.text){const 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},_f=()=>({tr:n,dispatch:t})=>{const{selection:e}=n,{empty:o,ranges:r}=e;return o||t&&r.forEach(i=>
vendor: 9,087 bytes, lines 13-53
13{n.removeMark(i.$from.pos,i.$to.pos)}),!0},Gf=(n,t={})=>({tr:e,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:s=!1}=t,{selection:l}=e,a=Ce(n,o.schema),{$from:c,empty:d,ranges:h}=l;if(!r)return!0;if(d&&s){let{from:p,to:u}=l;const f=(i=c.marks().find(g=>g.type===a))===null||i===void 0?void 0:i.attrs,m=rs(c,a,f);m&&(p=m.from,u=m.to),e.removeMark(p,u,a)}else h.forEach(p=>{e.removeMark(p.$from.pos,p.$to.pos,a)});return e.removeStoredMark(a),!0},Xf=(n,t={})=>({tr:e,state:o,dispatch:r})=>{let i=null,s=null;const l=br(typeof n=="string"?n:n.name,o.schema);return l?(l==="node"&&(i=ot(n,o.schema)),l==="mark"&&(s=Ce(n,o.schema)),r&&e.selection.ranges.forEach(a=>{const c=a.$from.pos,d=a.$to.pos;let h,p,u,f;e.selection.empty?o.doc.nodesBetween(c,d,(m,g)=>{i&&i===m.type&&(u=Math.max(g,c),f=Math.min(g+m.nodeSize,d),h=g,p=m)}):o.doc.nodesBetween(c,d,(m,g)=>{g<c&&i&&i===m.type&&(u=Math.max(g,c),f=Math.min(g+m.nodeSize,d),h=g,p=m),g>=c&&g<=d&&(i&&i===m.type&&e.setNodeMarkup(g,void 0,{...m.attrs,...t}),s&&m.marks.length&&m.marks.forEach(w=>{if(s===w.type){const x=Math.max(g,c),T=Math.min(g+m.nodeSize,d);e.addMark(x,T,s.create({...w.attrs,...t}))}}))}),p&&(h!==void 0&&e.setNodeMarkup(h,void 0,{...p.attrs,...t}),s&&p.marks.length&&p.marks.forEach(m=>{s===m.type&&e.addMark(u,f,s.create({...m.attrs,...t}))}))}),!0):!1},Qf=(n,t={})=>({state:e,dispatch:o})=>{const r=ot(n,e.schema);return du(r,t)(e,o)},Yf=(n,t={})=>({state:e,dispatch:o})=>{const r=ot(n,e.schema);return hu(r,t)(e,o)};var tm=Object.freeze({__proto__:null,blur:Iu,clearContent:Pu,clearNodes:$u,command:Hu,createParagraphNear:zu,cut:Bu,deleteCurrentNode:Vu,deleteNode:Fu,deleteRange:ju,deleteSelection:Wu,enter:qu,exitCode:Ku,extendMarkRange:Ju,first:Uu,focus:_u,forEach:Gu,insertContent:Xu,insertContentAt:tf,joinBackward:of,joinDown:nf,joinForward:rf,joinItemBackward:sf,joinItemForward:lf,joinTextblockBackward:af,joinTextblockForward:cf,joinUp:ef,keyboardShortcut:hf,lift:pf,liftEmptyBlock:uf,liftListItem:ff,newlineInCode:mf,resetAttributes:gf,scrollIntoView:yf,selectAll:wf,selectNodeBackward:vf,selectNodeForward:bf,selectParentNode:kf,selectTextblockEnd:xf,selectTextblockStart:Cf,setContent:Mf,setMark:$f,setMeta:Hf,setNode:zf,setNodeSelection:Bf,setTextSelection:Vf,sinkListItem:Ff,splitBlock:jf,splitListItem:Wf,toggleList:qf,toggleMark:Kf,toggleNode:Jf,toggleWrap:Uf,undoInputRule:Zf,unsetAllMarks:_f,unsetMark:Gf,updateAttributes:Xf,wrapIn:Qf,wrapInList:Yf});const em=ut.create({name:"commands",addCommands(){return{...tm}}}),nm=ut.create({name:"drop",addProseMirrorPlugins(){return[new Q({key:new at("tiptapDrop"),props:{handleDrop:(n,t,e,o)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:e,moved:o})}}})]}}),om=ut.create({name:"editable",addProseMirrorPlugins(){return[new Q({key:new at("editable"),props:{editable:()=>this.editor.options.editable}})]}}),rm=new at("focusEvents"),im=ut.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Q({key:rm,props:{handleDOMEvents:{focus:(t,e)=>{n.isFocused=!0;const o=n.state.tr.setMeta("focus",{event:e}).setMeta("addToHistory",!1);return t.dispatch(o),!1},blur:(t,e)=>{n.isFocused=!1;const o=n.state.tr.setMeta("blur",{event:e}).setMeta("addToHistory",!1);return t.dispatch(o),!1}}}})]}}),sm=ut.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:i})=>[()=>i.undoInputRule(),()=>i.command(({tr:s})=>{const{selection:l,doc:a}=s,{empty:c,$anchor:d}=l,{pos:h,parent:p}=d,u=d.parent.isTextblock&&h>0?s.doc.resolve(h-1):d,f=u.parent.type.spec.isolating,m=d.pos-d.parentOffset,g=f&&u.parent.childCount===1?m===d.pos:N.atStart(a).from===h;return!c||!p.type.isTextblock||p.textContent.length||!g||g&&d.parent.type.name==="paragraph"?!1:i.clearNodes()}),()=>i.deleteSelection(),()=>i.joinBackward(),()=>i.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:i})=>[()=>i.deleteSelection(),()=>i.deleteCurrentNode(),()=>i.joinForward(),()=>i.selectNodeForward()]),e={Enter:()=>this.editor.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},o={...e},r={...e,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return is()||Oc()?r:o},addProseMirrorPlugins(){return[new Q({key:new at("clearDocument"),appendTransaction:(n,t,e)=>{if(n.some(u=>u.getMeta("composition")))return;const o=n.some(u=>u.docChanged)&&!t.doc.eq(e.doc),r=n.some(u=>u.getMeta("preventClearDocument"));if(!o||r)return;const{empty:i,from:s,to:l}=t.selection,a=N.atStart(t.doc).from,c=N.atEnd(t.doc).to;if(i||!(s===a&&l===c)||!ls(e.doc))return;const d=e.tr,h=mr({state:e,transaction:d}),{commands:p}=new gr({editor:this.editor,state:h});if(p.clearNodes(),!!d.steps.length)return d}})]}}),lm=ut.create({name:"paste",addProseMirrorPlugins(){return[new Q({key:new at("tiptapPaste"),props:{handlePaste:(n,t,e)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:e})}}})]}}),am=ut.create({name:"tabindex",addProseMirrorPlugins(){return[new Q({key:new at("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Ae{get name(){return this.node.type.name}constructor(t,e,o=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=o,this.resolvedPos=t,this.editor=e,this.currentNode=r}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var t;return(t=this.actualDepth)!==null&&t!==void 0?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let e=this.from,o=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You canât set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}e=this.from+1,o=this.to-1}this.editor.commands.insertContentAt({from:e,to:o},t)}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;const t=this.resolvedPos.start(this.resolvedPos.depth-1),e=this.resolvedPos.doc.resolve(t);return new Ae(e,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new Ae(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new Ae(t,this.editor)}get children(){const t=[];return this.node.content.forEach((e,o)=>{const r=e.isBlock&&!e.isTextblock,i=e.isAtom&&!e.isText,s=this.pos+o+(i?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(s);if(!r&&l.depth<=this.depth)return;const a=new Ae(l,this.editor,r,r?e:null);r&&(a.actualDepth=this.depth+1),t.push(new Ae(l,this.editor,r,r?e:null))}),t}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,e={}){let o=null,r=this.parent;for(;r&&!o;){if(r.node.type.name===t)if(Object.keys(e).length>0){const i=r.node.attrs,s=Object.keys(e);for(let l=0;l<s.length;l+=1){const a=s[l];if(i[a]!==e[a])break}}else o=r;r=r.parent}return o}querySelector(t,e={}){return this.querySelectorAll(t,e,!0)[0]||null}querySelectorAll(t,e={},o=!1){let r=[];if(!this.children||this.children.length===0)return r;const i=Object.keys(e);return this.children.forEach(s=>{o&&r.length>0||(s.node.type.name===t&&i.every(l=>e[l]===s.node.attrs[l])&&r.push(s),!(o&&r.length>0)&&(r=r.concat(s.querySelectorAll(t,e,o))))}),r}setAttribute(t){const{tr:e}=this.editor.state;e.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(e)}}const cm=`.ProseMirror { 14 position: relative; 15} 16 17.ProseMirror { 18 word-wrap: break-word; 19 white-space: pre-wrap; 20 white-space: break-spaces; 21 -webkit-font-variant-ligatures: none; 22 font-variant-ligatures: none; 23 font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ 24} 25 26.ProseMirror [contenteditable="false"] { 27 white-space: normal; 28} 29 30.ProseMirror [contenteditable="false"] [contenteditable="true"] { 31 white-space: pre-wrap; 32} 33 34.ProseMirror pre { 35 white-space: pre-wrap; 36} 37 38img.ProseMirror-separator { 39 display: inline !important; 40 border: none !important; 41 margin: 0 !important; 42 width: 0 !important; 43 height: 0 !important; 44} 45 46.ProseMirror-gapcursor { 47 display: none; 48 pointer-events: none; 49 position: absolute; 50 margin: 0; 51} 52 53.ProseMirror-gapcursor:after {
54 content: ""; 55 display: block; 56 position: absolute; 57 top: -2px; 58 width: 20px; 59 border-top: 1px solid black; 60 animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; 61} 62 63@keyframes ProseMirror-cursor-blink { 64 to { 65 visibility: hidden; 66 } 67} 68 69.ProseMirror-hideselection *::selection { 70 background: transparent; 71} 72 73.ProseMirror-hideselection *::-moz-selection { 74 background: transparent; 75} 76 77.ProseMirror-hideselection * { 78 caret-color: transparent; 79} 80 81.ProseMirror-focused .ProseMirror-gapcursor { 82 display: block; 83} 84 85.tippy-box[data-animation=fade][data-state=hidden] { 86 opacity: 0 87}`;function dm(n,t,e){const o=document.querySelector("style[data-tiptap-style]");if(o!==null)return o;const r=document.createElement("style");return t&&r.setAttribute("nonce",t),r.setAttribute("data-tiptap-style",""),r.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(r),r}class hm extends wu{constructor(t={}){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,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),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:e,slice:o,moved:r})=>this.options.onDrop(e,o,r)),this.on("paste",({event:e,slice:o})=>this.options.onPaste(e,o)),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=dm(cm,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&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(t,e){const o=kc(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:o});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let o=e;if([].concat(t).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;o=o.filter(l=>!l.key.startsWith(s))}),e.length===o.length)return;const r=this.state.reconfigure({plugins:o});return this.view.updateState(r),r}createExtensionManager(){var t,e;const o=[...this.options.enableCoreExtensions?[om,Lu.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)===null||t===void 0?void 0:t.clipboardTextSerializer)===null||e===void 0?void 0:e.blockSeparator}),em,im,sm,am,nm,lm].filter(r=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[r.name]!==!1:!0):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r==null?void 0:r.type));this.extensionManager=new _e(o,this)}createCommandManager(){this.commandManager=new gr({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var t;let e;try{e=wi(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;
vendor: 13,644 bytes, lines 87-92
87this.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()}}),e=wi(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const o=Ac(e,this.options.autofocus);this.view=new $p(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(t=this.options.editorProps)===null||t===void 0?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:Ze.create({doc:e,selection:o||void 0})});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass();const 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(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(s=>{var l;return(l=this.capturedTransaction)===null||l===void 0?void 0:l.step(s)});return}const e=this.state.apply(t),o=!this.state.selection.eq(e.selection);this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t}),o&&this.emit("selectionUpdate",{editor:this,transaction:t});const r=t.getMeta("focus"),i=t.getMeta("blur");r&&this.emit("focus",{editor:this,event:r.event,transaction:t}),i&&this.emit("blur",{editor:this,event:i.event,transaction:t}),!(!t.docChanged||t.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:t})}getAttributes(t){return Dc(this.state,t)}isActive(t,e){const o=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return Lf(this.state,o,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return es(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=` 88 89`,textSerializers:o={}}=t||{};return Of(this.state.doc,{blockSeparator:e,textSerializers:{...Cc(this.schema),...o}})}get isEmpty(){return ls(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){const t=this.view.dom;t&&t.editor&&delete t.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var t;return!(!((t=this.view)===null||t===void 0)&&t.docView)}$node(t,e){var o;return((o=this.$doc)===null||o===void 0?void 0:o.querySelector(t,e))||null}$nodes(t,e){var o;return((o=this.$doc)===null||o===void 0?void 0:o.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new Ae(e,this)}get $doc(){return this.$pos(0)}}function rn(n){return new wr({find:n.find,handler:({state:t,range:e,match:o})=>{const r=I(n.getAttributes,void 0,o);if(r===!1||r===null)return null;const{tr:i}=t,s=o[o.length-1],l=o[0];if(s){const a=l.search(/\S/),c=e.from+l.indexOf(s),d=c+s.length;if(ss(e.from,e.to,t.doc).filter(p=>p.mark.type.excluded.find(u=>u===n.type&&u!==p.mark.type)).filter(p=>p.to>c).length)return null;d<e.to&&i.delete(d,e.to),c>e.from&&i.delete(e.from+a,c);const h=e.from+a+s.length;i.addMark(e.from+a,h,n.type.create(r||{})),i.removeStoredMark(n.type)}}})}function Rc(n){return new wr({find:n.find,handler:({state:t,range:e,match:o})=>{const r=I(n.getAttributes,void 0,o)||{},{tr:i}=t,s=e.from;let l=e.to;const a=n.type.create(r);if(o[1]){const c=o[0].lastIndexOf(o[1]);let d=s+c;d>l?d=l:l=d+o[1].length;const h=o[0][o[0].length-1];i.insertText(h,s+o[0].length-1),i.replaceWith(d,l,a)}else if(o[0]){const c=n.type.isInline?s:s-1;i.insert(c,n.type.create(r)).delete(i.mapping.map(s),i.mapping.map(l))}i.scrollIntoView()}})}function ki(n){return new wr({find:n.find,handler:({state:t,range:e,match:o})=>{const r=t.doc.resolve(e.from),i=I(n.getAttributes,void 0,o)||{};if(!r.node(-1).canReplaceWith(r.index(-1),r.indexAfter(-1),n.type))return null;t.tr.delete(e.from,e.to).setBlockType(e.from,e.from,n.type,i)}})}function Bn(n){return new wr({find:n.find,handler:({state:t,range:e,match:o,chain:r})=>{const i=I(n.getAttributes,void 0,o)||{},s=t.tr.delete(e.from,e.to),l=s.doc.resolve(e.from).blockRange(),a=l&&Vi(l,n.type,i);if(!a)return null;if(s.wrap(l,a),n.keepMarks&&n.editor){const{selection:d,storedMarks:h}=t,{splittableMarks:p}=n.editor.extensionManager,u=h||d.$to.parentOffset&&d.$from.marks();if(u){const f=u.filter(m=>p.includes(m.type.name));s.ensureMarks(f)}}if(n.keepAttributes){const d=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";r().updateAttributes(d,i).run()}const c=s.doc.resolve(e.from-1).nodeBefore;c&&c.type===n.type&&ke(s.doc,e.from-1)&&(!n.joinPredicate||n.joinPredicate(o,c))&&s.join(e.from-1)}})}class Y{constructor(t={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.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=I(C(this,"addOptions",{name:this.name}))),this.storage=I(C(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Y(t)}configure(t={}){const e=this.extend({...this.config,addOptions:()=>vr(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new Y(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=I(C(e,"addOptions",{name:e.name})),e.storage=I(C(e,"addStorage",{name:e.name,options:e.options})),e}}function Be(n){return new Eu({find:n.find,handler:({state:t,range:e,match:o,pasteEvent:r})=>{const i=I(n.getAttributes,void 0,o,r);if(i===!1||i===null)return null;const{tr:s}=t,l=o[o.length-1],a=o[0];let c=e.to;if(l){const d=a.search(/\S/),h=e.from+a.indexOf(l),p=h+l.length;if(ss(e.from,e.to,t.doc).filter(u=>u.mark.type.excluded.find(f=>f===n.type&&f!==u.mark.type)).filter(u=>u.to>h).length)return null;p<e.to&&s.delete(p,e.to),h>e.from&&s.delete(e.from+d,h),c=e.from+d+l.length,s.addMark(e.from+d,c,n.type.create(i||{})),s.removeStoredMark(n.type)}}})}function pm(n,t){const{selection:e}=n,{$from:o}=e;if(e instanceof A){const i=o.index();return o.parent.canReplaceWith(i,i+1,t)}let r=o.depth;for(;r>=0;){const i=o.index(r);if(o.node(r).contentMatchAt(i).matchType(t))return!0;r-=1}return!1}const um=/^\s*>\s$/,fm=Y.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",G(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[Bn({find:um,type:this.type})]}}),mm=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,gm=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,ym=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,wm=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,vm=ne.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",G(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[rn({find:mm,type:this.type}),rn({find:ym,type:this.type})]},addPasteRules(){return[Be({find:gm,type:this.type}),Be({find:wm,type:this.type})]}}),bm="listItem",Al="textStyle",El=/^\s*([-+*])\s$/,km=Y.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",G(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(bm,this.editor.getAttributes(Al)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Bn({find:El,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Bn({find:El,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Al),editor:this.editor})),[n]}}),xm=/(^|[^`])`([^`]+)`(?!`)/,Cm=/(^|[^`])`([^`]+)`(?!`)/g,Mm=ne.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",G(this.options.HTMLAttributes,n),0]},addCommands(){return{setCode:()=>({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[rn({find:xm,type:this.type})]},addPasteRules(){return[Be({find:Cm,type:this.type})]}}),Sm=/^```([a-z]+)?[\s\n]$/,Am=/^~~~([a-z]+)?[\s\n]$/,Em=Y.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 t;const{languageClassPrefix:e}=this.options;return[...((t=n.firstElementChild)===null||t===void 0?void 0:t.classList)||[]].filter(r=>r.startsWith(e)).map(r=>r.replace(e,""))[0]||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:t}){return["pre",G(this.options.HTMLAttributes,t),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},addCommands(){return{setCodeBlock:n=>({commands:t})=>t.setNode(this.name,n),toggleCodeBlock:n=>({commands:t})=>t.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:t}=this.editor.state.selection,e=t.pos===1;return!n||t.parent.type.name!==this.name?!1:e||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=n,{selection:e}=t,{$from:o,empty:r}=e;if(!r||o.parent.type!==this.type)return!1;const i=o.parentOffset===o.parent.nodeSize-2,s=o.parent.textContent.endsWith(` 90 91`);return!i||!s?!1:n.chain().command(({tr:l})=>(l.delete(o.pos-2,o.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=n,{selection:e,doc:o}=t,{$from:r,empty:i}=e;if(!i||r.parent.type!==this.type||r.parentOffset!==r.parent.nodeSize-2)return!1;const s=r.after();return s===void 0?!1:o.nodeAt(s)?n.commands.command(({tr:l})=>(l.setSelection(N.near(o.resolve(s))),!0)):n.commands.exitCode()}}},addInputRules(){return[ki({find:Sm,type:this.type,getAttributes:n=>({language:n[1]})}),ki({find:Am,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new Q({key:new at("codeBlockVSCodeHandler"),props:{handlePaste:(n,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;const e=t.clipboardData.getData("text/plain"),o=t.clipboardData.getData("vscode-editor-data"),r=o?JSON.parse(o):void 0,i=r==null?void 0:r.mode;if(!e||!i)return!1;const{tr:s,schema:l}=n.state,a=l.text(e.replace(/\r\n?/g,` 92`));return s.replaceSelectionWith(this.type.create({language:i},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(E.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),n.dispatch(s),!0}}})]}}),Om=Y.create({name:"doc",topNode:!0,content:"block+"});function Tm(n={}){return new Q({view(t){return new Nm(t,n)}})}class Nm{constructor(t,e){var o;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(o=e.width)!==null&&o!==void 0?o:1,this.color=e.color===!1?void 0:e.color||"black",this.class=e.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let i=s=>{this[r](s)};return t.dom.addEventListener(r,i),{name:r,handler:i}})}
vendor: 4,249 bytes, line 92
92destroy(){this.handlers.forEach(({name:t,handler:e})=>this.editorView.dom.removeEventListener(t,e))}update(t,e){this.cursorPos!=null&&e.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos),e=!t.parent.inlineContent,o;if(e){let l=t.nodeBefore,a=t.nodeAfter;if(l||a){let c=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(c){let d=c.getBoundingClientRect(),h=l?d.bottom:d.top;l&&a&&(h=(h+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),o={left:d.left,right:d.right,top:h-this.width/2,bottom:h+this.width/2}}}}if(!o){let l=this.editorView.coordsAtPos(this.cursorPos);o={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let r=this.editorView.dom.offsetParent;this.element||(this.element=r.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",e),this.element.classList.toggle("prosemirror-dropcursor-inline",!e);let i,s;if(!r||r==document.body&&getComputedStyle(r).position=="static")i=-pageXOffset,s=-pageYOffset;else{let l=r.getBoundingClientRect();i=l.left-r.scrollLeft,s=l.top-r.scrollTop}this.element.style.left=o.left-i+"px",this.element.style.top=o.top-s+"px",this.element.style.width=o.right-o.left+"px",this.element.style.height=o.bottom-o.top+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}dragover(t){if(!this.editorView.editable)return;let e=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),o=e&&e.inside>=0&&this.editorView.state.doc.nodeAt(e.inside),r=o&&o.type.spec.disableDropCursor,i=typeof r=="function"?r(this.editorView,e,t):r;if(e&&!i){let s=e.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Ea(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(t){(t.target==this.editorView.dom||!this.editorView.dom.contains(t.relatedTarget))&&this.setCursor(null)}}const Dm=ut.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Tm(this.options)]}});class Z extends N{constructor(t){super(t,t)}map(t,e){let o=t.resolve(e.map(this.head));return Z.valid(o)?new Z(o):N.near(o)}content(){return k.empty}eq(t){return t instanceof Z&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Z(t.resolve(e.pos))}getBookmark(){return new as(this.anchor)}static valid(t){let e=t.parent;if(e.isTextblock||!Rm(t)||!Lm(t))return!1;let o=e.type.spec.allowGapCursor;if(o!=null)return o;let r=e.contentMatchAt(t.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,e,o=!1){t:for(;;){if(!o&&Z.valid(t))return t;let r=t.pos,i=null;for(let s=t.depth;;s--){let l=t.node(s);if(e>0?t.indexAfter(s)<l.childCount:t.index(s)>0){i=l.child(e>0?t.indexAfter(s):t.index(s)-1);break}else if(s==0)return null;r+=e;let a=t.doc.resolve(r);if(Z.valid(a))return a}for(;;){let s=e>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!A.isSelectable(i)){t=t.doc.resolve(r+i.nodeSize*e),o=!1;continue t}break}i=s,r+=e;let l=t.doc.resolve(r);if(Z.valid(l))return l}return null}}}Z.prototype.visible=!1;Z.findFrom=Z.findGapCursorFrom;N.jsonID("gapcursor",Z);class as{constructor(t){this.pos=t}map(t){return new as(t.map(this.pos))}resolve(t){let e=t.resolve(this.pos);return Z.valid(e)?new Z(e):N.near(e)}}function Rm(n){for(let t=n.depth;t>=0;t--){let e=n.index(t),o=n.node(t);if(e==0){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(e-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;
vendor: 3,956 bytes, lines 92-93
92if(r.inlineContent)return!1}}return!0}function Lm(n){for(let t=n.depth;t>=0;t--){let e=n.indexAfter(t),o=n.node(t);if(e==o.childCount){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(e);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function Im(){return new Q({props:{decorations:zm,createSelectionBetween(n,t,e){return t.pos==e.pos&&Z.valid(e)?new Z(e):null},handleClick:$m,handleKeyDown:Pm,handleDOMEvents:{beforeinput:Hm}}})}const Pm=Qi({ArrowLeft:Yn("horiz",-1),ArrowRight:Yn("horiz",1),ArrowUp:Yn("vert",-1),ArrowDown:Yn("vert",1)});function Yn(n,t){const e=n=="vert"?t>0?"down":"up":t>0?"right":"left";return function(o,r,i){let s=o.selection,l=t>0?s.$to:s.$from,a=s.empty;if(s instanceof E){if(!i.endOfTextblock(e)||l.depth==0)return!1;a=!1,l=o.doc.resolve(t>0?l.after():l.before())}let c=Z.findGapCursorFrom(l,t,a);return c?(r&&r(o.tr.setSelection(new Z(c))),!0):!1}}function $m(n,t,e){if(!n||!n.editable)return!1;let o=n.state.doc.resolve(t);if(!Z.valid(o))return!1;let r=n.posAtCoords({left:e.clientX,top:e.clientY});return r&&r.inside>-1&&A.isSelectable(n.state.doc.nodeAt(r.inside))?!1:(n.dispatch(n.state.tr.setSelection(new Z(o))),!0)}function Hm(n,t){if(t.inputType!="insertCompositionText"||!(n.state.selection instanceof Z))return!1;let{$from:e}=n.state.selection,o=e.parent.contentMatchAt(e.index()).findWrapping(n.state.schema.nodes.text);if(!o)return!1;let r=v.empty;for(let s=o.length-1;s>=0;s--)r=v.from(o[s].createAndFill(null,r));let i=n.state.tr.replace(e.pos,e.pos,new k(r,0,0));return i.setSelection(E.near(i.doc.resolve(e.pos+1))),n.dispatch(i),!1}function zm(n){if(!(n.selection instanceof Z))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",U.create(n.doc,[yt.widget(n.selection.head,t,{key:"gapcursor"})])}const Bm=ut.create({name:"gapCursor",addProseMirrorPlugins(){return[Im()]},extendNodeSchema(n){var t;const e={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(t=I(C(n,"allowGapCursor",e)))!==null&&t!==void 0?t:null}}}),Vm=Y.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",G(this.options.HTMLAttributes,n)]},renderText(){return` 93`},addCommands(){return{setHardBreak:()=>({commands:n,chain:t,state:e,editor:o})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:r,storedMarks:i}=e;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=o.extensionManager,a=i||r.$to.parentOffset&&r.$from.marks();return t().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&a&&s){const h=a.filter(p=>l.includes(p.type.name));c.ensureMarks(h)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Fm=Y.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:t}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,G(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:n=>({commands:t})=>this.options.levels.includes(n.level)?t.setNode(this.name,n):!1,toggleHeading:n=>({commands:t})=>this.options.levels.includes(n.level)?t.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,t)=>({...n,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(n=>ki({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}}
93)\\s$`),type:this.type,getAttributes:{level:n}}))}});var Ro=200,nt=function(){};nt.prototype.append=function(n){return n.length?(n=nt.from(n),!this.length&&n||n.length<Ro&&this.leafAppend(n)||this.length<Ro&&n.leafPrepend(this)||this.appendInner(n)):this};nt.prototype.prepend=function(n){return n.length?nt.from(n).append(this):this};nt.prototype.appendInner=function(n){return new jm(this,n)};nt.prototype.slice=function(n,t){return n===void 0&&(n=0),t===void 0&&(t=this.length),n>=t?nt.empty:this.sliceInner(Math.max(0,n),Math.min(this.length,t))};nt.prototype.get=function(n){if(!(n<0||n>=this.length))return this.getInner(n)};nt.prototype.forEach=function(n,t,e){t===void 0&&(t=0),e===void 0&&(e=this.length),t<=e?this.forEachInner(n,t,e,0):this.forEachInvertedInner(n,t,e,0)};nt.prototype.map=function(n,t,e){t===void 0&&(t=0),e===void 0&&(e=this.length);var o=[];return this.forEach(function(r,i){return o.push(n(r,i))},t,e),o};nt.from=function(n){return n instanceof nt?n:n&&n.length?new Lc(n):nt.empty};var Lc=function(n){function t(o){n.call(this),this.values=o}n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t;var e={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(o,r){return o==0&&r==this.length?this:new t(this.values.slice(o,r))},t.prototype.getInner=function(o){return this.values[o]},t.prototype.forEachInner=function(o,r,i,s){for(var l=r;l<i;l++)if(o(this.values[l],s+l)===!1)return!1},t.prototype.forEachInvertedInner=function(o,r,i,s){for(var l=r-1;l>=i;l--)if(o(this.values[l],s+l)===!1)return!1},t.prototype.leafAppend=function(o){if(this.length+o.length<=Ro)return new t(this.values.concat(o.flatten()))},t.prototype.leafPrepend=function(o){if(this.length+o.length<=Ro)return new t(o.flatten().concat(this.values))},e.length.get=function(){return this.values.length},e.depth.get=function(){return 0},Object.defineProperties(t.prototype,e),t}(nt);nt.empty=new Lc([]);var jm=function(n){function t(e,o){n.call(this),this.left=e,this.right=o,this.length=e.length+o.length,this.depth=Math.max(e.depth,o.depth)+1}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,o,r,i){var s=this.left.length;if(o<s&&this.left.forEachInner(e,o,Math.min(r,s),i)===!1||r>s&&this.right.forEachInner(e,Math.max(o-s,0),Math.min(this.length,r)-s,i+s)===!1)return!1},t.prototype.forEachInvertedInner=function(e,o,r,i){var s=this.left.length;if(o>s&&this.right.forEachInvertedInner(e,o-s,Math.max(r,s)-s,i+s)===!1||r<s&&this.left.forEachInvertedInner(e,Math.min(o,s),r,i)===!1)return!1},t.prototype.sliceInner=function(e,o){if(e==0&&o==this.length)return this;var r=this.left.length;return o<=r?this.left.slice(e,o):e>=r?this.right.slice(e-r,o-r):this.left.slice(e,r).append(this.right.slice(0,o-r))},t.prototype.leafAppend=function(e){var o=this.right.leafAppend(e);if(o)return new t(this.left,o)},t.prototype.leafPrepend=function(e){var o=this.left.leafPrepend(e);if(o)return new t(o,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(nt);const Wm=500;class Pt{constructor(t,e){this.items=t,this.eventCount=e}popEvent(t,e){if(this.eventCount==0)return null;let o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}let r,i;e&&(r=this.remapping(o,this.items.length),i=r.maps.length);let s=t.tr,l,a,c=[],d=[];return this.items.forEach((h,p)=>{if(!h.step){r||(r=this.remapping(o,p+1),i=r.maps.length),i--,d.push(h);return}if(r){d.push(new Bt(h.map));let u=h.step.map(r.slice(i)),f;u&&s.maybeStep(u).doc&&(f=s.mapping.maps[s.mapping.maps.length-1],c.push(new Bt(f,void 0,void 0,c.length+d.length))),i--,f&&r.appendMap(f,i)}else s.maybeStep(h.step);if(h.selection)return l=r?h.selection.map(r.slice(i)):h.selection,a=new Pt(this.items.slice(0,o).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(t,e,o,r){let i=[],s=this.eventCount,l=this.items,a=!r&&l.length?l.get(l.length-1):null;for(let d=0;d<t.steps.length;d++){let h=t.steps[d].invert(t.docs[d]),p=new Bt(t.mapping.maps[d],h,e),u;(u=a&&a.merge(p))&&(p=u,d?i.pop():l=l.slice(0,l.length-1)),i.push(p),e&&(s++,e=void 0),r||(a=p)}let c=s-o.depth;return c>Km&&(l=qm(l,c),s-=c),new Pt(l.append(i),s)}remapping(t,e){let o=new Rn;
vendor: 5,120 bytes, line 93
93return this.items.forEach((r,i)=>{let s=r.mirrorOffset!=null&&i-r.mirrorOffset>=t?o.maps.length-r.mirrorOffset:void 0;o.appendMap(r.map,s)},t,e),o}addMaps(t){return this.eventCount==0?this:new Pt(this.items.append(t.map(e=>new Bt(e))),this.eventCount)}rebased(t,e){if(!this.eventCount)return this;let o=[],r=Math.max(0,this.items.length-e),i=t.mapping,s=t.steps.length,l=this.eventCount;this.items.forEach(p=>{p.selection&&l--},r);let a=e;this.items.forEach(p=>{let u=i.getMirror(--a);if(u==null)return;s=Math.min(s,u);let f=i.maps[u];if(p.step){let m=t.steps[u].invert(t.docs[u]),g=p.selection&&p.selection.map(i.slice(a+1,u));g&&l++,o.push(new Bt(f,m,g))}else o.push(new Bt(f))},r);let c=[];for(let p=e;p<s;p++)c.push(new Bt(i.maps[p]));let d=this.items.slice(0,r).append(c).append(o),h=new Pt(d,l);return h.emptyItemCount()>Wm&&(h=h.compress(this.items.length-o.length)),h}emptyItemCount(){let t=0;return this.items.forEach(e=>{e.step||t++}),t}compress(t=this.items.length){let e=this.remapping(0,t),o=e.maps.length,r=[],i=0;return this.items.forEach((s,l)=>{if(l>=t)r.push(s),s.selection&&i++;else if(s.step){let a=s.step.map(e.slice(o)),c=a&&a.getMap();if(o--,c&&e.appendMap(c,o),a){let d=s.selection&&s.selection.map(e.slice(o));d&&i++;let h=new Bt(c.invert(),a,d),p,u=r.length-1;(p=r.length&&r[u].merge(h))?r[u]=p:r.push(h)}}else s.map&&o--},this.items.length,0),new Pt(nt.from(r.reverse()),i)}}Pt.empty=new Pt(nt.empty,0);function qm(n,t){let e;return n.forEach((o,r)=>{if(o.selection&&t--==0)return e=r,!1}),n.slice(e)}class Bt{constructor(t,e,o,r){this.map=t,this.step=e,this.selection=o,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let e=t.step.merge(this.step);if(e)return new Bt(e.getMap().invert(),e,this.selection)}}}class ae{constructor(t,e,o,r,i){this.done=t,this.undone=e,this.prevRanges=o,this.prevTime=r,this.prevComposition=i}}const Km=20;function Jm(n,t,e,o){let r=e.getMeta(Pe),i;if(r)return r.historyState;e.getMeta(_m)&&(n=new ae(n.done,n.undone,null,0,-1));let s=e.getMeta("appendedTransaction");if(e.steps.length==0)return n;if(s&&s.getMeta(Pe))return s.getMeta(Pe).redo?new ae(n.done.addTransform(e,void 0,o,po(t)),n.undone,Ol(e.mapping.maps),n.prevTime,n.prevComposition):new ae(n.done,n.undone.addTransform(e,void 0,o,po(t)),null,n.prevTime,n.prevComposition);if(e.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=e.getMeta("composition"),a=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(e.time||0)-o.newGroupDelay||!Um(e,n.prevRanges)),c=s?Wr(n.prevRanges,e.mapping):Ol(e.mapping.maps);return new ae(n.done.addTransform(e,a?t.selection.getBookmark():void 0,o,po(t)),Pt.empty,c,e.time,l??n.prevComposition)}else return(i=e.getMeta("rebased"))?new ae(n.done.rebased(e,i),n.undone.rebased(e,i),Wr(n.prevRanges,e.mapping),n.prevTime,n.prevComposition):new ae(n.done.addMaps(e.mapping.maps),n.undone.addMaps(e.mapping.maps),Wr(n.prevRanges,e.mapping),n.prevTime,n.prevComposition)}function Um(n,t){if(!t)return!1;if(!n.docChanged)return!0;let e=!1;return n.mapping.maps[0].forEach((o,r)=>{for(let i=0;i<t.length;i+=2)o<=t[i+1]&&r>=t[i]&&(e=!0)}),e}function Ol(n){let t=[];for(let e=n.length-1;e>=0&&t.length==0;e--)n[e].forEach((o,r,i,s)=>t.push(i,s));return t}function Wr(n,t){if(!n)return null;let e=[];for(let o=0;o<n.length;o+=2){let r=t.map(n[o],1),i=t.map(n[o+1],-1);r<=i&&e.push(r,i)}return e}function Zm(n,t,e){let o=po(t),r=Pe.get(t).spec.config,i=(e?n.undone:n.done).popEvent(t,o);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(e?n.done:n.undone).addTransform(i.transform,t.selection.getBookmark(),r,o),a=new ae(e?l:i.remaining,e?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(Pe,{redo:e,historyState:a})}let qr=!1,Tl=null;function po(n){let t=n.plugins;if(Tl!=t){qr=!1,Tl=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){qr=!0;break}}return qr}const Pe=new at("history"),_m=new at("closeHistory");function Gm(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Q({key:Pe,state:{init(){return new ae(Pt.empty,Pt.empty,null,0,-1)},apply(t,e,o){return Jm(e,o,t,n)}},config:n,props:{handleDOMEvents:{beforeinput(t,e){let o=e.inputType,r=o=="historyUndo"?Pc:o=="historyRedo"?$c:null;return r?(e.preventDefault(),r(t.state,t.dispatch)):!1}}}})}function Ic(n,t){return(e,o)=>{let r=Pe.getState(e);if(!r||(n?r.undone:r.done).eventCount==0)return!1;if(o){let i=Zm(r,e,n);i&&o(i.scrollIntoView())}return!0}}const Pc=Ic(!1),$c=Ic(!0),Xm=ut.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:t})=>Pc(n,t),redo:()=>({state:n,dispatch:t})=>$c(n,t)}},addProseMirrorPlugins(){return[Gm(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-Ñ":()=>this.editor.commands.undo(),"Shift-Mod-Ñ":()=>this.editor.commands.redo()}}}),Qm=Y.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}
vendor: 4,906 bytes, line 93
93){return["hr",G(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:t})=>{if(!pm(t,t.schema.nodes[this.name]))return!1;const{selection:e}=t,{$from:o,$to:r}=e,i=n();return o.parentOffset===0?i.insertContentAt({from:Math.max(o.pos-1,0),to:r.pos},{type:this.name}):If(e)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({tr:s,dispatch:l})=>{var a;if(l){const{$to:c}=s.selection,d=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?s.setSelection(E.create(s.doc,c.pos+1)):c.nodeAfter.isBlock?s.setSelection(A.create(s.doc,c.pos)):s.setSelection(E.create(s.doc,c.pos));else{const h=(a=c.parent.type.contentMatch.defaultType)===null||a===void 0?void 0:a.create();h&&(s.insert(d,h),s.setSelection(E.create(s.doc,d+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Rc({find:/^(?:---|â-|___\s|\*\*\*\s)$/,type:this.type})]}}),Ym=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,t0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,e0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,n0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,o0=ne.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",G(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[rn({find:Ym,type:this.type}),rn({find:e0,type:this.type})]},addPasteRules(){return[Be({find:t0,type:this.type}),Be({find:n0,type:this.type})]}}),r0=Y.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",G(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)}}}),i0="listItem",Nl="textStyle",Dl=/^(\d+)\.\s$/,s0=Y.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:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:t,...e}=n;return t===1?["ol",G(this.options.HTMLAttributes,e),0]:["ol",G(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(i0,this.editor.getAttributes(Nl)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Bn({find:Dl,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,e)=>e.childCount+e.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Bn({find:Dl,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(Nl)}),joinPredicate:(t,e)=>e.childCount+e.attrs.start===+t[1],editor:this.editor})),[n]}}),l0=Y.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",G(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),a0=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,c0=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,d0=ne.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",G(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()}}
93,addInputRules(){return[rn({find:a0,type:this.type})]},addPasteRules(){return[Be({find:c0,type:this.type})]}}),h0=Y.create({name:"text",group:"inline"}),p0=ut.create({name:"starterKit",addExtensions(){const n=[];return this.options.bold!==!1&&n.push(vm.configure(this.options.bold)),this.options.blockquote!==!1&&n.push(fm.configure(this.options.blockquote)),this.options.bulletList!==!1&&n.push(km.configure(this.options.bulletList)),this.options.code!==!1&&n.push(Mm.configure(this.options.code)),this.options.codeBlock!==!1&&n.push(Em.configure(this.options.codeBlock)),this.options.document!==!1&&n.push(Om.configure(this.options.document)),this.options.dropcursor!==!1&&n.push(Dm.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&n.push(Bm.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&n.push(Vm.configure(this.options.hardBreak)),this.options.heading!==!1&&n.push(Fm.configure(this.options.heading)),this.options.history!==!1&&n.push(Xm.configure(this.options.history)),this.options.horizontalRule!==!1&&n.push(Qm.configure(this.options.horizontalRule)),this.options.italic!==!1&&n.push(o0.configure(this.options.italic)),this.options.listItem!==!1&&n.push(r0.configure(this.options.listItem)),this.options.orderedList!==!1&&n.push(s0.configure(this.options.orderedList)),this.options.paragraph!==!1&&n.push(l0.configure(this.options.paragraph)),this.options.strike!==!1&&n.push(d0.configure(this.options.strike)),this.options.text!==!1&&n.push(h0.configure(this.options.text)),n}});var xi,Ci;if(typeof WeakMap<"u"){let n=new WeakMap;xi=t=>n.get(t),Ci=(t,e)=>(n.set(t,e),e)}else{const n=[];let t=0;xi=e=>{for(let o=0;o<n.length;o+=2)if(n[o]==e)return n[o+1]},Ci=(e,o)=>(t==10&&(t=0),n[t++]=e,n[t++]=o)}var _=class{constructor(n,t,e,o){this.width=n,this.height=t,this.map=e,this.problems=o}findCell(n){for(let t=0;t<this.map.length;t++){const e=this.map[t];if(e!=n)continue;const o=t%this.width,r=t/this.width|0;let i=o+1,s=r+1;for(let l=1;i<this.width&&this.map[t+l]==e;l++)i++;for(let l=1;s<this.height&&this.map[t+this.width*l]==e;l++)s++;return{left:o,top:r,right:i,bottom:s}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let t=0;t<this.map.length;t++)if(this.map[t]==n)return t%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,t,e){const{left:o,right:r,top:i,bottom:s}=this.findCell(n);return t=="horiz"?(e<0?o==0:r==this.width)?null:this.map[i*this.width+(e<0?o-1:r)]:(e<0?i==0:s==this.height)?null:this.map[o+this.width*(e<0?i-1:s)]}rectBetween(n,t){const{left:e,right:o,top:r,bottom:i}=this.findCell(n),{left:s,right:l,top:a,bottom:c}=this.findCell(t);return{left:Math.min(e,s),top:Math.min(r,a),right:Math.max(o,l),bottom:Math.max(i,c)}}cellsInRect(n){const t=[],e={};for(let o=n.top;o<n.bottom;o++)for(let r=n.left;r<n.right;r++){const i=o*this.width+r,s=this.map[i];e[s]||(e[s]=!0,!(r==n.left&&r&&this.map[i-1]==s||o==n.top&&o&&this.map[i-this.width]==s)&&t.push(s))}return t}positionAt(n,t,e){for(let o=0,r=0;;o++){const i=r+e.child(o).nodeSize;if(o==n){let s=t+n*this.width;const l=(n+1)*this.width;for(;s<l&&this.map[s]<r;)s++;return s==l?i-1:this.map[s]}r=i}}static get(n){return xi(n)||Ci(n,u0(n))}};function u0(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const t=f0(n),e=n.childCount,o=[];let r=0,i=null;const s=[];for(let c=0,d=t*e;c<d;c++)o[c]=0;for(let c=0,d=0;c<e;c++){const h=n.child(c);d++;for(let f=0;;f++){for(;r<o.length&&o[r]!=0;)r++;if(f==h.childCount)break;const m=h.child(f),{colspan:g,rowspan:w,colwidth:x}=m.attrs;for(let T=0;T<w;T++){if(T+c>=e){(i||(i=[])).push({type:"overlong_rowspan",pos:d,n:w-T});break}const $=r+T*t;for(let O=0;O<g;O++){o[$+O]==0?o[$+O]=d:(i||(i=[])).push({type:"collision",row:c,pos:d,n:g-O});const H=x&&x[O];if(H){const j=($+O)%t*2,K=s[j];K==null||K!=H&&s[j+1]==1?(s[j]=H,s[j+1]=1):K==H&&s[j+1]++}}}r+=g,d+=m.nodeSize}const p=(c+1)*t;let u=0;for(;r<p;)o[r++]==0&&u++;u&&(i||(i=[])).push({type:"missing",row:c,n:u}),d++}(t===0||e===0)&&(i||(i=[])).push({type:"zero_sized"});const l=new _(t,e,o,i);let a=!1;for(let c=0;!a&&c<s.length;c+=2)s[c]!=null&&s[c+1]<e&&(a=!0);return a&&m0(l,s,n),l}function f0(n){let t=-1,e=!1;for(let o=0;o<n.childCount;o++){const r=n.child(o);let i=0;if(e)for(let s=0;s<o;s++){const l=n.child(s);for(let a=0;a<l.childCount;a++){const c=l.child(a);s+c.attrs.rowspan>o&&(i+=c.attrs.colspan)}}for(let s=0;s<r.childCount;s++){const l=r.child(s);i+=l.attrs.colspan,l.attrs.rowspan>1&&(e=!0)}t==-1?t=i:t!=i&&(t=Math.max(t,i))}return t}function m0(n,t,e){n.problems||(n.problems=[]);const o={};for(let r=0;r<n.map.length;r++){const i=n.map[r];if(o[i])continue;o[i]=!0;const s=e.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let l=null;const a=s.attrs;for(let c=0;c<a.colspan;c++){const d=(r+c)%n.width,h=t[d*2];h!=null&&(!a.colwidth||a.colwidth[c]!=h)&&((l||(l=g0(a)))[c]=h)}l&&n.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function g0(n){if(n.colwidth)return n.colwidth.slice();const t=[];for(let e=0;e<n.colspan;e++)t.push(0);return t}function ft(n){let t=n.cached.tableNodeTypes;if(!t){t=n.cached.tableNodeTypes={};for(const e in n.nodes){const o=n.nodes[e],r=o.spec.tableRole;r&&(t[r]=o)}}return t}var he=new at("selectingCells");function an(n){for(let t=n.depth-1;t>0;t--)if(n.node(t).type.spec.tableRole=="row")return n.node(0).resolve(n.before(t+1));return null}function y0(n){for(let t=n.depth;t>0;t--){const e=n.node(t).type.spec.tableRole;if(e==="cell"||e==="header_cell")return n.node(t)}return null}function Ht(n){const t=n.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return!0;return!1}function xr(n){const t=n.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;const e=an(t.$head)||w0(t.$head);if(e)return e;throw new RangeError(`No cell found around position ${t.head}`)}function w0(n){for(let t=n.nodeAfter,e=n.pos;t;t=t.firstChild,e++){const o=t.type.spec.tableRole;if(o=="cell"||o=="header_cell")return n.doc.resolve(e)}for(let t=n.nodeBefore,e=n.pos;t;t=t.lastChild,e--){const o=t.type.spec.tableRole;
93if(o=="cell"||o=="header_cell")return n.doc.resolve(e-t.nodeSize)}}function Mi(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function v0(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function cs(n,t){return n.depth==t.depth&&n.pos>=t.start(-1)&&n.pos<=t.end(-1)}function Hc(n,t,e){const o=n.node(-1),r=_.get(o),i=n.start(-1),s=r.nextCell(n.pos-i,t,e);return s==null?null:n.node(0).resolve(i+s)}function Ve(n,t,e=1){const o={...n,colspan:n.colspan-e};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(t,e),o.colwidth.some(r=>r>0)||(o.colwidth=null)),o}function zc(n,t,e=1){const o={...n,colspan:n.colspan+e};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let r=0;r<e;r++)o.colwidth.splice(t,0,0)}return o}function b0(n,t,e){const o=ft(t.type.schema).header_cell;for(let r=0;r<n.height;r++)if(t.nodeAt(n.map[e+r*n.width]).type!=o)return!1;return!0}var F=class _t extends N{constructor(t,e=t){const o=t.node(-1),r=_.get(o),i=t.start(-1),s=r.rectBetween(t.pos-i,e.pos-i),l=t.node(0),a=r.cellsInRect(s).filter(d=>d!=e.pos-i);a.unshift(e.pos-i);const c=a.map(d=>{const h=o.nodeAt(d);if(!h)throw RangeError(`No cell with offset ${d} found`);const p=i+d+1;return new Ra(l.resolve(p),l.resolve(p+h.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=t,this.$headCell=e}map(t,e){const o=t.resolve(e.map(this.$anchorCell.pos)),r=t.resolve(e.map(this.$headCell.pos));if(Mi(o)&&Mi(r)&&cs(o,r)){const i=this.$anchorCell.node(-1)!=o.node(-1);return i&&this.isRowSelection()?_t.rowSelection(o,r):i&&this.isColSelection()?_t.colSelection(o,r):new _t(o,r)}return E.between(o,r)}content(){const t=this.$anchorCell.node(-1),e=_.get(t),o=this.$anchorCell.start(-1),r=e.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),i={},s=[];for(let a=r.top;a<r.bottom;a++){const c=[];for(let d=a*e.width+r.left,h=r.left;h<r.right;h++,d++){const p=e.map[d];if(i[p])continue;i[p]=!0;const u=e.findCell(p);let f=t.nodeAt(p);if(!f)throw RangeError(`No cell with offset ${p} found`);const m=r.left-u.left,g=u.right-r.right;if(m>0||g>0){let w=f.attrs;if(m>0&&(w=Ve(w,0,m)),g>0&&(w=Ve(w,w.colspan-g,g)),u.left<r.left){if(f=f.type.createAndFill(w),!f)throw RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`)}else f=f.type.create(w,f.content)}if(u.top<r.top||u.bottom>r.bottom){const w={...f.attrs,rowspan:Math.min(u.bottom,r.bottom)-Math.max(u.top,r.top)};u.top<r.top?f=f.type.createAndFill(w):f=f.type.create(w,f.content)}c.push(f)}s.push(t.child(a).copy(v.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?t:s;return new k(v.from(l),1,1)}replace(t,e=k.empty){const o=t.steps.length,r=this.ranges;for(let s=0;s<r.length;s++){const{$from:l,$to:a}=r[s],c=t.mapping.slice(o);t.replace(c.map(l.pos),c.map(a.pos),s?k.empty:e)}const i=N.findFrom(t.doc.resolve(t.mapping.slice(o).map(this.to)),-1);i&&t.setSelection(i)}replaceWith(t,e){this.replace(t,new k(v.from(e),0,0))}forEachCell(t){const e=this.$anchorCell.node(-1),o=_.get(e),r=this.$anchorCell.start(-1),i=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let s=0;s<i.length;s++)t(e.nodeAt(i[s]),r+i[s])}isColSelection(){const t=this.$anchorCell.index(-1),e=this.$headCell.index(-1);if(Math.min(t,e)>0)return!1;const o=t+this.$anchorCell.nodeAfter.attrs.rowspan,r=e+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,r)==this.$headCell.node(-1).childCount}static colSelection(t,e=t){const o=t.node(-1),r=_.get(o),i=t.start(-1),s=r.findCell(t.pos-i),l=r.findCell(e.pos-i),a=t.node(0);return s.top<=l.top?(s.top>0&&(t=a.resolve(i+r.map[s.left])),l.bottom<r.height&&(e=a.resolve(i+r.map[r.width*(r.height-1)+l.right-1]))):(l.top>0&&(e=a.resolve(i+r.map[l.left])),s.bottom<r.height&&(t=a.resolve(i+r.map[r.width*(r.height-1)+s.right-1]))),new _t(t,e)}isRowSelection(){const t=this.$anchorCell.node(-1),e=_.get(t),o=this.$anchorCell.start(-1),r=e.colCount(this.$anchorCell.pos-o),i=e.colCount(this.$headCell.pos-o);if(Math.min(r,i)>0)return!1;const s=r+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==e.width}eq(t){return t instanceof _t&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,e=t){const o=t.node(-1),r=_.get(o),i=t.start(-1),s=r.findCell(t.pos-i),l=r.findCell(e.pos-i),a=t.node(0);return s.left<=l.left?(s.left>0&&(t=a.resolve(i+r.map[s.top*r.width])),l.right<r.width&&(e=a.resolve(i+r.map[r.width*(l.top+1)-1]))):(l.left>0&&(e=a.resolve(i+r.map[l.top*r.width])),s.right<r.width&&(t=a.resolve(i+r.map[r.width*(s.top+1)-1]))),new _t(t,e)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,e){return new _t(t.resolve(e.anchor),t.resolve(e.head))}static create(t,e,o=e){return new _t(t.resolve(e),t.resolve(o))}getBookmark(){return new k0(this.$anchorCell.pos,this.$headCell.pos)}};F.prototype.visible=!1;N.jsonID("cell",F);var k0=class Bc{constructor(t,e){this.anchor=t,this.head=e}map(t){return new Bc(t.map(this.anchor),t.map(this.head))}resolve(t){const e=t.resolve(this.anchor),o=t.resolve(this.head);return e.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&e.index()<e.parent.childCount&&o.index()<o.parent.childCount&&cs(e,o)?new F(e,o):N.near(o,1)}};function x0(n){if(!(n.selection instanceof F))return null;const t=[];return n.selection.forEachCell((e,o)=>{t.push(yt.node(o,o+e.nodeSize,{class:"selectedCell"}))}),U.create(n.doc,t)}function C0({$from:n,$to:t}){if(n.pos==t.pos||n.pos<t.pos-6)return!1;let e=n.pos,o=t.pos,r=n.depth;for(;r>=0&&!(n.after(r+1)<n.end(r));r--,e++);for(let i=t.depth;i>=0&&!(t.before(i+1)>t.start(i));i--,o--);return e==o&&/row|table/.test(n.node(r).type.spec.tableRole)}function M0({$from:n,$to:t}){let e,o;for(let r=n.depth;r>0;r--){const i=n.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){e=i;break}}for(let r=t.depth;r>0;r--){const i=t.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){o=i;break}}return e!==o&&t.parentOffset===0}function S0(n,t,e){const o=(t||n).selection,r=(t||n).doc;let i,s;if(o instanceof A&&(s=o.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=F.create(r,o.from);else if(s=="row"){const l=r.resolve(o.from+1);i=F.rowSelection(l,l)}else if(!e){const l=_.get(o.node),a=o.from+1,c=a+l.map[l.width*l.height-1];i=F.create(r,a+1,c)}}else o instanceof E&&C0(o)?i=E.create(r,o.from):o instanceof E&&M0(o)&&(i=E.create(r,o.$from.start(),o.$from.end()));return i&&(t||(t=n.tr)).setSelection(i),t}var A0=new at("fix-tables");function Vc(n,t,e,o){const r=n.childCount,i=t.childCount;t:for(let s=0,l=0;s<i;s++){const a=t.child(s);for(let c=l,d=Math.min(r,s+3);c<d;c++)if(n.child(c)==a){l=c+1,e+=a.nodeSize;continue t}o(a,e),l<r&&n.child(l).sameMarkup(a)?Vc(n.child(l),a,e+1,o):a.nodesBetween(0,a.content.size,o,e+1),e+=a.nodeSize}}function Fc(n,t){let e;const o=(r,i)=>{r.type.spec.tableRole=="table"&&(e=E0(n,r,i,e))};return t?t.doc!=n.doc&&Vc(t.doc,n.doc,0,o):n.doc.descendants(o),e}function E0(n,t,e,o){const r=_.get(t);if(!r.problems)return o;o||(o=n.tr);const i=[];for(let a=0;a<r.height;a++)i.push(0);for(let a=0;a<r.problems.length;a++){const c=r.problems[a];if(c.type=="collision"){const d=t.nodeAt(c.pos);if(!d)continue;const h=d.attrs;for(let p=0;p<h.rowspan;p++)i[c.row+p]+=c.n;o.setNodeMarkup(o.mapping.map(e+1+c.pos),null,Ve(h,h.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const d=t.nodeAt(c.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(e+1+c.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const d=t.nodeAt(c.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(e+1+c.pos),null,{...d.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const d=o.mapping.map(e);
93o.delete(d,d+t.nodeSize)}}let s,l;for(let a=0;a<i.length;a++)i[a]&&(s==null&&(s=a),l=a);for(let a=0,c=e+1;a<r.height;a++){const d=t.child(a),h=c+d.nodeSize,p=i[a];if(p>0){let u="cell";d.firstChild&&(u=d.firstChild.type.spec.tableRole);const f=[];for(let g=0;g<p;g++){const w=ft(n.schema)[u].createAndFill();w&&f.push(w)}const m=(a==0||s==a-1)&&l==a?c+1:h-1;o.insert(o.mapping.map(m),f)}c=h}return o.setMeta(A0,{fixTables:!0})}function Kt(n){const t=n.selection,e=xr(n),o=e.node(-1),r=e.start(-1),i=_.get(o);return{...t instanceof F?i.rectBetween(t.$anchorCell.pos-r,t.$headCell.pos-r):i.findCell(e.pos-r),tableStart:r,map:i,table:o}}function jc(n,{map:t,tableStart:e,table:o},r){let i=r>0?-1:0;b0(t,o,r+i)&&(i=r==0||r==t.width?null:0);for(let s=0;s<t.height;s++){const l=s*t.width+r;if(r>0&&r<t.width&&t.map[l-1]==t.map[l]){const a=t.map[l],c=o.nodeAt(a);n.setNodeMarkup(n.mapping.map(e+a),null,zc(c.attrs,r-t.colCount(a))),s+=c.attrs.rowspan-1}else{const a=i==null?ft(o.type.schema).cell:o.nodeAt(t.map[l+i]).type,c=t.positionAt(s,r,o);n.insert(n.mapping.map(e+c),a.createAndFill())}}return n}function O0(n,t){if(!Ht(n))return!1;if(t){const e=Kt(n);t(jc(n.tr,e,e.left))}return!0}function T0(n,t){if(!Ht(n))return!1;if(t){const e=Kt(n);t(jc(n.tr,e,e.right))}return!0}function N0(n,{map:t,table:e,tableStart:o},r){const i=n.mapping.maps.length;for(let s=0;s<t.height;){const l=s*t.width+r,a=t.map[l],c=e.nodeAt(a),d=c.attrs;if(r>0&&t.map[l-1]==a||r<t.width-1&&t.map[l+1]==a)n.setNodeMarkup(n.mapping.slice(i).map(o+a),null,Ve(d,r-t.colCount(a)));else{const h=n.mapping.slice(i).map(o+a);n.delete(h,h+c.nodeSize)}s+=d.rowspan}}function D0(n,t){if(!Ht(n))return!1;if(t){const e=Kt(n),o=n.tr;if(e.left==0&&e.right==e.map.width)return!1;for(let r=e.right-1;N0(o,e,r),r!=e.left;r--){const i=e.tableStart?o.doc.nodeAt(e.tableStart-1):o.doc;if(!i)throw RangeError("No table found");e.table=i,e.map=_.get(i)}t(o)}return!0}function R0(n,t,e){var o;const r=ft(t.type.schema).header_cell;for(let i=0;i<n.width;i++)if(((o=t.nodeAt(n.map[i+e*n.width]))==null?void 0:o.type)!=r)return!1;return!0}function Wc(n,{map:t,tableStart:e,table:o},r){var i;let s=e;for(let c=0;c<r;c++)s+=o.child(c).nodeSize;const l=[];let a=r>0?-1:0;R0(t,o,r+a)&&(a=r==0||r==t.height?null:0);for(let c=0,d=t.width*r;c<t.width;c++,d++)if(r>0&&r<t.height&&t.map[d]==t.map[d-t.width]){const h=t.map[d],p=o.nodeAt(h).attrs;n.setNodeMarkup(e+h,null,{...p,rowspan:p.rowspan+1}),c+=p.colspan-1}else{const h=a==null?ft(o.type.schema).cell:(i=o.nodeAt(t.map[d+a*t.width]))==null?void 0:i.type,p=h==null?void 0:h.createAndFill();p&&l.push(p)}return n.insert(s,ft(o.type.schema).row.create(null,l)),n}function L0(n,t){if(!Ht(n))return!1;if(t){const e=Kt(n);t(Wc(n.tr,e,e.top))}return!0}function I0(n,t){if(!Ht(n))return!1;if(t){const e=Kt(n);t(Wc(n.tr,e,e.bottom))}return!0}function P0(n,{map:t,table:e,tableStart:o},r){let i=0;for(let c=0;c<r;c++)i+=e.child(c).nodeSize;const s=i+e.child(r).nodeSize,l=n.mapping.maps.length;n.delete(i+o,s+o);const a=new Set;for(let c=0,d=r*t.width;c<t.width;c++,d++){const h=t.map[d];if(!a.has(h)){if(a.add(h),r>0&&h==t.map[d-t.width]){const p=e.nodeAt(h).attrs;n.setNodeMarkup(n.mapping.slice(l).map(h+o),null,{...p,rowspan:p.rowspan-1}),c+=p.colspan-1}else if(r<t.height&&h==t.map[d+t.width]){const p=e.nodeAt(h),u=p.attrs,f=p.type.create({...u,rowspan:p.attrs.rowspan-1},p.content),m=t.positionAt(r+1,c,e);n.insert(n.mapping.slice(l).map(o+m),f),c+=u.colspan-1}}}}function $0(n,t){if(!Ht(n))return!1;if(t){const e=Kt(n),o=n.tr;if(e.top==0&&e.bottom==e.map.height)return!1;for(let r=e.bottom-1;P0(o,e,r),r!=e.top;r--){const i=e.tableStart?o.doc.nodeAt(e.tableStart-1):o.doc;if(!i)throw RangeError("No table found");e.table=i,e.map=_.get(e.table)}t(o)}return!0}function Rl(n){const t=n.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function H0({width:n,height:t,map:e},o){let r=o.top*n+o.left,i=r,s=(o.bottom-1)*n+o.left,l=r+(o.right-o.left-1);for(let a=o.top;a<o.bottom;a++){if(o.left>0&&e[i]==e[i-1]||o.right<n&&e[l]==e[l+1])return!0;i+=n,l+=n}for(let a=o.left;a<o.right;a++){if(o.top>0&&e[r]==e[r-n]||o.bottom<t&&e[s]==e[s+n])return!0;r++,s++}return!1}function Ll(n,t){const e=n.selection;if(!(e instanceof F)||e.$anchorCell.pos==e.$headCell.pos)return!1;const o=Kt(n),{map:r}=o;if(H0(r,o))return!1;if(t){const i=n.tr,s={};let l=v.empty,a,c;for(let d=o.top;d<o.bottom;d++)for(let h=o.left;h<o.right;h++){const p=r.map[d*r.width+h],u=o.table.nodeAt(p);if(!(s[p]||!u))if(s[p]=!0,a==null)a=p,c=u;else{Rl(u)||(l=l.append(u.content));const f=i.mapping.map(p+o.tableStart);i.delete(f,f+u.nodeSize)}}if(a==null||c==null)return!0;
93if(i.setNodeMarkup(a+o.tableStart,null,{...zc(c.attrs,c.attrs.colspan,o.right-o.left-c.attrs.colspan),rowspan:o.bottom-o.top}),l.size){const d=a+1+c.content.size,h=Rl(c)?a+1:d;i.replaceWith(h+o.tableStart,d+o.tableStart,l)}i.setSelection(new F(i.doc.resolve(a+o.tableStart))),t(i)}return!0}function Il(n,t){const e=ft(n.schema);return z0(({node:o})=>e[o.type.spec.tableRole])(n,t)}function z0(n){return(t,e)=>{var o;const r=t.selection;let i,s;if(r instanceof F){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{if(i=y0(r.$from),!i)return!1;s=(o=an(r.$from))==null?void 0:o.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(e){let l=i.attrs;const a=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const d=Kt(t),h=t.tr;for(let u=0;u<d.right-d.left;u++)a.push(c?{...l,colwidth:c&&c[u]?[c[u]]:null}:l);let p;for(let u=d.top;u<d.bottom;u++){let f=d.map.positionAt(u,d.left,d.table);u==d.top&&(f+=i.nodeSize);for(let m=d.left,g=0;m<d.right;m++,g++)m==d.left&&u==d.top||h.insert(p=h.mapping.map(f+d.tableStart,1),n({node:i,row:u,col:m}).createAndFill(a[g]))}h.setNodeMarkup(s,n({node:i,row:d.top,col:d.left}),a[0]),r instanceof F&&h.setSelection(new F(h.doc.resolve(r.$anchorCell.pos),p?h.doc.resolve(p):void 0)),e(h)}return!0}}function B0(n,t){return function(e,o){if(!Ht(e))return!1;const r=xr(e);if(r.nodeAfter.attrs[n]===t)return!1;if(o){const i=e.tr;e.selection instanceof F?e.selection.forEachCell((s,l)=>{s.attrs[n]!==t&&i.setNodeMarkup(l,null,{...s.attrs,[n]:t})}):i.setNodeMarkup(r.pos,null,{...r.nodeAfter.attrs,[n]:t}),o(i)}return!0}}function V0(n){return function(t,e){if(!Ht(t))return!1;if(e){const o=ft(t.schema),r=Kt(t),i=t.tr,s=r.map.cellsInRect(n=="column"?{left:r.left,top:0,right:r.right,bottom:r.map.height}:n=="row"?{left:0,top:r.top,right:r.map.width,bottom:r.bottom}:r),l=s.map(a=>r.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==o.header_cell&&i.setNodeMarkup(r.tableStart+s[a],o.cell,l[a].attrs);if(i.steps.length==0)for(let a=0;a<s.length;a++)i.setNodeMarkup(r.tableStart+s[a],o.header_cell,l[a].attrs);e(i)}return!0}}function Pl(n,t,e){const o=t.map.cellsInRect({left:0,top:0,right:n=="row"?t.map.width:1,bottom:n=="column"?t.map.height:1});for(let r=0;r<o.length;r++){const i=t.table.nodeAt(o[r]);if(i&&i.type!==e.header_cell)return!1}return!0}function Vn(n,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?V0(n):function(e,o){if(!Ht(e))return!1;if(o){const r=ft(e.schema),i=Kt(e),s=e.tr,l=Pl("row",i,r),a=Pl("column",i,r),c=(n==="column"?l:n==="row"&&a)?1:0,d=n=="column"?{left:0,top:c,right:1,bottom:i.map.height}:n=="row"?{left:c,top:0,right:i.map.width,bottom:1}:i,h=n=="column"?a?r.cell:r.header_cell:n=="row"?l?r.cell:r.header_cell:r.cell;i.map.cellsInRect(d).forEach(p=>{const u=p+i.tableStart,f=s.doc.nodeAt(u);f&&s.setNodeMarkup(u,h,f.attrs)}),o(s)}return!0}}Vn("row",{useDeprecatedLogic:!0});Vn("column",{useDeprecatedLogic:!0});var F0=Vn("cell",{useDeprecatedLogic:!0});function j0(n,t){if(t<0){const e=n.nodeBefore;if(e)return n.pos-e.nodeSize;for(let o=n.index(-1)-1,r=n.before();o>=0;o--){const i=n.node(-1).child(o),s=i.lastChild;if(s)return r-1-s.nodeSize;r-=i.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const e=n.node(-1);for(let o=n.indexAfter(-1),r=n.after();o<e.childCount;o++){const i=e.child(o);if(i.childCount)return r+1;r+=i.nodeSize}}return null}function $l(n){return function(t,e){if(!Ht(t))return!1;const o=j0(xr(t),n);if(o==null)return!1;if(e){const r=t.doc.resolve(o);e(t.tr.setSelection(E.between(r,v0(r))).scrollIntoView())}return!0}}function W0(n,t){const e=n.selection.$anchor;for(let o=e.depth;o>0;o--)if(e.node(o).type.spec.tableRole=="table")return t&&t(n.tr.delete(e.before(o),e.after(o)).scrollIntoView()),!0;return!1}function to(n,t){const e=n.selection;if(!(e instanceof F))return!1;if(t){const o=n.tr,r=ft(n.schema).cell.createAndFill().content;e.forEachCell((i,s)=>{i.content.eq(r)||o.replace(o.mapping.map(s+1),o.mapping.map(s+i.nodeSize-1),new k(r,0,0))}),o.docChanged&&t(o)}return!0}function q0(n){if(!n.size)return null;
93let{content:t,openStart:e,openEnd:o}=n;for(;t.childCount==1&&(e>0&&o>0||t.child(0).type.spec.tableRole=="table");)e--,o--,t=t.child(0).content;const r=t.child(0),i=r.type.spec.tableRole,s=r.type.schema,l=[];if(i=="row")for(let a=0;a<t.childCount;a++){let c=t.child(a).content;const d=a?0:Math.max(0,e-1),h=a<t.childCount-1?0:Math.max(0,o-1);(d||h)&&(c=Si(ft(s).row,new k(c,d,h)).content),l.push(c)}else if(i=="cell"||i=="header_cell")l.push(e||o?Si(ft(s).row,new k(t,e,o)).content:t);else return null;return K0(s,l)}function K0(n,t){const e=[];for(let r=0;r<t.length;r++){const i=t[r];for(let s=i.childCount-1;s>=0;s--){const{rowspan:l,colspan:a}=i.child(s).attrs;for(let c=r;c<r+l;c++)e[c]=(e[c]||0)+a}}let o=0;for(let r=0;r<e.length;r++)o=Math.max(o,e[r]);for(let r=0;r<e.length;r++)if(r>=t.length&&t.push(v.empty),e[r]<o){const i=ft(n).cell.createAndFill(),s=[];for(let l=e[r];l<o;l++)s.push(i);t[r]=t[r].append(v.from(s))}return{height:t.length,width:o,rows:t}}function Si(n,t){const e=n.createAndFill();return new Fi(e).replace(0,e.content.size,t).doc}function J0({width:n,height:t,rows:e},o,r){if(n!=o){const i=[],s=[];for(let l=0;l<e.length;l++){const a=e[l],c=[];for(let d=i[l]||0,h=0;d<o;h++){let p=a.child(h%a.childCount);d+p.attrs.colspan>o&&(p=p.type.createChecked(Ve(p.attrs,p.attrs.colspan,d+p.attrs.colspan-o),p.content)),c.push(p),d+=p.attrs.colspan;for(let u=1;u<p.attrs.rowspan;u++)i[l+u]=(i[l+u]||0)+p.attrs.colspan}s.push(v.from(c))}e=s,n=o}if(t!=r){const i=[];for(let s=0,l=0;s<r;s++,l++){const a=[],c=e[l%t];for(let d=0;d<c.childCount;d++){let h=c.child(d);s+h.attrs.rowspan>r&&(h=h.type.create({...h.attrs,rowspan:Math.max(1,r-h.attrs.rowspan)},h.content)),a.push(h)}i.push(v.from(a))}e=i,t=r}return{width:n,height:t,rows:e}}function U0(n,t,e,o,r,i,s){const l=n.doc.type.schema,a=ft(l);let c,d;if(r>t.width)for(let h=0,p=0;h<t.height;h++){const u=e.child(h);p+=u.nodeSize;const f=[];let m;u.lastChild==null||u.lastChild.type==a.cell?m=c||(c=a.cell.createAndFill()):m=d||(d=a.header_cell.createAndFill());for(let g=t.width;g<r;g++)f.push(m);n.insert(n.mapping.slice(s).map(p-1+o),f)}if(i>t.height){const h=[];for(let f=0,m=(t.height-1)*t.width;f<Math.max(t.width,r);f++){const g=f>=t.width?!1:e.nodeAt(t.map[m+f]).type==a.header_cell;h.push(g?d||(d=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const p=a.row.create(null,v.from(h)),u=[];for(let f=t.height;f<i;f++)u.push(p);n.insert(n.mapping.slice(s).map(o+e.nodeSize-2),u)}return!!(c||d)}function Hl(n,t,e,o,r,i,s,l){if(s==0||s==t.height)return!1;let a=!1;for(let c=r;c<i;c++){const d=s*t.width+c,h=t.map[d];if(t.map[d-t.width]==h){a=!0;const p=e.nodeAt(h),{top:u,left:f}=t.findCell(h);n.setNodeMarkup(n.mapping.slice(l).map(h+o),null,{...p.attrs,rowspan:s-u}),n.insert(n.mapping.slice(l).map(t.positionAt(s,f,e)),p.type.createAndFill({...p.attrs,rowspan:u+p.attrs.rowspan-s})),c+=p.attrs.colspan-1}}return a}function zl(n,t,e,o,r,i,s,l){if(s==0||s==t.width)return!1;let a=!1;for(let c=r;c<i;c++){const d=c*t.width+s,h=t.map[d];if(t.map[d-1]==h){a=!0;const p=e.nodeAt(h),u=t.colCount(h),f=n.mapping.slice(l).map(h+o);n.setNodeMarkup(f,null,Ve(p.attrs,s-u,p.attrs.colspan-(s-u))),n.insert(f+p.nodeSize,p.type.createAndFill(Ve(p.attrs,0,s-u))),c+=p.attrs.rowspan-1}}return a}function Bl(n,t,e,o,r){let i=e?n.doc.nodeAt(e-1):n.doc;if(!i)throw new Error("No table found");let s=_.get(i);const{top:l,left:a}=o,c=a+r.width,d=l+r.height,h=n.tr;let p=0;function u(){if(i=e?h.doc.nodeAt(e-1):h.doc,!i)throw new Error("No table found");s=_.get(i),p=h.mapping.maps.length}U0(h,s,i,e,c,d,p)&&u(),Hl(h,s,i,e,a,c,l,p)&&u(),Hl(h,s,i,e,a,c,d,p)&&u(),zl(h,s,i,e,l,d,a,p)&&u(),zl(h,s,i,e,l,d,c,p)&&u();for(let f=l;f<d;f++){const m=s.positionAt(f,a,i),g=s.positionAt(f,c,i);h.replace(h.mapping.slice(p).map(m+e),h.mapping.slice(p).map(g+e),new k(r.rows[f-l],0,0))}u(),h.setSelection(new F(h.doc.resolve(e+s.positionAt(l,a,i)),h.doc.resolve(e+s.positionAt(d-1,c-1,i)))),t(h)}var Z0=Qi({ArrowLeft:eo("horiz",-1),ArrowRight:eo("horiz",1),ArrowUp:eo("vert",-1),ArrowDown:eo("vert",1),"Shift-ArrowLeft":no("horiz",-1),"Shift-ArrowRight":no("horiz",1),"Shift-ArrowUp":no("vert",-1),"Shift-ArrowDown":no("vert",1),Backspace:to,"Mod-Backspace":to,Delete:to,"Mod-Delete":to});function uo(n,t,e){return e.eq(n.selection)?!1:(t&&t(n.tr.setSelection(e).scrollIntoView()),!0)}function eo(n,t){return(e,o,r)=>{if(!r)return!1;const i=e.selection;if(i instanceof F)return uo(e,o,N.near(i.$headCell,t));if(n!="horiz"&&!i.empty)return!1;const s=qc(r,n,t);if(s==null)return!1;if(n=="horiz")return uo(e,o,N.near(e.doc.resolve(i.head+t),t));{const l=e.doc.resolve(s),a=Hc(l,n,t);let c;return a?c=N.near(a,1):t<0?c=N.near(e.doc.resolve(l.before(-1)),-1):c=N.near(e.doc.resolve(l.after(-1)),1),uo(e,o,c)}}}function no(n,t){return(e,o,r)=>{if(!r)return!1;const i=e.selection;let s;if(i instanceof F)s=i;else{const a=qc(r,n,t);if(a==null)return!1;s=new F(e.doc.resolve(a))}const l=Hc(s.$headCell,n,t);return l?uo(e,o,new F(s.$anchorCell,l)):!1}}function _0(n,t){const e=n.state.doc,o=an(e.resolve(t));return o?(n.dispatch(n.state.tr.setSelection(new F(o))),!0):!1}function G0(n,t,e){if(!Ht(n.state))return!1;let o=q0(e);const r=n.state.selection;if(r instanceof F){o||(o={width:1,height:1,rows:[v.from(Si(ft(n.state.schema).cell,e))]});const i=r.$anchorCell.node(-1),s=r.$anchorCell.start(-1),l=_.get(i).rectBetween(r.$anchorCell.pos-s,r.$headCell.pos-s);return o=J0(o,l.right-l.left,l.bottom-l.top),Bl(n.state,n.dispatch,s,l,o),!0}else if(o){const i=xr(n.state),s=i.start(-1);return Bl(n.state,n.dispatch,s,_.get(i.node(-1)).findCell(i.pos-s),o),!0}else return!1}function X0(n,t){var e;if(t.ctrlKey||t.metaKey)return;const o=Vl(n,t.target);let r;if(t.shiftKey&&n.state.selection instanceof F)i(n.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&o&&(r=an(n.state.selection.$anchor))!=null&&((e=Kr(n,t))==null?void 0:e.pos)!=r.pos)i(r,t),t.preventDefault();else if(!o)return;function i(a,c){let d=Kr(n,c);const h=he.getState(n.state)==null;
93if(!d||!cs(a,d))if(h)d=a;else return;const p=new F(a,d);if(h||!n.state.selection.eq(p)){const u=n.state.tr.setSelection(p);h&&u.setMeta(he,a.pos),n.dispatch(u)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),he.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(he,-1))}function l(a){const c=a,d=he.getState(n.state);let h;if(d!=null)h=n.state.doc.resolve(d);else if(Vl(n,c.target)!=o&&(h=Kr(n,t),!h))return s();h&&i(h,c)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function qc(n,t,e){if(!(n.state.selection instanceof E))return null;const{$head:o}=n.state.selection;for(let r=o.depth-1;r>=0;r--){const i=o.node(r);if((e<0?o.index(r):o.indexAfter(r))!=(e<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const s=o.before(r),l=t=="vert"?e>0?"down":"up":e>0?"right":"left";return n.endOfTextblock(l)?s:null}}return null}function Vl(n,t){for(;t&&t!=n.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function Kr(n,t){const e=n.posAtCoords({left:t.clientX,top:t.clientY});return e&&e?an(n.state.doc.resolve(e.pos)):null}var Q0=class{constructor(n,t){this.node=n,this.defaultCellMinWidth=t,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",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Ai(n,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!=this.node.type?!1:(this.node=n,Ai(n,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};function Ai(n,t,e,o,r,i){var s;let l=0,a=!0,c=t.firstChild;const d=n.firstChild;if(d){for(let h=0,p=0;h<d.childCount;h++){const{colspan:u,colwidth:f}=d.child(h).attrs;for(let m=0;m<u;m++,p++){const g=r==p?i:f&&f[m],w=g?g+"px":"";if(l+=g||o,g||(a=!1),c)c.style.width!=w&&(c.style.width=w),c=c.nextSibling;else{const x=document.createElement("col");x.style.width=w,t.appendChild(x)}}}for(;c;){const h=c.nextSibling;(s=c.parentNode)==null||s.removeChild(c),c=h}a?(e.style.width=l+"px",e.style.minWidth=""):(e.style.width="",e.style.minWidth=l+"px")}}var St=new at("tableColumnResizing");function Y0({handleWidth:n=5,cellMinWidth:t=25,defaultCellMinWidth:e=100,View:o=Q0,lastColumnResizable:r=!0}={}){const i=new Q({key:St,state:{init(s,l){var a,c;const d=(c=(a=i.spec)==null?void 0:a.props)==null?void 0:c.nodeViews,h=ft(l.schema).table.name;return o&&d&&(d[h]=(p,u)=>new o(p,e,u)),new tg(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{const l=St.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{eg(s,l,n,r)},mouseleave:s=>{ng(s)},mousedown:(s,l)=>{og(s,l,t,e)}},decorations:s=>{const l=St.getState(s);if(l&&l.activeHandle>-1)return ag(s,l.activeHandle)},nodeViews:{}}});return i}var tg=class fo{constructor(t,e){this.activeHandle=t,this.dragging=e}apply(t){const e=this,o=t.getMeta(St);if(o&&o.setHandle!=null)return new fo(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new fo(e.activeHandle,o.setDragging);if(e.activeHandle>-1&&t.docChanged){let r=t.mapping.map(e.activeHandle,-1);return Mi(t.doc.resolve(r))||(r=-1),new fo(r,e.dragging)}return e}};function eg(n,t,e,o){if(!n.editable)return;const r=St.getState(n.state);if(r&&!r.dragging){const i=ig(t.target);let s=-1;if(i){const{left:l,right:a}=i.getBoundingClientRect();t.clientX-l<=e?s=Fl(n,t,"left",e):a-t.clientX<=e&&(s=Fl(n,t,"right",e))}if(s!=r.activeHandle){if(!o&&s!==-1){const l=n.state.doc.resolve(s),a=l.node(-1),c=_.get(a),d=l.start(-1);if(c.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==c.width-1)return}Kc(n,s)}}}function ng(n){if(!n.editable)return;const t=St.getState(n.state);t&&t.activeHandle>-1&&!t.dragging&&Kc(n,-1)}function og(n,t,e,o){var r;if(!n.editable)return!1;const i=(r=n.dom.ownerDocument.defaultView)!=null?r:window,s=St.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const l=n.state.doc.nodeAt(s.activeHandle),a=rg(n,s.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(St,{setDragging:{startX:t.clientX,startWidth:a}}));function c(h){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",d);const p=St.getState(n.state);p!=null&&p.dragging&&(sg(n,p.activeHandle,jl(p.dragging,h,e)),n.dispatch(n.state.tr.setMeta(St,{setDragging:null})))}function d(h){if(!h.which)return c(h);const p=St.getState(n.state);if(p&&p.dragging){const u=jl(p.dragging,h,e);Wl(n,p.activeHandle,u,o)}}return Wl(n,s.activeHandle,a,o),i.addEventListener("mouseup",c),i.addEventListener("mousemove",d),t.preventDefault(),!0}function rg(n,t,{colspan:e,colwidth:o}){const r=o&&o[o.length-1];if(r)return r;const i=n.domAtPos(t);let s=i.node.childNodes[i.offset].offsetWidth,l=e;if(o)for(let a=0;a<e;a++)o[a]&&(s-=o[a],l--);return s/l}function ig(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function Fl(n,t,e,o){const r=e=="right"?-o:o,i=n.posAtCoords({left:t.clientX+r,top:t.clientY});if(!i)return-1;const{pos:s}=i,l=an(n.state.doc.resolve(s));if(!l)return-1;if(e=="right")return l.pos;const a=_.get(l.node(-1)),c=l.start(-1),d=a.map.indexOf(l.pos-c);return d%a.width==0?-1:c+a.map[d-1]}function jl(n,t,e){const o=t.clientX-n.startX;return Math.max(e,n.startWidth+o)}function Kc(n,t){n.dispatch(n.state.tr.setMeta(St,{setHandle:t}))}function sg(n,t,e){const o=n.state.doc.resolve(t),r=o.node(-1),i=_.get(r),s=o.start(-1),l=i.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let c=0;c<i.height;c++){const d=c*i.width+l;if(c&&i.map[d]==i.map[d-i.width])continue;const h=i.map[d],p=r.nodeAt(h).attrs,u=p.colspan==1?0:l-i.colCount(h);if(p.colwidth&&p.colwidth[u]==e)continue;const f=p.colwidth?p.colwidth.slice():lg(p.colspan);f[u]=e,a.setNodeMarkup(s+h,null,{...p,colwidth:f})}a.docChanged&&n.dispatch(a)}
93function Wl(n,t,e,o){const r=n.state.doc.resolve(t),i=r.node(-1),s=r.start(-1),l=_.get(i).colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;let a=n.domAtPos(r.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&Ai(i,a.firstChild,a,o,l,e)}function lg(n){return Array(n).fill(0)}function ag(n,t){var e;const o=[],r=n.doc.resolve(t),i=r.node(-1);if(!i)return U.empty;const s=_.get(i),l=r.start(-1),a=s.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const d=a+c*s.width;if((a==s.width-1||s.map[d]!=s.map[d+1])&&(c==0||s.map[d]!=s.map[d-s.width])){const h=s.map[d],p=l+h+i.nodeAt(h).nodeSize-1,u=document.createElement("div");u.className="column-resize-handle",(e=St.getState(n))!=null&&e.dragging&&o.push(yt.node(l+h,l+h+i.nodeAt(h).nodeSize,{class:"column-resize-dragging"})),o.push(yt.widget(p,u))}}return U.create(n.doc,o)}function cg({allowTableNodeSelection:n=!1}={}){return new Q({key:he,state:{init(){return null},apply(t,e){const o=t.getMeta(he);if(o!=null)return o==-1?null:o;if(e==null||!t.docChanged)return e;const{deleted:r,pos:i}=t.mapping.mapResult(e);return r?null:i}},props:{decorations:x0,handleDOMEvents:{mousedown:X0},createSelectionBetween(t){return he.getState(t.state)!=null?t.state.selection:null},handleTripleClick:_0,handleKeyDown:Z0,handlePaste:G0},appendTransaction(t,e,o){return S0(o,Fc(o,e),n)}})}function Ei(n,t){return t?["width",`${Math.max(t,n)}px`]:["min-width",`${n}px`]}function ql(n,t,e,o,r,i){var s;let l=0,a=!0,c=t.firstChild;const d=n.firstChild;if(d!==null)for(let h=0,p=0;h<d.childCount;h+=1){const{colspan:u,colwidth:f}=d.child(h).attrs;for(let m=0;m<u;m+=1,p+=1){const g=r===p?i:f&&f[m],w=g?`${g}px`:"";if(l+=g||o,g||(a=!1),c){if(c.style.width!==w){const[x,T]=Ei(o,g);c.style.setProperty(x,T)}c=c.nextSibling}else{const x=document.createElement("col"),[T,$]=Ei(o,g);x.style.setProperty(T,$),t.appendChild(x)}}}for(;c;){const h=c.nextSibling;(s=c.parentNode)===null||s===void 0||s.removeChild(c),c=h}a?(e.style.width=`${l}px`,e.style.minWidth=""):(e.style.width="",e.style.minWidth=`${l}px`)}class dg{constructor(t,e){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ql(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,ql(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){return t.type==="attributes"&&(t.target===this.table||this.colgroup.contains(t.target))}}function hg(n,t,e,o){let r=0,i=!0;const s=[],l=n.firstChild;if(!l)return{};for(let d=0,h=0;d<l.childCount;d+=1){const{colspan:p,colwidth:u}=l.child(d).attrs;for(let f=0;f<p;f+=1,h+=1){const m=e===h?o:u&&u[f];r+=m||t,m||(i=!1);const[g,w]=Ei(t,m);s.push(["col",{style:`${g}: ${w}`}])}}const a=i?`${r}px`:"",c=i?"":`${r}px`;return{colgroup:["colgroup",{},...s],tableWidth:a,tableMinWidth:c}}function Kl(n,t){return n.createAndFill()}function pg(n){if(n.cached.tableNodeTypes)return n.cached.tableNodeTypes;const t={};return Object.keys(n.nodes).forEach(e=>{const o=n.nodes[e];o.spec.tableRole&&(t[o.spec.tableRole]=o)}),n.cached.tableNodeTypes=t,t}function ug(n,t,e,o,r){const i=pg(n),s=[],l=[];for(let c=0;c<e;c+=1){const d=Kl(i.cell);if(d&&l.push(d),o){const h=Kl(i.header_cell);h&&s.push(h)}}const a=[];for(let c=0;c<t;c+=1)a.push(i.row.createChecked(null,o&&c===0?s:l));return i.table.createChecked(null,a)}function fg(n){return n instanceof F}const oo=({editor:n})=>{const{selection:t}=n.state;if(!fg(t))return!1;let e=0;const o=Nc(t.ranges[0].$from,r=>r.type.name==="table");return o==null||o.node.descendants(r=>{if(r.type.name==="table")return!1;["tableCell","tableHeader"].includes(r.type.name)&&(e+=1)}),e===t.ranges.length?(n.commands.deleteTable(),!0):!1},mg=Y.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:dg,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:t}){const{colgroup:e,tableWidth:o,tableMinWidth:r}=hg(n,this.options.cellMinWidth);return["table",G(this.options.HTMLAttributes,t,{style:o?`width: ${o}`:`min-width: ${r}`}),e,["tbody",0]]},addCommands(){return{insertTable:({rows:n=3,cols:t=3,withHeaderRow:e=!0}={})=>({tr:o,dispatch:r,editor:i})=>{const s=ug(i.schema,n,t,e);if(r){const l=o.selection.from+1;o.replaceSelectionWith(s).scrollIntoView().setSelection(E.near(o.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:n,dispatch:t})=>O0(n,t),addColumnAfter:()=>({state:n,dispatch:t})=>T0(n,t),deleteColumn:()=>({state:n,dispatch:t})=>D0(n,t),addRowBefore:()=>({state:n,dispatch:t})=>L0(n,t),addRowAfter:()=>({state:n,dispatch:t})=>I0(n,t),deleteRow:()=>({state:n,dispatch:t})=>$0(n,t),deleteTable:()=>({state:n,dispatch:t})=>W0(n,t),mergeCells:()=>({state:n,dispatch:t})=>Ll(n,t),splitCell:()=>({state:n,dispatch:t})=>Il(n,t),toggleHeaderColumn:()=>({state:n,dispatch:t})=>Vn("column")(n,t),toggleHeaderRow:()=>({state:n,dispatch:t})=>Vn("row")(n,t),toggleHeaderCell:()=>({state:n,dispatch:t})=>F0(n,t),mergeOrSplit:()=>({state:n,dispatch:t})=>Ll(n,t)?!0:Il(n,t),setCellAttribute:(n,t)=>({state:e,dispatch:o})=>B0(n,t)(e,o),goToNextCell:()=>({state:n,dispatch:t})=>$l(1)(n,t),goToPreviousCell:()=>({state:n,dispatch:t})=>$l(-1)(n,t),fixTables:()=>({state:n,dispatch:t})=>(t&&Fc(n),!0),setCellSelection:n=>({tr:t,dispatch:e})=>
93{if(e){const o=F.create(t.doc,n.anchorCell,n.headCell);t.setSelection(o)}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:oo,"Mod-Backspace":oo,Delete:oo,"Mod-Delete":oo}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Y0({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],cg({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const t={name:n.name,options:n.options,storage:n.storage};return{tableRole:I(C(n,"tableRole",t))}}}),gg=Y.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const t=n.getAttribute("colwidth");return t?t.split(",").map(e=>parseInt(e,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",G(this.options.HTMLAttributes,n),0]}}),yg=Y.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const t=n.getAttribute("colwidth");return t?t.split(",").map(e=>parseInt(e,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",G(this.options.HTMLAttributes,n),0]}}),wg=Y.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",G(this.options.HTMLAttributes,n),0]}}),vg=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,bg=Y.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",G(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:t})=>t.insertContent({type:this.name,attrs:n})}},addInputRules(){return[Rc({find:vg,type:this.type,getAttributes:n=>{const[,,t,e,o]=n;return{src:e,alt:t,title:o}}})]}}),kg="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2
93ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",xg="ελ1Ï
2бг1ел3деÑи4еÑ2каÑолик6ом3мÐ
93ºÐ´2он1Ñква6онлайн5Ñг3ÑÑÑ2Ñ2ÑайÑ3Ñб3ÑкÑ3Òаз3Õ°Õ¡Õµ3×שר××5×§××3Ø§Ø¨ÙØ¸Ø¨Ù5را٠ÙÙ5ÙØ§Ø±Ø¯Ù4Ø¨ØØ±ÙÙ5جزائر5Ø³Ø¹ÙØ¯ÙØ©6عÙÙØ§Ù5٠غرب5٠ارات5ÛØ±Ø§Ù5بارت2زار4ÙØªÙ3ھارت5تÙÙØ³4Ø³ÙØ¯Ø§Ù3Ø±ÙØ©5Ø´Ø¨ÙØ©4عراÙ2ب2٠اÙ4ÙÙØ³Ø·ÙÙ6ÙØ·Ø±3ÙØ§Ø«ÙÙÙÙ6ÙÙ 3٠صر2ÙÙØ³Ùا5ÙØ±ÙتاÙÙØ§7ÙØ¹4Ù٠راÙ5پاکستاÙ7ÚØ§Ø±Øª4à¤à¥à¤®3नà¥à¤3à¤à¤¾à¤°à¤¤0मà¥3à¥à¤¤5सà¤à¤à¤ न5বাà¦à¦²à¦¾5à¦à¦¾à¦°à¦¤2ৰত4à¨à¨¾à¨°à¨¤4àªàª¾àª°àª¤4à¬à¬¾à¬°à¬¤4à®à®¨à¯à®¤à®¿à®¯à®¾6லà®à¯à®à¯6à®à®¿à®à¯à®à®ªà¯à®ªà¯à®°à¯11à°à°¾à°°à°¤à±5à²à²¾à²°à²¤4à´à´¾à´°à´¤à´5à¶½à¶à¶à·4à¸à¸à¸¡3à¹à¸à¸¢3ລາວ3áá2ã¿ããª3ã¢ãã¾ã³4ã¯ã©ã¦ã4ã°ã¼ã°ã«4ã³ã 2ã¹ãã¢3ã»ã¼ã«3ãã¡ãã·ã§ã³6ãã¤ã³ã4ä¸ç2ä¸ä¿¡1å½1å1æç½3äºé©¬é3ä¼ä¸2ä½å±±2ä¿¡æ¯2å¥åº·2å «å¦2å ¬å¸1ç2å°æ¹¾1ç£2åå1åº1æ 2åé0大é åº5å¨çº¿2大æ¿2天主æ3娱ä¹2å®¶é»2广ä¸2å¾®å2æ å2æç±ä½ 3ææº2æè2æ¿å¡1åº2æ°å å¡2é»2æ¶å°2æ¸ç±2æºæ2淡马é¡3游æ2æ¾³é2ç¹ç2ç§»å¨2ç»ç»æºæ4ç½å1åº1ç«1ç»2èé2è°·æ2è´ç©2é販2éå¢2é»è¨çç§4é£å©æµ¦3é£å2é¤å 2馿 ¼éæ3港2ë·ë·1ì»´2ì¼ì±2íêµ2",sn=(n,t)=>{for(const e in t)n[e]=t[e];return n},Oi="numeric",Ti="ascii",Ni="alpha",Cn="asciinumeric",gn="alphanumeric",Di="domain",Jc="emoji",Cg="scheme",Mg="slashscheme",Jr="whitespace";function Sg(n,t){return n in t||(t[n]=[]),t[n]}function Ne(n,t,e){t[Oi]&&(t[Cn]=!0,t[gn]=!0),t[Ti]&&(t[Cn]=!0,t[Ni]=!0),t[Cn]&&(t[gn]=!0),t[Ni]&&(t[gn]=!0),t[gn]&&(t[Di]=!0),t[Jc]&&(t[Di]=!0);for(const o in t){const r=Sg(o,e);r.indexOf(n)<0&&r.push(n)}}function Ag(n,t){const e={};for(const o in t)t[o].indexOf(n)>=0&&(e[o]=!0);return e}function kt(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}kt.groups={};kt.prototype={accepts(){return!!this.t},go(n){const t=this,e=t.j[n];if(e)return e;for(let o=0;o<t.jr.length;o++){const r=t.jr[o][0],i=t.jr[o][1];if(i&&r.test(n))return i}return t.jd},has(n,t=!1){return t?n in this.j:!!this.go(n)},ta(n,t,e,o){for(let r=0;r<n.length;r++)this.tt(n[r],t,e,o)},tr(n,t,e,o){o=o||kt.groups;let r;return t&&t.j?r=t:(r=new kt(t),e&&o&&Ne(t,e,o)),this.jr.push([n,r]),r},ts(n,t,e,o){let r=this;const i=n.length;if(!i)return r;for(let s=0;s<i-1;s++)r=r.tt(n[s]);return r.tt(n[i-1],t,e,o)},tt(n,t,e,o){o=o||kt.groups;const r=this;if(t&&t.j)return r.j[n]=t,t;const i=t;let s,l=r.go(n);if(l?(s=new kt,sn(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new kt,i){if(o)if(s.t&&typeof s.t=="string"){const a=sn(Ag(s.t,o),e);Ne(i,a,o)}else e&&Ne(i,e,o);s.t=i}return r.j[n]=s,s}};const L=(n,t,e,o,r)=>n.ta(t,e,o,r),J=(n,t,e,o,r)=>n.tr(t,e,o,r),Jl=(n,t,e,o,r)=>n.ts(t,e,o,r),b=(n,t,e,o,r)=>n.tt(t,e,o,r),Gt="WORD",Ri="UWORD",Uc="ASCIINUMERICAL",Zc="ALPHANUMERICAL",Fn="LOCALHOST",Li="TLD",Ii="UTLD",mo="SCHEME",Je="SLASH_SCHEME",ds="NUM",Pi="WS",hs="NL",Mn="OPENBRACE",Sn="CLOSEBRACE",Lo="OPENBRACKET",Io="CLOSEBRACKET",Po="OPENPAREN",$o="CLOSEPAREN",Ho="OPENANGLEBRACKET",zo="CLOSEANGLEBRACKET",Bo="FULLWIDTHLEFTPAREN",Vo="FULLWIDTHRIGHTPAREN",Fo="LEFTCORNERBRACKET",jo="RIGHTCORNERBRACKET",Wo="LEFTWHITECORNERBRACKET",qo="RIGHTWHITECORNERBRACKET",Ko="FULLWIDTHLESSTHAN",Jo="FULLWIDTHGREATERTHAN",Uo="AMPERSAND",Zo="APOSTROPHE",_o="ASTERISK",ce="AT",Go="BACKSLASH",Xo="BACKTICK",Qo="CARET",pe="COLON",ps="COMMA",Yo="DOLLAR",Vt="DOT",tr="EQUALS",us="EXCLAMATION",Tt="HYPHEN",An="PERCENT",er="PIPE",nr="PLUS",or="POUND",En="QUERY",fs="QUOTE",_c="FULLWIDTHMIDDLEDOT",ms="SEMI",Ft="SLASH",On="TILDE",rr="UNDERSCORE",Gc="EMOJI",ir="SYM";var Xc=Object.freeze({__proto__:null,ALPHANUMERICAL:Zc,AMPERSAND:Uo,APOSTROPHE:Zo,ASCIINUMERICAL:Uc,ASTERISK:_o,AT:ce,BACKSLASH:Go,BACKTICK:Xo,CARET:Qo,CLOSEANGLEBRACKET:zo,CLOSEBRACE:Sn,CLOSEBRACKET:Io,CLOSEPAREN:$o,COLON:pe,COMMA:ps,DOLLAR:Yo,DOT:Vt,EMOJI:Gc,EQUALS:tr,EXCLAMATION:us,FULLWIDTHGREATERTHAN:Jo,FULLWIDTHLEFTPAREN:Bo,FULLWIDTHLESSTHAN:Ko,FULLWIDTHMIDDLEDOT:_c,FULLWIDTHRIGHTPAREN:Vo,HYPHEN:Tt,LEFTCORNERBRACKET:Fo,LEFTWHITECORNERBRACKET:Wo,LOCALHOST:Fn,NL:hs,NUM:ds,OPENANGLEBRACKET:Ho,OPENBRACE:Mn,OPENBRACKET:Lo,OPENPAREN:Po,PERCENT:An,PIPE:er,PLUS:nr,POUND:or,QUERY:En,QUOTE:fs,RIGHTCORNERBRACKET:jo,RIGHTWHITECORNERBRACKET:qo,SCHEME:mo,SEMI:ms,SLASH:Ft,SLASH_SCHEME:Je,SYM:ir,TILDE:On,TLD:Li,UNDERSCORE:rr,UTLD:Ii,UWORD:Ri,WORD:Gt,WS:Pi});const Ut=/[a-z]/,pn=new RegExp("\\p{L}","u"),Ur=new RegExp("\\p{Emoji}","u"),Zt=/\d/,Zr=/\s/,Ul="\r",_r=` 94`,Eg="ï¸",Og="â",Gr="";let ro=null,io=null;function Tg(n=[]){const t={};kt.groups=t;const e=new kt;ro==null&&(ro=Zl(kg)),io==null&&(io=Zl(xg)),b(e,"'",Zo),b(e,"{",Mn),b(e,"}",Sn),b(e,"[",Lo),b(e,"]",Io),b(e,"(",Po),b(e,")",$o),b(e,"<",Ho),b(e,">",zo),b(e,"ï¼",Bo),b(e,"ï¼",Vo),b(e,"ã",Fo),b(e,"ã",jo),b(e,"ã",Wo),b(e,"ã",qo),b(e,"ï¼",Ko),b(e,"ï¼",Jo),b(e,"&",Uo),b(e,"*",_o),b(e,"@",ce),b(e,"`",Xo),b(e,"^",Qo),b(e,":",pe),b(e,",",ps),b(e,"$",Yo),b(e,".",Vt),b(e,"=",tr),b(e,"!",us),b(e,"-",Tt),b(e,"%",An),b(e,"|",er),b(e,"+",nr),b(e,"#",or),b(e,"?",En),b(e,'"',fs),b(e,"/",Ft),b(e,";",ms),b(e,"~",On),b(e,"_",rr),b(e,"\\",Go),b(e,"ã»",_c);const o=J(e,Zt,ds,{[Oi]:!0});J(o,Zt,o);const r=J(o,Ut,Uc,{[Cn]:!0}),i=J(o,pn,Zc,{[gn]:!0}),s=J(e,Ut,Gt,{[Ti]:!0});J(s,Zt,r),J(s,Ut,s),J(r,Zt,r),J(r,Ut,r);const l=J(e,pn,Ri,{[Ni]:!0});J(l,Ut),J(l,Zt,i),J(l,pn,l),J(i,Zt,i),J(i,Ut),J(i,pn,i);const a=b(e,_r,hs,{[Jr]:!0}),c=b(e,Ul,Pi,{[Jr]:!0}),d=J(e,Zr,Pi,{[Jr]:!0});b(e,Gr,d),b(c,_r,a),b(c,Gr,d),J(c,Zr,d),b(d,Ul),b(d,_r),J(d,Zr,d),b(d,Gr,d);const h=J(e,Ur,Gc,{[Jc]:!0});b(h,"#"),J(h,Ur,h),b(h,Eg,h);const p=b(h,Og);b(p,"#"),J(p,Ur,h);const u=[[Ut,s],[Zt,r]],f=[[Ut,null],[pn,l],[Zt,i]];for(let m=0;m<ro.length;m++)re(e,ro[m],Li,Gt,u);for(let m=0;m<io.length;m++)re(e,io[m],Ii,Ri,f);Ne(Li,{tld:!0,ascii:!0},t),Ne(Ii,{utld:!0,alpha:!0},t),re(e,"file",mo,Gt,u),re(e,"mailto",mo,Gt,u),re(e,"http",Je,Gt,u),re(e,"https",Je,Gt,u),re(e,"ftp",Je,Gt,u),re(e,"ftps",Je,Gt,u),Ne(mo,{scheme:!0,ascii:!0},t),Ne(Je,{slashscheme:!0,ascii:!0},t),n=n.sort((m,g)=>m[0]>g[0]?1:-1);for(let m=0;m<n.length;m++){const g=n[m][0],w=n[m][1]?{[Cg]:!0}:{[Mg]:!0};g.indexOf("-")>=0?w[Di]=!0:Ut.test(g)?Zt.test(g)?w[Cn]=!0:w[Ti]=!0:w[Oi]=!0,Jl(e,g,g,w)}return Jl(e,"localhost",Fn,{ascii:!0}),e.jd=new kt(ir),{start:e,tokens:sn({groups:t},Xc)}}function Qc(n,t){const e=Ng(t.replace(/[A-Z]/g,l=>l.toLowerCase())),o=e.length,r=[];let i=0,s=0;for(;s<o;){let l=n,a=null,c=0,d=null,h=-1,p=-1;for(;s<o&&(a=l.go(e[s]));)l=a,l.accepts()?(h=0,p=0,d=l):h>=0&&(h+=e[s].length,p++),c+=e[s].length,i+=e[s].length,s++;i-=h,s-=p,c-=h,r.push({t:d.t,v:t.slice(i-c,i),s:i-c,e:i})}return r}function Ng(n){const t=[],e=n.length;let o=0;for(;o<e;){let r=n.charCodeAt(o),i,s=r<55296||r>56319||o+1===e||(i=n.charCodeAt(o+1))<56320||i>57343?n[o]:n.slice(o,o+2);t.push(s),o+=s.length}return t}function re(n,t,e,o,r){let i;const s=t.length;for(let l=0;l<s-1;l++){const a=t[l];n.j[a]?i=n.j[a]:(i=new kt(o),i.jr=r.slice(),n.j[a]=i),n=i}return i=new kt(e),i.jr=r.slice(),n.j[t[s-1]]=i,i}function Zl(n){const t=[],e=[];let o=0,r="0123456789";for(;o<n.length;){let i=0;for(;r.indexOf(n[o+i])>=0;)i++;if(i>0){t.push(e.join(""));for(let s=parseInt(n.substring(o,o+i),10);s>0;s--)e.pop();o+=i}else e.push(n[o]),o++}return t}const jn={defaultProtocol:"http",events:null,format:_l,formatHref:_l,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function gs(n,t=null){let e=sn({},jn);n&&(e=sn(e,n instanceof gs?n.o:n));const o=e.ignoreTags,r=[];for(let i=0;i<o.length;i++)r.push(o[i].toUpperCase());this.o=e,t&&(this.defaultRender=t),this.ignoreTags=r}gs.prototype={o:jn,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,t,e){const o=t!=null;let r=this.o[n];return r&&(typeof r=="object"?(r=e.t in r?r[e.t]:jn[n],typeof r=="function"&&o&&(r=r(t,e))):typeof r=="function"&&o&&(r=r(t,e.t,e)),r)},getObj(n,t,e){let o=this.o[n];return typeof o=="function"&&t!=null&&(o=o(t,e.t,e)),o},render(n){const t=n.render(this);return(this.get("render",null,n)||this.defaultRender)(t,n.t,n)}};function _l(n){return n}function Yc(n,t){this.t="token",this.v=n,this.tk=t}Yc.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const t=this.toString(),e=n.get("truncate",t,this),o=n.get("format",t,this);return e&&o.length>e?o.substring(0,e)+"â¦":o},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=jn.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){const t=this,e=this.toHref(n.get("defaultProtocol")),o=n.get("formatHref",e,this),r=n.get("tagName",e,t),i=this.toFormattedString(n),s={},l=n.get("className",e,t),a=n.get("target",e,t),c=n.get("rel",e,t),d=n.getObj("attributes",e,t),h=n.getObj("events",e,t);return s.href=o,l&&(s.class=l),a&&(s.target=a),c&&(s.rel=c),d&&sn(s,d),{tagName:r,attributes:s,content:i,eventListeners:h}}};function Cr(n,t){class e extends Yc{constructor(r,i){super(r,i),this.t=n}}for(const o in t)e.prototype[o]=t[o];return e.t=n,e}const Gl=Cr("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Xl=Cr("text"),Dg=Cr("nl"),so=Cr("url",{isLink:!0,toHref(n=jn.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Fn&&n[1].t===pe}}),Et=n=>new kt(n);function Rg({groups:n}){const t=n.domain.concat([Uo,_o,ce,Go,Xo,Qo,Yo,tr,Tt,ds,An,er,nr,or,Ft,ir,On,rr]),e=[Zo,pe,ps,Vt,us,An,En,fs,ms,Ho,zo,Mn,Sn,Io,Lo,Po,$o,Bo,V
vendor: 4,005 bytes, lines 94-97
94o,Fo,jo,Wo,qo,Ko,Jo],o=[Uo,Zo,_o,Go,Xo,Qo,Yo,tr,Tt,Mn,Sn,An,er,nr,or,En,Ft,ir,On,rr],r=Et(),i=b(r,On);L(i,o,i),L(i,n.domain,i);const s=Et(),l=Et(),a=Et();L(r,n.domain,s),L(r,n.scheme,l),L(r,n.slashscheme,a),L(s,o,i),L(s,n.domain,s);const c=b(s,ce);b(i,ce,c),b(l,ce,c),b(a,ce,c);const d=b(i,Vt);L(d,o,i),L(d,n.domain,i);const h=Et();L(c,n.domain,h),L(h,n.domain,h);const p=b(h,Vt);L(p,n.domain,h);const u=Et(Gl);L(p,n.tld,u),L(p,n.utld,u),b(c,Fn,u);const f=b(h,Tt);b(f,Tt,f),L(f,n.domain,h),L(u,n.domain,h),b(u,Vt,p),b(u,Tt,f);const m=b(u,pe);L(m,n.numeric,Gl);const g=b(s,Tt),w=b(s,Vt);b(g,Tt,g),L(g,n.domain,s),L(w,o,i),L(w,n.domain,s);const x=Et(so);L(w,n.tld,x),L(w,n.utld,x),L(x,n.domain,s),L(x,o,i),b(x,Vt,w),b(x,Tt,g),b(x,ce,c);const T=b(x,pe),$=Et(so);L(T,n.numeric,$);const O=Et(so),H=Et();L(O,t,O),L(O,e,H),L(H,t,O),L(H,e,H),b(x,Ft,O),b($,Ft,O);const j=b(l,pe),K=b(a,pe),P=b(K,Ft),gt=b(P,Ft);L(l,n.domain,s),b(l,Vt,w),b(l,Tt,g),L(a,n.domain,s),b(a,Vt,w),b(a,Tt,g),L(j,n.domain,O),b(j,Ft,O),b(j,En,O),L(gt,n.domain,O),L(gt,t,O),b(gt,Ft,O);const zt=[[Mn,Sn],[Lo,Io],[Po,$o],[Ho,zo],[Bo,Vo],[Fo,jo],[Wo,qo],[Ko,Jo]];for(let oe=0;oe<zt.length;oe++){const[cn,It]=zt[oe],z=b(O,cn);b(H,cn,z),b(z,It,O);const ct=Et(so);L(z,t,ct);const At=Et();L(z,e),L(ct,t,ct),L(ct,e,At),L(At,t,ct),L(At,e,At),b(ct,It,O),b(At,It,O)}return b(r,Fn,x),b(r,hs,Dg),{start:r,tokens:Xc}}function Lg(n,t,e){let o=e.length,r=0,i=[],s=[];for(;r<o;){let l=n,a=null,c=null,d=0,h=null,p=-1;for(;r<o&&!(a=l.go(e[r].t));)s.push(e[r++]);for(;r<o&&(c=a||l.go(e[r].t));)a=null,l=c,l.accepts()?(p=0,h=l):p>=0&&p++,r++,d++;if(p<0)r-=d,r<o&&(s.push(e[r]),r++);else{s.length>0&&(i.push(Xr(Xl,t,s)),s=[]),r-=p,d-=p;const u=h.t,f=e.slice(r-d,r);i.push(Xr(u,t,f))}}return s.length>0&&i.push(Xr(Xl,t,s)),i}function Xr(n,t,e){const o=e[0].s,r=e[e.length-1].e,i=t.slice(o,r);return new n(i,e)}const Ig=typeof console<"u"&&console&&console.warn||(()=>{}),Pg="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",q={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function $g(){return kt.groups={},q.scanner=null,q.parser=null,q.tokenQueue=[],q.pluginQueue=[],q.customSchemes=[],q.initialized=!1,q}function Ql(n,t=!1){if(q.initialized&&Ig(`linkifyjs: already initialized - will not register custom scheme "${n}" ${Pg}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format. 951. Must only contain digits, lowercase ASCII letters or "-" 962. Cannot start or end with "-" 973. "-" cannot repeat`);q.customSchemes.push([n,t])}function Hg(){q.scanner=Tg(q.customSchemes);for(let n=0;n<q.tokenQueue.length;n++)q.tokenQueue[n][1]({scanner:q.scanner});q.parser=Rg(q.scanner.tokens);for(let n=0;n<q.pluginQueue.length;n++)q.pluginQueue[n][1]({scanner:q.scanner,parser:q.parser});return q.initialized=!0,q}function ys(n){return q.initialized||Hg(),Lg(q.parser.start,n,Qc(q.scanner.start,n))}ys.scan=Qc;function td(n,t=null,e=null){if(t&&typeof t=="object"){if(e)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);e=t,t=null}const o=new gs(e),r=ys(n),i=[];for(let s=0;s<r.length;s++){const l=r[s];l.isLink&&(!t||l.t===t)&&o.check(l)&&i.push(l.toFormattedObject(o))}return i}const ws="[\0- Â áá â-\u2029âã]",zg=new RegExp(ws),Bg=new RegExp(`${ws}$`),Vg=new RegExp(ws,"g");function Fg(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function jg(n){return new Q({key:new at("autolink"),appendTransaction:(t,e,o)=>{const r=t.some(a=>a.docChanged)&&!e.doc.eq(o.doc),i=t.some(a=>a.getMeta("preventAutolink"));if(!r||i)return;const{tr:s}=o,l=Sf(e.doc,[...t]);if(Rf(l).forEach(({newRange:a})=>{const c=Ef(o.doc,a,p=>p.isTextblock);let d,h;if(c.length>1)d=c[0],h=o.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(c.length){const p=o.doc.textBetween(a.from,a.to," "," ");if(!Bg.test(p))return;d=c[0],h=o.doc.textBetween(d.pos,a.to,void 0," ")}
vendor: 4,125 bytes, line 97
97if(d&&h){const p=h.split(zg).filter(Boolean);if(p.length<=0)return!1;const u=p[p.length-1],f=d.pos+h.lastIndexOf(u);if(!u)return!1;const m=ys(u).map(g=>g.toObject(n.defaultProtocol));if(!Fg(m))return!1;m.filter(g=>g.isLink).map(g=>({...g,from:f+g.start+1,to:f+g.end+1})).filter(g=>o.schema.marks.code?!o.doc.rangeHasMark(g.from,g.to,o.schema.marks.code):!0).filter(g=>n.validate(g.value)).filter(g=>n.shouldAutoLink(g.value)).forEach(g=>{ss(g.from,g.to,o.doc).some(w=>w.mark.type===n.type)||s.addMark(g.from,g.to,n.type.create({href:g.href}))})}}),!!s.steps.length)return s}})}function Wg(n){return new Q({key:new at("handleClickLink"),props:{handleClick:(t,e,o)=>{var r,i;if(o.button!==0||!t.editable)return!1;let s=o.target;const l=[];for(;s.nodeName!=="DIV";)l.push(s),s=s.parentNode;if(!l.find(p=>p.nodeName==="A"))return!1;const a=Dc(t.state,n.type.name),c=o.target,d=(r=c==null?void 0:c.href)!==null&&r!==void 0?r:a.href,h=(i=c==null?void 0:c.target)!==null&&i!==void 0?i:a.target;return c&&d?(window.open(d,h),!0):!1}}})}function qg(n){return new Q({key:new at("handlePasteLink"),props:{handlePaste:(t,e,o)=>{const{state:r}=t,{selection:i}=r,{empty:s}=i;if(s)return!1;let l="";o.content.forEach(c=>{l+=c.textContent});const a=td(l,{defaultProtocol:n.defaultProtocol}).find(c=>c.isLink&&c.value===l);return!l||!a?!1:n.editor.commands.setMark(n.type,{href:a.href})}}})}function Me(n,t){const e=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(o=>{const r=typeof o=="string"?o:o.scheme;r&&e.push(r)}),!n||n.replace(Vg,"").match(new RegExp(`^(?:(?:${e.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const Kg=ne.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"){Ql(n);return}Ql(n.scheme,n.optionalSlashes)})},onDestroy(){$g()},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,t)=>!!Me(n,t.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=>{const t=n.getAttribute("href");return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!Me(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:t=>!!Me(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",G(this.options.HTMLAttributes,n),0]:["a",G(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:t})=>{const{href:e}=n;return this.options.isAllowedUri(e,{defaultValidate:o=>!!Me(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:t})=>{const{href:e}=n;return this.options.isAllowedUri(e,{defaultValidate:o=>!!Me(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().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[Be({find:n=>{const t=[];if(n){const{protocols:e,defaultProtocol:o}=this.options,r=td(n).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Me(s,e),protocols:e,defaultProtocol:o}));r.length&&r.forEach(i=>
97t.push({text:i.value,data:{href:i.href},index:i.start}))}return t},type:this.type,getAttributes:n=>{var t;return{href:(t=n.data)===null||t===void 0?void 0:t.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:t,defaultProtocol:e}=this.options;return this.options.autolink&&n.push(jg({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:o=>this.options.isAllowedUri(o,{defaultValidate:r=>!!Me(r,t),protocols:t,defaultProtocol:e}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(Wg({type:this.type})),this.options.linkOnPaste&&n.push(qg({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}});let Qr=Object.hasOwn(HTMLElement.prototype,"popover");var Ct,yn;class Jg{constructor(t){rt(this,Ct),rt(this,yn),dt(this,Ct,t),dt(this,yn,new Map)}add(t){y(this,yn).set(t.name,t)}show({x:t,y:e}={}){for(;y(this,Ct).firstChild;)y(this,Ct).removeChild(y(this,Ct).firstChild);t&&(y(this,Ct).style.left=`${t}px`),e&&(y(this,Ct).style.top=`${e}px`);for(const o of y(this,yn).values())if(o.shouldShow()){const r=y(this,Ct).ownerDocument.createElement("div");r.classList.add(o.name);for(const i of o.items)r.appendChild(i);y(this,Ct).appendChild(r)}}hide(){for(;y(this,Ct).firstChild;)y(this,Ct).removeChild(y(this,Ct).firstChild)}}Ct=new WeakMap,yn=new WeakMap;var go,yo,wo;class Yr{constructor(t,e,o){rt(this,go),rt(this,yo),rt(this,wo),dt(this,go,t),dt(this,yo,e),dt(this,wo,o)}get name(){return y(this,go)}get items(){return y(this,yo)}shouldShow(){return y(this,wo).call(this)}}go=new WeakMap,yo=new WeakMap,wo=new WeakMap;const Ug=ut.create({name:"doubleClickHandler",addProseMirrorPlugins(){const n=this.editor;return[new Q({key:new at("doubleClickHandler"),props:{handleDOMEvents:{dblclick:(t,e)=>{var o;const r=(o=t.posAtCoords({left:e.clientX,top:e.clientY}))==null?void 0:o.pos;return n.emit("dblclick",{event:e,pos:r,state:n.state,view:t}),!1}}}})]}});var Tn,B,Xt,S,Ue,Qt,M,wn,sr,vo,se,D,ed,lr,Ot,W,Yl,nd,od;const $i=class rd extends id{constructor(){super(),rt(this,D),rt(this,Tn),rt(this,B),rt(this,Xt),rt(this,S),rt(this,Ue),rt(this,Qt),rt(this,M),rt(this,wn,[[["block"],["blockquote"],["bold","italic","strike"],["bullet-list","ordered-list"],["undo","redo"]]]),rt(this,sr,["paragraph","heading1","heading2","heading3"]),rt(this,vo,[]),rt(this,se,null),dt(this,Tn,HTMLElement.prototype.attachInternals?this.attachInternals():new ld(this)),dt(this,B,sd().newTranslator()),dt(this,S,new Map),dt(this,Xt,this.ownerDocument.createElement("div")),y(this,Xt).classList.add("wrapper"),this.shadowRoot.appendChild(y(this,Xt)),dt(this,Ue,this.ownerDocument.createElement("menu")),y(this,Ue).classList.add("toolbar"),y(this,Xt).appendChild(y(this,Ue));const t=this.ownerDocument.createElement("menu");t.classList.add("context"),y(this,Xt).appendChild(t),dt(this,se,new Jg(t)),dt(this,Qt,this.ownerDocument.createElement("div")),y(this,Qt).spellcheck=!1,y(this,Qt).classList.add("editor-container"),y(this,Xt).appendChild(y(this,Qt))}connectedCallback(){var t,e,o,r,i,s,l,a,c,d,h,p,u,f,m,g,w,x,T,$,O,H,j,K,P,gt,zt,oe;this.hasAttribute("controls")&&dt(this,wn,this.getAttribute("controls").split(" _ ").map(z=>z.trim().split(" | ").map(ct=>ct.trim().split(" ").map(At=>At.trim())))),this.hasAttribute("features")&&dt(this,vo,this.getAttribute("features").split(" "));const cn=y(this,wn).flat(1/0);let It=[];cn.includes("table")&&(It=[...It,mg.configure({resizable:!0}),wg,yg,gg],y(this,se).add(new Yr("table-add",[R(this,D,Ot).call(this,"table-add-column-before"),R(this,D,Ot).call(this,"table-add-column-after"),R(this,D,Ot).call(this,"table-add-row-before"),R(this,D,Ot).call(this,"table-add-row-after")],()=>y(this,M).isActive("table"))),y(this,se).add(new Yr("table-delete",[R(this,D,Ot).call(this,"table-delete-row"),R(this,D,Ot).call(this,"table-delete-column"),R(this,D,Ot).call(this,"table-delete")],()=>y(this,M).isActive("table"))),y(this,se).add(new Yr("thead",[R(this,D,Ot).call(this,"table-toggle-header-column"),R(this,D,Ot).call(this,"table-toggle-header-row"),R(this,D,Ot).call(this,"table-toggle-header-cell")],()=>y(this,M).isActive("table")))),cn.includes("link")&&(It=[...It,Kg.configure({openOnClick:!1,autolink:!0,defaultProtocol:"https",protocols:["http","https"],isAllowedUri:(z,ct)=>{try{const At=z.includes(":")?new URL(z):new URL(`${ct.defaultProtocol}://${z}`);if(!ct.defaultValidate(At.href))return!1;const dn=["ftp","file","mailto"],Jn=At.protocol.replace(":","");return dn.includes(Jn)?!1:ct.protocols.map(Mr=>typeof Mr=="string"?Mr:Mr.scheme).includes(Jn)}catch{return!1}},shouldAutoLink:z=>{try{return z.includes(":")?new URL(z):new URL(`https://${z}`),!0}catch{return!1}}})]),y(this,vo).includes("image")&&(It=[...It,bg.configure({allowBase64:!0})]),dt(this,M,new hm({element:y(this,Qt),extensions:[p0,Ug,...It],content:this.innerHTML,onUpdate:()=>R(this,D,ed).call(this),onSelectionUpdate:()=>R(this,D,lr).call(this),onFocus:()=>y(this,Qt).classList.add("has-focus"),onBlur:()=>y(this,Qt).classList.remove("has-focus")})),this.hasAttribute("block-types")&&dt(this,sr,this.getAttribute("block-types").split(" ").map(z=>z.trim()));for(const z of y(this,wn)){const ct=this.ownerDocument.createElement("div");ct.classList.add("row"),y(this,Ue).appendChild(ct);for(const At of z){const dn=this.ownerDocument.createElement("div");dn.classList.add("group"),ct.appendChild(dn);for(const Jn of At)dn.appendChild(R(this,D,Ot).call(this,Jn))}}this.innerHTML="",R(this,D,lr).call(this),(t=y(this,S).get("bold"))==null||t.addEventListener("click",()=>{y(this,M).chain().focus().toggleBold().run()}),(e=y(this,S).get("italic"))==null||e.addEventListener("click",()=>{y(this,M).chain().focus().toggleItalic().run()}),(o=y(this,S).get("strike"))==null||o.addEventListener("click",()=>{y(this,M).chain().focus().toggleStrike().run()}),(r=y(this,S).get("paragraph"))==null||r.addEventListener("click",()=>{y(this,M).chain().focus().toggleNode("paragraph","paragraph").run()}),(i=y(this,S).get("heading1"))==null||i.addEventListener("click",()=>{y(this,M).chain().focus().toggleHeading({level:1}).run()}),(s=y(this,S).get("heading2"))==null||s.addEventListener("click",()=>{y(this,M).chain().focus().toggleHeading({level:2}).run()}),(l=y(this,S).get("heading3"))==null||l.addEventListener("click",()=>{y(this,M).chain().focus().toggleHeading({level:3}).run()}),(a=y(this,S).get("heading4"))==null||a.addEventListener("click",()=>{y(this,M).chain().focus().toggleHeading({level:4}).run()}),(c=y(this,S).get("heading5"))==null||c.addEventListener("click",()=>{y(this,M).chain().focus().toggleHeading({level:5}).run()}),(d=y(this,S).get("heading6"))==null||d.addEventListener("click",()=>{y(this,M).chain().focus().toggleHeading({level:6}).run()}),(h=y(this,S).get("bullet-list"))==null||h.addEventListener("click",()=>{y(this,M).chain().focus().toggleBulletList().run()}),(p=y(this,S).get("ordered-list"))==null||p.addEventListener("click",()=>{y(this,M).chain().focus().toggleOrderedList().run()}),(u=y(this,S).get("undo"))==null||u.addEventListener("click",()=>
97{y(this,M).chain().focus().undo().run()}),(f=y(this,S).get("redo"))==null||f.addEventListener("click",()=>{y(this,M).chain().focus().redo().run()}),(m=y(this,S).get("blockquote"))==null||m.addEventListener("click",()=>{y(this,M).chain().focus().toggleBlockquote().run()}),(g=y(this,S).get("table"))==null||g.addEventListener("click",()=>{y(this,M).chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()}),(w=y(this,S).get("table-add-column-before"))==null||w.addEventListener("click",()=>{y(this,M).chain().focus().addColumnBefore().run()}),(x=y(this,S).get("table-add-column-after"))==null||x.addEventListener("click",()=>{y(this,M).chain().focus().addColumnAfter().run()}),(T=y(this,S).get("table-add-row-before"))==null||T.addEventListener("click",()=>{y(this,M).chain().focus().addRowBefore().run()}),($=y(this,S).get("table-add-row-after"))==null||$.addEventListener("click",()=>{y(this,M).chain().focus().addRowAfter().run()}),(O=y(this,S).get("table-toggle-header-column"))==null||O.addEventListener("click",()=>{y(this,M).chain().focus().toggleHeaderColumn().run()}),(H=y(this,S).get("table-toggle-header-row"))==null||H.addEventListener("click",()=>{y(this,M).chain().focus().toggleHeaderRow().run()}),(j=y(this,S).get("table-toggle-header-cell"))==null||j.addEventListener("click",()=>{y(this,M).chain().focus().toggleHeaderCell().run()}),(K=y(this,S).get("table-merge-split-cells"))==null||K.addEventListener("click",()=>{y(this,M).chain().focus().mergeOrSplit().run()}),(P=y(this,S).get("table-delete-row"))==null||P.addEventListener("click",()=>{y(this,M).chain().focus().deleteRow().run()}),(gt=y(this,S).get("table-delete-column"))==null||gt.addEventListener("click",()=>{y(this,M).chain().focus().deleteColumn().run()}),(zt=y(this,S).get("table-delete"))==null||zt.addEventListener("click",()=>{y(this,M).chain().focus().deleteTable().run()}),(oe=y(this,S).get("link"))==null||oe.addEventListener("click",()=>{if(y(this,M).state.selection.empty&&!y(this,M).isActive("link"))return;const z=R(this,D,od).call(this);y(this,Xt).appendChild(z),z.showModal()}),y(this,M).on("dblclick",()=>{var z;y(this,M).isActive("link")&&((z=y(this,S).get("link"))==null||z.click())}),this.addEventListener("click",z=>{y(this,se).hide(),R(this,D,nd).call(this)}),this.addEventListener("contextmenu",z=>{z.preventDefault(),y(this,se).show({x:z.clientX,y:z.clientY})}),y(this,Tn).setFormValue(this.value)}get value(){const t=y(this,M).getHTML();if(t===null)return null;const e=new DOMParser().parseFromString(t,"text/html");return e.querySelectorAll("li > p:only-child, td > p:only-child, th > p:only-child, dt > p:only-child, dd > p:only-child").forEach(o=>{const r=o.parentElement;for(;o.firstChild;)r.insertBefore(o.firstChild,o);o.remove()}),e.body.innerHTML}static register(){customElements.get("g2ui-rich-text-editor")||customElements.define("g2ui-rich-text-editor",rd)}};Tn=new WeakMap,B=new WeakMap,Xt=new WeakMap,S=new WeakMap,Ue=new WeakMap,Qt=new WeakMap,M=new WeakMap,wn=new WeakMap,sr=new WeakMap,vo=new WeakMap,se=new WeakMap,D=new WeakSet,ed=function(){y(this,Tn).setFormValue(this.value),R(this,D,lr).call(this),this.dispatchEvent(new Event("change"))},lr=function(){var n,t,e,o,r,i,s,l,a,c,d,h,p,u,f;const m=y(this,M).extensionManager.extensions,g=kr(x=>bi(x.type.name,m))(y(this,M).state.selection);if((n=y(this,S).get("bold"))==null||n.classList.toggle("is-active",y(this,M).isActive("bold")),(t=y(this,S).get("italic"))==null||t.classList.toggle("is-active",y(this,M).isActive("italic")),(e=y(this,S).get("strike"))==null||e.classList.toggle("is-active",y(this,M).isActive("strike")),(o=y(this,S).get("underline"))==null||o.classList.toggle("is-active",y(this,M).isActive("underline")),(r=y(this,S).get("bullet-list"))==null||r.classList.toggle("is-active",(g==null?void 0:g.node.type.name)==="bulletList"),(i=y(this,S).get("ordered-list"))==null||i.classList.toggle("is-active",(g==null?void 0:g.node.type.name)==="orderedList"),(s=y(this,S).get("paragraph"))==null||s.classList.toggle("is-active",y(this,M).isActive("paragraph")),(l=y(this,S).get("heading1"))==null||l.classList.toggle("is-active",y(this,M).isActive("heading",{level:1})),(a=y(this,S).get("heading2"))==null||a.classList.toggle("is-active",y(this,M).isActive("heading",{level:2})),(c=y(this,S).get("heading3"))==null||c.classList.toggle("is-active",y(this,M).isActive("heading",{level:3})),(d=y(this,S).get("heading4"))==null||d.classList.toggle("is-active",y(this,M).isActive("heading",{level:4})),(h=y(this,S).get("heading5"))==null||h.classList.toggle("is-active",y(this,M).isActive("heading",{level:5})),(p=y(this,S).get("heading6"))==null||p.classList.toggle("is-active",y(this,M).isActive("heading",{level:6})),(u=y(this,S).get("blockquote"))==null||u.classList.toggle("is-active",y(this,M).isActive("blockquote")),(f=y(this,S).get("table"))==null||f.classList.toggle("is-active",y(this,M).isActive("table")),y(this,S).has("block")){const x=y(this,S).get("block").querySelector("li.is-active");x&&(y(this,S).get("block").querySelector("button").textContent=x.textContent)}const w=y(this,S).get("link");w&&(w.classList.toggle("is-active",y(this,M).isActive("link")),w.disabled=y(this,M).state.selection.empty&&!y(this,M).isActive("link"))},Ot=function(n){switch(n){case"block":return R(this,D,Yl).call(this);case"blockquote":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_blockquote"),'<svg viewBox="0 0 256 256"><path d="M116,72v88a48.05,48.05,0,0,1-48,48,8,8,0,0,1,0-16,32,32,0,0,0,32-32v-8H40a16,16,0,0,1-16-16V72A16,16,0,0,1,40,56h60A16,16,0,0,1,116,72ZM216,56H156a16,16,0,0,0-16,16v64a16,16,0,0,0,16,16h60v8a32,32,0,0,1-32,32,8,8,0,0,0,0,16,48.05,48.05,0,0,0,48-48V72A16,16,0,0,0,216,56Z"></path></svg>');case"bold":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_bold"),'<svg viewBox="0 0 256 256"><path d="M185.08,114.46A48,48,0,0,0,148,36H80A12,12,0,0,0,68,48V200a12,12,0,0,0,12,12h80a52,52,0,0,0,25.08-97.54ZM92,60h56a24,24,0,0,1,0,48H92Zm68,128H92V132h68a28,28,0,0,1,0,56Z"></path></svg>');case"italic":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_italic"),'<svg viewBox="0 0 256 256"><path d="M204,56a12,12,0,0,1-12,12H160.65l-40,120H144a12,12,0,0,1,0,24H64a12,12,0,0,1,0-24H95.35l40-120H112a12,12,0,0,1,0-24h80A12,12,0,0,1,204,56Z"></path></svg>');case"strike":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_strike"),'<svg viewBox="0 0 256 256"><path d="M228,128a12,12,0,0,1-12,12H185.86A41.48,41.48,0,0,1,196,168c0,14.45-7.81,28.32-21.43,38.05C162,215.05,145.44,220,128,220s-34-4.95-46.57-13.95C67.81,196.32,60,182.45,60,168a12,12,0,0,1,24,0c0,15.18,20.15,28,44,28s44-12.82,44-28c0-12.76-9.3-20.18-35.35-28H40a12,12,0,0,1,0-24H216A12,12,0,0,1,228,128ZM75.11,100a12,12,0,0,0,12-12c0-16,17.58-28,40.89-28,17.36,0,31.37,6.65,37.48,17.78a12,12,0,0,0,21-11.56C176.13,47.3,154.25,36,128,36,91,36,63.11,58.35,63.11,88A12,12,0,0,0,75.11,100Z"></path></svg>');case"bullet-list":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_unordered_list"),'<svg viewBox="0 0 256 256"><path d="M76,64A12,12,0,0,1,88,52H216a12,12,0,0,1,0,24H88A12,12,0,0,1,76,64Zm140,52H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24Zm0,64H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24ZM44,112a16,16,0,1,0,16,16A16,16,0,0,0,44,112Zm0-64A16,16,0,1,0,60,64,16,16,0,0,0,44,48Zm0,128a16,16,0,1,0,16,16A16,16,0,0,0,44,176Z"></path></svg>');case"ordered-list":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_ordered_list"),'<svg viewBox="0 0 256 256"><path d="M228,128a12,12,0,0,1-12,12H116a12,12,0,0,1,0-24H216A12,12,0,0,1,228,128ZM116,76H216a12,12,0,0,0,0-24H116a12,12,0,0,0,0,24ZM216,180H116a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24ZM44,59.31V104a12,12,0,0,0,24,0V40A12,12,0,0,0,50.64,29.27l-16,8a12,12,0,0,0,9.36,22Zm39.73,96.86a27.7,27.7,0,0,0-11.2-18.63A28.89,28.89,0,0,0,32.9,143a27.71,27.71,0,0,0-4.17,7.54,12,12,0,0,0,22.55,8.21,4,4,0,0,1,.58-1,4.78,4.78,0,0,1,6.5-.82,3.82,3.82,0,0,1,1.61,2.6,3.63,3.63,0,0,1-.77,2.77l-.13.17L30.39,200.82A12,12,0,0,0,40,220H72a12,12,0,0,0,0-24H64l14.28-19.11A27.48,27.48,0,0,0,83.73,156.17Z"></path></svg>');case"undo":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_undo"),'<svg viewBox="0 0 256 256"><path d="M228,128a100,100,0,0,1-98.66,100H128a99.39,99.39,0,0,1-68.62-27.29,12,12,0,0,1,16.48-17.45,76,76,0,1,0-1.57-109c-.13.13-.25.25-.39.37L54.89,92H72a12,12,0,0,1,0,24H24a12,12,0,0,1-12-12V56a12,12,0,0,1,24,0V76.72L57.48,57.06A100,100,0,0,1,228,128Z"></path></svg>');case"redo":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_redo"),'<svg viewBox="0 0 256 256"><path d="M244,56v48a12,12,0,0,1-12,12H184a12,12,0,1,1,0-24H201.1l-19-17.38c-.13-.12-.26-.24-.38-.37A76,76,0,1,0,127,204h1a75.53,75.53,0,0,0,52.15-20.72,12,12,0,0,1,16.49,17.45A99.45,99.45,0,0,1,128,228h-1.37A100,100,0,1,1,198.51,57.06L220,76.72V56a12,12,0,0,1,24,0Z"></path></svg>');case"cut":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_cut"),'<svg viewBox="0 0 256 256"><path d="M238.78,183.79,98.28,87.65A40.18,40.18,0,0,0,100,76a40,40,0,1,0-15.29,31.45l30,20.56-30,20.56a40,40,0,1,0,3.57,59.74h0A39.73,39.73,0,0,0,100,180a40.18,40.18,0,0,0-1.72-11.66L136,142.54l89.22,61.06a12,12,0,0,0,13.56-19.81ZM71.31,191.33h0A16,16,0,1,1,76,180,16,16,0,0,1,71.31,191.33ZM48.69,87.3a16,16,0,1,1,22.62,0h0A16,16,0,0,1,48.69,87.3Zm112.82,23.24a12,12,0,0,1,3.13-16.68L225.22,52.4a12,12,0,0,1,13.56,19.81l-60.59,41.46a12,12,0,0,1-16.68-3.13Z"></path></svg>');case"copy":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_copy"),'<svg viewBox="0 0 256 256"><path d="M180,64H40A12,12,0,0,0,28,76V216a12,12,0,0,0,12,12H180a12,12,0,0,0,12-12V76A12,12,0,0,0,180,64ZM168,204H52V88H168ZM228,40V180a12,12,0,0,1-24,0V52H76a12,12,0,0,1,0-24H216A12,12,0,0,1,228,40Z"></path></svg>');case"paste":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_paste"),'<svg viewBox="0 0 256 256"><path d="M172,164a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,164Zm-12-52H96a12,12,0,0,0,0,24h64a12,12,0,0,0,0-24Zm60-64V216a20,20,0,0,1-20,20H56a20,20,0,0,1-20-20V48A20,20,0,0,1,56,28H90.53a51.88,51.88,0,0,1,74.94,0H200A20,20,0,0,1,220,48ZM100.29,60h55.42a28,28,0,0,0-55.42,0ZM196,52H178.59A52.13,52.13,0,0,1,180,64v8a12,12,0,0,1-12,12H88A12,12,0,0,1,76,72V64a52.13,52.13,0,0,1,1.41-12H60V212H196Z"></path></svg>');case"table":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_table"),'<svg viewBox="0 0 256 256"><path d="M88,104v96H32V104Z" opacity="0.2"></path><path d="M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM40,112H80v32H40Zm56,0H216v32H96ZM216,64V96H40V64ZM40,160H80v32H40Zm176,32H96V160H216v32Z"></path></svg>');case"table-add-column-before":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_table_add_column_before"),'<svg viewBox="0 0 256 256"><path d="M136,48V208a8,8,0,0,1-8,8H104a8,8,0,0,1-8-8V48a8,8,0,0,1,8-8h24A8,8,0,0,1,136,48Zm64-8H176a8,8,0,0,0-8,8V2
9708a8,8,0,0,0,8,8h24a8,8,0,0,0,8-8V48A8,8,0,0,0,200,40Z" opacity="0.2"></path><path d="M128,32H104A16,16,0,0,0,88,48V208a16,16,0,0,0,16,16h24a16,16,0,0,0,16-16V48A16,16,0,0,0,128,32Zm0,176H104V48h24ZM200,32H176a16,16,0,0,0-16,16V208a16,16,0,0,0,16,16h24a16,16,0,0,0,16-16V48A16,16,0,0,0,200,32Zm0,176H176V48h24ZM72,128a8,8,0,0,1-8,8H48v16a8,8,0,0,1-16,0V136H16a8,8,0,0,1,0-16H32V104a8,8,0,0,1,16,0v16H64A8,8,0,0,1,72,128Z"></path></svg>');case"table-add-column-after":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_table_add_column_after"),'<svg viewBox="0 0 256 256"><path d="M88,48V208a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V48a8,8,0,0,1,8-8H80A8,8,0,0,1,88,48Zm64-8H128a8,8,0,0,0-8,8V208a8,8,0,0,0,8,8h24a8,8,0,0,0,8-8V48A8,8,0,0,0,152,40Z" opacity="0.2"></path><path d="M80,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H80a16,16,0,0,0,16-16V48A16,16,0,0,0,80,32Zm0,176H56V48H80ZM152,32H128a16,16,0,0,0-16,16V208a16,16,0,0,0,16,16h24a16,16,0,0,0,16-16V48A16,16,0,0,0,152,32Zm0,176H128V48h24Zm96-80a8,8,0,0,1-8,8H224v16a8,8,0,0,1-16,0V136H192a8,8,0,0,1,0-16h16V104a8,8,0,0,1,16,0v16h16A8,8,0,0,1,248,128Z"></path></svg>');case"table-add-row-before":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_table_add_row_before"),'<svg viewBox="0 0 256 256"><path d="M216,176v24a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V176a8,8,0,0,1,8-8H208A8,8,0,0,1,216,176Zm-8-80H48a8,8,0,0,0-8,8v24a8,8,0,0,0,8,8H208a8,8,0,0,0,8-8V104A8,8,0,0,0,208,96Z" opacity="0.2"></path><path d="M208,160H48a16,16,0,0,0-16,16v24a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V176A16,16,0,0,0,208,160Zm0,40H48V176H208v24Zm0-112H48a16,16,0,0,0-16,16v24a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V104A16,16,0,0,0,208,88Zm0,40H48V104H208v24ZM96,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H136V64a8,8,0,0,1-16,0V48H104A8,8,0,0,1,96,40Z"></path></svg>');case"table-add-row-after":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_table_add_row_after"),'<svg viewBox="0 0 256 256"><path d="M216,128v24a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V128a8,8,0,0,1,8-8H208A8,8,0,0,1,216,128Zm-8-80H48a8,8,0,0,0-8,8V80a8,8,0,0,0,8,8H208a8,8,0,0,0,8-8V56A8,8,0,0,0,208,48Z" opacity="0.2"></path><path d="M208,112H48a16,16,0,0,0-16,16v24a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V128A16,16,0,0,0,208,112Zm0,40H48V128H208v24Zm0-112H48A16,16,0,0,0,32,56V80A16,16,0,0,0,48,96H208a16,16,0,0,0,16-16V56A16,16,0,0,0,208,40Zm0,40H48V56H208V80ZM160,216a8,8,0,0,1-8,8H136v16a8,8,0,0,1-16,0V224H104a8,8,0,0,1,0-16h16V192a8,8,0,0,1,16,0v16h16A8,8,0,0,1,160,216Z"></path></svg>');case"table-toggle-header-column":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_table_toggle_header_column"),'<svg viewBox="0 0 32 32"><path d="M28 6H4c-.6 0-1 .4-1 1v17c0 1.1.9 2 2 2h22c1.1 0 2-.9 2-2V7c0-.6-.4-1-1-1Zm-16 8h15v4H12v-4Zm15 10H12v-4h15v4ZM12 8h15v4H12V8Z"/></svg>');case"table-toggle-header-row":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_table_toggle_header_row"),'<svg viewBox="0 0 256 256"><path d="M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM40,112H80v32H40Zm56,0H216v32H96ZM40,160H80v32H40Zm176,32H96V160H216v32Z"></path></svg>');case"table-toggle-header-cell":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_table_toggle_header_cell"),'<svg viewBox="0 0 32 32"><path d="M26 17H6c-1.1 0-2 .9-2 2v5c0 1.1.9 2 2 2h20c1.1 0 2-.9 2-2v-5c0-1.1-.9-2-2-2Zm0 7H6v-5h20v5Zm0-18H6c-1.1 0-2 .9-2 2v5c0 1.1.9 2 2 2h20c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2Z"/></svg>');case"table-merge-split-cells":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_table_merge_split_cells"));case"table-delete-row":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_table_delete_row"),'<svg viewBox="0 0 32 32"><path d="M26 15H6c-.6 0-1 .4-1 1v5c0 .6.4 1 1 1h20c.6 0 1-.4 1-1v-5c0-.6-.4-1-1-1Z" style="isolation:isolate;opacity:.2"/><path d="M26 14H6c-1.1 0-2 .9-2 2v5c0 1.1.9 2 2 2h20c1.1 0 2-.9 2-2v-5c0-1.1-.9-2-2-2Zm0 7H6v-5h20v5ZM12 8c0-.6.4-1 1-1h6c.6 0 1 .4 1 1s-.4 1-1 1h-6c-.6 0-1-.4-1-1Z"/></svg>');case"table-delete-column":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_table_delete_column"),'<svg viewBox="0 0 32 32">
97<path d="M24 6v20c0 .6-.4 1-1 1h-5c-.6 0-1-.4-1-1V6c0-.6.4-1 1-1h5c.6 0 1 .4 1 1Z" style="isolation:isolate;opacity:.2"/><path d="M23 4h-5c-1.1 0-2 .9-2 2v20c0 1.1.9 2 2 2h5c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2Zm0 22h-5V6h5v20Zm-9-10c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1s.4-1 1-1h6c.6 0 1 .4 1 1Z"/></svg>');case"table-delete":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_table_delete"),'<svg viewBox="0 0 256 256"><path d="M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z" opacity="0.2"></path><path d="M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"></path></svg>');case"link":return R(this,D,W).call(this,n,y(this,B).lookup("editor_menu_link"),'<svg viewBox="0 0 256 256"><path d="M117.18 188.74a12 12 0 0 1 0 17l-5.12 5.12A58.26 58.26 0 0 1 70.6 228a58.62 58.62 0 0 1-41.46-100.08l34.75-34.75a58.64 58.64 0 0 1 98.56 28.11 12 12 0 1 1-23.37 5.44 34.65 34.65 0 0 0-58.22-16.58l-34.75 34.75A34.62 34.62 0 0 0 70.57 204a34.41 34.41 0 0 0 24.49-10.14l5.11-5.12a12 12 0 0 1 17.01 0ZM226.83 45.17a58.65 58.65 0 0 0-82.93 0l-5.11 5.11a12 12 0 0 0 17 17l5.12-5.12a34.63 34.63 0 1 1 49 49l-34.81 34.7A34.39 34.39 0 0 1 150.61 156a34.63 34.63 0 0 1-33.69-26.72 12 12 0 0 0-23.38 5.44A58.64 58.64 0 0 0 150.56 180h.05a58.28 58.28 0 0 0 41.47-17.17l34.75-34.75a58.62 58.62 0 0 0 0-82.91Z"/></svg>');default:throw new Error(`Unknown menu item ${n}`)}},W=function(n,t,e=null){const o=this.ownerDocument.createElement("button");if(o.classList.add(n),o.type="button",y(this,S).set(n,o),e){const i=document.createElement("span");i.innerHTML=e,i.classList.add("icon"),o.appendChild(i)}const r=document.createElement("span");return r.textContent=t,o.title=t,o.appendChild(r),o},Yl=function(){var n;const t="block",e=this.ownerDocument.createElement("div");e.classList.add("dropdown"),e.classList.add(t);const o=this.ownerDocument.createElement("ul");Qr?o.popover="auto":o.hidden=!0;const r=this.ownerDocument.createElement("button");r.addEventListener("click",i=>{i.stopPropagation(),Qr?o.togglePopover():o.hidden=!o.hidden});for(const i of y(this,sr)){const s=this.ownerDocument.createElement("li");s.textContent=i,s.addEventListener("click",l=>{l.stopPropagation(),r.textContent=s.textContent,Qr?o.togglePopover(!1):o.hidden=!0}),y(this,S).set(i,s),o.appendChild(s)}return r.textContent=((n=o.firstElementChild)==null?void 0:n.textContent)||"paragraph",e.appendChild(r),e.appendChild(o),y(this,S).set(t,e),e},nd=function(){this.shadowRoot.querySelectorAll(".dropdown.is-active").forEach(n=>n.classList.remove("is-active"))},od=function(){const n=this.ownerDocument.createElement("dialog");n.classList.add("link"),n.addEventListener("close",()=>n.remove());const t=this.ownerDocument.createElement("div");t.classList.add("dialog-inner");const e=this.ownerDocument.createElement("button");e.type="button",e.textContent=y(this,B).lookup("cancel"),e.classList.add("cancel"),e.addEventListener("click",()=>n.close());const o=this.ownerDocument.createElement("form");o.method="dialog";const r=this.ownerDocument.createElement("fieldset"),i=this.ownerDocument.createElement("input");i.type="submit",i.value=y(this,B).lookup("save");const s=this.ownerDocument.createElement("div");s.classList.add("actions");const l=this.ownerDocument.createElement("input");l.type="url",l.name="href",l.autofocus=!0,l.value=y(this,M).getAttributes("link").href??"";const a=this.ownerDocument.createElement("label");return a.textContent="URL",a.appendChild(l),r.appendChild(a),o.appendChild(r),o.addEventListener("submit",c=>{let d;if(l.value==="")d=y(this,M).chain().focus().extendMarkRange("link").unsetLink().run();else try{d=y(this,M).chain().focus().extendMarkRange("link").setLink({href:l.value}).run()}catch{d=!1}d||(a.classList.add("error"),c.preventDefault())}),n.appendChild(t),t.appendChild(o),o.appendChild(s),s.appendChild(i),s.appendChild(e),n},vs($i,"formAssociated",!0),vs($i,"adopt",[new URL("/apps/framework/build/css/g2ui-rich-text-editor-NlNRmLzz.css",import.meta.url)]);let Xg=$i;export{Xg as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.