1
0
Files
Johan Dahlin 50366b9b9c
All checks were successful
Deploy Quartz site to GitHub Pages / build (push) Successful in 2m29s
vault backup: 2025-12-26 02:09:22
2025-12-26 02:09:22 +01:00

125 lines
456 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
function oe(t){this.content=t}oe.prototype={constructor:oe,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),o=r.content.slice();return i==-1?o.push(n||t,e):(o[i+1]=e,n&&(o[i]=n)),new oe(o)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new oe(n)},addToStart:function(t,e){return new oe([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new oe(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),o=r.find(t);return i.splice(o==-1?i.length:o,0,e,n),new oe(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=oe.from(t),t.size?new oe(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=oe.from(t),t.size?new oe(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=oe.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};oe.from=function(t){if(t instanceof oe)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new oe(e)};function Wa(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)n++;return n}if(i.content.size||o.content.size){let s=Wa(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function Ua(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let s=t.child(--i),u=e.child(--o),a=s.nodeSize;if(s==u){n-=a,r-=a;continue}if(!s.sameMarkup(u))return{a:n,b:r};if(s.isText&&s.text!=u.text){let l=0,c=Math.min(s.text.length,u.text.length);for(;l<c&&s.text[s.text.length-l-1]==u.text[u.text.length-l-1];)l++,n--,r--;return{a:n,b:r}}if(s.content.size||u.content.size){let l=Ua(s.content,u.content,n-1,r-1);if(l)return l}n-=a,r-=a}}class w{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,o){for(let s=0,u=0;u<n;s++){let a=this.content[s],l=u+a.nodeSize;if(l>e&&r(a,i+u,o||null,s)!==!1&&a.content.size){let c=u+1;a.nodesBetween(Math.max(0,e-c),Math.min(a.content.size,n-c),r,i+c)}u=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(u,a)=>{let l=u.isText?u.text.slice(Math.max(e,a)-a,n-a):u.isLeaf?i?typeof i=="function"?i(u):i:u.type.spec.leafText?u.type.spec.leafText(u):"":"";u.isBlock&&(u.isLeaf&&l||u.isTextblock)&&r&&(s?s=!1:o+=r),o+=l},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new w(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let o=0,s=0;s<n;o++){let u=this.content[o],a=s+u.nodeSize;a>e&&((s<e||a>n)&&(u.isText?u=u.cut(Math.max(0,e-s),Math.min(u.text.length,n-s)):u=u.cut(Math.max(0,e-s-1),Math.min(u.content.size,n-s-1))),r.push(u),i+=u.nodeSize),s=a}return new w(r,i)}cutByIndex(e,n){return e==n?w.empty:e==0&&n==this.content.length?this:new w(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new w(i,o)}addToStart(e){return new w([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new w(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))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(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return Wa(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Ua(this,e,n,r)}findIndex(e){if(e==0)return Lr(0,e);if(e==this.size)return Lr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),o=r+i.nodeSize;if(o>=e)return o==e?Lr(n+1,o):Lr(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return w.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new w(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return w.empty;let n,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(n||(n=e.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new w(n||e,r)}static from(e){if(!e)return w.empty;if(e instanceof w)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new w([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}w.empty=new w([],0);const ji={index:0,offset:0};function Lr(t,e){return ji.index=t,ji.offset=e,ji}function ti(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!ti(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!ti(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let L=class Do{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))n||(n=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ti(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Do.none;if(e instanceof Do)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};L.none=[];class ni extends Error{}class D{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Ka(this.content,e+this.openStart,n);return r&&new D(r,this.openStart,this.openEnd)}removeBetween(e,n){return new D(Ja(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return D.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new D(w.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new D(e,r,i)}}D.empty=new D(w.empty,0,0);function Ja(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:u}=t.findIndex(n);if(i==e||o.isText){if(u!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(Ja(o.content,e-i-1,n-i-1)))}function Ka(t,e,n,r){let{index:i,offset:o}=t.findIndex(e),s=t.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let u=Ka(s.content,e-o-1,n,s);return u&&t.replaceChild(i,s.copy(u))}function Wf(t,e,n){if(n.openStart>t.depth)throw new ni("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ni("Inconsistent open depths");return Ga(t,e,n,0)}function Ga(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=Ga(t,e,n,r+1);return o.copy(o.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,u=s.content;return Gt(s,u.cut(0,t.parentOffset).append(n.content).append(u.cut(e.parentOffset)))}else{let{start:s,end:u}=Uf(n,t);return Gt(o,Ya(t,s,u,e,r))}else return Gt(o,ri(t,e,r))}function Za(t,e){if(!e.type.compatibleContent(t.type))throw new ni("Cannot join "+e.type.name+" onto "+t.type.name)}function Ao(t,e,n){let r=t.node(n);return Za(r,e.node(n)),r}function Kt(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Kn(t,e,n,r){let i=(e||t).node(n),o=0,s=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(Kt(t.nodeAfter,r),o++));for(let u=o;u<s;u++)Kt(i.child(u),r);e&&e.depth==n&&e.textOffset&&Kt(e.nodeBefore,r)}function Gt(t,e){return t.type.checkContent(e),t.copy(e)}function Ya(t,e,n,r,i){let o=t.depth>i&&Ao(t,e,i+1),s=r.depth>i&&Ao(n,r,i+1),u=[];return Kn(null,t,i,u),o&&s&&e.index(i)==n.index(i)?(Za(o,s),Kt(Gt(o,Ya(t,e,n,r,i+1)),u)):(o&&Kt(Gt(o,ri(t,e,i+1)),u),Kn(e,n,i,u),s&&Kt(Gt(s,ri(n,r,i+1)),u)),Kn(r,null,i,u),new w(u)}function ri(t,e,n){let r=[];if(Kn(null,t,n,r),t.depth>n){let i=Ao(t,e,n+1);Kt(Gt(i,ri(t,e,n+1)),r)}return Kn(e,null,n,r),new w(r)}function Uf(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)i=e.node(o).copy(w.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class tr{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return L.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let u=r;r=i,i=u}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new ii(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let s=e;;){let{index:u,offset:a}=s.content.findIndex(o),l=o-a;if(r.push(s,u,i+a),!l||(s=s.child(u),s.isText))break;o=l-1,i+=a+1}return new tr(n,r,o)}static resolveCached(e,n){let r=js.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==n)return s}else js.set(e,r=new Jf);let i=r.elts[r.i]=tr.resolve(e,n);return r.i=(r.i+1)%Kf,i}}class Jf{constructor(){this.elts=[],this.i=0}}const Kf=12,js=new WeakMap;class ii{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}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 Gf=Object.create(null);let Tt=class Mo{constructor(e,n,r,i=L.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||w.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&ti(this.attrs,n||e.defaultAttrs||Gf)&&L.sameSet(this.marks,r||L.none)}copy(e=null){return e==this.content?this:new Mo(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Mo(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return D.empty;let i=this.resolve(e),o=this.resolve(n),s=r?0:i.sharedDepth(n),u=i.start(s),l=i.node(s).content.cut(i.pos-u,o.pos-u);return new D(l,i.depth-s,o.depth-s)}replace(e,n,r){return Wf(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return tr.resolveCached(this,e)}resolveNoCache(e){return tr.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Xa(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=w.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),u=s&&s.matchFragment(this.content,n);if(!u||!u.validEnd)return!1;for(let a=i;a<o;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=L.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!L.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=w.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};Tt.prototype.text=void 0;class oi extends Tt{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Xa(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new oi(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new oi(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Xa(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class en{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new Zf(e,n);if(r.next==null)return en.empty;let i=Qa(r);r.next&&r.err("Unexpected trailing text");let o=rd(nd(i));return id(o,r),o}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let o=n;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function o(s,u){let a=s.matchFragment(e,r);if(a&&(!n||a.validEnd))return w.from(u.map(l=>l.createAndFill()));for(let l=0;l<s.next.length;l++){let{type:c,next:f}=s.next[l];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let d=o(f,u.concat(c));if(d)return d}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let u=i;u.type;u=u.via)s.push(u.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:u,next:a}=o.next[s];!u.isLeaf&&!u.hasRequiredAttrs()&&!(u.name in n)&&(!i.type||a.validEnd)&&(r.push({match:u.contentMatch,type:u,via:i}),n[u.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
`)}}en.empty=new en(!0);class Zf{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Qa(t){let e=[];do e.push(Yf(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Yf(t){let e=[];do e.push(Xf(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Xf(t){let e=td(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=Qf(t,e);else break;return e}function Ws(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Qf(t,e){let n=Ws(t),r=n;return t.eat(",")&&(t.next!="}"?r=Ws(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function ed(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let o in n){let s=n[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function td(t){if(t.eat("(")){let e=Qa(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=ed(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function nd(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(s,u,a){let l={term:a,to:u};return e[s].push(l),l}function i(s,u){s.forEach(a=>a.to=u)}function o(s,u){if(s.type=="choice")return s.exprs.reduce((a,l)=>a.concat(o(l,u)),[]);if(s.type=="seq")for(let a=0;;a++){let l=o(s.exprs[a],u);if(a==s.exprs.length-1)return l;i(l,u=n())}else if(s.type=="star"){let a=n();return r(u,a),i(o(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=n();return i(o(s.expr,u),a),i(o(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(u)].concat(o(s.expr,u));if(s.type=="range"){let a=u;for(let l=0;l<s.min;l++){let c=n();i(o(s.expr,a),c),a=c}if(s.max==-1)i(o(s.expr,a),a);else for(let l=s.min;l<s.max;l++){let c=n();r(a,c),i(o(s.expr,a),c),a=c}return[r(a)]}else{if(s.type=="name")return[r(u,void 0,s.value)];throw new Error("Unknown expr type")}}}}function el(t,e){return e-t}function Us(t,e){let n=[];return r(e),n.sort(el);function r(i){let o=t[i];if(o.length==1&&!o[0].term)return r(o[0].to);n.push(i);for(let s=0;s<o.length;s++){let{term:u,to:a}=o[s];!u&&n.indexOf(a)==-1&&r(a)}}}function rd(t){let e=Object.create(null);return n(Us(t,0));function n(r){let i=[];r.forEach(s=>{t[s].forEach(({term:u,to:a})=>{if(!u)return;let l;for(let c=0;c<i.length;c++)i[c][0]==u&&(l=i[c][1]);Us(t,a).forEach(c=>{l||i.push([u,l=[]]),l.indexOf(c)==-1&&l.push(c)})})});let o=e[r.join(",")]=new en(r.indexOf(t.length-1)>-1);for(let s=0;s<i.length;s++){let u=i[s][1].sort(el);o.next.push({type:i[s][0],next:e[u.join(",")]||n(u)})}return o}}function id(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],o=!i.validEnd,s=[];for(let u=0;u<i.next.length;u++){let{type:a,next:l}=i.next[u];s.push(a.name),o&&!(a.isText||a.hasRequiredAttrs())&&(o=!1),r.indexOf(l)==-1&&r.push(l)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function tl(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function nl(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let o=t[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function rl(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let o=t[i];o.validate&&o.validate(e[i])}}function il(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new sd(t,r,e[r]);return n}let Js=class ol{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=il(e,r.attrs),this.defaultAttrs=tl(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==en.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:nl(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Tt(this,this.computeAttrs(e),w.from(n),L.setFrom(r))}createChecked(e=null,n,r){return n=w.from(n),this.checkContent(n),new Tt(this,this.computeAttrs(e),n,L.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=w.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(w.empty,!0);return o?new Tt(this,e,n.append(o),L.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){rl(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:L.none:e}static compile(e,n){let r=Object.create(null);e.forEach((o,s)=>r[o]=new ol(o,n,s));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function od(t,e,n){let r=n.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${o}`)}}class sd{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?od(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Ci{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=il(e,i.attrs),this.excluded=null;let o=tl(this.attrs);this.instance=o?new L(this,o):null}create(e=null){return!e&&this.instance?this.instance:new L(this,nl(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new Ci(o,i++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){rl(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class es{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=oe.from(e.nodes),n.marks=oe.from(e.marks||{}),this.nodes=Js.compile(this.spec.nodes,this),this.marks=Ci.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",u=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=en.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=u=="_"?null:u?Ks(this,u.split(" ")):u==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:Ks(this,s.split(" "))}this.nodeFromJSON=i=>Tt.fromJSON(this,i),this.markFromJSON=i=>L.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Js){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new oi(r,r.defaultAttrs,e,L.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Ks(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],o=t.marks[i],s=o;if(o)n.push(o);else for(let u in t.marks){let a=t.marks[u];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function ud(t){return t.tag!=null}function ad(t){return t.style!=null}class dt{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(ud(i))this.tags.push(i);else if(ad(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let r=new Zs(this,n,!1);return r.addAll(e,L.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Zs(this,n,!0);return r.addAll(e,L.none,n.from,n.to),D.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(fd(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(e,n,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],u=s.style;if(!(u.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||u.length>e.length&&(u.charCodeAt(e.length)!=61||u.slice(e.length+1)!=n))){if(s.getAttrs){let a=s.getAttrs(n);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let n=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<n.length;s++){let u=n[s];if((u.priority==null?50:u.priority)<o)break}n.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=Ys(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=Ys(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new dt(e,dt.schemaRules(e)))}}const sl={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},ld={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ul={ol:!0,ul:!0},nr=1,To=2,Gn=4;function Gs(t,e,n){return e!=null?(e?nr:0)|(e==="full"?To:0):t&&t.whitespace=="pre"?nr|To:n&~Gn}class zr{constructor(e,n,r,i,o,s){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=L.none,this.match=o||(s&Gn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(w.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&nr)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=w.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(w.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!sl.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Zs{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,o,s=Gs(null,n.preserveWhitespace,0)|(r?Gn:0);i?o=new zr(i.type,i.attrs,L.none,!0,n.topMatch||i.type.contentMatch,s):r?o=new zr(null,null,L.none,!0,null,s):o=new zr(e.schema.topNodeType,null,L.none,!0,null,s),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,o=i.options&To?"full":this.localPreserveWS||(i.options&nr)>0,{schema:s}=this.parser;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)if(o==="full")r=r.replace(/\r\n?/g,`
`);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let u=r.split(/\r?\n|\r/);for(let a=0;a<u.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),n,!0),u[a]&&this.insertNode(s.text(u[a]),n,!/\S/.test(u[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let u=i.content[i.content.length-1],a=e.previousSibling;(!u||a&&a.nodeName=="BR"||u.isText&&/[ \t\r\n\u000c]$/.test(u.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),u;ul.hasOwnProperty(s)&&this.parser.normalizeLists&&cd(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(u=this.parser.matchTag(e,this,r));e:if(a?a.ignore:ld.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let l,c=this.needsBlock;if(sl.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),l=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let f=a&&a.skip?n:this.readStyles(e,n);f&&this.addAll(e,f),l&&this.sync(o),this.needsBlock=c}else{let l=this.readStyles(e,n);l&&this.addElementByRule(e,a,l,a.consuming===!1?u:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let u=void 0;;){let a=this.parser.matchStyle(o,s,this,u);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(l=>!a.clearMark(l)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)u=a;else break}}return n}addElementByRule(e,n,r,i){let o,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(s,n.attrs||null,r,n.preserveWhitespace);a&&(o=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let u=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}o&&this.sync(u)&&this.open--}addAll(e,n,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,u=i==null?null:e.childNodes[i];s!=u;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,n);this.findAtPoint(e,o)}findPlace(e,n,r){let i,o;for(let s=this.open,u=0;s>=0;s--){let a=this.nodes[s],l=a.findWrapping(e);if(l&&(!i||i.length>l.length+u)&&(i=l,o=a,!l.length))break;if(a.solid){if(r)break;u+=2}}if(!i)return null;this.sync(o);for(let s=0;s<i.length;s++)n=this.enterInner(i[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(n=this.enterInner(o,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let s=L.none;for(let u of i.concat(e.marks))(o.type?o.type.allowsMarkType(u.type):Xs(u.type,e.type))&&(s=u.addToSet(s));return o.content.push(e.mark(s)),!0}return!1}enter(e,n,r,i){let o=this.findPlace(e.create(n),r,!1);return o&&(o=this.enterInner(e,n,r,!0,i)),o}enterInner(e,n,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let u=Gs(e,o,s.options);s.options&Gn&&s.content.length==0&&(u|=Gn);let a=L.none;return r=r.filter(l=>(s.type?s.type.allowsMarkType(l.type):Xs(l.type,e))?(a=l.addToSet(a),!1):!0),this.nodes.push(new zr(e,n,a,i,null,u)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=nr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(u,a)=>{for(;u>=0;u--){let l=n[u];if(l==""){if(u==n.length-1||u==0)continue;for(;a>=o;a--)if(s(u-1,a))return!0;return!1}else{let c=a>0||a==0&&i?this.nodes[a].type:r&&a>=o?r.node(a-o).type:null;if(!c||c.name!=l&&!c.isInGroup(l))return!1;a--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function cd(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&ul.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function fd(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Ys(t){let e={};for(let n in t)e[n]=t[n];return e}function Xs(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let o=[],s=u=>{o.push(u);for(let a=0;a<u.edgeCount;a++){let{type:l,next:c}=u.edge(a);if(l==e||o.indexOf(c)<0&&s(c))return!0}};if(s(i.contentMatch))return!0}}class sn{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Wi(n).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let u=0,a=0;for(;u<o.length&&a<s.marks.length;){let l=s.marks[a];if(!this.marks[l.type.name]){a++;continue}if(!l.eq(o[u][0])||l.type.spec.spanning===!1)break;u++,a++}for(;u<o.length;)i=o.pop()[1];for(;a<s.marks.length;){let l=s.marks[a++],c=this.serializeMark(l,s.isInline,n);c&&(o.push([l,i]),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=Zr(Wi(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Zr(Wi(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Zr(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new sn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Qs(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Qs(e.marks)}}function Qs(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Wi(t){return t.document||window.document}const eu=new WeakMap;function dd(t){let e=eu.get(t);return e===void 0&&eu.set(t,e=hd(t)),e}function hd(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function Zr(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=dd(r))&&o.indexOf(e)>-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=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));let u,a=n?t.createElementNS(n,i):t.createElement(i),l=e[1],c=1;if(l&&typeof l=="object"&&l.nodeType==null&&!Array.isArray(l)){c=2;for(let f in l)if(l[f]!=null){let d=f.indexOf(" ");d>0?a.setAttributeNS(f.slice(0,d),f.slice(d+1),l[f]):f=="style"&&a.style?a.style.cssText=l[f]:a.setAttribute(f,l[f])}}for(let f=c;f<e.length;f++){let d=e[f];if(d===0){if(f<e.length-1||f>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=Zr(t,d,n,r);if(a.appendChild(h),p){if(u)throw new RangeError("Multiple content holes");u=p}}}return{dom:a,contentDOM:u}}const al=65535,ll=Math.pow(2,16);function pd(t,e){return t+e*ll}function tu(t){return t&al}function md(t){return(t-(t&al))/ll}const cl=1,fl=2,Yr=4,dl=8;class _o{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&dl)>0}get deletedBefore(){return(this.delInfo&(cl|Yr))>0}get deletedAfter(){return(this.delInfo&(fl|Yr))>0}get deletedAcross(){return(this.delInfo&Yr)>0}}class Ee{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Ee.empty)return Ee.empty}recover(e){let n=0,r=tu(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+md(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let a=this.ranges[u]-(this.inverted?i:0);if(a>e)break;let l=this.ranges[u+o],c=this.ranges[u+s],f=a+l;if(e<=f){let d=l?e==a?-1:e==f?1:n:n,h=a+i+(d<0?0:c);if(r)return h;let p=e==(n<0?a:f)?null:pd(u/3,e-a),m=e==a?fl:e==f?cl:Yr;return(n<0?e!=a:e!=f)&&(m|=dl),new _o(h,m,p)}i+=c-l}return r?e+i:new _o(e+i,0,null)}touches(e,n){let r=0,i=tu(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let a=this.ranges[u]-(this.inverted?r:0);if(a>e)break;let l=this.ranges[u+o],c=a+l;if(e<=c&&u==i*3)return!0;r+=this.ranges[u+s]-l}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],u=s-(this.inverted?o:0),a=s+(this.inverted?0:o),l=this.ranges[i+n],c=this.ranges[i+r];e(u,u+l,a,a+c),o+=c-l}}invert(){return new Ee(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ee.empty:new Ee(e<0?[0,-e,0]:[0,0,e])}}Ee.empty=new Ee([]);class rr{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new rr(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new rr;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this._maps[o],u=s.mapResult(e,n);if(u.recover!=null){let a=this.getMirror(o);if(a!=null&&a>o&&a<this.to){o=a,e=this._maps[a].recover(u.recover);continue}}i|=u.delInfo,e=u.pos}return r?e:new _o(e,i,null)}}const Ui=Object.create(null);class he{getMap(){return Ee.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ui[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ui)throw new RangeError("Duplicate use of step JSON ID "+e);return Ui[e]=n,n.prototype.jsonID=e,n}}class K{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new K(e,null)}static fail(e){return new K(null,e)}static fromReplace(e,n,r,i){try{return K.ok(e.replace(n,r,i))}catch(o){if(o instanceof ni)return K.fail(o.message);throw o}}}function ts(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let o=t.child(i);o.content.size&&(o=o.copy(ts(o.content,e,o))),o.isInline&&(o=e(o,n,i)),r.push(o)}return w.fromArray(r)}class St extends he{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new D(ts(n.content,(s,u)=>!s.isAtom||!u.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return K.fromReplace(e,this.from,this.to,o)}invert(){return new Ke(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new St(n.pos,r.pos,this.mark)}merge(e){return e instanceof St&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new St(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new St(n.from,n.to,e.markFromJSON(n.mark))}}he.jsonID("addMark",St);class Ke extends he{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new D(ts(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return K.fromReplace(e,this.from,this.to,r)}invert(){return new St(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Ke(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ke&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ke(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ke(n.from,n.to,e.markFromJSON(n.mark))}}he.jsonID("removeMark",Ke);class Dt extends he{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return K.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return K.fromReplace(e,this.pos,this.pos+1,new D(w.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Dt(this.pos,n.marks[i]);return new Dt(this.pos,this.mark)}}return new tn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Dt(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Dt(n.pos,e.markFromJSON(n.mark))}}he.jsonID("addNodeMark",Dt);class tn extends he{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return K.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return K.fromReplace(e,this.pos,this.pos+1,new D(w.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Dt(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new tn(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new tn(n.pos,e.markFromJSON(n.mark))}}he.jsonID("removeNodeMark",tn);class X extends he{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Oo(e,this.from,this.to)?K.fail("Structure replace would overwrite content"):K.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ee([this.from,this.to-this.from,this.slice.size])}invert(e){return new X(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new X(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof X)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?D.empty:new D(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new X(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?D.empty:new D(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new X(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new X(n.from,n.to,D.fromJSON(e,n.slice),!!n.structure)}}he.jsonID("replace",X);class te extends he{constructor(e,n,r,i,o,s,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=u}apply(e){if(this.structure&&(Oo(e,this.from,this.gapFrom)||Oo(e,this.gapTo,this.to)))return K.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return K.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?K.fromReplace(e,this.from,this.to,r):K.fail("Content does not fit in gap")}getMap(){return new Ee([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new te(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new te(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new te(n.from,n.to,n.gapFrom,n.gapTo,D.fromJSON(e,n.slice),n.insert,!!n.structure)}}he.jsonID("replaceAround",te);function Oo(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function gd(t,e,n,r){let i=[],o=[],s,u;t.doc.nodesBetween(e,n,(a,l,c)=>{if(!a.isInline)return;let f=a.marks;if(!r.isInSet(f)&&c.type.allowsMarkType(r.type)){let d=Math.max(l,e),h=Math.min(l+a.nodeSize,n),p=r.addToSet(f);for(let m=0;m<f.length;m++)f[m].isInSet(p)||(s&&s.to==d&&s.mark.eq(f[m])?s.to=h:i.push(s=new Ke(d,h,f[m])));u&&u.to==d?u.to=h:o.push(u=new St(d,h,r))}}),i.forEach(a=>t.step(a)),o.forEach(a=>t.step(a))}function bd(t,e,n,r){let i=[],o=0;t.doc.nodesBetween(e,n,(s,u)=>{if(!s.isInline)return;o++;let a=null;if(r instanceof Ci){let l=s.marks,c;for(;c=r.isInSet(l);)(a||(a=[])).push(c),l=c.removeFromSet(l)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let l=Math.min(u+s.nodeSize,n);for(let c=0;c<a.length;c++){let f=a[c],d;for(let h=0;h<i.length;h++){let p=i[h];p.step==o-1&&f.eq(i[h].style)&&(d=p)}d?(d.to=l,d.step=o):i.push({style:f,from:Math.max(u,e),to:l,step:o})}}}),i.forEach(s=>t.step(new Ke(s.from,s.to,s.style)))}function ns(t,e,n,r=n.contentMatch,i=!0){let o=t.doc.nodeAt(e),s=[],u=e+1;for(let a=0;a<o.childCount;a++){let l=o.child(a),c=u+l.nodeSize,f=r.matchType(l.type);if(!f)s.push(new X(u,c,D.empty));else{r=f;for(let d=0;d<l.marks.length;d++)n.allowsMarkType(l.marks[d].type)||t.step(new Ke(u,c,l.marks[d]));if(i&&l.isText&&n.whitespace!="pre"){let d,h=/\r?\n|\r/g,p;for(;d=h.exec(l.text);)p||(p=new D(w.from(n.schema.text(" ",n.allowedMarks(l.marks))),0,0)),s.push(new X(u+d.index,u+d.index+d[0].length,p))}}u=c}if(!r.validEnd){let a=r.fillBefore(w.empty,!0);t.replace(u,u,new D(a,0,0))}for(let a=s.length-1;a>=0;a--)t.step(s[a])}function yd(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Rn(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,o=0;;--r){let s=t.$from.node(r),u=t.$from.index(r)+i,a=t.$to.indexAfter(r)-o;if(r<t.depth&&s.canReplace(u,a,n))return r;if(r==0||s.type.spec.isolating||!yd(s,u,a))break;u&&(i=1),a<s.childCount&&(o=1)}return null}function xd(t,e,n){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),u=i.after(o+1),a=s,l=u,c=w.empty,f=0;for(let p=o,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,c=w.from(r.node(p).copy(c)),f++):a--;let d=w.empty,h=0;for(let p=o,m=!1;p>n;p--)m||i.after(p+1)<i.end(p)?(m=!0,d=w.from(i.node(p).copy(d)),h++):l++;t.step(new te(a,l,s,u,new D(c.append(d),f,h),c.size-f,!0))}function rs(t,e,n=null,r=t){let i=kd(t,e),o=i&&Cd(r,e);return o?i.map(nu).concat({type:e,attrs:n}).concat(o.map(nu)):null}function nu(t){return{type:t,attrs:null}}function kd(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return n.canReplaceWith(r,i,s)?o:null}function Cd(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let l=r;a&&l<i;l++)a=a.matchType(n.child(l).type);return!a||!a.validEnd?null:s}function vd(t,e,n){let r=w.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let u=n[s].type.contentMatch.matchFragment(r);if(!u||!u.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=w.from(n[s].type.create(n[s].attrs,r))}let i=e.start,o=e.end;t.step(new te(i,o,i,o,new D(r,0,0),n.length,!0))}function wd(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(s,u)=>{let a=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,a)&&Ed(t.doc,t.mapping.slice(o).map(u),r)){let l=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?l=!1:!h&&p&&(l=!0)}l===!1&&pl(t,s,u,o),ns(t,t.mapping.slice(o).map(u,1),r,void 0,l===null);let c=t.mapping.slice(o),f=c.map(u,1),d=c.map(u+s.nodeSize,1);return t.step(new te(f,d,f+1,d-1,new D(w.from(r.create(a,null,s.marks)),0,0),1,!0)),l===!0&&hl(t,s,u,o),!1}})}function hl(t,e,n,r){e.forEach((i,o)=>{if(i.isText){let s,u=/\r?\n|\r/g;for(;s=u.exec(i.text);){let a=t.mapping.slice(r).map(n+1+o+s.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function pl(t,e,n,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+o);t.replaceWith(s,s+1,e.type.schema.text(`
`))}})}function Ed(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function Sd(t,e,n,r,i){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let s=n.create(r,null,i||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,s);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new te(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new D(w.from(s),0,0),1,!0))}function ht(t,e,n=1,r){let i=t.resolve(e),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let l=i.depth-1,c=n-2;l>o;l--,c--){let f=i.node(l),d=i.index(l);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(d,f.childCount),p=r&&r[c+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[c]||f;if(!f.canReplace(d+1,f.childCount)||!m.type.validContent(h))return!1}let u=i.indexAfter(o),a=r&&r[0];return i.node(o).canReplaceWith(u,u,a?a.type:i.node(o+1).type)}function Dd(t,e,n=1,r){let i=t.doc.resolve(e),o=w.empty,s=w.empty;for(let u=i.depth,a=i.depth-n,l=n-1;u>a;u--,l--){o=w.from(i.node(u).copy(o));let c=r&&r[l];s=w.from(c?c.type.create(c.attrs,s):i.node(u).copy(s))}t.step(new X(e,e,new D(o.append(s),n,n),!0))}function Rt(t,e){let n=t.resolve(e),r=n.index();return ml(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Ad(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let o=e.child(i),s=o.type==r?t.type.schema.nodes.text:o.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(o.marks))return!1}return n.validEnd}function ml(t,e){return!!(t&&e&&!t.isLeaf&&Ad(t,e))}function vi(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let o,s,u=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):n>0?(o=r.node(i+1),u++,s=r.node(i).maybeChild(u)):(o=r.node(i).maybeChild(u-1),s=r.node(i+1)),o&&!o.isTextblock&&ml(o,s)&&r.node(i).canReplace(u,u+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function Md(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,o=t.doc.resolve(e-n),s=o.node().type;if(i&&s.inlineContent){let c=s.whitespace=="pre",f=!!s.contentMatch.matchType(i);c&&!f?r=!1:!c&&f&&(r=!0)}let u=t.steps.length;if(r===!1){let c=t.doc.resolve(e+n);pl(t,c.node(),c.before(),u)}s.inlineContent&&ns(t,e+n-1,s,o.node().contentMatchAt(o.index()),r==null);let a=t.mapping.slice(u),l=a.map(e-n);if(t.step(new X(l,a.map(e+n,-1),D.empty,!0)),r===!0){let c=t.doc.resolve(l);hl(t,c.node(),c.before(),t.steps.length)}return t}function Td(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,n))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function gl(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let o=0;o<n.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(n.openStart==0&&n.size?2:1);o++)for(let s=r.depth;s>=0;s--){let u=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(u>0?1:0),l=r.node(s),c=!1;if(o==1)c=l.canReplace(a,a,i);else{let f=l.contentMatchAt(a).findWrapping(i.firstChild.type);c=f&&l.canReplaceWith(a,a,f[0])}if(c)return u==0?r.pos:u<0?r.before(s+1):r.after(s+1)}return null}function wi(t,e,n=e,r=D.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return bl(i,o,r)?new X(e,n,r):new _d(i,o,r).fit()}function bl(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class _d{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=w.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=w.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let l=this.findFittable();l?this.placeNodes(l):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,u=i.depth;for(;s&&u&&o.childCount==1;)o=o.firstChild.content,s--,u--;let a=new D(o,s,u);return e>-1?new te(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new X(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=n.firstChild;if(n.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}n=o.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=Ji(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let u=this.depth;u>=0;u--){let{type:a,match:l}=this.frontier[u],c,f=null;if(n==1&&(s?l.matchType(s.type)||(f=l.fillBefore(w.from(s),!1)):o&&a.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:u,parent:o,inject:f};if(n==2&&s&&(c=l.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:u,parent:o,wrap:c};if(o&&l.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Ji(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new D(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Ji(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new D(Wn(e,n-1,1),n-1,o?n-1:r)}else this.unplaced=new D(Wn(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let m=0;m<o.length;m++)this.openFrontierNode(o[m]);let s=this.unplaced,u=r?r.content:s.content,a=s.openStart-e,l=0,c=[],{match:f,type:d}=this.frontier[n];if(i){for(let m=0;m<i.childCount;m++)c.push(i.child(m));f=f.matchFragment(i)}let h=u.size+e-(s.content.size-s.openEnd);for(;l<u.childCount;){let m=u.child(l),g=f.matchType(m.type);if(!g)break;l++,(l>1||a==0||m.content.size)&&(f=g,c.push(yl(m.mark(d.allowedMarks(m.marks)),l==1?a:0,l==u.childCount?h:-1)))}let p=l==u.childCount;p||(h=-1),this.placed=Un(this.placed,n,w.from(c)),this.frontier[n].match=f,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=u;m<h;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=p?e==0?D.empty:new D(Wn(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new D(Wn(s.content,e,l),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Ki(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],o=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=Ki(e,n,i,r,o);if(s){for(let u=n-1;u>=0;u--){let{match:a,type:l}=this.frontier[u],c=Ki(e,u,l,a,!0);if(!c||c.childCount)continue e}return{depth:n,fit:s,move:o?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Un(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Un(this.placed,this.depth,w.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(w.empty,!0);n.childCount&&(this.placed=Un(this.placed,this.frontier.length,n))}}function Wn(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Wn(t.firstChild.content,e-1,n)))}function Un(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Un(t.lastChild.content,e-1,n)))}function Ji(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function yl(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,yl(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(w.empty,!0)))),t.copy(r)}function Ki(t,e,n,r,i){let o=t.node(e),s=i?t.indexAfter(e):t.index(e);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let u=r.fillBefore(o.content,!0,s);return u&&!Od(n,o.content,s)?u:null}function Od(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function Nd(t){return t.spec.defining||t.spec.definingForContent}function Fd(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),o=t.doc.resolve(n);if(bl(i,o,r))return t.step(new X(e,n,r));let s=kl(i,o);s[s.length-1]==0&&s.pop();let u=-(i.depth+1);s.unshift(u);for(let d=i.depth,h=i.pos-1;d>0;d--,h--){let p=i.node(d).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;s.indexOf(d)>-1?u=d:i.before(d)==h&&s.splice(1,0,-d)}let a=s.indexOf(u),l=[],c=r.openStart;for(let d=r.content,h=0;;h++){let p=d.firstChild;if(l.push(p),h==r.openStart)break;d=p.content}for(let d=c-1;d>=0;d--){let h=l[d],p=Nd(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(u)-1)))c=d;else if(p||!h.type.isTextblock)break}for(let d=r.openStart;d>=0;d--){let h=(d+c+1)%(r.openStart+1),p=l[h];if(p)for(let m=0;m<s.length;m++){let g=s[(m+a)%s.length],y=!0;g<0&&(y=!1,g=-g);let x=i.node(g-1),k=i.index(g-1);if(x.canReplaceWith(k,k,p.type,p.marks))return t.replace(i.before(g),y?o.after(g):n,new D(xl(r.content,0,r.openStart,h),h,r.openEnd))}}let f=t.steps.length;for(let d=s.length-1;d>=0&&(t.replace(e,n,r),!(t.steps.length>f));d--){let h=s[d];h<0||(e=i.before(h),n=o.after(h))}}function xl(t,e,n,r,i){if(e<n){let o=t.firstChild;t=t.replaceChild(0,o.copy(xl(o.content,e+1,n,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(t).append(t);t=s.append(o.matchFragment(s).fillBefore(w.empty,!0))}return t}function Id(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=Td(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new D(w.from(r),0,0))}function Rd(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),o=kl(r,i);for(let s=0;s<o.length;s++){let u=o[s],a=s==o.length-1;if(a&&u==0||r.node(u).type.contentMatch.validEnd)return t.delete(r.start(u),i.end(u));if(u>0&&(a||r.node(u-1).canReplace(r.index(u-1),i.indexAfter(u-1))))return t.delete(r.before(u),i.after(u))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&i.end(s)-n!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function kl(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let o=t.start(i);if(o<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&n.push(i)}return n}class kn extends he{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return K.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return K.fromReplace(e,this.pos,this.pos+1,new D(w.from(i),0,n.isLeaf?0:1))}getMap(){return Ee.empty}invert(e){return new kn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new kn(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new kn(n.pos,n.attr,n.value)}}he.jsonID("attr",kn);class ir extends he{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return K.ok(r)}getMap(){return Ee.empty}invert(e){return new ir(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new ir(n.attr,n.value)}}he.jsonID("docAttr",ir);let wn=class extends Error{};wn=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};wn.prototype=Object.create(Error.prototype);wn.prototype.constructor=wn;wn.prototype.name="TransformError";class Bd{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new rr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new wn(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=D.empty){let i=wi(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new D(w.from(r),0,0))}delete(e,n){return this.replace(e,n,D.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return Fd(this,e,n,r),this}replaceRangeWith(e,n,r){return Id(this,e,n,r),this}deleteRange(e,n){return Rd(this,e,n),this}lift(e,n){return xd(this,e,n),this}join(e,n=1){return Md(this,e,n),this}wrap(e,n){return vd(this,e,n),this}setBlockType(e,n=e,r,i=null){return wd(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return Sd(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new kn(e,n,r)),this}setDocAttribute(e,n){return this.step(new ir(e,n)),this}addNodeMark(e,n){return this.step(new Dt(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof L)n.isInSet(r.marks)&&this.step(new tn(e,n));else{let i=r.marks,o,s=[];for(;o=n.isInSet(i);)s.push(new tn(e,o)),i=o.removeFromSet(i);for(let u=s.length-1;u>=0;u--)this.step(s[u])}return this}split(e,n=1,r){return Dd(this,e,n,r),this}addMark(e,n,r){return gd(this,e,n,r),this}removeMark(e,n,r){return bd(this,e,n,r),this}clearIncompatible(e,n,r){return ns(this,e,n,r),this}}const Gi=Object.create(null);class I{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Pd(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=D.empty){let r=n.content.lastChild,i=null;for(let u=0;u<n.openEnd;u++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let u=0;u<s.length;u++){let{$from:a,$to:l}=s[u],c=e.mapping.slice(o);e.replaceRange(c.map(a.pos),c.map(l.pos),u?D.empty:n),u==0&&ou(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:u}=i[o],a=e.mapping.slice(r),l=a.map(s.pos),c=a.map(u.pos);o?e.deleteRange(l,c):(e.replaceRangeWith(l,c,n),ou(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new F(e):mn(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=n<0?mn(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):mn(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new De(e.node(0))}static atStart(e){return mn(e,e,0,0,1)||new De(e)}static atEnd(e){return mn(e,e,e.content.size,e.childCount,-1)||new De(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Gi[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Gi)throw new RangeError("Duplicate use of selection JSON ID "+e);return Gi[e]=n,n.prototype.jsonID=e,n}getBookmark(){return F.between(this.$anchor,this.$head).getBookmark()}}I.prototype.visible=!0;class Pd{constructor(e,n){this.$from=e,this.$to=n}}let ru=!1;function iu(t){!ru&&!t.parent.inlineContent&&(ru=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class F extends I{constructor(e,n=e){iu(e),iu(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return I.near(r);let i=e.resolve(n.map(this.anchor));return new F(i.parent.inlineContent?i:r,r)}replace(e,n=D.empty){if(super.replace(e,n),n==D.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof F&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ei(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new F(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let o=I.findFrom(n,r,!0)||I.findFrom(n,-r,!0);if(o)n=o.$head;else return I.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(I.findFrom(e,-r,!0)||I.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new F(e,n)}}I.jsonID("text",F);class Ei{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Ei(e.map(this.anchor),e.map(this.head))}resolve(e){return F.between(e.resolve(this.anchor),e.resolve(this.head))}}class _ extends I{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),o=e.resolve(i);return r?I.near(o):new _(o)}content(){return new D(w.from(this.node),0,0)}eq(e){return e instanceof _&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new is(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new _(e.resolve(n.anchor))}static create(e,n){return new _(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}_.prototype.visible=!1;I.jsonID("node",_);class is{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Ei(r,r):new is(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&_.isSelectable(r)?new _(n):I.near(n)}}class De extends I{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=D.empty){if(n==D.empty){e.delete(0,e.doc.content.size);let r=I.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new De(e)}map(e){return new De(e)}eq(e){return e instanceof De}getBookmark(){return Ld}}I.jsonID("all",De);const Ld={map(){return this},resolve(t){return new De(t)}};function mn(t,e,n,r,i,o=!1){if(e.inlineContent)return F.create(t,n);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let u=e.child(s);if(u.isAtom){if(!o&&_.isSelectable(u))return _.create(t,n-(i<0?u.nodeSize:0))}else{let a=mn(t,u,n+i,i<0?u.childCount:0,i,o);if(a)return a}n+=u.nodeSize*i}return null}function ou(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof X||i instanceof te))return;let o=t.mapping.maps[r],s;o.forEach((u,a,l,c)=>{s==null&&(s=c)}),t.setSelection(I.near(t.doc.resolve(s),n))}const su=1,$r=2,uu=4;class zd extends Bd{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|su)&~$r,this.storedMarks=null,this}get selectionSet(){return(this.updated&su)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=$r,this}ensureMarks(e){return L.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&$r)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~$r,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||L.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(n);o=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,o)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(I.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=uu,this}get scrolledIntoView(){return(this.updated&uu)>0}}function au(t,e){return!e||!t?t:t.bind(e)}class Jn{constructor(e,n,r){this.name=e,this.init=au(n.init,r),this.apply=au(n.apply,r)}}const $d=[new Jn("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Jn("selection",{init(t,e){return t.selection||I.atStart(e.doc)},apply(t){return t.selection}}),new Jn("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Jn("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Zi{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=$d.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Jn(r.key,r.spec.state,r))})}}class yn{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let u=this.config.plugins[s];if(u.spec.appendTransaction){let a=i?i[s].n:0,l=i?i[s].state:this,c=a<n.length&&u.spec.appendTransaction.call(u,a?n.slice(a):n,l,r);if(c&&r.filterTransaction(c,s)){if(c.setMeta("appendedTransaction",e),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<s?{state:r,n:n.length}:{state:this,n:0})}n.push(c),r=r.applyInner(c),o=!0}i&&(i[s]={state:r,n:n.length})}}if(!o)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new yn(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];n[o.name]=o.apply(e,this[o.name],this,n)}return n}get tr(){return new zd(this)}static create(e){let n=new Zi(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new yn(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new Zi(this.schema,e.plugins),r=n.fields,i=new yn(n);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],o=i.spec.state;o&&o.toJSON&&(n[r]=o.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Zi(e.schema,e.plugins),o=new yn(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=Tt.fromJSON(e.schema,n.doc);else if(s.name=="selection")o.selection=I.fromJSON(o.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let u in r){let a=r[u],l=a.spec.state;if(a.key==s.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(n,u)){o[s.name]=l.fromJSON.call(a,e,n[u],o);return}}o[s.name]=s.init(e,o)}}),o}}function Cl(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Cl(i,e,{})),n[r]=i}return n}class ae{constructor(e){this.spec=e,this.props={},e.props&&Cl(e.props,this,this.props),this.key=e.key?e.key.key:vl("plugin")}getState(e){return e[this.key]}}const Yi=Object.create(null);function vl(t){return t in Yi?t+"$"+ ++Yi[t]:(Yi[t]=0,t+"$")}class Te{constructor(e="key"){this.key=vl(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const se=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},En=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let No=null;const lt=function(t,e,n){let r=No||(No=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},Vd=function(){No=null},nn=function(t,e,n,r){return n&&(lu(t,e,n,r,-1)||lu(t,e,n,r,1))},Hd=/^(img|br|input|textarea|hr)$/i;function lu(t,e,n,r,i){for(var o;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Ne(t))){let s=t.parentNode;if(!s||s.nodeType!=1||br(t)||Hd.test(t.nodeName)||t.contentEditable=="false")return!1;e=se(t)+(i<0?0:1),t=s}else if(t.nodeType==1){let s=t.childNodes[e+(i<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((o=s.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=i;else return!1;else t=s,e=i<0?Ne(t):0}else return!1}}function Ne(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function qd(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Ne(t)}else if(t.parentNode&&!br(t))e=se(t),t=t.parentNode;else return null}}function jd(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!br(t))e=se(t)+1,t=t.parentNode;else return null}}function Wd(t,e,n){for(let r=e==0,i=e==Ne(t);r||i;){if(t==n)return!0;let o=se(t);if(t=t.parentNode,!t)return!1;r=r&&o==0,i=i&&o==Ne(t)}}function br(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Si=function(t){return t.focusNode&&nn(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function jt(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Ud(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Jd(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Ne(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Ne(r.startContainer),r.startOffset)}}}const Xe=typeof navigator<"u"?navigator:null,cu=typeof document<"u"?document:null,Bt=Xe&&Xe.userAgent||"",Fo=/Edge\/(\d+)/.exec(Bt),wl=/MSIE \d/.exec(Bt),Io=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Bt),ye=!!(wl||Io||Fo),_t=wl?document.documentMode:Io?+Io[1]:Fo?+Fo[1]:0,Fe=!ye&&/gecko\/(\d+)/i.test(Bt);Fe&&+(/Firefox\/(\d+)/.exec(Bt)||[0,0])[1];const Ro=!ye&&/Chrome\/(\d+)/.exec(Bt),ee=!!Ro,El=Ro?+Ro[1]:0,de=!ye&&!!Xe&&/Apple Computer/.test(Xe.vendor),Sn=de&&(/Mobile\/\w+/.test(Bt)||!!Xe&&Xe.maxTouchPoints>2),Oe=Sn||(Xe?/Mac/.test(Xe.platform):!1),Sl=Xe?/Win/.test(Xe.platform):!1,ct=/Android \d/.test(Bt),yr=!!cu&&"webkitFontSmoothing"in cu.documentElement.style,Kd=yr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Gd(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function at(t,e){return typeof t=="number"?t:t[e]}function Zd(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function fu(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=En(s);continue}let u=s,a=u==o.body,l=a?Gd(o):Zd(u),c=0,f=0;if(e.top<l.top+at(r,"top")?f=-(l.top-e.top+at(i,"top")):e.bottom>l.bottom-at(r,"bottom")&&(f=e.bottom-e.top>l.bottom-l.top?e.top+at(i,"top")-l.top:e.bottom-l.bottom+at(i,"bottom")),e.left<l.left+at(r,"left")?c=-(l.left-e.left+at(i,"left")):e.right>l.right-at(r,"right")&&(c=e.right-l.right+at(i,"right")),c||f)if(a)o.defaultView.scrollBy(c,f);else{let h=u.scrollLeft,p=u.scrollTop;f&&(u.scrollTop+=f),c&&(u.scrollLeft+=c);let m=u.scrollLeft-h,g=u.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let d=a?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(d))break;s=d=="absolute"?s.offsetParent:En(s)}}function Yd(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let u=t.root.elementFromPoint(o,s);if(!u||u==t.dom||!t.dom.contains(u))continue;let a=u.getBoundingClientRect();if(a.top>=n-20){r=u,i=a.top;break}}return{refDOM:r,refTop:i,stack:Dl(t.dom)}}function Dl(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=En(r));return e}function Xd({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Al(n,r==0?0:r-e)}function Al(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:o}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let dn=null;function Qd(t){if(t.setActive)return t.setActive();if(dn)return t.focus(dn);let e=Dl(t);t.focus(dn==null?{get preventScroll(){return dn={preventScroll:!0},!0}}:void 0),dn||(dn=!1,Al(e,0))}function Ml(t,e){let n,r=2e8,i,o=0,s=e.top,u=e.top,a,l;for(let c=t.firstChild,f=0;c;c=c.nextSibling,f++){let d;if(c.nodeType==1)d=c.getClientRects();else if(c.nodeType==3)d=lt(c).getClientRects();else continue;for(let h=0;h<d.length;h++){let p=d[h];if(p.top<=s&&p.bottom>=u){s=Math.max(p.bottom,s),u=Math.min(p.top,u);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=c,r=m,i=m&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,c.nodeType==1&&m&&(o=f+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=c,l={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(o=f+1)}}return!n&&a&&(n=a,i=l,r=0),n&&n.nodeType==3?eh(n,i):!n||r&&n.nodeType==1?{node:t,offset:o}:Ml(n,i)}function eh(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);let s=xt(r,1);if(s.top!=s.bottom&&ss(e,s)){i={node:t,offset:o+(e.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function ss(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function th(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function nh(t,e,n){let{node:r,offset:i}=Ml(e,n),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,i,o)}function rh(t,e,n,r){let i=-1;for(let o=e,s=!1;o!=t.dom;){let u=t.docView.nearestDesc(o,!0),a;if(!u)return null;if(u.dom.nodeType==1&&(u.node.isBlock&&u.parent||!u.contentDOM)&&((a=u.dom.getBoundingClientRect()).width||a.height)&&(u.node.isBlock&&u.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(u.dom.nodeName)&&(!s&&a.left>r.left||a.top>r.top?i=u.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(i=u.posAfter),s=!0),!u.contentDOM&&i<0&&!u.node.isText))return(u.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?u.posBefore:u.posAfter;o=u.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function Tl(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),o=i;;){let s=t.childNodes[o];if(s.nodeType==1){let u=s.getClientRects();for(let a=0;a<u.length;a++){let l=u[a];if(ss(e,l))return Tl(s,e,l)}}if((o=(o+1)%r)==i)break}return t}function ih(t,e){let n=t.dom.ownerDocument,r,i=0,o=Jd(n,e.left,e.top);o&&({node:r,offset:i}=o);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),u;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let l=t.dom.getBoundingClientRect();if(!ss(e,l)||(s=Tl(t.dom,e,l),!s))return null}if(de)for(let l=s;r&&l;l=En(l))l.draggable&&(r=void 0);if(s=th(s,e),r){if(Fe&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let c=r.childNodes[i],f;c.nodeName=="IMG"&&(f=c.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let l;yr&&i&&r.nodeType==1&&(l=r.childNodes[i-1]).nodeType==1&&l.contentEditable=="false"&&l.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?u=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(u=rh(t,r,i,e))}u==null&&(u=nh(t,s,e));let a=t.docView.nearestDesc(s,!0);return{pos:u,inside:a?a.posAtStart-a.border:-1}}function du(t){return t.top<t.bottom||t.left<t.right}function xt(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(du(r))return r}return Array.prototype.find.call(n,du)||t.getBoundingClientRect()}const oh=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function _l(t,e,n){let{node:r,offset:i,atom:o}=t.docView.domFromPos(e,n<0?-1:1),s=yr||Fe;if(r.nodeType==3)if(s&&(oh.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let a=xt(lt(r,i,i),n);if(Fe&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let l=xt(lt(r,i-1,i-1),-1);if(l.top==a.top){let c=xt(lt(r,i,i+1),-1);if(c.top!=a.top)return Hn(c,c.left<l.left)}}return a}else{let a=i,l=i,c=n<0?1:-1;return n<0&&!i?(l++,c=-1):n>=0&&i==r.nodeValue.length?(a--,c=1):n<0?a--:l++,Hn(xt(lt(r,a,l),c),c<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==Ne(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return Xi(a.getBoundingClientRect(),!1)}if(o==null&&i<Ne(r)){let a=r.childNodes[i];if(a.nodeType==1)return Xi(a.getBoundingClientRect(),!0)}return Xi(r.getBoundingClientRect(),n>=0)}if(o==null&&i&&(n<0||i==Ne(r))){let a=r.childNodes[i-1],l=a.nodeType==3?lt(a,Ne(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(l)return Hn(xt(l,1),!1)}if(o==null&&i<Ne(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let l=a?a.nodeType==3?lt(a,0,s?0:1):a.nodeType==1?a:null:null;if(l)return Hn(xt(l,-1),!0)}return Hn(xt(r.nodeType==3?lt(r):r,-n),n>=0)}function Hn(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Xi(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Ol(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function sh(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return Ol(t,e,()=>{let{node:o}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let u=t.docView.nearestDesc(o,!0);if(!u)break;if(u.node.isBlock){o=u.contentDOM||u.dom;break}o=u.dom.parentNode}let s=_l(t,i.pos,1);for(let u=o.firstChild;u;u=u.nextSibling){let a;if(u.nodeType==1)a=u.getClientRects();else if(u.nodeType==3)a=lt(u,0,u.nodeValue.length).getClientRects();else continue;for(let l=0;l<a.length;l++){let c=a[l];if(c.bottom>c.top+1&&(n=="up"?s.top-c.top>(c.bottom-s.top)*2:c.bottom-s.bottom>(s.bottom-c.top)*2))return!1}}return!0})}const uh=/[\u0590-\u08ac]/;function ah(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,u=t.domSelection();return u?!uh.test(r.parent.textContent)||!u.modify?n=="left"||n=="backward"?o:s:Ol(t,e,()=>{let{focusNode:a,focusOffset:l,anchorNode:c,anchorOffset:f}=t.domSelectionRange(),d=u.caretBidiLevel;u.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),g=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&l==m;try{u.collapse(c,f),a&&(a!=c||l!=f)&&u.extend&&u.extend(a,l)}catch{}return d!=null&&(u.caretBidiLevel=d),g}):r.pos==r.start()||r.pos==r.end()}let hu=null,pu=null,mu=!1;function lh(t,e,n){return hu==e&&pu==n?mu:(hu=e,pu=n,mu=n=="up"||n=="down"?sh(t,e,n):ah(t,e,n))}const Ie=0,gu=1,Ut=2,Qe=3;class xr{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Ie,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.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(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let o,s;if(e==this.contentDOM)o=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}else{let o,s;if(e==this.contentDOM)o=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>se(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!n||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)for(let s=0;s<i.children.length;s++){let u=i.children[s];if(u.size){i=u;break}}return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],u=o+s.size;if(u>e||s instanceof Fl){i=e-o;break}o=u}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof Nl&&o.side>=0;r--);if(n<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&n&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?se(o.dom)+1:0}}else{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,n):{node:this.contentDOM,offset:o?se(o.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let s=r,u=0;;u++){let a=this.children[u],l=s+a.size;if(i==-1&&e<=l){let c=s+a.border;if(e>=c&&n<=l-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,c);e=s;for(let f=u;f>0;f--){let d=this.children[f-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){i=se(d.dom)+1;break}e-=d.size}i==-1&&(i=0)}if(i>-1&&(l>n||u==this.children.length-1)){n=l;for(let c=u+1;c<this.children.length;c++){let f=this.children[c];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){o=se(f.dom);break}n+=f.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=l}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let o=Math.min(e,n),s=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],g=p+m.size;if(o>p&&s<g)return m.setSelection(e-p-m.border,n-p-m.border,r,i);p=g}let u=this.domFromPos(e,e?-1:1),a=n==e?u:this.domFromPos(n,n?-1:1),l=r.root.getSelection(),c=r.domSelectionRange(),f=!1;if((Fe||de)&&e==n){let{node:h,offset:p}=u;if(h.nodeType==3){if(f=!!(p&&h.nodeValue[p-1]==`
`),f&&p==h.nodeValue.length)for(let m=h,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(u=a={node:g.parentNode,offset:se(g)+1});break}let y=m.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let m=h.childNodes[p-1];f=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Fe&&c.focusNode&&c.focusNode!=a.node&&c.focusNode.nodeType==1){let h=c.focusNode.childNodes[c.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||f&&de)&&nn(u.node,u.offset,c.anchorNode,c.anchorOffset)&&nn(a.node,a.offset,c.focusNode,c.focusOffset))return;let d=!1;if((l.extend||e==n)&&!(f&&Fe)){l.collapse(u.node,u.offset);try{e!=n&&l.extend(a.node,a.offset),d=!0}catch{}}if(!d){if(e>n){let p=u;u=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(u.node,u.offset),l.removeAllRanges(),l.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let u=r+o.border,a=s-o.border;if(e>=u&&n<=a){this.dirty=e==r||n==s?Ut:gu,e==u&&n==a&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Qe:o.markDirty(e-u,n-u);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Ut:Qe}r=s}this.dirty=Ut}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Ut:gu;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Nl extends xr{constructor(e,n,r,i){let o,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(s.nodeType!=1){let u=document.createElement("span");u.appendChild(s),s=u}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,o=this}matchesWidget(e){return this.dirty==Ie&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class ch extends xr{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class rn extends xr{constructor(e,n,r,i,o){super(e,[],r,i),this.mark=n,this.spec=o}static create(e,n,r,i){let o=i.nodeViews[n.type.name],s=o&&o(n,i,r);return(!s||!s.dom)&&(s=sn.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new rn(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Qe||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Qe&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Ie){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Ie}}slice(e,n,r){let i=rn.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;n<s&&(o=Po(o,n,s,r)),e>0&&(o=Po(o,0,e,r));for(let u=0;u<o.length;u++)o[u].parent=i;return i.children=o,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Ot extends xr{constructor(e,n,r,i,o,s,u,a,l){super(e,[],o,s),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=u}static create(e,n,r,i,o,s){let u=o.nodeViews[n.type.name],a,l=u&&u(n,o,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,i),c=l&&l.dom,f=l&&l.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:f}=sn.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let d=c;return c=Bl(c,r,n),l?a=new fh(e,n,r,i,c,f||null,d,l,o,s+1):n.isText?new Di(e,n,r,i,c,d,o):new Ot(e,n,r,i,c,f||null,d,o,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>w.empty)}return e}matchesNode(e,n,r){return this.dirty==Ie&&e.eq(this.node)&&si(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,o=e.composing?this.localCompositionInfo(e,n):null,s=o&&o.pos>-1?o:null,u=o&&o.pos<0,a=new hh(this,s&&s.node,e);gh(this.node,this.innerDeco,(l,c,f)=>{l.spec.marks?a.syncToMarks(l.spec.marks,r,e):l.type.side>=0&&!f&&a.syncToMarks(c==this.node.childCount?L.none:this.node.child(c).marks,r,e),a.placeWidget(l,e,i)},(l,c,f,d)=>{a.syncToMarks(l.marks,r,e);let h;a.findNodeMatch(l,c,f,d)||u&&e.state.selection.from>i&&e.state.selection.to<i+l.nodeSize&&(h=a.findIndexWithChild(o.node))>-1&&a.updateNodeAt(l,c,f,h,e)||a.updateNextNode(l,c,f,e,d,i)||a.addNode(l,c,f,e,i),i+=l.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Ut)&&(s&&this.protectLocalComposition(e,s),Il(this.contentDOM,this.children,e),Sn&&bh(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof F)||r<n||i>n+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,u=yh(this.node.content,s,r-n,i-n);return u<0?null:{node:o,pos:u,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new ch(this,o,n,i);e.input.compositionNodes.push(s),this.children=Po(this.children,r,r+i.length,e,s)}update(e,n,r,i){return this.dirty==Qe||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Ie}updateOuterDeco(e){if(si(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Rl(this.dom,this.nodeDOM,Bo(this.outerDeco,this.node,n),Bo(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function bu(t,e,n,r,i){Bl(r,e,t);let o=new Ot(void 0,t,e,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Di extends Ot{constructor(e,n,r,i,o,s,u){super(e,n,r,i,o,null,s,u,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==Qe||this.dirty!=Ie&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Ie||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Ie,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),o=document.createTextNode(i.text);return new Di(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Qe)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Fl extends xr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ie&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class fh extends Ot{constructor(e,n,r,i,o,s,u,a,l,c){super(e,n,r,i,o,s,u,l,c),this.spec=a}update(e,n,r,i){if(this.dirty==Qe)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,n,r);return o&&this.updateInner(e,n,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Il(t,e,n){let r=t.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],u=s.dom;if(u.parentNode==t){for(;u!=r;)r=yu(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(u,r);if(s instanceof rn){let a=r?r.previousSibling:t.lastChild;Il(s.contentDOM,s.children,n),r=a?a.nextSibling:t.firstChild}}for(;r;)r=yu(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Zn=function(t){t&&(this.nodeName=t)};Zn.prototype=Object.create(null);const Jt=[new Zn];function Bo(t,e,n){if(t.length==0)return Jt;let r=n?Jt[0]:new Zn,i=[r];for(let o=0;o<t.length;o++){let s=t[o].type.attrs;if(s){s.nodeName&&i.push(r=new Zn(s.nodeName));for(let u in s){let a=s[u];a!=null&&(n&&i.length==1&&i.push(r=new Zn(e.isInline?"span":"div")),u=="class"?r.class=(r.class?r.class+" ":"")+a:u=="style"?r.style=(r.style?r.style+";":"")+a:u!="nodeName"&&(r[u]=a))}}}return i}function Rl(t,e,n,r){if(n==Jt&&r==Jt)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],u=n[o];if(o){let a;u&&u.nodeName==s.nodeName&&i!=t&&(a=i.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(i),u=Jt[0]),i=a}dh(i,u||Jt[0],s)}return i}function dh(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&t.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&t.classList.add(i[o]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function Bl(t,e,n){return Rl(t,t,Jt,Bo(e,n,t.nodeType!=1))}function si(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function yu(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class hh{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=ph(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r){let i=0,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=Ie,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let u=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let l=this.top.children[a];if(l.matchesMark(e[o])&&!this.isLocked(l.dom)){u=a;break}}if(u>-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let a=rn.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))o=this.top.children.indexOf(s,this.index);else for(let u=this.index,a=Math.min(this.top.children.length,u+5);u<a;u++){let l=this.top.children[u];if(l.matchesNode(e,n,r)&&!this.preMatch.matched.has(l)){o=u;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,n,r,i,o){let s=this.top.children[i];return s.dirty==Qe&&s.dom==s.contentDOM&&(s.dirty=Ut),s.update(e,n,r,o)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,o,s){for(let u=this.index;u<this.top.children.length;u++){let a=this.top.children[u];if(a instanceof Ot){let l=this.preMatch.matched.get(a);if(l!=null&&l!=o)return!1;let c=a.dom,f,d=this.isLocked(c)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Qe&&si(n,a.outerDeco));if(!d&&a.update(e,n,r,i))return this.destroyBetween(this.index,u),a.dom!=c&&(this.changed=!0),this.index++,!0;if(!d&&(f=this.recreateWrapper(a,e,n,r,i,s)))return this.destroyBetween(this.index,u),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=Ut,f.updateChildren(i,s+1),f.dirty=Ie),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,o,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!si(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let u=Ot.create(this.top,n,r,i,o,s);if(u.contentDOM){u.children=e.children,e.children=[];for(let a of u.children)a.parent=u}return e.destroy(),u}addNode(e,n,r,i,o){let s=Ot.create(this.top,e,n,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let o=new Nl(this.top,e,n,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof rn;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Di)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((de||ee)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new Fl(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function ph(t,e){let n=e,r=n.children.length,i=t.childCount,o=new Map,s=[];e:for(;i>0;){let u;for(;;)if(r){let l=n.children[r-1];if(l instanceof rn)n=l,r=l.children.length;else{u=l,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=u.node;if(a){if(a!=t.child(i-1))break;--i,o.set(u,i),s.push(u)}}return{index:i,matched:o,matches:s.reverse()}}function mh(t,e){return t.type.side-e.type.side}function gh(t,e,n,r){let i=e.locals(t),o=0;if(i.length==0){for(let l=0;l<t.childCount;l++){let c=t.child(l);r(c,i,e.forChild(o,c),l),o+=c.nodeSize}return}let s=0,u=[],a=null;for(let l=0;;){let c,f;for(;s<i.length&&i[s].to==o;){let g=i[s++];g.widget&&(c?(f||(f=[c])).push(g):c=g)}if(c)if(f){f.sort(mh);for(let g=0;g<f.length;g++)n(f[g],l,!!a)}else n(c,l,!!a);let d,h;if(a)h=-1,d=a,a=null;else if(l<t.childCount)h=l,d=t.child(l++);else break;for(let g=0;g<u.length;g++)u[g].to<=o&&u.splice(g--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)u.push(i[s++]);let p=o+d.nodeSize;if(d.isText){let g=p;s<i.length&&i[s].from<g&&(g=i[s].from);for(let y=0;y<u.length;y++)u[y].to<g&&(g=u[y].to);g<p&&(a=d.cut(g-o),d=d.cut(0,g-o),p=g,h=-1)}else for(;s<i.length&&i[s].to<p;)s++;let m=d.isInline&&!d.isLeaf?u.filter(g=>!g.inline):u.slice();r(d,m,e.forChild(o,d),h),o=p}}function bh(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function yh(t,e,n,r){for(let i=0,o=0;i<t.childCount&&o<=r;){let s=t.child(i++),u=o;if(o+=s.nodeSize,!s.isText)continue;let a=s.text;for(;i<t.childCount;){let l=t.child(i++);if(o+=l.nodeSize,!l.isText)break;a+=l.text}if(o>=n){if(o>=r&&a.slice(r-e.length-u,r-u)==e)return r-e.length;let l=u<r?a.lastIndexOf(e,r-u-1):-1;if(l>=0&&l+e.length+u>=n)return u+l;if(n==r&&a.length>=r+e.length-u&&a.slice(r-u,r-u+e.length)==e)return r}}return-1}function Po(t,e,n,r,i){let o=[];for(let s=0,u=0;s<t.length;s++){let a=t[s],l=u,c=u+=a.size;l>=n||c<=e?o.push(a):(l<e&&o.push(a.slice(0,e-l,r)),i&&(o.push(i),i=void 0),c>n&&o.push(a.slice(n-l,a.size,r)))}return o}function us(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),o=i&&i.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let u=r.resolve(s),a,l;if(Si(n)){for(a=s;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&_.isSelectable(f)&&i.parent&&!(f.isInline&&Wd(n.focusNode,n.focusOffset,i.dom))){let d=i.posBefore;l=new _(s==d?u:r.resolve(d))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=s,d=s;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);f=Math.min(f,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),d=Math.max(d,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(f<0)return null;[a,s]=d==t.state.selection.anchor?[d,f]:[f,d],u=r.resolve(s)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let c=r.resolve(a);if(!l){let f=e=="pointer"||t.state.selection.head<u.pos&&!o?1:-1;l=as(t,c,u,f)}return l}function Pl(t){return t.editable?t.hasFocus():zl(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function pt(t,e=!1){let n=t.state.selection;if(Ll(t,n),!!Pl(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&ee){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&nn(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)kh(t);else{let{anchor:r,head:i}=n,o,s;xu&&!(n instanceof F)&&(n.$from.parent.inlineContent||(o=ku(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=ku(t,n.to))),t.docView.setSelection(r,i,t,e),xu&&(o&&Cu(o),s&&Cu(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&xh(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const xu=de||ee&&El<63;function ku(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(de&&i&&i.contentEditable=="false")return Qi(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return Qi(i);if(o)return Qi(o)}}function Qi(t){return t.contentEditable="true",de&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Cu(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function xh(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Pl(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function kh(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,se(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&ye&&_t<=11&&(n.disabled=!0,n.disabled=!1)}function Ll(t,e){if(e instanceof _){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(vu(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else vu(t)}function vu(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function as(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||F.between(e,n,r)}function wu(t){return t.editable&&!t.hasFocus()?!1:zl(t)}function zl(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Ch(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return nn(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Lo(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return o&&I.findFrom(o,e)}function kt(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Eu(t,e,n){let r=t.state.selection;if(r instanceof F)if(n.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=t.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return kt(t,new F(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Lo(t.state,e);return i&&i instanceof _?kt(t,i):!1}else if(!(Oe&&n.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let u=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=t.docView.descAt(u))&&!s.contentDOM?_.isSelectable(o)?kt(t,new _(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):yr?kt(t,new F(t.state.doc.resolve(e<0?u:u+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof _&&r.node.isInline)return kt(t,new F(e>0?r.$to:r.$from));{let i=Lo(t.state,e);return i?kt(t,i):!1}}}function ui(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Yn(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function hn(t,e){return e<0?vh(t):wh(t)}function vh(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,s=!1;for(Fe&&n.nodeType==1&&r<ui(n)&&Yn(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let u=n.childNodes[r-1];if(Yn(u,-1))i=n,o=--r;else if(u.nodeType==3)n=u,r=n.nodeValue.length;else break}}else{if($l(n))break;{let u=n.previousSibling;for(;u&&Yn(u,-1);)i=n.parentNode,o=se(u),u=u.previousSibling;if(u)n=u,r=ui(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?zo(t,n,r):i&&zo(t,i,o)}function wh(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=ui(n),o,s;for(;;)if(r<i){if(n.nodeType!=1)break;let u=n.childNodes[r];if(Yn(u,1))o=n,s=++r;else break}else{if($l(n))break;{let u=n.nextSibling;for(;u&&Yn(u,1);)o=u.parentNode,s=se(u)+1,u=u.nextSibling;if(u)n=u,r=0,i=ui(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}o&&zo(t,o,s)}function $l(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Eh(t,e){for(;t&&e==t.childNodes.length&&!br(t);)e=se(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Sh(t,e){for(;t&&!e&&!br(t);)e=se(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function zo(t,e,n){if(e.nodeType!=3){let o,s;(s=Eh(e,n))?(e=s,n=0):(o=Sh(e,n))&&(e=o,n=o.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Si(r)){let o=document.createRange();o.setEnd(e,n),o.setStart(e,n),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&pt(t)},50)}function Su(t,e){let n=t.state.doc.resolve(e);if(!(ee||Sl)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<n.end()){let o=t.coordsAtPos(e+1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Du(t,e,n){let r=t.state.selection;if(r instanceof F&&!r.empty||n.indexOf("s")>-1||Oe&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Lo(t.state,e);if(s&&s instanceof _)return kt(t,s)}if(!i.parent.inlineContent){let s=e<0?i:o,u=r instanceof De?I.near(s,e):I.findFrom(s,e);return u?kt(t,u):!1}return!1}function Au(t,e){if(!(t.state.selection instanceof F))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let s=t.state.tr;return e<0?s.delete(n.pos-o.nodeSize,n.pos):s.delete(n.pos,n.pos+o.nodeSize),t.dispatch(s),!0}return!1}function Mu(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Dh(t){if(!de||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Mu(t,r,"true"),setTimeout(()=>Mu(t,r,"false"),20)}return!1}function Ah(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Mh(t,e){let n=e.keyCode,r=Ah(e);if(n==8||Oe&&n==72&&r=="c")return Au(t,-1)||hn(t,-1);if(n==46&&!e.shiftKey||Oe&&n==68&&r=="c")return Au(t,1)||hn(t,1);if(n==13||n==27)return!0;if(n==37||Oe&&n==66&&r=="c"){let i=n==37?Su(t,t.state.selection.from)=="ltr"?-1:1:-1;return Eu(t,i,r)||hn(t,i)}else if(n==39||Oe&&n==70&&r=="c"){let i=n==39?Su(t,t.state.selection.from)=="ltr"?1:-1:1;return Eu(t,i,r)||hn(t,i)}else{if(n==38||Oe&&n==80&&r=="c")return Du(t,-1,r)||hn(t,-1);if(n==40||Oe&&n==78&&r=="c")return Dh(t)||Du(t,1,r)||hn(t,1);if(r==(Oe?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function ls(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let s=t.someProp("clipboardSerializer")||sn.fromSchema(t.state.schema),u=Ul(),a=u.createElement("div");a.appendChild(s.serializeFragment(r,{document:u}));let l=a.firstChild,c,f=0;for(;l&&l.nodeType==1&&(c=Wl[l.nodeName.toLowerCase()]);){for(let h=c.length-1;h>=0;h--){let p=u.createElement(c[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),f++}l=a.firstChild}l&&l.nodeType==1&&l.setAttribute("data-pm-slice",`${i} ${o}${f?` -${f}`:""} ${JSON.stringify(n)}`);let d=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
`);return{dom:a,text:d,slice:e}}function Vl(t,e,n,r,i){let o=i.parent.type.spec.code,s,u;if(!n&&!e)return null;let a=!!e&&(r||o||!n);if(a){if(t.someProp("transformPastedText",d=>{e=d(e,o||r,t)}),o)return u=new D(w.from(t.state.schema.text(e.replace(/\r\n?/g,`
`))),0,0),t.someProp("transformPasted",d=>{u=d(u,t,!0)}),u;let f=t.someProp("clipboardTextParser",d=>d(e,i,r,t));if(f)u=f;else{let d=i.marks(),{schema:h}=t.state,p=sn.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=s.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(h.text(m,d)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),s=Nh(n),yr&&Fh(s);let l=s&&s.querySelector("[data-pm-slice]"),c=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let f=+c[3];f>0;f--){let d=s.firstChild;for(;d&&d.nodeType!=1;)d=d.nextSibling;if(!d)break;s=d}if(u||(u=(t.someProp("clipboardParser")||t.someProp("domParser")||dt.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||c),context:i,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!Th.test(d.parentNode.nodeName)?{ignore:!0}:null}})),c)u=Ih(Tu(u,+c[1],+c[2]),c[4]);else if(u=D.maxOpen(_h(u.content,i),!0),u.openStart||u.openEnd){let f=0,d=0;for(let h=u.content.firstChild;f<u.openStart&&!h.type.spec.isolating;f++,h=h.firstChild);for(let h=u.content.lastChild;d<u.openEnd&&!h.type.spec.isolating;d++,h=h.lastChild);u=Tu(u,f,d)}return t.someProp("transformPasted",f=>{u=f(u,t,a)}),u}const Th=/^(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 _h(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),o,s=[];if(t.forEach(u=>{if(!s)return;let a=i.findWrapping(u.type),l;if(!a)return s=null;if(l=s.length&&o.length&&ql(a,o,u,s[s.length-1],0))s[s.length-1]=l;else{s.length&&(s[s.length-1]=jl(s[s.length-1],o.length));let c=Hl(u,a);s.push(c),i=i.matchType(c.type),o=a}}),s)return w.from(s)}return t}function Hl(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,w.from(t));return t}function ql(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let o=ql(t,e,n,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(w.from(Hl(n,t,i+1))))}}function jl(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,jl(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(w.empty,!0);return t.copy(n.append(r))}function $o(t,e,n,r,i,o){let s=e<0?t.firstChild:t.lastChild,u=s.content;return t.childCount>1&&(o=0),i<r-1&&(u=$o(u,e,n,r,i+1,o)),i>=n&&(u=e<0?s.contentMatchAt(0).fillBefore(u,o<=i).append(u):u.append(s.contentMatchAt(s.childCount).fillBefore(w.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(u))}function Tu(t,e,n){return e<t.openStart&&(t=new D($o(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new D($o(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Wl={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 _u=null;function Ul(){return _u||(_u=document.implementation.createHTMLDocument("title"))}let eo=null;function Oh(t){let e=window.trustedTypes;return e?(eo||(eo=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),eo.createHTML(t)):t}function Nh(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Ul().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&Wl[r[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"</"+o+">").reverse().join("")),n.innerHTML=Oh(t),i)for(let o=0;o<i.length;o++)n=n.querySelector(i[o])||n;return n}function Fh(t){let e=t.querySelectorAll(ee?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function Ih(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:o,openEnd:s}=t;for(let u=r.length-2;u>=0;u-=2){let a=n.nodes[r[u]];if(!a||a.hasRequiredAttrs())break;i=w.from(a.create(r[u+1],i)),o++,s++}return new D(i,o,s)}const me={},ge={},Rh={touchstart:!0,touchmove:!0};class Bh{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},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 Ph(t){for(let e in me){let n=me[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{zh(t,r)&&!cs(t,r)&&(t.editable||!(r.type in ge))&&n(t,r)},Rh[e]?{passive:!0}:void 0)}de&&t.dom.addEventListener("input",()=>null),Vo(t)}function At(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Lh(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Vo(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>cs(t,r))})}function cs(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function zh(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function $h(t,e){!cs(t,e)&&me[e.type]&&(t.editable||!(e.type in ge))&&me[e.type](t,e)}ge.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Kl(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(ct&&ee&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Sn&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,jt(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||Mh(t,n)?n.preventDefault():At(t,"key")};ge.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};ge.keypress=(t,e)=>{let n=e;if(Kl(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Oe&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof F)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),o=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,i,o))&&t.dispatch(o()),n.preventDefault()}};function Ai(t){return{left:t.clientX,top:t.clientY}}function Vh(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function fs(t,e,n,r,i){if(r==-1)return!1;let o=t.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(t.someProp(e,u=>s>o.depth?u(t,n,o.nodeAfter,o.before(s),i,!0):u(t,n,o.node(s),o.before(s),i,!1)))return!0;return!1}function Cn(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function Hh(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&_.isSelectable(r)?(Cn(t,new _(n)),!0):!1}function qh(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof _&&(r=n.node);let o=t.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let u=s>o.depth?o.nodeAfter:o.node(s);if(_.isSelectable(u)){r&&n.$from.depth>0&&s>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(s);break}}return i!=null?(Cn(t,_.create(t.state.doc,i)),!0):!1}function jh(t,e,n,r,i){return fs(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?qh(t,n):Hh(t,n))}function Wh(t,e,n,r){return fs(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function Uh(t,e,n,r){return fs(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||Jh(t,n,r)}function Jh(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Cn(t,F.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),u=i.before(o);if(s.inlineContent)Cn(t,F.create(r,u+1,u+1+s.content.size));else if(_.isSelectable(s))Cn(t,_.create(r,u));else continue;return!0}}function ds(t){return ai(t)}const Jl=Oe?"metaKey":"ctrlKey";me.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=ds(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&Vh(n,t.input.lastClick)&&!n[Jl]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o,button:n.button};let s=t.posAtCoords(Ai(n));s&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Kh(t,s,n,!!r)):(o=="doubleClick"?Wh:Uh)(t,s.pos,s.inside,n)?n.preventDefault():At(t,"pointer"))};class Kh{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Jl],this.allowDefault=r.shiftKey;let o,s;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),s=n.inside;else{let c=e.state.doc.resolve(n.pos);o=c.parent,s=c.depth?c.before():0}const u=i?null:r.target,a=u?e.docView.nearestDesc(u,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:l}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||l instanceof _&&l.from<=s&&l.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Fe&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),At(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>pt(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Ai(e))),this.updateAllowDefault(e),this.allowDefault||!n?At(this.view,"pointer"):jh(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||de&&this.mightDrag&&!this.mightDrag.node.isAtom||ee&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Cn(this.view,I.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):At(this.view,"pointer")}move(e){this.updateAllowDefault(e),At(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}me.touchstart=t=>{t.input.lastTouch=Date.now(),ds(t),At(t,"pointer")};me.touchmove=t=>{t.input.lastTouch=Date.now(),At(t,"pointer")};me.contextmenu=t=>ds(t);function Kl(t,e){return t.composing?!0:de&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Gh=ct?5e3:-1;ge.compositionstart=ge.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof F&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ee&&Sl&&Zh(t)))t.markCursor=t.state.storedMarks||n.marks(),ai(t,!0),t.markCursor=null;else if(ai(t,!e.selection.empty),Fe&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let u=t.domSelection();u&&u.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}t.input.composing=!0}Gl(t,Gh)};function Zh(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}ge.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Gl(t,20))};function Gl(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>ai(t),e))}function Zl(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Xh());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Yh(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=qd(e.focusNode,e.focusOffset),r=jd(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function Xh(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function ai(t,e=!1){if(!(ct&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Zl(t),e||t.docView&&t.docView.dirty){let n=us(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function Qh(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const or=ye&&_t<15||Sn&&Kd<604;me.copy=ge.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let o=or?null:n.clipboardData,s=r.content(),{dom:u,text:a}=ls(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",u.innerHTML),o.setData("text/plain",a)):Qh(t,u),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function ep(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function tp(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?sr(t,r.value,null,i,e):sr(t,r.textContent,r.innerHTML,i,e)},50)}function sr(t,e,n,r,i){let o=Vl(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,i,o||D.empty)))return!0;if(!o)return!1;let s=ep(o),u=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(o);return t.dispatch(u.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Yl(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}ge.paste=(t,e)=>{let n=e;if(t.composing&&!ct)return;let r=or?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&sr(t,Yl(r),r.getData("text/html"),i,n)?n.preventDefault():tp(t,n)};class Xl{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const np=Oe?"altKey":"ctrlKey";function Ql(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[np]}me.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,o=i.empty?null:t.posAtCoords(Ai(n)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof _?i.to-1:i.to))){if(r&&r.mightDrag)s=_.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(s=_.create(t.state.doc,f.posBefore))}}let u=(s||t.state.selection).content(),{dom:a,text:l,slice:c}=ls(t,u);(!n.dataTransfer.files.length||!ee||El>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(or?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",or||n.dataTransfer.setData("text/plain",l),t.dragging=new Xl(c,Ql(t,n),s)};me.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};ge.dragover=ge.dragenter=(t,e)=>e.preventDefault();ge.drop=(t,e)=>{try{rp(t,e,t.dragging)}finally{t.dragging=null}};function rp(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Ai(e));if(!r)return;let i=t.state.doc.resolve(r.pos),o=n&&n.slice;o?t.someProp("transformPasted",h=>{o=h(o,t,!1)}):o=Vl(t,Yl(e.dataTransfer),or?null:e.dataTransfer.getData("text/html"),!1,i);let s=!!(n&&Ql(t,e));if(t.someProp("handleDrop",h=>h(t,e,o||D.empty,s))){e.preventDefault();return}if(!o)return;e.preventDefault();let u=o?gl(t.state.doc,i.pos,o):i.pos;u==null&&(u=i.pos);let a=t.state.tr;if(s){let{node:h}=n;h?h.replace(a):a.deleteSelection()}let l=a.mapping.map(u),c=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,f=a.doc;if(c?a.replaceRangeWith(l,l,o.content.firstChild):a.replaceRange(l,l,o),a.doc.eq(f))return;let d=a.doc.resolve(l);if(c&&_.isSelectable(o.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(o.content.firstChild))a.setSelection(new _(d));else{let h=a.mapping.map(u);a.mapping.maps[a.mapping.maps.length-1].forEach((p,m,g,y)=>h=y),a.setSelection(as(t,d,a.doc.resolve(h)))}t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}me.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&pt(t)},20))};me.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};me.beforeinput=(t,e)=>{if(ee&&ct&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",o=>o(t,jt(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in ge)me[t]=ge[t];function ur(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class li{constructor(e,n){this.toDOM=e,this.spec=n||Zt,this.side=this.spec.side||0}map(e,n,r,i){let{pos:o,deleted:s}=e.mapResult(n.from+i,this.side<0?-1:1);return s?null:new Se(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof li&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ur(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Nt{constructor(e,n){this.attrs=e,this.spec=n||Zt}map(e,n,r,i){let o=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new Se(o,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Nt&&ur(this.attrs,e.attrs)&&ur(this.spec,e.spec)}static is(e){return e.type instanceof Nt}destroy(){}}class hs{constructor(e,n){this.attrs=e,this.spec=n||Zt}map(e,n,r,i){let o=e.mapResult(n.from+i,1);if(o.deleted)return null;let s=e.mapResult(n.to+i,-1);return s.deleted||s.pos<=o.pos?null:new Se(o.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),o;return i==n.from&&!(o=e.child(r)).isText&&i+o.nodeSize==n.to}eq(e){return this==e||e instanceof hs&&ur(this.attrs,e.attrs)&&ur(this.spec,e.spec)}destroy(){}}class Se{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Se(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Se(e,e,new li(n,r))}static inline(e,n,r,i){return new Se(e,n,new Nt(r,i))}static node(e,n,r,i){return new Se(e,n,new hs(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Nt}get widget(){return this.type instanceof li}}const gn=[],Zt={};class J{constructor(e,n){this.local=e.length?e:gn,this.children=n.length?n:gn}static create(e,n){return n.length?ci(n,e,0,Zt):fe}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,o){for(let s=0;s<this.local.length;s++){let u=this.local[s];u.from<=n&&u.to>=e&&(!o||o(u.spec))&&r.push(u.copy(u.from+i,u.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let u=this.children[s]+1;this.children[s+2].findInner(e-u,n-u,r,i+u,o)}}map(e,n,r){return this==fe||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Zt)}mapInner(e,n,r,i,o){let s;for(let u=0;u<this.local.length;u++){let a=this.local[u].map(e,r,i);a&&a.type.valid(n,a)?(s||(s=[])).push(a):o.onRemove&&o.onRemove(this.local[u].spec)}return this.children.length?ip(this.children,s||[],e,n,r,i,o):s?new J(s.sort(Yt),gn):fe}add(e,n){return n.length?this==fe?J.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,o=0;e.forEach((u,a)=>{let l=a+r,c;if(c=tc(n,u,l)){for(i||(i=this.children.slice());o<i.length&&i[o]<a;)o+=3;i[o]==a?i[o+2]=i[o+2].addInner(u,c,l+1):i.splice(o,0,a,a+u.nodeSize,ci(c,u,l+1,Zt)),o+=3}});let s=ec(o?nc(n):n,-r);for(let u=0;u<s.length;u++)s[u].type.valid(e,s[u])||s.splice(u--,1);return new J(s.length?this.local.concat(s).sort(Yt):this.local,i||this.children)}remove(e){return e.length==0||this==fe?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,u=r[o]+n,a=r[o+1]+n;for(let c=0,f;c<e.length;c++)(f=e[c])&&f.from>u&&f.to<a&&(e[c]=null,(s||(s=[])).push(f));if(!s)continue;r==this.children&&(r=this.children.slice());let l=r[o+2].removeInner(s,u+1);l!=fe?r[o+2]=l:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,s;o<e.length;o++)if(s=e[o])for(let u=0;u<i.length;u++)i[u].eq(s,n)&&(i==this.local&&(i=this.local.slice()),i.splice(u--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new J(i,r):fe}forChild(e,n){if(this==fe)return this;if(n.isLeaf)return J.empty;let r,i;for(let u=0;u<this.children.length;u+=3)if(this.children[u]>=e){this.children[u]==e&&(r=this.children[u+2]);break}let o=e+1,s=o+n.content.size;for(let u=0;u<this.local.length;u++){let a=this.local[u];if(a.from<s&&a.to>o&&a.type instanceof Nt){let l=Math.max(o,a.from)-o,c=Math.min(s,a.to)-o;l<c&&(i||(i=[])).push(a.copy(l,c))}}if(i){let u=new J(i.sort(Yt),gn);return r?new wt([u,r]):u}return r||fe}eq(e){if(this==e)return!0;if(!(e instanceof J)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return ps(this.localsInner(e))}localsInner(e){if(this==fe)return gn;if(e.inlineContent||!this.local.some(Nt.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Nt||n.push(this.local[r]);return n}forEachSet(e){e(this)}}J.empty=new J([],[]);J.removeOverlap=ps;const fe=J.empty;class wt{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Zt));return wt.from(r)}forChild(e,n){if(n.isLeaf)return J.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,n);o!=fe&&(o instanceof wt?r=r.concat(o.members):r.push(o))}return wt.from(r)}eq(e){if(!(e instanceof wt)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!n)n=o;else{r&&(n=n.slice(),r=!1);for(let s=0;s<o.length;s++)n.push(o[s])}}return n?ps(r?n:n.sort(Yt)):gn}static from(e){switch(e.length){case 0:return fe;case 1:return e[0];default:return new wt(e.every(n=>n instanceof J)?e:e.reduce((n,r)=>n.concat(r instanceof J?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function ip(t,e,n,r,i,o,s){let u=t.slice();for(let l=0,c=o;l<n.maps.length;l++){let f=0;n.maps[l].forEach((d,h,p,m)=>{let g=m-p-(h-d);for(let y=0;y<u.length;y+=3){let x=u[y+1];if(x<0||d>x+c-f)continue;let k=u[y]+c-f;h>=k?u[y+1]=d<=k?-2:-1:d>=c&&g&&(u[y]+=g,u[y+1]+=g)}f+=g}),c=n.maps[l].map(c,-1)}let a=!1;for(let l=0;l<u.length;l+=3)if(u[l+1]<0){if(u[l+1]==-2){a=!0,u[l+1]=-1;continue}let c=n.map(t[l]+o),f=c-i;if(f<0||f>=r.content.size){a=!0;continue}let d=n.map(t[l+1]+o,-1),h=d-i,{index:p,offset:m}=r.content.findIndex(f),g=r.maybeChild(p);if(g&&m==f&&m+g.nodeSize==h){let y=u[l+2].mapInner(n,g,c+1,t[l]+o+1,s);y!=fe?(u[l]=f,u[l+1]=h,u[l+2]=y):(u[l+1]=-2,a=!0)}else a=!0}if(a){let l=op(u,t,e,n,i,o,s),c=ci(l,r,0,s);e=c.local;for(let f=0;f<u.length;f+=3)u[f+1]<0&&(u.splice(f,3),f-=3);for(let f=0,d=0;f<c.children.length;f+=3){let h=c.children[f];for(;d<u.length&&u[d]<h;)d+=3;u.splice(d,0,c.children[f],c.children[f+1],c.children[f+2])}}return new J(e.sort(Yt),u)}function ec(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new Se(i.from+e,i.to+e,i.type))}return n}function op(t,e,n,r,i,o,s){function u(a,l){for(let c=0;c<a.local.length;c++){let f=a.local[c].map(r,i,l);f?n.push(f):s.onRemove&&s.onRemove(a.local[c].spec)}for(let c=0;c<a.children.length;c+=3)u(a.children[c+2],a.children[c]+l+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&u(t[a+2],e[a]+o+1);return n}function tc(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let o=0,s;o<t.length;o++)(s=t[o])&&s.from>n&&s.to<r&&((i||(i=[])).push(s),t[o]=null);return i}function nc(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function ci(t,e,n,r){let i=[],o=!1;e.forEach((u,a)=>{let l=tc(t,u,a+n);if(l){o=!0;let c=ci(l,u,n+a+1,r);c!=fe&&i.push(a,a+u.nodeSize,c)}});let s=ec(o?nc(t):t,-n).sort(Yt);for(let u=0;u<s.length;u++)s[u].type.valid(e,s[u])||(r.onRemove&&r.onRemove(s[u].spec),s.splice(u--,1));return s.length||i.length?new J(s,i):fe}function Yt(t,e){return t.from-e.from||t.to-e.to}function ps(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==t&&(e=t.slice()),e[i]=o.copy(o.from,r.to),Ou(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,o.from),Ou(e,i,r.copy(o.from,r.to)));break}}}return e}function Ou(t,e,n){for(;e<t.length&&Yt(n,t[e])>0;)e++;t.splice(e,0,n)}function to(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=fe&&e.push(r)}),t.cursorWrapper&&e.push(J.create(t.state.doc,[t.cursorWrapper.deco])),wt.from(e)}const sp={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},up=ye&&_t<=11;class ap{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class lp{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ap,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);ye&&_t<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),up&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,sp)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);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(wu(this.view)){if(this.suppressingSelectionUpdates)return pt(this.view);if(ye&&_t<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&nn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let o=e.focusNode;o;o=En(o))n.add(o);for(let o=e.anchorNode;o;o=En(o))if(n.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&wu(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,u=!1,a=[];if(e.editable)for(let c=0;c<n.length;c++){let f=this.registerMutation(n[c],a);f&&(o=o<0?f.from:Math.min(f.from,o),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(u=!0))}if(Fe&&a.length){let c=a.filter(f=>f.nodeName=="BR");if(c.length==2){let[f,d]=c;f.parentNode&&f.parentNode.parentNode==d.parentNode?d.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let d of c){let h=d.parentNode;h&&h.nodeName=="LI"&&(!f||dp(e,f)!=h)&&d.remove()}}}else if((ee||de)&&a.some(c=>c.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let c of a)if(c.nodeName=="BR"&&c.parentNode){let f=c.nextSibling;f&&f.nodeType==1&&f.contentEditable=="false"&&c.parentNode.removeChild(c)}}let l=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Si(r)&&(l=us(e))&&l.eq(I.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,pt(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),cp(e)),this.handleDOMChange(o,s,u,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||pt(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let c=0;c<e.addedNodes.length;c++){let f=e.addedNodes[c];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,o=e.nextSibling;if(ye&&_t<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:f,nextSibling:d}=e.addedNodes[c];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f),(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(o=d)}let s=i&&i.parentNode==e.target?se(i)+1:0,u=r.localPosFromDOM(e.target,s,-1),a=o&&o.parentNode==e.target?se(o):e.target.childNodes.length,l=r.localPosFromDOM(e.target,a,1);return{from:u,to:l}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Nu=new WeakMap,Fu=!1;function cp(t){if(!Nu.has(t)&&(Nu.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Fe,Fu)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."),Fu=!0}}function Iu(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return nn(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function fp(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Iu(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Iu(t,n):null}function dp(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function hp(t,e,n){let{node:r,fromOffset:i,toOffset:o,from:s,to:u}=t.docView.parseRange(e,n),a=t.domSelectionRange(),l,c=a.anchorNode;if(c&&t.dom.contains(c.nodeType==1?c:c.parentNode)&&(l=[{node:c,offset:a.anchorOffset}],Si(a)||l.push({node:a.focusNode,offset:a.focusOffset})),ee&&t.input.lastKeyCode===8)for(let g=o;g>i;g--){let y=r.childNodes[g-1],x=y.pmViewDesc;if(y.nodeName=="BR"&&!x){o=g;break}if(!x||x.size)break}let f=t.state.doc,d=t.someProp("domParser")||dt.fromSchema(t.state.schema),h=f.resolve(s),p=null,m=d.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:o,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:l,ruleFromNode:pp,context:h});if(l&&l[0].pos!=null){let g=l[0].pos,y=l[1]&&l[1].pos;y==null&&(y=g),p={anchor:g+s,head:y+s}}return{doc:m,sel:p,from:s,to:u}}function pp(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(de&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||de&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const mp=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function gp(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let S=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,M=us(t,S);if(M&&!t.state.selection.eq(M)){if(ee&&ct&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",P=>P(t,jt(13,"Enter"))))return;let O=t.state.tr.setSelection(M);S=="pointer"?O.setMeta("pointer",!0):S=="key"&&O.scrollIntoView(),o&&O.setMeta("composition",o),t.dispatch(O)}return}let s=t.state.doc.resolve(e),u=s.sharedDepth(n);e=s.before(u+1),n=t.state.doc.resolve(n).after(u+1);let a=t.state.selection,l=hp(t,e,n),c=t.state.doc,f=c.slice(l.from,l.to),d,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(d=t.state.selection.to,h="end"):(d=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let p=xp(f.content,l.doc.content,l.from,d,h);if(p&&t.input.domChangeCount++,(Sn&&t.input.lastIOSEnter>Date.now()-225||ct)&&i.some(S=>S.nodeType==1&&!mp.test(S.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",S=>S(t,jt(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof F&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(l.sel){let S=Ru(t,t.state.doc,l.sel);if(S&&!S.eq(t.state.selection)){let M=t.state.tr.setSelection(S);o&&M.setMeta("composition",o),t.dispatch(M)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof F&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=l.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=l.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),ye&&_t<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>l.from&&l.doc.textBetween(p.start-l.from-1,p.start-l.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=l.doc.resolveNoCache(p.start-l.from),g=l.doc.resolveNoCache(p.endB-l.from),y=c.resolve(p.start),x=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=p.endA;if((Sn&&t.input.lastIOSEnter>Date.now()-225&&(!x||i.some(S=>S.nodeName=="DIV"||S.nodeName=="P"))||!x&&m.pos<l.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(l.doc.textBetween(m.pos,g.pos,"","")))&&t.someProp("handleKeyDown",S=>S(t,jt(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&yp(c,p.start,p.endA,m,g)&&t.someProp("handleKeyDown",S=>S(t,jt(8,"Backspace")))){ct&&ee&&t.domObserver.suppressSelectionUpdates();return}ee&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),ct&&!x&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==p.endA&&(p.endB-=2,g=l.doc.resolveNoCache(p.endB-l.from),setTimeout(()=>{t.someProp("handleKeyDown",function(S){return S(t,jt(13,"Enter"))})},20));let k=p.start,b=p.endA,E=S=>{let M=S||t.state.tr.replace(k,b,l.doc.slice(p.start-l.from,p.endB-l.from));if(l.sel){let O=Ru(t,M.doc,l.sel);O&&!(ee&&t.composing&&O.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(O.head==k||O.head==M.mapping.map(b)-1)||ye&&O.empty&&O.head==k)&&M.setSelection(O)}return o&&M.setMeta("composition",o),M.scrollIntoView()},C;if(x)if(m.pos==g.pos){ye&&_t<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>pt(t),20));let S=E(t.state.tr.delete(k,b)),M=c.resolve(p.start).marksAcross(c.resolve(p.endA));M&&S.ensureMarks(M),t.dispatch(S)}else if(p.endA==p.endB&&(C=bp(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start())))){let S=E(t.state.tr);C.type=="add"?S.addMark(k,b,C.mark):S.removeMark(k,b,C.mark),t.dispatch(S)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let S=m.parent.textBetween(m.parentOffset,g.parentOffset),M=()=>E(t.state.tr.insertText(S,k,b));t.someProp("handleTextInput",O=>O(t,k,b,S,M))||t.dispatch(M())}else t.dispatch(E());else t.dispatch(E())}function Ru(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:as(t,e.resolve(n.anchor),e.resolve(n.head))}function bp(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,o=r,s,u,a;for(let c=0;c<r.length;c++)i=r[c].removeFromSet(i);for(let c=0;c<n.length;c++)o=n[c].removeFromSet(o);if(i.length==1&&o.length==0)u=i[0],s="add",a=c=>c.mark(u.addToSet(c.marks));else if(i.length==0&&o.length==1)u=o[0],s="remove",a=c=>c.mark(u.removeFromSet(c.marks));else return null;let l=[];for(let c=0;c<e.childCount;c++)l.push(a(e.child(c)));if(w.from(l).eq(t))return{mark:u,type:s}}function yp(t,e,n,r,i){if(n-e<=i.pos-r.pos||no(r,!0,!1)<i.pos)return!1;let o=t.resolve(e);if(!r.parent.isTextblock){let u=o.nodeAfter;return u!=null&&n==e+u.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=t.resolve(no(o,!0,!0));return!s.parent.isTextblock||s.pos>n||no(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function no(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let o=t.node(r).maybeChild(t.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function xp(t,e,n,r,i){let o=t.findDiffStart(e,n);if(o==null)return null;let{a:s,b:u}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let a=Math.max(0,o-Math.min(s,u));r-=s+a-o}if(s<o&&t.size<e.size){let a=r<=o&&r>=s?o-r:0;o-=a,o&&o<e.size&&Bu(e.textBetween(o-1,o+1))&&(o+=a?1:-1),u=o+(u-s),s=o}else if(u<o){let a=r<=o&&r>=u?o-r:0;o-=a,o&&o<t.size&&Bu(t.textBetween(o-1,o+1))&&(o+=a?1:-1),s=o+(s-u),u=o}return{start:o,endA:s,endB:u}}function Bu(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class rc{constructor(e,n){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 Bh,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Vu),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=zu(this),Lu(this),this.nodeViews=$u(this),this.docView=bu(this.state.doc,Pu(this),to(this),this.dom,this),this.domObserver=new lp(this,(r,i,o,s)=>gp(this,r,i,o,s)),this.domObserver.start(),Ph(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Vo(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Vu),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(Zl(this),s=!0),this.state=e;let u=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(u||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=$u(this);Cp(h,this.nodeViews)&&(this.nodeViews=h,o=!0)}(u||n.handleDOMEvents!=this._props.handleDOMEvents)&&Vo(this),this.editable=zu(this),Lu(this);let a=to(this),l=Pu(this),c=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=o||!this.docView.matchesNode(e.doc,l,a);(f||!e.selection.eq(i.selection))&&(s=!0);let d=c=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Yd(this);if(s){this.domObserver.stop();let h=f&&(ye||ee)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&kp(i.selection,e.selection);if(f){let p=ee?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Yh(this)),(o||!this.docView.update(e.doc,l,a,this))&&(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=bu(e.doc,l,a,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Ch(this))?pt(this,h):(Ll(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():d&&Xd(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof _){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&fu(this,n.getBoundingClientRect(),e)}else fu(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let o=r.from+(this.state.doc.content.size-n.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new Xl(e.slice,e.move,i<0?void 0:_.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let s=0;s<this.directPlugins.length;s++){let u=this.directPlugins[s].props[e];if(u!=null&&(i=n?n(u):u))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let u=o[s].props[e];if(u!=null&&(i=n?n(u):u))return i}}hasFocus(){if(ye){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Qd(this.dom),pt(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return ih(this,e)}coordsAtPos(e,n=1){return _l(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return lh(this,n||this.state,e)}pasteHTML(e,n){return sr(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return sr(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return ls(this,e)}destroy(){this.docView&&(Lh(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],to(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Vd())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return $h(this,e)}domSelectionRange(){let e=this.domSelection();return e?de&&this.root.nodeType===11&&Ud(this.dom.ownerDocument)==this.dom&&fp(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}rc.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Pu(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Se.node(0,t.state.doc.content.size,e)]}function Lu(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Se.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function zu(t){return!t.someProp("editable",e=>e(t.state)===!1)}function kp(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function $u(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Cp(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function Vu(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Ft={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:"'"},fi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},vp=typeof navigator<"u"&&/Mac/.test(navigator.platform),wp=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ue=0;ue<10;ue++)Ft[48+ue]=Ft[96+ue]=String(ue);for(var ue=1;ue<=24;ue++)Ft[ue+111]="F"+ue;for(var ue=65;ue<=90;ue++)Ft[ue]=String.fromCharCode(ue+32),fi[ue]=String.fromCharCode(ue);for(var ro in Ft)fi.hasOwnProperty(ro)||(fi[ro]=Ft[ro]);function Ep(t){var e=vp&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||wp&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?fi:Ft)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const Sp=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Dp=typeof navigator<"u"&&/Win/.test(navigator.platform);function Ap(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,o,s;for(let u=0;u<e.length-1;u++){let a=e[u];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))o=!0;else if(/^mod$/i.test(a))Sp?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),s&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function Mp(t){let e=Object.create(null);for(let n in t)e[Ap(n)]=t[n];return e}function io(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function Tp(t){return new ae({props:{handleKeyDown:ic(t)}})}function ic(t){let e=Mp(t);return function(n,r){let i=Ep(r),o,s=e[io(i,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let u=e[io(i,r,!1)];if(u&&u(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Dp&&r.ctrlKey&&r.altKey)&&(o=Ft[r.keyCode])&&o!=i){let u=e[io(o,r)];if(u&&u(n.state,n.dispatch,n))return!0}}return!1}}const ms=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function oc(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const sc=(t,e,n)=>{let r=oc(t,n);if(!r)return!1;let i=gs(r);if(!i){let s=r.blockRange(),u=s&&Rn(s);return u==null?!1:(e&&e(t.tr.lift(s,u).scrollIntoView()),!0)}let o=i.nodeBefore;if(mc(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Dn(o,"end")||_.isSelectable(o)))for(let s=r.depth;;s--){let u=wi(t.doc,r.before(s),r.after(s),D.empty);if(u&&u.slice.size<u.to-u.from){if(e){let a=t.tr.step(u);a.setSelection(Dn(o,"end")?I.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):_.create(a.doc,i.pos-o.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},_p=(t,e,n)=>{let r=oc(t,n);if(!r)return!1;let i=gs(r);return i?uc(t,i,e):!1},Op=(t,e,n)=>{let r=lc(t,n);if(!r)return!1;let i=bs(r);return i?uc(t,i,e):!1};function uc(t,e,n){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let c=i.lastChild;if(!c)return!1;i=c}let s=e.nodeAfter,u=s,a=e.pos+1;for(;!u.isTextblock;a++){if(u.type.spec.isolating)return!1;let c=u.firstChild;if(!c)return!1;u=c}let l=wi(t.doc,o,a,D.empty);if(!l||l.from!=o||l instanceof X&&l.slice.size>=a-o)return!1;if(n){let c=t.tr.step(l);c.setSelection(F.create(c.doc,o)),n(c.scrollIntoView())}return!0}function Dn(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const ac=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;o=gs(r)}let s=o&&o.nodeBefore;return!s||!_.isSelectable(s)?!1:(e&&e(t.tr.setSelection(_.create(t.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function gs(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function lc(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const cc=(t,e,n)=>{let r=lc(t,n);if(!r)return!1;let i=bs(r);if(!i)return!1;let o=i.nodeAfter;if(mc(t,i,e,1))return!0;if(r.parent.content.size==0&&(Dn(o,"start")||_.isSelectable(o))){let s=wi(t.doc,r.before(),r.after(),D.empty);if(s&&s.slice.size<s.to-s.from){if(e){let u=t.tr.step(s);u.setSelection(Dn(o,"start")?I.findFrom(u.doc.resolve(u.mapping.map(i.pos)),1):_.create(u.doc,u.mapping.map(i.pos))),e(u.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},fc=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;o=bs(r)}let s=o&&o.nodeAfter;return!s||!_.isSelectable(s)?!1:(e&&e(t.tr.setSelection(_.create(t.doc,o.pos)).scrollIntoView()),!0)};function bs(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const Np=(t,e)=>{let n=t.selection,r=n instanceof _,i;if(r){if(n.node.isTextblock||!Rt(t.doc,n.from))return!1;i=n.from}else if(i=vi(t.doc,n.from,-1),i==null)return!1;if(e){let o=t.tr.join(i);r&&o.setSelection(_.create(o.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},Fp=(t,e)=>{let n=t.selection,r;if(n instanceof _){if(n.node.isTextblock||!Rt(t.doc,n.to))return!1;r=n.to}else if(r=vi(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Ip=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),o=i&&Rn(i);return o==null?!1:(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)},dc=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
`).scrollIntoView()),!0)};function ys(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Rp=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=ys(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let u=n.after(),a=t.tr.replaceWith(u,u,s.createAndFill());a.setSelection(I.near(a.doc.resolve(u),1)),e(a.scrollIntoView())}return!0},hc=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof De||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=ys(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,u=t.tr.insert(s,o.createAndFill());u.setSelection(F.create(u.doc,s+1)),e(u.scrollIntoView())}return!0},pc=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(ht(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Rn(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function Bp(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof _&&e.selection.node.isBlock)return!r.parentOffset||!ht(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],s,u,a=!1,l=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){a=r.end(h)==r.pos+(r.depth-h),l=r.start(h)==r.pos-(r.depth-h),u=ys(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),o.unshift(a&&u?{type:u}:null),s=h;break}else{if(h==1)return!1;o.unshift(null)}let c=e.tr;(e.selection instanceof F||e.selection instanceof De)&&c.deleteSelection();let f=c.mapping.map(r.pos),d=ht(c.doc,f,o.length,o);if(d||(o[0]=u?{type:u}:null,d=ht(c.doc,f,o.length,o)),!d)return!1;if(c.split(f,o.length,o),!a&&l&&r.node(s).type!=u){let h=c.mapping.map(r.before(s)),p=c.doc.resolve(h);u&&r.node(s-1).canReplaceWith(p.index(),p.index()+1,u)&&c.setNodeMarkup(c.mapping.map(r.before(s)),u)}return n&&n(c.scrollIntoView()),!0}}const Pp=Bp(),Lp=(t,e)=>{let{$from:n,to:r}=t.selection,i,o=n.sharedDepth(r);return o==0?!1:(i=n.before(o),e&&e(t.tr.setSelection(_.create(t.doc,i))),!0)};function zp(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||Rt(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function mc(t,e,n,r){let i=e.nodeBefore,o=e.nodeAfter,s,u,a=i.type.spec.isolating||o.type.spec.isolating;if(!a&&zp(t,e,n))return!0;let l=!a&&e.parent.canReplace(e.index(),e.index()+1);if(l&&(s=(u=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&u.matchType(s[0]||o.type).validEnd){if(n){let h=e.pos+o.nodeSize,p=w.empty;for(let y=s.length-1;y>=0;y--)p=w.from(s[y].create(null,p));p=w.from(i.copy(p));let m=t.tr.step(new te(e.pos-1,h,e.pos,h,new D(p,1,0),s.length,!0)),g=m.doc.resolve(h+2*s.length);g.nodeAfter&&g.nodeAfter.type==i.type&&Rt(m.doc,g.pos)&&m.join(g.pos),n(m.scrollIntoView())}return!0}let c=o.type.spec.isolating||r>0&&a?null:I.findFrom(e,1),f=c&&c.$from.blockRange(c.$to),d=f&&Rn(f);if(d!=null&&d>=e.depth)return n&&n(t.tr.lift(f,d).scrollIntoView()),!0;if(l&&Dn(o,"start",!0)&&Dn(i,"end")){let h=i,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=o,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(n){let y=w.empty;for(let k=p.length-1;k>=0;k--)y=w.from(p[k].copy(y));let x=t.tr.step(new te(e.pos-p.length,e.pos+o.nodeSize,e.pos+g,e.pos+o.nodeSize-g,new D(y,p.length,0),0,!0));n(x.scrollIntoView())}return!0}}return!1}function gc(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(n&&n(e.tr.setSelection(F.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}const $p=gc(-1),Vp=gc(1);function Hp(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),u=s&&rs(s,t,e);return u?(r&&r(n.tr.wrap(s,u).scrollIntoView()),!0):!1}}function Hu(t,e=null){return function(n,r){let i=!1;for(let o=0;o<n.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:u}}=n.selection.ranges[o];n.doc.nodesBetween(s,u,(a,l)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)i=!0;else{let c=n.doc.resolve(l),f=c.index();i=c.parent.canReplaceWith(f,f+1,t)}})}if(!i)return!1;if(r){let o=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:u},$to:{pos:a}}=n.selection.ranges[s];o.setBlockType(u,a,t,e)}r(o.scrollIntoView())}return!0}}function xs(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}xs(ms,sc,ac);xs(ms,cc,fc);xs(dc,hc,pc,Pp);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function qp(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o);if(!s)return!1;let u=r?n.tr:null;return jp(u,s,t,e)?(r&&r(u.scrollIntoView()),!0):!1}}function jp(t,e,n,r=null){let i=!1,o=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=s.resolve(e.start-2);o=new ii(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new ii(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let u=rs(o,n,r,e);return u?(t&&Wp(t,e,u,i,n),!0):!1}function Wp(t,e,n,r,i){let o=w.empty;for(let c=n.length-1;c>=0;c--)o=w.from(n[c].type.create(n[c].attrs,o));t.step(new te(e.start-(r?2:0),e.end,e.start,e.end,new D(o,0,0),n.length,!0));let s=0;for(let c=0;c<n.length;c++)n[c].type==i&&(s=c+1);let u=n.length-s,a=e.start+n.length-(r?2:0),l=e.parent;for(let c=e.startIndex,f=e.endIndex,d=!0;c<f;c++,d=!1)!d&&ht(t.doc,a,u)&&(t.split(a,u),a+=2*u),a+=l.child(c).nodeSize;return t}function Up(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==t);return o?n?r.node(o.depth-1).type==t?Jp(e,n,t,o):Kp(e,n,o):!0:!1}}function Jp(t,e,n,r){let i=t.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new te(o-1,s,o,s,new D(w.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new ii(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const u=Rn(r);if(u==null)return!1;i.lift(r,u);let a=i.doc.resolve(i.mapping.map(o,-1)-1);return Rt(i.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&i.join(a.pos),e(i.scrollIntoView()),!0}function Kp(t,e,n){let r=t.tr,i=n.parent;for(let h=n.end,p=n.endIndex-1,m=n.startIndex;p>m;p--)h-=i.child(p).nodeSize,r.delete(h-1,h+1);let o=r.doc.resolve(n.start),s=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let u=n.startIndex==0,a=n.endIndex==i.childCount,l=o.node(-1),c=o.index(-1);if(!l.canReplace(c+(u?0:1),c+1,s.content.append(a?w.empty:w.from(i))))return!1;let f=o.pos,d=f+s.nodeSize;return r.step(new te(f-(u?1:0),d+(a?1:0),f+1,d-1,new D((u?w.empty:w.from(i.copy(w.empty))).append(a?w.empty:w.from(i.copy(w.empty))),u?0:1,a?0:1),u?0:1)),e(r.scrollIntoView()),!0}function Gp(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,l=>l.childCount>0&&l.firstChild.type==t);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let u=o.parent,a=u.child(s-1);if(a.type!=t)return!1;if(n){let l=a.lastChild&&a.lastChild.type==u.type,c=w.from(l?t.create():null),f=new D(w.from(t.create(null,w.from(u.type.create(null,c)))),l?3:1,0),d=o.start,h=o.end;n(e.tr.step(new te(d-(l?3:1),h,d,h,f,1,!0)).scrollIntoView())}return!0}}function Mi(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}class Ti{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:o}=r,s=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([u,a])=>[u,(...c)=>{const f=a(...c)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,u=[],a=!!e,l=e||o.tr,c=()=>(!a&&n&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(l),u.every(d=>d===!0)),f={...Object.fromEntries(Object.entries(r).map(([d,h])=>[d,(...m)=>{const g=this.buildProps(l,n),y=h(...m)(g);return u.push(y),f}])),run:c};return f}createCan(e){const{rawCommands:n,state:r}=this,i=!1,o=e||r.tr,s=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...c)=>l(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,u={tr:e,editor:i,view:s,state:Mi({state:o,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([a,l])=>[a,(...c)=>l(...c)(u)]))}};return u}}class Zp{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e]),this}once(e,n){const r=(...i)=>{this.off(e,r),n.apply(this,i)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}}function A(t,e,n){return t.config[e]===void 0&&t.parent?A(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?A(t.parent,e,n):null}):t.config[e]}function _i(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function bc(t){const e=[],{nodeExtensions:n,markExtensions:r}=_i(t),i=[...n,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const u={name:s.name,options:s.options,storage:s.storage,extensions:i},a=A(s,"addGlobalAttributes",u);if(!a)return;a().forEach(c=>{c.types.forEach(f=>{Object.entries(c.attributes).forEach(([d,h])=>{e.push({type:f,name:d,attribute:{...o,...h}})})})})}),i.forEach(s=>{const u={name:s.name,options:s.options,storage:s.storage},a=A(s,"addAttributes",u);if(!a)return;const l=a();Object.entries(l).forEach(([c,f])=>{const d={...o,...f};typeof(d==null?void 0:d.default)=="function"&&(d.default=d.default()),d!=null&&d.isRequired&&(d==null?void 0:d.default)===void 0&&delete d.default,e.push({type:s.name,name:c,attribute:d})})}),e}function re(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function be(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const u=o?String(o).split(" "):[],a=r[i]?r[i].split(" "):[],l=u.filter(c=>!a.includes(c));r[i]=[...a,...l].join(" ")}else if(i==="style"){const u=o?o.split(";").map(c=>c.trim()).filter(Boolean):[],a=r[i]?r[i].split(";").map(c=>c.trim()).filter(Boolean):[],l=new Map;a.forEach(c=>{const[f,d]=c.split(":").map(h=>h.trim());l.set(f,d)}),u.forEach(c=>{const[f,d]=c.split(":").map(h=>h.trim());l.set(f,d)}),r[i]=Array.from(l.entries()).map(([c,f])=>`${c}: ${f}`).join("; ")}else r[i]=o}),r},{})}function Ho(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>be(n,r),{})}function yc(t){return typeof t=="function"}function R(t,e=void 0,...n){return yc(t)?e?t.bind(e)(...n):t(...n):t}function Yp(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Xp(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function qu(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((o,s)=>{const u=s.attribute.parseHTML?s.attribute.parseHTML(n):Xp(n.getAttribute(s.name));return u==null?o:{...o,[s.name]:u}},{});return{...r,...i}}}}function ju(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&Yp(n)?!1:n!=null))}function Qp(t,e){var n;const r=bc(t),{nodeExtensions:i,markExtensions:o}=_i(t),s=(n=i.find(l=>A(l,"topNode")))===null||n===void 0?void 0:n.name,u=Object.fromEntries(i.map(l=>{const c=r.filter(y=>y.type===l.name),f={name:l.name,options:l.options,storage:l.storage,editor:e},d=t.reduce((y,x)=>{const k=A(x,"extendNodeSchema",f);return{...y,...k?k(l):{}}},{}),h=ju({...d,content:R(A(l,"content",f)),marks:R(A(l,"marks",f)),group:R(A(l,"group",f)),inline:R(A(l,"inline",f)),atom:R(A(l,"atom",f)),selectable:R(A(l,"selectable",f)),draggable:R(A(l,"draggable",f)),code:R(A(l,"code",f)),whitespace:R(A(l,"whitespace",f)),linebreakReplacement:R(A(l,"linebreakReplacement",f)),defining:R(A(l,"defining",f)),isolating:R(A(l,"isolating",f)),attrs:Object.fromEntries(c.map(y=>{var x;return[y.name,{default:(x=y==null?void 0:y.attribute)===null||x===void 0?void 0:x.default}]}))}),p=R(A(l,"parseHTML",f));p&&(h.parseDOM=p.map(y=>qu(y,c)));const m=A(l,"renderHTML",f);m&&(h.toDOM=y=>m({node:y,HTMLAttributes:Ho(y,c)}));const g=A(l,"renderText",f);return g&&(h.toText=g),[l.name,h]})),a=Object.fromEntries(o.map(l=>{const c=r.filter(g=>g.type===l.name),f={name:l.name,options:l.options,storage:l.storage,editor:e},d=t.reduce((g,y)=>{const x=A(y,"extendMarkSchema",f);return{...g,...x?x(l):{}}},{}),h=ju({...d,inclusive:R(A(l,"inclusive",f)),excludes:R(A(l,"excludes",f)),group:R(A(l,"group",f)),spanning:R(A(l,"spanning",f)),code:R(A(l,"code",f)),attrs:Object.fromEntries(c.map(g=>{var y;return[g.name,{default:(y=g==null?void 0:g.attribute)===null||y===void 0?void 0:y.default}]}))}),p=R(A(l,"parseHTML",f));p&&(h.parseDOM=p.map(g=>qu(g,c)));const m=A(l,"renderHTML",f);return m&&(h.toDOM=g=>m({mark:g,HTMLAttributes:Ho(g,c)})),[l.name,h]}));return new es({topNode:s,nodes:u,marks:a})}function oo(t,e){return e.nodes[t]||e.marks[t]||null}function Wu(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function kr(t,e){const n=sn.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}const e0=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,u)=>{var a,l;const c=((l=(a=i.type.spec).toText)===null||l===void 0?void 0:l.call(a,{node:i,pos:o,parent:s,index:u}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?c:c.slice(0,Math.max(0,r-o))}),n};function ks(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class Oi{constructor(e){this.find=e.find,this.handler=e.handler}}const t0=(t,e)=>{if(ks(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Vr(t){var e;const{editor:n,from:r,to:i,text:o,rules:s,plugin:u}=t,{view:a}=n;if(a.composing)return!1;const l=a.state.doc.resolve(r);if(l.parent.type.spec.code||!((e=l.nodeBefore||l.nodeAfter)===null||e===void 0)&&e.marks.find(d=>d.type.spec.code))return!1;let c=!1;const f=e0(l)+o;return s.forEach(d=>{if(c)return;const h=t0(f,d.find);if(!h)return;const p=a.state.tr,m=Mi({state:a.state,transaction:p}),g={from:r-(h[0].length-o.length),to:i},{commands:y,chain:x,can:k}=new Ti({editor:n,state:m});d.handler({state:m,range:g,match:h,commands:y,chain:x,can:k})===null||!p.steps.length||(p.setMeta(u,{transform:p,from:r,to:i,text:o}),a.dispatch(p),c=!0)}),c}function n0(t){const{editor:e,rules:n}=t,r=new ae({state:{init(){return null},apply(i,o,s){const u=i.getMeta(r);if(u)return u;const a=i.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:c}=a;typeof c=="string"?c=c:c=kr(w.from(c),s.schema);const{from:f}=a,d=f+c.length;Vr({editor:e,from:f,to:d,text:c,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,u){return Vr({editor:e,from:o,to:s,text:u,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&Vr({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:s}=i.state.selection;return s?Vr({editor:e,from:s.pos,to:s.pos,text:`
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function r0(t){return Object.prototype.toString.call(t).slice(8,-1)}function Hr(t){return r0(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Ni(t,e){const n={...t};return Hr(t)&&Hr(e)&&Object.keys(e).forEach(r=>{Hr(e[r])&&Hr(t[r])?n[r]=Ni(t[r],e[r]):n[r]=e[r]}),n}class Ce{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=R(A(this,"addOptions",{name:this.name}))),this.storage=R(A(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ce(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Ni(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Ce(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=R(A(n,"addOptions",{name:n.name})),n.storage=R(A(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const s=i.marks();if(!!!s.find(l=>(l==null?void 0:l.type.name)===n.name))return!1;const a=s.find(l=>(l==null?void 0:l.type.name)===n.name);return a&&r.removeStoredMark(a),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function i0(t){return typeof t=="number"}class o0{constructor(e){this.find=e.find,this.handler=e.handler}}const s0=(t,e,n)=>{if(ks(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const o=[i.text];return o.index=i.index,o.input=t,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function u0(t){const{editor:e,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:u}=t,{commands:a,chain:l,can:c}=new Ti({editor:e,state:n}),f=[];return n.doc.nodesBetween(r,i,(h,p)=>{if(!h.isTextblock||h.type.spec.code)return;const m=Math.max(r,p),g=Math.min(i,p+h.content.size),y=h.textBetween(m-p,g-p,void 0,"");s0(y,o.find,s).forEach(k=>{if(k.index===void 0)return;const b=m+k.index+1,E=b+k[0].length,C={from:n.tr.mapping.map(b),to:n.tr.mapping.map(E)},S=o.handler({state:n,range:C,match:k,commands:a,chain:l,can:c,pasteEvent:s,dropEvent:u});f.push(S)})}),f.every(h=>h!==null)}let qr=null;const a0=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function l0(t){const{editor:e,rules:n}=t;let r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,u;try{u=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{u=null}const a=({state:c,from:f,to:d,rule:h,pasteEvt:p})=>{const m=c.tr,g=Mi({state:c,transaction:m});if(!(!u0({editor:e,state:g,from:Math.max(f-1,0),to:d.b-1,rule:h,pasteEvent:p,dropEvent:u})||!m.steps.length)){try{u=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{u=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(c=>new ae({view(f){const d=p=>{var m;r=!((m=f.dom.parentElement)===null||m===void 0)&&m.contains(p.target)?f.dom.parentElement:null,r&&(qr=e)},h=()=>{qr&&(qr=null)};return window.addEventListener("dragstart",d),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",d),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(f,d)=>{if(o=r===f.dom.parentElement,u=d,!o){const h=qr;h!=null&&h.isEditable&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(f,d)=>{var h;const p=(h=d.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return s=d,i=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(f,d,h)=>{const p=f[0],m=p.getMeta("uiEvent")==="paste"&&!i,g=p.getMeta("uiEvent")==="drop"&&!o,y=p.getMeta("applyPasteRules"),x=!!y;if(!m&&!g&&!x)return;if(x){let{text:E}=y;typeof E=="string"?E=E:E=kr(w.from(E),h.schema);const{from:C}=y,S=C+E.length,M=a0(E);return a({rule:c,state:h,from:C,to:{b:S},pasteEvt:M})}const k=d.doc.content.findDiffStart(h.doc.content),b=d.doc.content.findDiffEnd(h.doc.content);if(!(!i0(k)||!b||k===b.b))return a({rule:c,state:h,from:k,to:b,pasteEvt:s})}}))}function c0(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}class xn{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=xn.resolve(e),this.schema=Qp(this.extensions,n),this.setupExtensions()}static resolve(e){const n=xn.sort(xn.flatten(e)),r=c0(n.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},i=A(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{const o=A(r,"priority")||100,s=A(i,"priority")||100;return o>s?-1:o<s?1:0})}get commands(){return this.extensions.reduce((e,n)=>{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:oo(n.name,this.schema)},i=A(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=xn.sort([...this.extensions].reverse()),r=[],i=[],o=n.map(s=>{const u={name:s.name,options:s.options,storage:s.storage,editor:e,type:oo(s.name,this.schema)},a=[],l=A(s,"addKeyboardShortcuts",u);let c={};if(s.type==="mark"&&A(s,"exitable",u)&&(c.ArrowRight=()=>Ce.handleExit({editor:e,mark:s})),l){const m=Object.fromEntries(Object.entries(l()).map(([g,y])=>[g,()=>y({editor:e})]));c={...c,...m}}const f=Tp(c);a.push(f);const d=A(s,"addInputRules",u);Wu(s,e.options.enableInputRules)&&d&&r.push(...d());const h=A(s,"addPasteRules",u);Wu(s,e.options.enablePasteRules)&&h&&i.push(...h());const p=A(s,"addProseMirrorPlugins",u);if(p){const m=p();a.push(...m)}return a}).flat();return[n0({editor:e,rules:r}),...l0({editor:e,rules:i}),...o]}get attributes(){return bc(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=_i(this.extensions);return Object.fromEntries(n.filter(r=>!!A(r,"addNodeView")).map(r=>{const i=this.attributes.filter(a=>a.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:e,type:re(r.name,this.schema)},s=A(r,"addNodeView",o);if(!s)return[];const u=(a,l,c,f,d)=>{const h=Ho(a,i);return s()({node:a,view:l,getPos:c,decorations:f,innerDecorations:d,editor:e,extension:r,HTMLAttributes:h})};return[r.name,u]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:oo(e.name,this.schema)};e.type==="mark"&&(!((n=R(A(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=A(e,"onBeforeCreate",r),o=A(e,"onCreate",r),s=A(e,"onUpdate",r),u=A(e,"onSelectionUpdate",r),a=A(e,"onTransaction",r),l=A(e,"onFocus",r),c=A(e,"onBlur",r),f=A(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),s&&this.editor.on("update",s),u&&this.editor.on("selectionUpdate",u),a&&this.editor.on("transaction",a),l&&this.editor.on("focus",l),c&&this.editor.on("blur",c),f&&this.editor.on("destroy",f)})}}class G{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=R(A(this,"addOptions",{name:this.name}))),this.storage=R(A(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new G(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Ni(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new G({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=R(A(n,"addOptions",{name:n.name})),n.storage=R(A(n,"addStorage",{name:n.name,options:n.options})),n}}function xc(t,e,n){const{from:r,to:i}=e,{blockSeparator:o=`
`,textSerializers:s={}}=n||{};let u="";return t.nodesBetween(r,i,(a,l,c,f)=>{var d;a.isBlock&&l>r&&(u+=o);const h=s==null?void 0:s[a.type.name];if(h)return c&&(u+=h({node:a,pos:l,parent:c,index:f,range:e})),!1;a.isText&&(u+=(d=a==null?void 0:a.text)===null||d===void 0?void 0:d.slice(Math.max(r,l)-l,i-l))}),u}function kc(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const Cc=G.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ae({key:new Te("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:o}=i,s=Math.min(...o.map(c=>c.$from.pos)),u=Math.max(...o.map(c=>c.$to.pos)),a=kc(n);return xc(r,{from:s,to:u},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),f0=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),d0=(t=!1)=>({commands:e})=>e.setContent("",t),h0=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:o,$to:s})=>{t.doc.nodesBetween(o.pos,s.pos,(u,a)=>{if(u.type.isText)return;const{doc:l,mapping:c}=e,f=l.resolve(c.map(a)),d=l.resolve(c.map(a+u.nodeSize)),h=f.blockRange(d);if(!h)return;const p=Rn(h);if(u.type.isTextblock){const{defaultType:m}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},p0=t=>e=>t(e),m0=()=>({state:t,dispatch:e})=>hc(t,e),g0=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,o=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,o.content),r.setSelection(new F(r.doc.resolve(Math.max(s-1,0)))),!0},b0=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const u=i.before(o),a=i.after(o);t.delete(u,a).scrollIntoView()}return!0}return!1},y0=t=>({tr:e,state:n,dispatch:r})=>{const i=re(t,n.schema),o=e.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===i){if(r){const a=o.before(s),l=o.after(s);e.delete(a,l).scrollIntoView()}return!0}return!1},x0=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},k0=()=>({state:t,dispatch:e})=>ms(t,e),C0=()=>({commands:t})=>t.keyboardShortcut("Enter"),v0=()=>({state:t,dispatch:e})=>Rp(t,e);function di(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:ks(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function vc(t,e,n={}){return t.find(r=>r.type===e&&di(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function Uu(t,e,n={}){return!!vc(t,e,n)}function Cs(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(c=>c.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(c=>c.type===e)||(n=n||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!vc([...i.node.marks],e,n)))return;let s=i.index,u=t.start()+i.offset,a=s+1,l=u+i.node.nodeSize;for(;s>0&&Uu([...t.parent.child(s-1).marks],e,n);)s-=1,u-=t.parent.child(s).nodeSize;for(;a<t.parent.childCount&&Uu([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:u,to:l}}function Pt(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const w0=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const o=Pt(t,r.schema),{doc:s,selection:u}=n,{$from:a,from:l,to:c}=u;if(i){const f=Cs(a,o,e);if(f&&f.from<=l&&f.to>=c){const d=F.create(s,f.from,f.to);n.setSelection(d)}}return!0},E0=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function vs(t){return t instanceof F}function ft(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function wc(t,e=null){if(!e)return null;const n=I.atStart(t),r=I.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,o=r.to;return e==="all"?F.create(t,ft(0,i,o),ft(t.content.size,i,o)):F.create(t,ft(e,i,o),ft(e,i,o))}function S0(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ws(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const D0=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{(ws()||S0())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(o&&t===null&&!vs(n.state.selection))return s(),!0;const u=wc(i.doc,t)||n.state.selection,a=n.state.selection.eq(u);return o&&(a||i.setSelection(u),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},A0=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),M0=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Ec=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&Ec(r)}return t};function jr(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return Ec(n)}function ar(t,e,n){if(t instanceof Tt||t instanceof w)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return w.fromArray(t.map(u=>e.nodeFromJSON(u)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),ar("",e,n)}if(i){if(n.errorOnInvalidContent){let s=!1,u="";const a=new es({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:l=>(s=!0,u=typeof l=="string"?l:l.outerHTML,null)}]}})});if(n.slice?dt.fromSchema(a).parseSlice(jr(t),n.parseOptions):dt.fromSchema(a).parse(jr(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${u}`)})}const o=dt.fromSchema(e);return n.slice?o.parseSlice(jr(t),n.parseOptions).content:o.parse(jr(t),n.parseOptions)}return ar("",e,n)}function T0(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof X||i instanceof te))return;const o=t.mapping.maps[r];let s=0;o.forEach((u,a,l,c)=>{s===0&&(s=c)}),t.setSelection(I.near(t.doc.resolve(s),n))}const _0=t=>!("type"in t),O0=(t,e,n)=>({tr:r,dispatch:i,editor:o})=>{var s;if(i){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let u;const a=g=>{o.emit("contentError",{editor:o,error:g,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},l={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{ar(e,o.schema,{parseOptions:l,errorOnInvalidContent:!0})}catch(g){a(g)}try{u=ar(e,o.schema,{parseOptions:l,errorOnInvalidContent:(s=n.errorOnInvalidContent)!==null&&s!==void 0?s:o.options.enableContentCheck})}catch(g){return a(g),!1}let{from:c,to:f}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},d=!0,h=!0;if((_0(u)?u:[u]).forEach(g=>{g.check(),d=d?g.isText&&g.marks.length===0:!1,h=h?g.isBlock:!1}),c===f&&h){const{parent:g}=r.doc.resolve(c);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(c-=1,f+=1)}let m;if(d){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof w){let g="";e.forEach(y=>{y.text&&(g+=y.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,c,f)}else m=u,r.replaceWith(c,f,m);n.updateSelection&&T0(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:m})}return!0},N0=()=>({state:t,dispatch:e})=>Np(t,e),F0=()=>({state:t,dispatch:e})=>Fp(t,e),I0=()=>({state:t,dispatch:e})=>sc(t,e),R0=()=>({state:t,dispatch:e})=>cc(t,e),B0=()=>({state:t,dispatch:e,tr:n})=>{try{const r=vi(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},P0=()=>({state:t,dispatch:e,tr:n})=>{try{const r=vi(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},L0=()=>({state:t,dispatch:e})=>_p(t,e),z0=()=>({state:t,dispatch:e})=>Op(t,e);function Sc(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function $0(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,o,s;for(let u=0;u<e.length-1;u+=1){const a=e[u];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))o=!0;else if(/^mod$/i.test(a))ws()||Sc()?s=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),o&&(n=`Shift-${n}`),n}const V0=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const o=$0(t).split(/-(?!$)/),s=o.find(l=>!["Alt","Ctrl","Meta","Shift"].includes(l)),u=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{n.someProp("handleKeyDown",l=>l(n,u))});return a==null||a.steps.forEach(l=>{const c=l.map(r.mapping);c&&i&&r.maybeStep(c)}),!0};function lr(t,e,n={}){const{from:r,to:i,empty:o}=t.selection,s=e?re(e,t.schema):null,u=[];t.doc.nodesBetween(r,i,(f,d)=>{if(f.isText)return;const h=Math.max(r,d),p=Math.min(i,d+f.nodeSize);u.push({node:f,from:h,to:p})});const a=i-r,l=u.filter(f=>s?s.name===f.node.type.name:!0).filter(f=>di(f.node.attrs,n,{strict:!1}));return o?!!l.length:l.reduce((f,d)=>f+d.to-d.from,0)>=a}const H0=(t,e={})=>({state:n,dispatch:r})=>{const i=re(t,n.schema);return lr(n,i,e)?Ip(n,r):!1},q0=()=>({state:t,dispatch:e})=>pc(t,e),j0=t=>({state:e,dispatch:n})=>{const r=re(t,e.schema);return Up(r)(e,n)},W0=()=>({state:t,dispatch:e})=>dc(t,e);function Fi(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Ju(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}const U0=(t,e)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const u=Fi(typeof t=="string"?t:t.name,r.schema);return u?(u==="node"&&(o=re(t,r.schema)),u==="mark"&&(s=Pt(t,r.schema)),i&&n.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(l,c)=>{o&&o===l.type&&n.setNodeMarkup(c,void 0,Ju(l.attrs,e)),s&&l.marks.length&&l.marks.forEach(f=>{s===f.type&&n.addMark(c,c+l.nodeSize,s.create(Ju(f.attrs,e)))})})}),!0):!1},J0=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),K0=()=>({tr:t,dispatch:e})=>{if(e){const n=new De(t.doc);t.setSelection(n)}return!0},G0=()=>({state:t,dispatch:e})=>ac(t,e),Z0=()=>({state:t,dispatch:e})=>fc(t,e),Y0=()=>({state:t,dispatch:e})=>Lp(t,e),X0=()=>({state:t,dispatch:e})=>Vp(t,e),Q0=()=>({state:t,dispatch:e})=>$p(t,e);function qo(t,e,n={},r={}){return ar(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const em=(t,e=!1,n={},r={})=>({editor:i,tr:o,dispatch:s,commands:u})=>{var a,l;const{doc:c}=o;if(n.preserveWhitespace!=="full"){const f=qo(t,i.schema,n,{errorOnInvalidContent:(a=r.errorOnInvalidContent)!==null&&a!==void 0?a:i.options.enableContentCheck});return s&&o.replaceWith(0,c.content.size,f).setMeta("preventUpdate",!e),!0}return s&&o.setMeta("preventUpdate",!e),u.insertContentAt({from:0,to:c.content.size},t,{parseOptions:n,errorOnInvalidContent:(l=r.errorOnInvalidContent)!==null&&l!==void 0?l:i.options.enableContentCheck})};function Dc(t,e){const n=Pt(e,t.schema),{from:r,to:i,empty:o}=t.selection,s=[];o?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,a=>{s.push(...a.marks)});const u=s.find(a=>a.type.name===n.name);return u?{...u.attrs}:{}}function tm(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function nm(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Es(t){return e=>nm(e.$from,t)}function rm(t,e){const n={from:0,to:t.content.size};return xc(t,n,e)}function im(t,e){const n=re(e,t.schema),{from:r,to:i}=t.selection,o=[];t.doc.nodesBetween(r,i,u=>{o.push(u)});const s=o.reverse().find(u=>u.type.name===n.name);return s?{...s.attrs}:{}}function om(t,e){const n=Fi(typeof e=="string"?e:e.name,t.schema);return n==="node"?im(t,e):n==="mark"?Dc(t,e):{}}function Ac(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const o=n.resolve(t),s=Cs(o,i.type);s&&r.push({mark:i,...s})}):n.nodesBetween(t,e,(i,o)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(s=>({from:o,to:o+i.nodeSize,mark:s})))}),r}function Xr(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}function jo(t,e,n={}){const{empty:r,ranges:i}=t.selection,o=e?Pt(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>o?o.name===f.type.name:!0).find(f=>di(f.attrs,n,{strict:!1}));let s=0;const u=[];if(i.forEach(({$from:f,$to:d})=>{const h=f.pos,p=d.pos;t.doc.nodesBetween(h,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;const y=Math.max(h,g),x=Math.min(p,g+m.nodeSize),k=x-y;s+=k,u.push(...m.marks.map(b=>({mark:b,from:y,to:x})))})}),s===0)return!1;const a=u.filter(f=>o?o.name===f.mark.type.name:!0).filter(f=>di(f.mark.attrs,n,{strict:!1})).reduce((f,d)=>f+d.to-d.from,0),l=u.filter(f=>o?f.mark.type!==o&&f.mark.type.excludes(o):!0).reduce((f,d)=>f+d.to-d.from,0);return(a>0?a+l:a)>=s}function sm(t,e,n={}){if(!e)return lr(t,null,n)||jo(t,null,n);const r=Fi(e,t.schema);return r==="node"?lr(t,e,n):r==="mark"?jo(t,e,n):!1}function Ku(t,e){const{nodeExtensions:n}=_i(e),r=n.find(s=>s.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=R(A(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function Ii(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!==null&&r!==void 0?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(o=>{i!==!1&&(Ii(o,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function Mc(t){return t instanceof _}function um(t,e,n){const i=t.state.doc.content.size,o=ft(e,0,i),s=ft(n,0,i),u=t.coordsAtPos(o),a=t.coordsAtPos(s,-1),l=Math.min(u.top,a.top),c=Math.max(u.bottom,a.bottom),f=Math.min(u.left,a.left),d=Math.max(u.right,a.right),h=d-f,p=c-l,y={top:l,bottom:c,left:f,right:d,width:h,height:p,x:f,y:l};return{...y,toJSON:()=>y}}function am(t,e,n){var r;const{selection:i}=e;let o=null;if(vs(i)&&(o=i.$cursor),o){const u=(r=t.storedMarks)!==null&&r!==void 0?r:o.marks();return!!n.isInSet(u)||!u.some(a=>a.type.excludes(n))}const{ranges:s}=i;return s.some(({$from:u,$to:a})=>{let l=u.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(u.pos,a.pos,(c,f,d)=>{if(l)return!1;if(c.isInline){const h=!d||d.type.allowsMarkType(n),p=!!n.isInSet(c.marks)||!c.marks.some(m=>m.type.excludes(n));l=h&&p}return!l}),l})}const lm=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:o}=n,{empty:s,ranges:u}=o,a=Pt(t,r.schema);if(i)if(s){const l=Dc(r,a);n.addStoredMark(a.create({...l,...e}))}else u.forEach(l=>{const c=l.$from.pos,f=l.$to.pos;r.doc.nodesBetween(c,f,(d,h)=>{const p=Math.max(h,c),m=Math.min(h+d.nodeSize,f);d.marks.find(y=>y.type===a)?d.marks.forEach(y=>{a===y.type&&n.addMark(p,m,a.create({...y.attrs,...e}))}):n.addMark(p,m,a.create(e))})});return am(r,n,a)},cm=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),fm=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const o=re(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:u})=>Hu(o,{...s,...e})(n)?!0:u.clearNodes()).command(({state:u})=>Hu(o,{...s,...e})(u,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},dm=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=ft(t,0,r.content.size),o=_.create(r,i);e.setSelection(o)}return!0},hm=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:o}=typeof t=="number"?{from:t,to:t}:t,s=F.atStart(r).from,u=F.atEnd(r).to,a=ft(i,s,u),l=ft(o,s,u),c=F.create(r,a,l);e.setSelection(c)}return!0},pm=t=>({state:e,dispatch:n})=>{const r=re(t,e.schema);return Gp(r)(e,n)};function Gu(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e==null?void 0:e.includes(i.type.name));t.tr.ensureMarks(r)}}const mm=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:o,doc:s}=e,{$from:u,$to:a}=o,l=i.extensionManager.attributes,c=Xr(l,u.node().type.name,u.node().attrs);if(o instanceof _&&o.node.isBlock)return!u.parentOffset||!ht(s,u.pos)?!1:(r&&(t&&Gu(n,i.extensionManager.splittableMarks),e.split(u.pos).scrollIntoView()),!0);if(!u.parent.isBlock)return!1;const f=a.parentOffset===a.parent.content.size,d=u.depth===0?void 0:tm(u.node(-1).contentMatchAt(u.indexAfter(-1)));let h=f&&d?[{type:d,attrs:c}]:void 0,p=ht(e.doc,e.mapping.map(u.pos),1,h);if(!h&&!p&&ht(e.doc,e.mapping.map(u.pos),1,d?[{type:d}]:void 0)&&(p=!0,h=d?[{type:d,attrs:c}]:void 0),r){if(p&&(o instanceof F&&e.deleteSelection(),e.split(e.mapping.map(u.pos),1,h),d&&!f&&!u.parentOffset&&u.parent.type!==d)){const m=e.mapping.map(u.before()),g=e.doc.resolve(m);u.node(-1).canReplaceWith(g.index(),g.index()+1,d)&&e.setNodeMarkup(e.mapping.map(u.before()),d)}t&&Gu(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},gm=(t,e={})=>({tr:n,state:r,dispatch:i,editor:o})=>{var s;const u=re(t,r.schema),{$from:a,$to:l}=r.selection,c=r.selection.node;if(c&&c.isBlock||a.depth<2||!a.sameParent(l))return!1;const f=a.node(-1);if(f.type!==u)return!1;const d=o.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==u||a.index(-2)!==a.node(-2).childCount-1)return!1;if(i){let y=w.empty;const x=a.index(-1)?1:a.index(-2)?2:3;for(let M=a.depth-x;M>=a.depth-3;M-=1)y=w.from(a.node(M).copy(y));const k=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,b={...Xr(d,a.node().type.name,a.node().attrs),...e},E=((s=u.contentMatch.defaultType)===null||s===void 0?void 0:s.createAndFill(b))||void 0;y=y.append(w.from(u.createAndFill(null,E)||void 0));const C=a.before(a.depth-(x-1));n.replace(C,a.after(-k),new D(y,4-x,0));let S=-1;n.doc.nodesBetween(C,n.doc.content.size,(M,O)=>{if(S>-1)return!1;M.isTextblock&&M.content.size===0&&(S=O+1)}),S>-1&&n.setSelection(F.near(n.doc.resolve(S))),n.scrollIntoView()}return!0}const h=l.pos===a.end()?f.contentMatchAt(0).defaultType:null,p={...Xr(d,f.type.name,f.attrs),...e},m={...Xr(d,a.node().type.name,a.node().attrs),...e};n.delete(a.pos,l.pos);const g=h?[{type:u,attrs:p},{type:h,attrs:m}]:[{type:u,attrs:p}];if(!ht(n.doc,a.pos,2))return!1;if(i){const{selection:y,storedMarks:x}=r,{splittableMarks:k}=o.extensionManager,b=x||y.$to.parentOffset&&y.$from.marks();if(n.split(a.pos,2,g).scrollIntoView(),!b||!i)return!0;const E=b.filter(C=>k.includes(C.type.name));n.ensureMarks(E)}return!0},so=(t,e)=>{const n=Es(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Rt(t.doc,n.pos)&&t.join(n.pos),!0},uo=(t,e)=>{const n=Es(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Rt(t.doc,r)&&t.join(r),!0},bm=(t,e,n,r={})=>({editor:i,tr:o,state:s,dispatch:u,chain:a,commands:l,can:c})=>{const{extensions:f,splittableMarks:d}=i.extensionManager,h=re(t,s.schema),p=re(e,s.schema),{selection:m,storedMarks:g}=s,{$from:y,$to:x}=m,k=y.blockRange(x),b=g||m.$to.parentOffset&&m.$from.marks();if(!k)return!1;const E=Es(C=>Ku(C.type.name,f))(m);if(k.depth>=1&&E&&k.depth-E.depth<=1){if(E.node.type===h)return l.liftListItem(p);if(Ku(E.node.type.name,f)&&h.validContent(E.node.content)&&u)return a().command(()=>(o.setNodeMarkup(E.pos,h),!0)).command(()=>so(o,h)).command(()=>uo(o,h)).run()}return!n||!b||!u?a().command(()=>c().wrapInList(h,r)?!0:l.clearNodes()).wrapInList(h,r).command(()=>so(o,h)).command(()=>uo(o,h)).run():a().command(()=>{const C=c().wrapInList(h,r),S=b.filter(M=>d.includes(M.type.name));return o.ensureMarks(S),C?!0:l.clearNodes()}).wrapInList(h,r).command(()=>so(o,h)).command(()=>uo(o,h)).run()},ym=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=n,s=Pt(t,r.schema);return jo(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},xm=(t,e,n={})=>({state:r,commands:i})=>{const o=re(t,r.schema),s=re(e,r.schema),u=lr(r,o,n);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),u?i.setNode(s,a):i.setNode(o,{...a,...n})},km=(t,e={})=>({state:n,commands:r})=>{const i=re(t,n.schema);return lr(n,i,e)?r.lift(i):r.wrapIn(i,e)},Cm=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let o;if(i.spec.isInputRules&&(o=i.getState(t))){if(e){const s=t.tr,u=o.transform;for(let a=u.steps.length-1;a>=0;a-=1)s.step(u.steps[a].invert(u.docs[a]));if(o.text){const a=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,t.schema.text(o.text,a))}else s.delete(o.from,o.to)}return!0}}return!1},vm=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(o=>{t.removeMark(o.$from.pos,o.$to.pos)}),!0},wm=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:s=!1}=e,{selection:u}=n,a=Pt(t,r.schema),{$from:l,empty:c,ranges:f}=u;if(!i)return!0;if(c&&s){let{from:d,to:h}=u;const p=(o=l.marks().find(g=>g.type===a))===null||o===void 0?void 0:o.attrs,m=Cs(l,a,p);m&&(d=m.from,h=m.to),n.removeMark(d,h,a)}else f.forEach(d=>{n.removeMark(d.$from.pos,d.$to.pos,a)});return n.removeStoredMark(a),!0},Em=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const u=Fi(typeof t=="string"?t:t.name,r.schema);return u?(u==="node"&&(o=re(t,r.schema)),u==="mark"&&(s=Pt(t,r.schema)),i&&n.selection.ranges.forEach(a=>{const l=a.$from.pos,c=a.$to.pos;let f,d,h,p;n.selection.empty?r.doc.nodesBetween(l,c,(m,g)=>{o&&o===m.type&&(h=Math.max(g,l),p=Math.min(g+m.nodeSize,c),f=g,d=m)}):r.doc.nodesBetween(l,c,(m,g)=>{g<l&&o&&o===m.type&&(h=Math.max(g,l),p=Math.min(g+m.nodeSize,c),f=g,d=m),g>=l&&g<=c&&(o&&o===m.type&&n.setNodeMarkup(g,void 0,{...m.attrs,...e}),s&&m.marks.length&&m.marks.forEach(y=>{if(s===y.type){const x=Math.max(g,l),k=Math.min(g+m.nodeSize,c);n.addMark(x,k,s.create({...y.attrs,...e}))}}))}),d&&(f!==void 0&&n.setNodeMarkup(f,void 0,{...d.attrs,...e}),s&&d.marks.length&&d.marks.forEach(m=>{s===m.type&&n.addMark(h,p,s.create({...m.attrs,...e}))}))}),!0):!1},Sm=(t,e={})=>({state:n,dispatch:r})=>{const i=re(t,n.schema);return Hp(i,e)(n,r)},Dm=(t,e={})=>({state:n,dispatch:r})=>{const i=re(t,n.schema);return qp(i,e)(n,r)};var Am=Object.freeze({__proto__:null,blur:f0,clearContent:d0,clearNodes:h0,command:p0,createParagraphNear:m0,cut:g0,deleteCurrentNode:b0,deleteNode:y0,deleteRange:x0,deleteSelection:k0,enter:C0,exitCode:v0,extendMarkRange:w0,first:E0,focus:D0,forEach:A0,insertContent:M0,insertContentAt:O0,joinBackward:I0,joinDown:F0,joinForward:R0,joinItemBackward:B0,joinItemForward:P0,joinTextblockBackward:L0,joinTextblockForward:z0,joinUp:N0,keyboardShortcut:V0,lift:H0,liftEmptyBlock:q0,liftListItem:j0,newlineInCode:W0,resetAttributes:U0,scrollIntoView:J0,selectAll:K0,selectNodeBackward:G0,selectNodeForward:Z0,selectParentNode:Y0,selectTextblockEnd:X0,selectTextblockStart:Q0,setContent:em,setMark:lm,setMeta:cm,setNode:fm,setNodeSelection:dm,setTextSelection:hm,sinkListItem:pm,splitBlock:mm,splitListItem:gm,toggleList:bm,toggleMark:ym,toggleNode:xm,toggleWrap:km,undoInputRule:Cm,unsetAllMarks:vm,unsetMark:wm,updateAttributes:Em,wrapIn:Sm,wrapInList:Dm});const Tc=G.create({name:"commands",addCommands(){return{...Am}}}),_c=G.create({name:"drop",addProseMirrorPlugins(){return[new ae({key:new Te("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),Oc=G.create({name:"editable",addProseMirrorPlugins(){return[new ae({key:new Te("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Nc=new Te("focusEvents"),Fc=G.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new ae({key:Nc,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Ic=G.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:u})=>{const{selection:a,doc:l}=u,{empty:c,$anchor:f}=a,{pos:d,parent:h}=f,p=f.parent.isTextblock&&d>0?u.doc.resolve(d-1):f,m=p.parent.type.spec.isolating,g=f.pos-f.parentOffset,y=m&&p.parent.childCount===1?g===f.pos:I.atStart(l).from===d;return!c||!h.type.isTextblock||h.textContent.length||!y||y&&f.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ws()||Sc()?o:i},addProseMirrorPlugins(){return[new ae({key:new Te("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),i=t.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;const{empty:o,from:s,to:u}=e.selection,a=I.atStart(e.doc).from,l=I.atEnd(e.doc).to;if(o||!(s===a&&u===l)||!Ii(n.doc))return;const d=n.tr,h=Mi({state:n,transaction:d}),{commands:p}=new Ti({editor:this.editor,state:h});if(p.clearNodes(),!!d.steps.length)return d}})]}}),Rc=G.create({name:"paste",addProseMirrorPlugins(){return[new ae({key:new Te("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),Bc=G.create({name:"tabindex",addProseMirrorPlugins(){return[new ae({key:new Te("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});var Mm=Object.freeze({__proto__:null,ClipboardTextSerializer:Cc,Commands:Tc,Drop:_c,Editable:Oc,FocusEvents:Fc,Keymap:Ic,Paste:Rc,Tabindex:Bc,focusEventsPluginKey:Nc});class Wt{get name(){return this.node.type.name}constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You cant set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Wt(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Wt(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Wt(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,s=this.pos+r+(o?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const u=this.resolvedPos.doc.resolve(s);if(!i&&u.depth<=this.depth)return;const a=new Wt(u,this.editor,i,i?n:null);i&&(a.actualDepth=this.depth+1),e.push(new Wt(u,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const o=i.node.attrs,s=Object.keys(n);for(let u=0;u<s.length;u+=1){const a=s[u];if(o[a]!==n[a])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const o=Object.keys(n);return this.children.forEach(s=>{r&&i.length>0||(s.node.type.name===e&&o.every(a=>n[a]===s.node.attrs[a])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}}const Tm=`.ProseMirror {
position: relative;
}
.ProseMirror {
word-wrap: break-word;
white-space: pre-wrap;
white-space: break-spaces;
-webkit-font-variant-ligatures: none;
font-variant-ligatures: none;
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
}
.ProseMirror [contenteditable="false"] {
white-space: normal;
}
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
white-space: pre-wrap;
}
.ProseMirror pre {
white-space: pre-wrap;
}
img.ProseMirror-separator {
display: inline !important;
border: none !important;
margin: 0 !important;
width: 0 !important;
height: 0 !important;
}
.ProseMirror-gapcursor {
display: none;
pointer-events: none;
position: absolute;
margin: 0;
}
.ProseMirror-gapcursor:after {
content: "";
display: block;
position: absolute;
top: -2px;
width: 20px;
border-top: 1px solid black;
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
}
@keyframes ProseMirror-cursor-blink {
to {
visibility: hidden;
}
}
.ProseMirror-hideselection *::selection {
background: transparent;
}
.ProseMirror-hideselection *::-moz-selection {
background: transparent;
}
.ProseMirror-hideselection * {
caret-color: transparent;
}
.ProseMirror-focused .ProseMirror-gapcursor {
display: block;
}
.tippy-box[data-animation=fade][data-state=hidden] {
opacity: 0
}`;function _m(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}class Om extends Zp{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:r,moved:i})=>this.options.onDrop(n,r,i)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=_m(Tm,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,n){const r=yc(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const n=this.state.plugins;let r=n;if([].concat(e).forEach(o=>{const s=typeof o=="string"?`${o}$`:o.key;r=r.filter(u=>!u.key.startsWith(s))}),n.length===r.length)return;const i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}createExtensionManager(){var e,n;const i=[...this.options.enableCoreExtensions?[Oc,Cc.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),Tc,Fc,Ic,Bc,_c,Rc].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new xn(i,this)}createCommandManager(){this.commandManager=new Ti({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=qo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(s){if(!(s instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(s.message))throw s;this.emit("contentError",{editor:this,error:s,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(u=>u.name!=="collaboration"),this.createExtensionManager()}}),n=qo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=wc(n,this.options.autofocus);this.view=new rc(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:yn.create({doc:n,selection:r||void 0})});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.createNodeViews(),this.prependClass();const o=this.view.dom;o.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(s=>{var u;return(u=this.capturedTransaction)===null||u===void 0?void 0:u.step(s)});return}const n=this.state.apply(e),r=!this.state.selection.eq(n.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:n}),this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),o=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),o&&this.emit("blur",{editor:this,event:o.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return om(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return sm(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return kr(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
`,textSerializers:r={}}=e||{};return rm(this.state.doc,{blockSeparator:n,textSerializers:{...kc(this.schema),...r}})}get isEmpty(){return Ii(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 e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,n))||null}$nodes(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new Wt(n,this)}get $doc(){return this.$pos(0)}}function An(t){return new Oi({find:t.find,handler:({state:e,range:n,match:r})=>{const i=R(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=e,s=r[r.length-1],u=r[0];if(s){const a=u.search(/\S/),l=n.from+u.indexOf(s),c=l+s.length;if(Ac(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===t.type&&m!==h.mark.type)).filter(h=>h.to>l).length)return null;c<n.to&&o.delete(c,n.to),l>n.from&&o.delete(n.from+a,l);const d=n.from+a+s.length;o.addMark(n.from+a,d,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}function Nm(t){return new Oi({find:t.find,handler:({state:e,range:n,match:r})=>{const i=R(t.getAttributes,void 0,r)||{},{tr:o}=e,s=n.from;let u=n.to;const a=t.type.create(i);if(r[1]){const l=r[0].lastIndexOf(r[1]);let c=s+l;c>u?c=u:u=c+r[1].length;const f=r[0][r[0].length-1];o.insertText(f,s+r[0].length-1),o.replaceWith(c,u,a)}else if(r[0]){const l=t.type.isInline?s:s-1;o.insert(l,t.type.create(i)).delete(o.mapping.map(s),o.mapping.map(u))}o.scrollIntoView()}})}function Wo(t){return new Oi({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),o=R(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,o)}})}function cr(t){return new Oi({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const o=R(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&rs(a,t.type,o);if(!l)return null;if(s.wrap(a,l),t.keepMarks&&t.editor){const{selection:f,storedMarks:d}=e,{splittableMarks:h}=t.editor.extensionManager,p=d||f.$to.parentOffset&&f.$from.marks();if(p){const m=p.filter(g=>h.includes(g.type.name));s.ensureMarks(m)}}if(t.keepAttributes){const f=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(f,o).run()}const c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&Rt(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&s.join(n.from-1)}})}let V=class Uo{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=R(A(this,"addOptions",{name:this.name}))),this.storage=R(A(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Uo(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Ni(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Uo(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=R(A(n,"addOptions",{name:n.name})),n.storage=R(A(n,"addStorage",{name:n.name,options:n.options})),n}};function Mn(t){return new o0({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const o=R(t.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:s}=e,u=r[r.length-1],a=r[0];let l=n.to;if(u){const c=a.search(/\S/),f=n.from+a.indexOf(u),d=f+u.length;if(Ac(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===t.type&&g!==p.mark.type)).filter(p=>p.to>f).length)return null;d<n.to&&s.delete(d,n.to),f>n.from&&s.delete(n.from+c,f),l=n.from+c+u.length,s.addMark(n.from+c,l,t.type.create(o||{})),s.removeStoredMark(t.type)}}})}function Fm(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof _){const o=r.index();return r.parent.canReplaceWith(o,o+1,e)}let i=r.depth;for(;i>=0;){const o=r.index(i);if(r.node(i).contentMatchAt(o).matchType(e))return!0;i-=1}return!1}const Im=/^\s*>\s$/,Rm=V.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",be(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[cr({find:Im,type:this.type})]}}),Bm=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Pm=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Lm=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,zm=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,$m=Ce.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",be(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[An({find:Bm,type:this.type}),An({find:Lm,type:this.type})]},addPasteRules(){return[Mn({find:Pm,type:this.type}),Mn({find:zm,type:this.type})]}}),Vm="listItem",Zu="textStyle",Yu=/^\s*([-+*])\s$/,Hm=V.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:t}){return["ul",be(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Vm,this.editor.getAttributes(Zu)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=cr({find:Yu,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=cr({find:Yu,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Zu),editor:this.editor})),[t]}}),qm=/(^|[^`])`([^`]+)`(?!`)/,jm=/(^|[^`])`([^`]+)`(?!`)/g,Wm=Ce.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",be(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[An({find:qm,type:this.type})]},addPasteRules(){return[Mn({find:jm,type:this.type})]}}),Um=/^```([a-z]+)?[\s\n]$/,Jm=/^~~~([a-z]+)?[\s\n]$/,Km=V.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:t=>{var e;const{languageClassPrefix:n}=this.options,o=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(s=>s.startsWith(n)).map(s=>s.replace(n,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",be(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(`
`);return!o||!s?!1:t.chain().command(({tr:u})=>(u.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const u=i.after();return u===void 0?!1:r.nodeAt(u)?t.commands.command(({tr:l})=>(l.setSelection(I.near(r.resolve(u))),!0)):t.commands.exitCode()}}},addInputRules(){return[Wo({find:Um,type:this.type,getAttributes:t=>({language:t[1]})}),Wo({find:Jm,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new ae({key:new Te("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=i==null?void 0:i.mode;if(!n||!o)return!1;const{tr:s,schema:u}=t.state,a=u.text(n.replace(/\r\n?/g,`
`));return s.replaceSelectionWith(this.type.create({language:o},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(F.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}}),Gm=V.create({name:"doc",topNode:!0,content:"block+"});function Zm(t={}){return new ae({view(e){return new Ym(e,t)}})}class Ym{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,i=this.editorView.dom,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,u=o.height/i.offsetHeight;if(n){let f=e.nodeBefore,d=e.nodeAfter;if(f||d){let h=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(h){let p=h.getBoundingClientRect(),m=f?p.bottom:p.top;f&&d&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*u;r={left:p.left,right:p.right,top:m-g,bottom:m+g}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),d=this.width/2*s;r={left:f.left-d,right:f.left+d,top:f.top,bottom:f.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.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",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let l,c;if(!a||a==document.body&&getComputedStyle(a).position=="static")l=-pageXOffset,c=-pageYOffset;else{let f=a.getBoundingClientRect(),d=f.width/a.offsetWidth,h=f.height/a.offsetHeight;l=f.left-a.scrollLeft*d,c=f.top-a.scrollTop*h}this.element.style.left=(r.left-l)/s+"px",this.element.style.top=(r.top-c)/u+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/u+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!o){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let u=gl(this.editorView.state.doc,s,this.editorView.dragging.slice);u!=null&&(s=u)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const Xm=G.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Zm(this.options)]}});class W extends I{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return W.valid(r)?new W(r):I.near(r)}content(){return D.empty}eq(e){return e instanceof W&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new W(e.resolve(n.pos))}getBookmark(){return new Ss(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!Qm(e)||!e1(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&W.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let u=e.node(s);if(n>0?e.indexAfter(s)<u.childCount:e.index(s)>0){o=u.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=n;let a=e.doc.resolve(i);if(W.valid(a))return a}for(;;){let s=n>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!_.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*n),r=!1;continue e}break}o=s,i+=n;let u=e.doc.resolve(i);if(W.valid(u))return u}return null}}}W.prototype.visible=!1;W.findFrom=W.findGapCursorFrom;I.jsonID("gapcursor",W);class Ss{constructor(e){this.pos=e}map(e){return new Ss(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return W.valid(n)?new W(n):I.near(n)}}function Pc(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Qm(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||Pc(i.type))return!0;if(i.inlineContent)return!1}}return!0}function e1(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||Pc(i.type))return!0;if(i.inlineContent)return!1}}return!0}function t1(){return new ae({props:{decorations:o1,createSelectionBetween(t,e,n){return e.pos==n.pos&&W.valid(n)?new W(n):null},handleClick:r1,handleKeyDown:n1,handleDOMEvents:{beforeinput:i1}}})}const n1=ic({ArrowLeft:Wr("horiz",-1),ArrowRight:Wr("horiz",1),ArrowUp:Wr("vert",-1),ArrowDown:Wr("vert",1)});function Wr(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,u=e>0?s.$to:s.$from,a=s.empty;if(s instanceof F){if(!o.endOfTextblock(n)||u.depth==0)return!1;a=!1,u=r.doc.resolve(e>0?u.after():u.before())}let l=W.findGapCursorFrom(u,e,a);return l?(i&&i(r.tr.setSelection(new W(l))),!0):!1}}function r1(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!W.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&_.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new W(r))),!0)}function i1(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof W))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=w.empty;for(let s=r.length-1;s>=0;s--)i=w.from(r[s].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new D(i,0,0));return o.setSelection(F.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function o1(t){if(!(t.selection instanceof W))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",J.create(t.doc,[Se.widget(t.selection.head,e,{key:"gapcursor"})])}const s1=G.create({name:"gapCursor",addProseMirrorPlugins(){return[t1()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=R(A(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),u1=V.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",be(this.options.HTMLAttributes,t)]},renderText(){return`
`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:o}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:u}=r.extensionManager,a=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:l,dispatch:c})=>{if(c&&a&&s){const f=a.filter(d=>u.includes(d.type.name));l.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),a1=V.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(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,be(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Wo({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var hi=200,ne=function(){};ne.prototype.append=function(e){return e.length?(e=ne.from(e),!this.length&&e||e.length<hi&&this.leafAppend(e)||this.length<hi&&e.leafPrepend(this)||this.appendInner(e)):this};ne.prototype.prepend=function(e){return e.length?ne.from(e).append(this):this};ne.prototype.appendInner=function(e){return new l1(this,e)};ne.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?ne.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};ne.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ne.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};ne.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},n,r),i};ne.from=function(e){return e instanceof ne?e:e&&e.length?new Lc(e):ne.empty};var Lc=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,u){for(var a=o;a<s;a++)if(i(this.values[a],u+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,u){for(var a=o-1;a>=s;a--)if(i(this.values[a],u+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=hi)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=hi)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(ne);ne.empty=new Lc([]);var l1=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,o,s){var u=this.left.length;if(i<u&&this.left.forEachInner(r,i,Math.min(o,u),s)===!1||o>u&&this.right.forEachInner(r,Math.max(i-u,0),Math.min(this.length,o)-u,s+u)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var u=this.left.length;if(i>u&&this.right.forEachInvertedInner(r,i-u,Math.max(o,u)-u,s+u)===!1||o<u&&this.left.forEachInvertedInner(r,Math.min(i,u),o,s)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(ne);const c1=500;class ze{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,u,a,l=[],c=[];return this.items.forEach((f,d)=>{if(!f.step){i||(i=this.remapping(r,d+1),o=i.maps.length),o--,c.push(f);return}if(i){c.push(new We(f.map));let h=f.step.map(i.slice(o)),p;h&&s.maybeStep(h).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],l.push(new We(p,void 0,void 0,l.length+c.length))),o--,p&&i.appendMap(p,o)}else s.maybeStep(f.step);if(f.selection)return u=i?f.selection.map(i.slice(o)):f.selection,a=new ze(this.items.slice(0,r).append(c.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:u}}addTransform(e,n,r,i){let o=[],s=this.eventCount,u=this.items,a=!i&&u.length?u.get(u.length-1):null;for(let c=0;c<e.steps.length;c++){let f=e.steps[c].invert(e.docs[c]),d=new We(e.mapping.maps[c],f,n),h;(h=a&&a.merge(d))&&(d=h,c?o.pop():u=u.slice(0,u.length-1)),o.push(d),n&&(s++,n=void 0),i||(a=d)}let l=s-r.depth;return l>d1&&(u=f1(u,l),s-=l),new ze(u.append(o),s)}remapping(e,n){let r=new rr;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new ze(this.items.append(e.map(n=>new We(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=e.mapping,s=e.steps.length,u=this.eventCount;this.items.forEach(d=>{d.selection&&u--},i);let a=n;this.items.forEach(d=>{let h=o.getMirror(--a);if(h==null)return;s=Math.min(s,h);let p=o.maps[h];if(d.step){let m=e.steps[h].invert(e.docs[h]),g=d.selection&&d.selection.map(o.slice(a+1,h));g&&u++,r.push(new We(p,m,g))}else r.push(new We(p))},i);let l=[];for(let d=n;d<s;d++)l.push(new We(o.maps[d]));let c=this.items.slice(0,i).append(l).append(r),f=new ze(c,u);return f.emptyItemCount()>c1&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],o=0;return this.items.forEach((s,u)=>{if(u>=e)i.push(s),s.selection&&o++;else if(s.step){let a=s.step.map(n.slice(r)),l=a&&a.getMap();if(r--,l&&n.appendMap(l,r),a){let c=s.selection&&s.selection.map(n.slice(r));c&&o++;let f=new We(l.invert(),a,c),d,h=i.length-1;(d=i.length&&i[h].merge(f))?i[h]=d:i.push(f)}}else s.map&&r--},this.items.length,0),new ze(ne.from(i.reverse()),o)}}ze.empty=new ze(ne.empty,0);function f1(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class We{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new We(n.getMap().invert(),n,this.selection)}}}class Ct{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const d1=20;function h1(t,e,n,r){let i=n.getMeta(Xt),o;if(i)return i.historyState;n.getMeta(g1)&&(t=new Ct(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(Xt))return s.getMeta(Xt).redo?new Ct(t.done.addTransform(n,void 0,r,Qr(e)),t.undone,Xu(n.mapping.maps),t.prevTime,t.prevComposition):new Ct(t.done,t.undone.addTransform(n,void 0,r,Qr(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let u=n.getMeta("composition"),a=t.prevTime==0||!s&&t.prevComposition!=u&&(t.prevTime<(n.time||0)-r.newGroupDelay||!p1(n,t.prevRanges)),l=s?ao(t.prevRanges,n.mapping):Xu(n.mapping.maps);return new Ct(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,Qr(e)),ze.empty,l,n.time,u??t.prevComposition)}else return(o=n.getMeta("rebased"))?new Ct(t.done.rebased(n,o),t.undone.rebased(n,o),ao(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Ct(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),ao(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function p1(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(n=!0)}),n}function Xu(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,o,s)=>e.push(o,s));return e}function ao(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),o=e.map(t[r+1],-1);i<=o&&n.push(i,o)}return n}function m1(t,e,n){let r=Qr(e),i=Xt.get(e).spec.config,o=(n?t.undone:t.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),u=(n?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),a=new Ct(n?u:o.remaining,n?o.remaining:u,null,0,-1);return o.transform.setSelection(s).setMeta(Xt,{redo:n,historyState:a})}let lo=!1,Qu=null;function Qr(t){let e=t.plugins;if(Qu!=e){lo=!1,Qu=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){lo=!0;break}}return lo}const Xt=new Te("history"),g1=new Te("closeHistory");function b1(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new ae({key:Xt,state:{init(){return new Ct(ze.empty,ze.empty,null,0,-1)},apply(e,n,r){return h1(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?$c:r=="historyRedo"?Vc:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function zc(t,e){return(n,r)=>{let i=Xt.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let o=m1(i,n,t);o&&r(e?o.scrollIntoView():o)}return!0}}const $c=zc(!1,!0),Vc=zc(!0,!0),y1=G.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>$c(t,e),redo:()=>({state:t,dispatch:e})=>Vc(t,e)}},addProseMirrorPlugins(){return[b1(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()}}}),x1=V.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",be(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!Fm(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$from:r,$to:i}=n,o=t();return r.parentOffset===0?o.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):Mc(n)?o.insertContentAt(i.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:s,dispatch:u})=>{var a;if(u){const{$to:l}=s.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?s.setSelection(F.create(s.doc,l.pos+1)):l.nodeAfter.isBlock?s.setSelection(_.create(s.doc,l.pos)):s.setSelection(F.create(s.doc,l.pos));else{const f=(a=l.parent.type.contentMatch.defaultType)===null||a===void 0?void 0:a.create();f&&(s.insert(c,f),s.setSelection(F.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Nm({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),k1=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,C1=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,v1=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,w1=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,E1=Ce.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",be(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[An({find:k1,type:this.type}),An({find:v1,type:this.type})]},addPasteRules(){return[Mn({find:C1,type:this.type}),Mn({find:w1,type:this.type})]}}),S1=V.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",be(this.options.HTMLAttributes,t),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)}}}),D1="listItem",ea="textStyle",ta=/^(\d+)\.\s$/,A1=V.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:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",be(this.options.HTMLAttributes,n),0]:["ol",be(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(D1,this.editor.getAttributes(ea)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=cr({find:ta,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=cr({find:ta,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(ea)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),M1=V.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",be(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),T1=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,_1=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,O1=Ce.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",be(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[An({find:T1,type:this.type})]},addPasteRules(){return[Mn({find:_1,type:this.type})]}}),N1=V.create({name:"text",group:"inline"}),F1=G.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push($m.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(Rm.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(Hm.configure(this.options.bulletList)),this.options.code!==!1&&t.push(Wm.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(Km.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(Gm.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(Xm.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(s1.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(u1.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(a1.configure(this.options.heading)),this.options.history!==!1&&t.push(y1.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(x1.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(E1.configure(this.options.italic)),this.options.listItem!==!1&&t.push(S1.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(A1.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(M1.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(O1.configure(this.options.strike)),this.options.text!==!1&&t.push(N1.configure(this.options.text)),t}}),na={};function I1(t){let e=na[t];if(e)return e;e=na[t]=[];for(let n=0;n<128;n++){const r=String.fromCharCode(n);e.push(r)}for(let n=0;n<t.length;n++){const r=t.charCodeAt(n);e[r]="%"+("0"+r.toString(16).toUpperCase()).slice(-2)}return e}function Tn(t,e){typeof e!="string"&&(e=Tn.defaultChars);const n=I1(e);return t.replace(/(%[a-f0-9]{2})+/gi,function(r){let i="";for(let o=0,s=r.length;o<s;o+=3){const u=parseInt(r.slice(o+1,o+3),16);if(u<128){i+=n[u];continue}if((u&224)===192&&o+3<s){const a=parseInt(r.slice(o+4,o+6),16);if((a&192)===128){const l=u<<6&1984|a&63;l<128?i+="<22><>":i+=String.fromCharCode(l),o+=3;continue}}if((u&240)===224&&o+6<s){const a=parseInt(r.slice(o+4,o+6),16),l=parseInt(r.slice(o+7,o+9),16);if((a&192)===128&&(l&192)===128){const c=u<<12&61440|a<<6&4032|l&63;c<2048||c>=55296&&c<=57343?i+="<22><><EFBFBD>":i+=String.fromCharCode(c),o+=6;continue}}if((u&248)===240&&o+9<s){const a=parseInt(r.slice(o+4,o+6),16),l=parseInt(r.slice(o+7,o+9),16),c=parseInt(r.slice(o+10,o+12),16);if((a&192)===128&&(l&192)===128&&(c&192)===128){let f=u<<18&1835008|a<<12&258048|l<<6&4032|c&63;f<65536||f>1114111?i+="<22><><EFBFBD><EFBFBD>":(f-=65536,i+=String.fromCharCode(55296+(f>>10),56320+(f&1023))),o+=9;continue}}i+="<22>"}return i})}Tn.defaultChars=";/?:@&=+$,#";Tn.componentChars="";const ra={};function R1(t){let e=ra[t];if(e)return e;e=ra[t]=[];for(let n=0;n<128;n++){const r=String.fromCharCode(n);/^[0-9a-z]$/i.test(r)?e.push(r):e.push("%"+("0"+n.toString(16).toUpperCase()).slice(-2))}for(let n=0;n<t.length;n++)e[t.charCodeAt(n)]=t[n];return e}function Cr(t,e,n){typeof e!="string"&&(n=e,e=Cr.defaultChars),typeof n>"u"&&(n=!0);const r=R1(e);let i="";for(let o=0,s=t.length;o<s;o++){const u=t.charCodeAt(o);if(n&&u===37&&o+2<s&&/^[0-9a-f]{2}$/i.test(t.slice(o+1,o+3))){i+=t.slice(o,o+3),o+=2;continue}if(u<128){i+=r[u];continue}if(u>=55296&&u<=57343){if(u>=55296&&u<=56319&&o+1<s){const a=t.charCodeAt(o+1);if(a>=56320&&a<=57343){i+=encodeURIComponent(t[o]+t[o+1]),o++;continue}}i+="%EF%BF%BD";continue}i+=encodeURIComponent(t[o])}return i}Cr.defaultChars=";/?:@&=+$,-_.!~*'()#";Cr.componentChars="-_.!~*'()";function Ds(t){let e="";return e+=t.protocol||"",e+=t.slashes?"//":"",e+=t.auth?t.auth+"@":"",t.hostname&&t.hostname.indexOf(":")!==-1?e+="["+t.hostname+"]":e+=t.hostname||"",e+=t.port?":"+t.port:"",e+=t.pathname||"",e+=t.search||"",e+=t.hash||"",e}function pi(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}const B1=/^([a-z0-9.+-]+:)/i,P1=/:[0-9]*$/,L1=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,z1=["<",">",'"',"`"," ","\r",`
`," "],$1=["{","}","|","\\","^","`"].concat(z1),V1=["'"].concat($1),ia=["%","/","?",";","#"].concat(V1),oa=["/","?","#"],H1=255,sa=/^[+a-z0-9A-Z_-]{0,63}$/,q1=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ua={javascript:!0,"javascript:":!0},aa={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function As(t,e){if(t&&t instanceof pi)return t;const n=new pi;return n.parse(t,e),n}pi.prototype.parse=function(t,e){let n,r,i,o=t;if(o=o.trim(),!e&&t.split("#").length===1){const l=L1.exec(o);if(l)return this.pathname=l[1],l[2]&&(this.search=l[2]),this}let s=B1.exec(o);if(s&&(s=s[0],n=s.toLowerCase(),this.protocol=s,o=o.substr(s.length)),(e||s||o.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=o.substr(0,2)==="//",i&&!(s&&ua[s])&&(o=o.substr(2),this.slashes=!0)),!ua[s]&&(i||s&&!aa[s])){let l=-1;for(let p=0;p<oa.length;p++)r=o.indexOf(oa[p]),r!==-1&&(l===-1||r<l)&&(l=r);let c,f;l===-1?f=o.lastIndexOf("@"):f=o.lastIndexOf("@",l),f!==-1&&(c=o.slice(0,f),o=o.slice(f+1),this.auth=c),l=-1;for(let p=0;p<ia.length;p++)r=o.indexOf(ia[p]),r!==-1&&(l===-1||r<l)&&(l=r);l===-1&&(l=o.length),o[l-1]===":"&&l--;const d=o.slice(0,l);o=o.slice(l),this.parseHost(d),this.hostname=this.hostname||"";const h=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!h){const p=this.hostname.split(/\./);for(let m=0,g=p.length;m<g;m++){const y=p[m];if(y&&!y.match(sa)){let x="";for(let k=0,b=y.length;k<b;k++)y.charCodeAt(k)>127?x+="x":x+=y[k];if(!x.match(sa)){const k=p.slice(0,m),b=p.slice(m+1),E=y.match(q1);E&&(k.push(E[1]),b.unshift(E[2])),b.length&&(o=b.join(".")+o),this.hostname=k.join(".");break}}}}this.hostname.length>H1&&(this.hostname=""),h&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}const u=o.indexOf("#");u!==-1&&(this.hash=o.substr(u),o=o.slice(0,u));const a=o.indexOf("?");return a!==-1&&(this.search=o.substr(a),o=o.slice(0,a)),o&&(this.pathname=o),aa[n]&&this.hostname&&!this.pathname&&(this.pathname=""),this};pi.prototype.parseHost=function(t){let e=P1.exec(t);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};const j1=Object.freeze(Object.defineProperty({__proto__:null,decode:Tn,encode:Cr,format:Ds,parse:As},Symbol.toStringTag,{value:"Module"})),Hc=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,qc=/[\0-\x1F\x7F-\x9F]/,W1=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,Ms=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,jc=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,Wc=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,U1=Object.freeze(Object.defineProperty({__proto__:null,Any:Hc,Cc:qc,Cf:W1,P:Ms,S:jc,Z:Wc},Symbol.toStringTag,{value:"Module"})),J1=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎸᏄϨrrowƀ;BDᅐᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ\0ᚕ᚛ᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsuᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ拔;櫙artint;樍Āao⁕Ācsα‰‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0耻¾䂾;慗;慜5;慘ƶ⁌\0;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚ;檒;檥;檤ȀEaes;扩pĀ;p℣檊rox»Ā;q檈Ā;qim;拧pf;쀀𝕘Āci⅃r;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❶❼➅➇ròࢨorneòarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;efभ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛òðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬Āet;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ëĀ;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓pĀ;sᆴ㑵;쀀⊔uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;h㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊;쀀⫋setneqĀ;q㦏㦒쀀⊋;쀀⫌Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(t=>t.charCodeAt(0))),K1=new Uint16Array("Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map(t=>t.charCodeAt(0)));var co;const G1=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),Z1=(co=String.fromCodePoint)!==null&&co!==void 0?co:function(t){let e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|t&1023),e+=String.fromCharCode(t),e};function Y1(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=G1.get(t))!==null&&e!==void 0?e:t}var Q;(function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z"})(Q||(Q={}));const X1=32;var Mt;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})(Mt||(Mt={}));function Jo(t){return t>=Q.ZERO&&t<=Q.NINE}function Q1(t){return t>=Q.UPPER_A&&t<=Q.UPPER_F||t>=Q.LOWER_A&&t<=Q.LOWER_F}function eg(t){return t>=Q.UPPER_A&&t<=Q.UPPER_Z||t>=Q.LOWER_A&&t<=Q.LOWER_Z||Jo(t)}function tg(t){return t===Q.EQUALS||eg(t)}var Y;(function(t){t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity"})(Y||(Y={}));var Et;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute"})(Et||(Et={}));class ng{constructor(e,n,r){this.decodeTree=e,this.emitCodePoint=n,this.errors=r,this.state=Y.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Et.Strict}startEntity(e){this.decodeMode=e,this.state=Y.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,n){switch(this.state){case Y.EntityStart:return e.charCodeAt(n)===Q.NUM?(this.state=Y.NumericStart,this.consumed+=1,this.stateNumericStart(e,n+1)):(this.state=Y.NamedEntity,this.stateNamedEntity(e,n));case Y.NumericStart:return this.stateNumericStart(e,n);case Y.NumericDecimal:return this.stateNumericDecimal(e,n);case Y.NumericHex:return this.stateNumericHex(e,n);case Y.NamedEntity:return this.stateNamedEntity(e,n)}}stateNumericStart(e,n){return n>=e.length?-1:(e.charCodeAt(n)|X1)===Q.LOWER_X?(this.state=Y.NumericHex,this.consumed+=1,this.stateNumericHex(e,n+1)):(this.state=Y.NumericDecimal,this.stateNumericDecimal(e,n))}addToNumericResult(e,n,r,i){if(n!==r){const o=r-n;this.result=this.result*Math.pow(i,o)+parseInt(e.substr(n,o),i),this.consumed+=o}}stateNumericHex(e,n){const r=n;for(;n<e.length;){const i=e.charCodeAt(n);if(Jo(i)||Q1(i))n+=1;else return this.addToNumericResult(e,r,n,16),this.emitNumericEntity(i,3)}return this.addToNumericResult(e,r,n,16),-1}stateNumericDecimal(e,n){const r=n;for(;n<e.length;){const i=e.charCodeAt(n);if(Jo(i))n+=1;else return this.addToNumericResult(e,r,n,10),this.emitNumericEntity(i,2)}return this.addToNumericResult(e,r,n,10),-1}emitNumericEntity(e,n){var r;if(this.consumed<=n)return(r=this.errors)===null||r===void 0||r.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===Q.SEMI)this.consumed+=1;else if(this.decodeMode===Et.Strict)return 0;return this.emitCodePoint(Y1(this.result),this.consumed),this.errors&&(e!==Q.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,n){const{decodeTree:r}=this;let i=r[this.treeIndex],o=(i&Mt.VALUE_LENGTH)>>14;for(;n<e.length;n++,this.excess++){const s=e.charCodeAt(n);if(this.treeIndex=rg(r,i,this.treeIndex+Math.max(1,o),s),this.treeIndex<0)return this.result===0||this.decodeMode===Et.Attribute&&(o===0||tg(s))?0:this.emitNotTerminatedNamedEntity();if(i=r[this.treeIndex],o=(i&Mt.VALUE_LENGTH)>>14,o!==0){if(s===Q.SEMI)return this.emitNamedEntityData(this.treeIndex,o,this.consumed+this.excess);this.decodeMode!==Et.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;const{result:n,decodeTree:r}=this,i=(r[n]&Mt.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,n,r){const{decodeTree:i}=this;return this.emitCodePoint(n===1?i[e]&~Mt.VALUE_LENGTH:i[e+1],r),n===3&&this.emitCodePoint(i[e+2],r),r}end(){var e;switch(this.state){case Y.NamedEntity:return this.result!==0&&(this.decodeMode!==Et.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Y.NumericDecimal:return this.emitNumericEntity(0,2);case Y.NumericHex:return this.emitNumericEntity(0,3);case Y.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Y.EntityStart:return 0}}}function Uc(t){let e="";const n=new ng(t,r=>e+=Z1(r));return function(i,o){let s=0,u=0;for(;(u=i.indexOf("&",u))>=0;){e+=i.slice(s,u),n.startEntity(o);const l=n.write(i,u+1);if(l<0){s=u+n.end();break}s=u+l,u=l===0?s+1:s}const a=e+i.slice(s);return e="",a}}function rg(t,e,n,r){const i=(e&Mt.BRANCH_LENGTH)>>7,o=e&Mt.JUMP_TABLE;if(i===0)return o!==0&&r===o?n:-1;if(o){const a=r-o;return a<0||a>=i?-1:t[n+a]-1}let s=n,u=s+i-1;for(;s<=u;){const a=s+u>>>1,l=t[a];if(l<r)s=a+1;else if(l>r)u=a-1;else return t[a+i]}return-1}const ig=Uc(J1);Uc(K1);function Jc(t,e=Et.Legacy){return ig(t,e)}function og(t){return Object.prototype.toString.call(t)}function Ts(t){return og(t)==="[object String]"}const sg=Object.prototype.hasOwnProperty;function ug(t,e){return sg.call(t,e)}function Ri(t){return Array.prototype.slice.call(arguments,1).forEach(function(n){if(n){if(typeof n!="object")throw new TypeError(n+"must be object");Object.keys(n).forEach(function(r){t[r]=n[r]})}}),t}function Kc(t,e,n){return[].concat(t.slice(0,e),n,t.slice(e+1))}function _s(t){return!(t>=55296&&t<=57343||t>=64976&&t<=65007||(t&65535)===65535||(t&65535)===65534||t>=0&&t<=8||t===11||t>=14&&t<=31||t>=127&&t<=159||t>1114111)}function mi(t){if(t>65535){t-=65536;const e=55296+(t>>10),n=56320+(t&1023);return String.fromCharCode(e,n)}return String.fromCharCode(t)}const Gc=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,ag=/&([a-z#][a-z0-9]{1,31});/gi,lg=new RegExp(Gc.source+"|"+ag.source,"gi"),cg=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function fg(t,e){if(e.charCodeAt(0)===35&&cg.test(e)){const r=e[1].toLowerCase()==="x"?parseInt(e.slice(2),16):parseInt(e.slice(1),10);return _s(r)?mi(r):t}const n=Jc(t);return n!==t?n:t}function dg(t){return t.indexOf("\\")<0?t:t.replace(Gc,"$1")}function _n(t){return t.indexOf("\\")<0&&t.indexOf("&")<0?t:t.replace(lg,function(e,n,r){return n||fg(e,r)})}const hg=/[&<>"]/,pg=/[&<>"]/g,mg={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function gg(t){return mg[t]}function It(t){return hg.test(t)?t.replace(pg,gg):t}const bg=/[.?*+^$[\]\\(){}|-]/g;function yg(t){return t.replace(bg,"\\$&")}function $(t){switch(t){case 9:case 32:return!0}return!1}function fr(t){if(t>=8192&&t<=8202)return!0;switch(t){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function dr(t){return Ms.test(t)||jc.test(t)}function hr(t){switch(t){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function Bi(t){return t=t.trim().replace(/\s+/g," "),"ẞ".toLowerCase()==="Ṿ"&&(t=t.replace(/ẞ/g,"ß")),t.toLowerCase().toUpperCase()}const xg={mdurl:j1,ucmicro:U1},kg=Object.freeze(Object.defineProperty({__proto__:null,arrayReplaceAt:Kc,assign:Ri,escapeHtml:It,escapeRE:yg,fromCodePoint:mi,has:ug,isMdAsciiPunct:hr,isPunctChar:dr,isSpace:$,isString:Ts,isValidEntityCode:_s,isWhiteSpace:fr,lib:xg,normalizeReference:Bi,unescapeAll:_n,unescapeMd:dg},Symbol.toStringTag,{value:"Module"}));function Cg(t,e,n){let r,i,o,s;const u=t.posMax,a=t.pos;for(t.pos=e+1,r=1;t.pos<u;){if(o=t.src.charCodeAt(t.pos),o===93&&(r--,r===0)){i=!0;break}if(s=t.pos,t.md.inline.skipToken(t),o===91){if(s===t.pos-1)r++;else if(n)return t.pos=a,-1}}let l=-1;return i&&(l=t.pos),t.pos=a,l}function vg(t,e,n){let r,i=e;const o={ok:!1,pos:0,str:""};if(t.charCodeAt(i)===60){for(i++;i<n;){if(r=t.charCodeAt(i),r===10||r===60)return o;if(r===62)return o.pos=i+1,o.str=_n(t.slice(e+1,i)),o.ok=!0,o;if(r===92&&i+1<n){i+=2;continue}i++}return o}let s=0;for(;i<n&&(r=t.charCodeAt(i),!(r===32||r<32||r===127));){if(r===92&&i+1<n){if(t.charCodeAt(i+1)===32)break;i+=2;continue}if(r===40&&(s++,s>32))return o;if(r===41){if(s===0)break;s--}i++}return e===i||s!==0||(o.str=_n(t.slice(e,i)),o.pos=i,o.ok=!0),o}function wg(t,e,n,r){let i,o=e;const s={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(r)s.str=r.str,s.marker=r.marker;else{if(o>=n)return s;let u=t.charCodeAt(o);if(u!==34&&u!==39&&u!==40)return s;e++,o++,u===40&&(u=41),s.marker=u}for(;o<n;){if(i=t.charCodeAt(o),i===s.marker)return s.pos=o+1,s.str+=_n(t.slice(e,o)),s.ok=!0,s;if(i===40&&s.marker===41)return s;i===92&&o+1<n&&o++,o++}return s.can_continue=!0,s.str+=_n(t.slice(e,o)),s}const Eg=Object.freeze(Object.defineProperty({__proto__:null,parseLinkDestination:vg,parseLinkLabel:Cg,parseLinkTitle:wg},Symbol.toStringTag,{value:"Module"})),tt={};tt.code_inline=function(t,e,n,r,i){const o=t[e];return"<code"+i.renderAttrs(o)+">"+It(o.content)+"</code>"};tt.code_block=function(t,e,n,r,i){const o=t[e];return"<pre"+i.renderAttrs(o)+"><code>"+It(t[e].content)+`</code></pre>
`};tt.fence=function(t,e,n,r,i){const o=t[e],s=o.info?_n(o.info).trim():"";let u="",a="";if(s){const c=s.split(/(\s+)/g);u=c[0],a=c.slice(2).join("")}let l;if(n.highlight?l=n.highlight(o.content,u,a)||It(o.content):l=It(o.content),l.indexOf("<pre")===0)return l+`
`;if(s){const c=o.attrIndex("class"),f=o.attrs?o.attrs.slice():[];c<0?f.push(["class",n.langPrefix+u]):(f[c]=f[c].slice(),f[c][1]+=" "+n.langPrefix+u);const d={attrs:f};return`<pre><code${i.renderAttrs(d)}>${l}</code></pre>
`}return`<pre><code${i.renderAttrs(o)}>${l}</code></pre>
`};tt.image=function(t,e,n,r,i){const o=t[e];return o.attrs[o.attrIndex("alt")][1]=i.renderInlineAsText(o.children,n,r),i.renderToken(t,e,n)};tt.hardbreak=function(t,e,n){return n.xhtmlOut?`<br />
`:`<br>
`};tt.softbreak=function(t,e,n){return n.breaks?n.xhtmlOut?`<br />
`:`<br>
`:`
`};tt.text=function(t,e){return It(t[e].content)};tt.html_block=function(t,e){return t[e].content};tt.html_inline=function(t,e){return t[e].content};function Bn(){this.rules=Ri({},tt)}Bn.prototype.renderAttrs=function(e){let n,r,i;if(!e.attrs)return"";for(i="",n=0,r=e.attrs.length;n<r;n++)i+=" "+It(e.attrs[n][0])+'="'+It(e.attrs[n][1])+'"';return i};Bn.prototype.renderToken=function(e,n,r){const i=e[n];let o="";if(i.hidden)return"";i.block&&i.nesting!==-1&&n&&e[n-1].hidden&&(o+=`
`),o+=(i.nesting===-1?"</":"<")+i.tag,o+=this.renderAttrs(i),i.nesting===0&&r.xhtmlOut&&(o+=" /");let s=!1;if(i.block&&(s=!0,i.nesting===1&&n+1<e.length)){const u=e[n+1];(u.type==="inline"||u.hidden||u.nesting===-1&&u.tag===i.tag)&&(s=!1)}return o+=s?`>
`:">",o};Bn.prototype.renderInline=function(t,e,n){let r="";const i=this.rules;for(let o=0,s=t.length;o<s;o++){const u=t[o].type;typeof i[u]<"u"?r+=i[u](t,o,e,n,this):r+=this.renderToken(t,o,e)}return r};Bn.prototype.renderInlineAsText=function(t,e,n){let r="";for(let i=0,o=t.length;i<o;i++)switch(t[i].type){case"text":r+=t[i].content;break;case"image":r+=this.renderInlineAsText(t[i].children,e,n);break;case"html_inline":case"html_block":r+=t[i].content;break;case"softbreak":case"hardbreak":r+=`
`;break}return r};Bn.prototype.render=function(t,e,n){let r="";const i=this.rules;for(let o=0,s=t.length;o<s;o++){const u=t[o].type;u==="inline"?r+=this.renderInline(t[o].children,e,n):typeof i[u]<"u"?r+=i[u](t,o,e,n,this):r+=this.renderToken(t,o,e,n)}return r};function ve(){this.__rules__=[],this.__cache__=null}ve.prototype.__find__=function(t){for(let e=0;e<this.__rules__.length;e++)if(this.__rules__[e].name===t)return e;return-1};ve.prototype.__compile__=function(){const t=this,e=[""];t.__rules__.forEach(function(n){n.enabled&&n.alt.forEach(function(r){e.indexOf(r)<0&&e.push(r)})}),t.__cache__={},e.forEach(function(n){t.__cache__[n]=[],t.__rules__.forEach(function(r){r.enabled&&(n&&r.alt.indexOf(n)<0||t.__cache__[n].push(r.fn))})})};ve.prototype.at=function(t,e,n){const r=this.__find__(t),i=n||{};if(r===-1)throw new Error("Parser rule not found: "+t);this.__rules__[r].fn=e,this.__rules__[r].alt=i.alt||[],this.__cache__=null};ve.prototype.before=function(t,e,n,r){const i=this.__find__(t),o=r||{};if(i===-1)throw new Error("Parser rule not found: "+t);this.__rules__.splice(i,0,{name:e,enabled:!0,fn:n,alt:o.alt||[]}),this.__cache__=null};ve.prototype.after=function(t,e,n,r){const i=this.__find__(t),o=r||{};if(i===-1)throw new Error("Parser rule not found: "+t);this.__rules__.splice(i+1,0,{name:e,enabled:!0,fn:n,alt:o.alt||[]}),this.__cache__=null};ve.prototype.push=function(t,e,n){const r=n||{};this.__rules__.push({name:t,enabled:!0,fn:e,alt:r.alt||[]}),this.__cache__=null};ve.prototype.enable=function(t,e){Array.isArray(t)||(t=[t]);const n=[];return t.forEach(function(r){const i=this.__find__(r);if(i<0){if(e)return;throw new Error("Rules manager: invalid rule name "+r)}this.__rules__[i].enabled=!0,n.push(r)},this),this.__cache__=null,n};ve.prototype.enableOnly=function(t,e){Array.isArray(t)||(t=[t]),this.__rules__.forEach(function(n){n.enabled=!1}),this.enable(t,e)};ve.prototype.disable=function(t,e){Array.isArray(t)||(t=[t]);const n=[];return t.forEach(function(r){const i=this.__find__(r);if(i<0){if(e)return;throw new Error("Rules manager: invalid rule name "+r)}this.__rules__[i].enabled=!1,n.push(r)},this),this.__cache__=null,n};ve.prototype.getRules=function(t){return this.__cache__===null&&this.__compile__(),this.__cache__[t]||[]};function Ve(t,e,n){this.type=t,this.tag=e,this.attrs=null,this.map=null,this.nesting=n,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}Ve.prototype.attrIndex=function(e){if(!this.attrs)return-1;const n=this.attrs;for(let r=0,i=n.length;r<i;r++)if(n[r][0]===e)return r;return-1};Ve.prototype.attrPush=function(e){this.attrs?this.attrs.push(e):this.attrs=[e]};Ve.prototype.attrSet=function(e,n){const r=this.attrIndex(e),i=[e,n];r<0?this.attrPush(i):this.attrs[r]=i};Ve.prototype.attrGet=function(e){const n=this.attrIndex(e);let r=null;return n>=0&&(r=this.attrs[n][1]),r};Ve.prototype.attrJoin=function(e,n){const r=this.attrIndex(e);r<0?this.attrPush([e,n]):this.attrs[r][1]=this.attrs[r][1]+" "+n};function Zc(t,e,n){this.src=t,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=e}Zc.prototype.Token=Ve;const Sg=/\r\n?|\n/g,Dg=/\0/g;function Ag(t){let e;e=t.src.replace(Sg,`
`),e=e.replace(Dg,"<22>"),t.src=e}function Mg(t){let e;t.inlineMode?(e=new t.Token("inline","",0),e.content=t.src,e.map=[0,1],e.children=[],t.tokens.push(e)):t.md.block.parse(t.src,t.md,t.env,t.tokens)}function Tg(t){const e=t.tokens;for(let n=0,r=e.length;n<r;n++){const i=e[n];i.type==="inline"&&t.md.inline.parse(i.content,t.md,t.env,i.children)}}function _g(t){return/^<a[>\s]/i.test(t)}function Og(t){return/^<\/a\s*>/i.test(t)}function Ng(t){const e=t.tokens;if(t.md.options.linkify)for(let n=0,r=e.length;n<r;n++){if(e[n].type!=="inline"||!t.md.linkify.pretest(e[n].content))continue;let i=e[n].children,o=0;for(let s=i.length-1;s>=0;s--){const u=i[s];if(u.type==="link_close"){for(s--;i[s].level!==u.level&&i[s].type!=="link_open";)s--;continue}if(u.type==="html_inline"&&(_g(u.content)&&o>0&&o--,Og(u.content)&&o++),!(o>0)&&u.type==="text"&&t.md.linkify.test(u.content)){const a=u.content;let l=t.md.linkify.match(a);const c=[];let f=u.level,d=0;l.length>0&&l[0].index===0&&s>0&&i[s-1].type==="text_special"&&(l=l.slice(1));for(let h=0;h<l.length;h++){const p=l[h].url,m=t.md.normalizeLink(p);if(!t.md.validateLink(m))continue;let g=l[h].text;l[h].schema?l[h].schema==="mailto:"&&!/^mailto:/i.test(g)?g=t.md.normalizeLinkText("mailto:"+g).replace(/^mailto:/,""):g=t.md.normalizeLinkText(g):g=t.md.normalizeLinkText("http://"+g).replace(/^http:\/\//,"");const y=l[h].index;if(y>d){const E=new t.Token("text","",0);E.content=a.slice(d,y),E.level=f,c.push(E)}const x=new t.Token("link_open","a",1);x.attrs=[["href",m]],x.level=f++,x.markup="linkify",x.info="auto",c.push(x);const k=new t.Token("text","",0);k.content=g,k.level=f,c.push(k);const b=new t.Token("link_close","a",-1);b.level=--f,b.markup="linkify",b.info="auto",c.push(b),d=l[h].lastIndex}if(d<a.length){const h=new t.Token("text","",0);h.content=a.slice(d),h.level=f,c.push(h)}e[n].children=i=Kc(i,s,c)}}}}const Yc=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,Fg=/\((c|tm|r)\)/i,Ig=/\((c|tm|r)\)/ig,Rg={c:"©",r:"®",tm:"™"};function Bg(t,e){return Rg[e.toLowerCase()]}function Pg(t){let e=0;for(let n=t.length-1;n>=0;n--){const r=t[n];r.type==="text"&&!e&&(r.content=r.content.replace(Ig,Bg)),r.type==="link_open"&&r.info==="auto"&&e--,r.type==="link_close"&&r.info==="auto"&&e++}}function Lg(t){let e=0;for(let n=t.length-1;n>=0;n--){const r=t[n];r.type==="text"&&!e&&Yc.test(r.content)&&(r.content=r.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1—").replace(/(^|\s)--(?=\s|$)/mg,"$1").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1")),r.type==="link_open"&&r.info==="auto"&&e--,r.type==="link_close"&&r.info==="auto"&&e++}}function zg(t){let e;if(t.md.options.typographer)for(e=t.tokens.length-1;e>=0;e--)t.tokens[e].type==="inline"&&(Fg.test(t.tokens[e].content)&&Pg(t.tokens[e].children),Yc.test(t.tokens[e].content)&&Lg(t.tokens[e].children))}const $g=/['"]/,la=/['"]/g,ca="";function Ur(t,e,n){return t.slice(0,e)+n+t.slice(e+1)}function Vg(t,e){let n;const r=[];for(let i=0;i<t.length;i++){const o=t[i],s=t[i].level;for(n=r.length-1;n>=0&&!(r[n].level<=s);n--);if(r.length=n+1,o.type!=="text")continue;let u=o.content,a=0,l=u.length;e:for(;a<l;){la.lastIndex=a;const c=la.exec(u);if(!c)break;let f=!0,d=!0;a=c.index+1;const h=c[0]==="'";let p=32;if(c.index-1>=0)p=u.charCodeAt(c.index-1);else for(n=i-1;n>=0&&!(t[n].type==="softbreak"||t[n].type==="hardbreak");n--)if(t[n].content){p=t[n].content.charCodeAt(t[n].content.length-1);break}let m=32;if(a<l)m=u.charCodeAt(a);else for(n=i+1;n<t.length&&!(t[n].type==="softbreak"||t[n].type==="hardbreak");n++)if(t[n].content){m=t[n].content.charCodeAt(0);break}const g=hr(p)||dr(String.fromCharCode(p)),y=hr(m)||dr(String.fromCharCode(m)),x=fr(p),k=fr(m);if(k?f=!1:y&&(x||g||(f=!1)),x?d=!1:g&&(k||y||(d=!1)),m===34&&c[0]==='"'&&p>=48&&p<=57&&(d=f=!1),f&&d&&(f=g,d=y),!f&&!d){h&&(o.content=Ur(o.content,c.index,ca));continue}if(d)for(n=r.length-1;n>=0;n--){let b=r[n];if(r[n].level<s)break;if(b.single===h&&r[n].level===s){b=r[n];let E,C;h?(E=e.md.options.quotes[2],C=e.md.options.quotes[3]):(E=e.md.options.quotes[0],C=e.md.options.quotes[1]),o.content=Ur(o.content,c.index,C),t[b.token].content=Ur(t[b.token].content,b.pos,E),a+=C.length-1,b.token===i&&(a+=E.length-1),u=o.content,l=u.length,r.length=n;continue e}}f?r.push({token:i,pos:c.index,single:h,level:s}):d&&h&&(o.content=Ur(o.content,c.index,ca))}}}function Hg(t){if(t.md.options.typographer)for(let e=t.tokens.length-1;e>=0;e--)t.tokens[e].type!=="inline"||!$g.test(t.tokens[e].content)||Vg(t.tokens[e].children,t)}function qg(t){let e,n;const r=t.tokens,i=r.length;for(let o=0;o<i;o++){if(r[o].type!=="inline")continue;const s=r[o].children,u=s.length;for(e=0;e<u;e++)s[e].type==="text_special"&&(s[e].type="text");for(e=n=0;e<u;e++)s[e].type==="text"&&e+1<u&&s[e+1].type==="text"?s[e+1].content=s[e].content+s[e+1].content:(e!==n&&(s[n]=s[e]),n++);e!==n&&(s.length=n)}}const fo=[["normalize",Ag],["block",Mg],["inline",Tg],["linkify",Ng],["replacements",zg],["smartquotes",Hg],["text_join",qg]];function Os(){this.ruler=new ve;for(let t=0;t<fo.length;t++)this.ruler.push(fo[t][0],fo[t][1])}Os.prototype.process=function(t){const e=this.ruler.getRules("");for(let n=0,r=e.length;n<r;n++)e[n](t)};Os.prototype.State=Zc;function nt(t,e,n,r){this.src=t,this.md=e,this.env=n,this.tokens=r,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0;const i=this.src;for(let o=0,s=0,u=0,a=0,l=i.length,c=!1;s<l;s++){const f=i.charCodeAt(s);if(!c)if($(f)){u++,f===9?a+=4-a%4:a++;continue}else c=!0;(f===10||s===l-1)&&(f!==10&&s++,this.bMarks.push(o),this.eMarks.push(s),this.tShift.push(u),this.sCount.push(a),this.bsCount.push(0),c=!1,u=0,a=0,o=s+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}nt.prototype.push=function(t,e,n){const r=new Ve(t,e,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r};nt.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]};nt.prototype.skipEmptyLines=function(e){for(let n=this.lineMax;e<n&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e};nt.prototype.skipSpaces=function(e){for(let n=this.src.length;e<n;e++){const r=this.src.charCodeAt(e);if(!$(r))break}return e};nt.prototype.skipSpacesBack=function(e,n){if(e<=n)return e;for(;e>n;)if(!$(this.src.charCodeAt(--e)))return e+1;return e};nt.prototype.skipChars=function(e,n){for(let r=this.src.length;e<r&&this.src.charCodeAt(e)===n;e++);return e};nt.prototype.skipCharsBack=function(e,n,r){if(e<=r)return e;for(;e>r;)if(n!==this.src.charCodeAt(--e))return e+1;return e};nt.prototype.getLines=function(e,n,r,i){if(e>=n)return"";const o=new Array(n-e);for(let s=0,u=e;u<n;u++,s++){let a=0;const l=this.bMarks[u];let c=l,f;for(u+1<n||i?f=this.eMarks[u]+1:f=this.eMarks[u];c<f&&a<r;){const d=this.src.charCodeAt(c);if($(d))d===9?a+=4-(a+this.bsCount[u])%4:a++;else if(c-l<this.tShift[u])a++;else break;c++}a>r?o[s]=new Array(a-r+1).join(" ")+this.src.slice(c,f):o[s]=this.src.slice(c,f)}return o.join("")};nt.prototype.Token=Ve;const jg=65536;function ho(t,e){const n=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];return t.src.slice(n,r)}function fa(t){const e=[],n=t.length;let r=0,i=t.charCodeAt(r),o=!1,s=0,u="";for(;r<n;)i===124&&(o?(u+=t.substring(s,r-1),s=r):(e.push(u+t.substring(s,r)),u="",s=r+1)),o=i===92,r++,i=t.charCodeAt(r);return e.push(u+t.substring(s)),e}function Wg(t,e,n,r){if(e+2>n)return!1;let i=e+1;if(t.sCount[i]<t.blkIndent||t.sCount[i]-t.blkIndent>=4)return!1;let o=t.bMarks[i]+t.tShift[i];if(o>=t.eMarks[i])return!1;const s=t.src.charCodeAt(o++);if(s!==124&&s!==45&&s!==58||o>=t.eMarks[i])return!1;const u=t.src.charCodeAt(o++);if(u!==124&&u!==45&&u!==58&&!$(u)||s===45&&$(u))return!1;for(;o<t.eMarks[i];){const b=t.src.charCodeAt(o);if(b!==124&&b!==45&&b!==58&&!$(b))return!1;o++}let a=ho(t,e+1),l=a.split("|");const c=[];for(let b=0;b<l.length;b++){const E=l[b].trim();if(!E){if(b===0||b===l.length-1)continue;return!1}if(!/^:?-+:?$/.test(E))return!1;E.charCodeAt(E.length-1)===58?c.push(E.charCodeAt(0)===58?"center":"right"):E.charCodeAt(0)===58?c.push("left"):c.push("")}if(a=ho(t,e).trim(),a.indexOf("|")===-1||t.sCount[e]-t.blkIndent>=4)return!1;l=fa(a),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop();const f=l.length;if(f===0||f!==c.length)return!1;if(r)return!0;const d=t.parentType;t.parentType="table";const h=t.md.block.ruler.getRules("blockquote"),p=t.push("table_open","table",1),m=[e,0];p.map=m;const g=t.push("thead_open","thead",1);g.map=[e,e+1];const y=t.push("tr_open","tr",1);y.map=[e,e+1];for(let b=0;b<l.length;b++){const E=t.push("th_open","th",1);c[b]&&(E.attrs=[["style","text-align:"+c[b]]]);const C=t.push("inline","",0);C.content=l[b].trim(),C.children=[],t.push("th_close","th",-1)}t.push("tr_close","tr",-1),t.push("thead_close","thead",-1);let x,k=0;for(i=e+2;i<n&&!(t.sCount[i]<t.blkIndent);i++){let b=!1;for(let C=0,S=h.length;C<S;C++)if(h[C](t,i,n,!0)){b=!0;break}if(b||(a=ho(t,i).trim(),!a)||t.sCount[i]-t.blkIndent>=4||(l=fa(a),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop(),k+=f-l.length,k>jg))break;if(i===e+2){const C=t.push("tbody_open","tbody",1);C.map=x=[e+2,0]}const E=t.push("tr_open","tr",1);E.map=[i,i+1];for(let C=0;C<f;C++){const S=t.push("td_open","td",1);c[C]&&(S.attrs=[["style","text-align:"+c[C]]]);const M=t.push("inline","",0);M.content=l[C]?l[C].trim():"",M.children=[],t.push("td_close","td",-1)}t.push("tr_close","tr",-1)}return x&&(t.push("tbody_close","tbody",-1),x[1]=i),t.push("table_close","table",-1),m[1]=i,t.parentType=d,t.line=i,!0}function Ug(t,e,n){if(t.sCount[e]-t.blkIndent<4)return!1;let r=e+1,i=r;for(;r<n;){if(t.isEmpty(r)){r++;continue}if(t.sCount[r]-t.blkIndent>=4){r++,i=r;continue}break}t.line=i;const o=t.push("code_block","code",0);return o.content=t.getLines(e,i,4+t.blkIndent,!1)+`
`,o.map=[e,t.line],!0}function Jg(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],o=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||i+3>o)return!1;const s=t.src.charCodeAt(i);if(s!==126&&s!==96)return!1;let u=i;i=t.skipChars(i,s);let a=i-u;if(a<3)return!1;const l=t.src.slice(u,i),c=t.src.slice(i,o);if(s===96&&c.indexOf(String.fromCharCode(s))>=0)return!1;if(r)return!0;let f=e,d=!1;for(;f++,!(f>=n||(i=u=t.bMarks[f]+t.tShift[f],o=t.eMarks[f],i<o&&t.sCount[f]<t.blkIndent));)if(t.src.charCodeAt(i)===s&&!(t.sCount[f]-t.blkIndent>=4)&&(i=t.skipChars(i,s),!(i-u<a)&&(i=t.skipSpaces(i),!(i<o)))){d=!0;break}a=t.sCount[e],t.line=f+(d?1:0);const h=t.push("fence","code",0);return h.info=c,h.content=t.getLines(e+1,f,a,!0),h.markup=l,h.map=[e,t.line],!0}function Kg(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],o=t.eMarks[e];const s=t.lineMax;if(t.sCount[e]-t.blkIndent>=4||t.src.charCodeAt(i)!==62)return!1;if(r)return!0;const u=[],a=[],l=[],c=[],f=t.md.block.ruler.getRules("blockquote"),d=t.parentType;t.parentType="blockquote";let h=!1,p;for(p=e;p<n;p++){const k=t.sCount[p]<t.blkIndent;if(i=t.bMarks[p]+t.tShift[p],o=t.eMarks[p],i>=o)break;if(t.src.charCodeAt(i++)===62&&!k){let E=t.sCount[p]+1,C,S;t.src.charCodeAt(i)===32?(i++,E++,S=!1,C=!0):t.src.charCodeAt(i)===9?(C=!0,(t.bsCount[p]+E)%4===3?(i++,E++,S=!1):S=!0):C=!1;let M=E;for(u.push(t.bMarks[p]),t.bMarks[p]=i;i<o;){const O=t.src.charCodeAt(i);if($(O))O===9?M+=4-(M+t.bsCount[p]+(S?1:0))%4:M++;else break;i++}h=i>=o,a.push(t.bsCount[p]),t.bsCount[p]=t.sCount[p]+1+(C?1:0),l.push(t.sCount[p]),t.sCount[p]=M-E,c.push(t.tShift[p]),t.tShift[p]=i-t.bMarks[p];continue}if(h)break;let b=!1;for(let E=0,C=f.length;E<C;E++)if(f[E](t,p,n,!0)){b=!0;break}if(b){t.lineMax=p,t.blkIndent!==0&&(u.push(t.bMarks[p]),a.push(t.bsCount[p]),c.push(t.tShift[p]),l.push(t.sCount[p]),t.sCount[p]-=t.blkIndent);break}u.push(t.bMarks[p]),a.push(t.bsCount[p]),c.push(t.tShift[p]),l.push(t.sCount[p]),t.sCount[p]=-1}const m=t.blkIndent;t.blkIndent=0;const g=t.push("blockquote_open","blockquote",1);g.markup=">";const y=[e,0];g.map=y,t.md.block.tokenize(t,e,p);const x=t.push("blockquote_close","blockquote",-1);x.markup=">",t.lineMax=s,t.parentType=d,y[1]=t.line;for(let k=0;k<c.length;k++)t.bMarks[k+e]=u[k],t.tShift[k+e]=c[k],t.sCount[k+e]=l[k],t.bsCount[k+e]=a[k];return t.blkIndent=m,!0}function Gg(t,e,n,r){const i=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;let o=t.bMarks[e]+t.tShift[e];const s=t.src.charCodeAt(o++);if(s!==42&&s!==45&&s!==95)return!1;let u=1;for(;o<i;){const l=t.src.charCodeAt(o++);if(l!==s&&!$(l))return!1;l===s&&u++}if(u<3)return!1;if(r)return!0;t.line=e+1;const a=t.push("hr","hr",0);return a.map=[e,t.line],a.markup=Array(u+1).join(String.fromCharCode(s)),!0}function da(t,e){const n=t.eMarks[e];let r=t.bMarks[e]+t.tShift[e];const i=t.src.charCodeAt(r++);if(i!==42&&i!==45&&i!==43)return-1;if(r<n){const o=t.src.charCodeAt(r);if(!$(o))return-1}return r}function ha(t,e){const n=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];let i=n;if(i+1>=r)return-1;let o=t.src.charCodeAt(i++);if(o<48||o>57)return-1;for(;;){if(i>=r)return-1;if(o=t.src.charCodeAt(i++),o>=48&&o<=57){if(i-n>=10)return-1;continue}if(o===41||o===46)break;return-1}return i<r&&(o=t.src.charCodeAt(i),!$(o))?-1:i}function Zg(t,e){const n=t.level+2;for(let r=e+2,i=t.tokens.length-2;r<i;r++)t.tokens[r].level===n&&t.tokens[r].type==="paragraph_open"&&(t.tokens[r+2].hidden=!0,t.tokens[r].hidden=!0,r+=2)}function Yg(t,e,n,r){let i,o,s,u,a=e,l=!0;if(t.sCount[a]-t.blkIndent>=4||t.listIndent>=0&&t.sCount[a]-t.listIndent>=4&&t.sCount[a]<t.blkIndent)return!1;let c=!1;r&&t.parentType==="paragraph"&&t.sCount[a]>=t.blkIndent&&(c=!0);let f,d,h;if((h=ha(t,a))>=0){if(f=!0,s=t.bMarks[a]+t.tShift[a],d=Number(t.src.slice(s,h-1)),c&&d!==1)return!1}else if((h=da(t,a))>=0)f=!1;else return!1;if(c&&t.skipSpaces(h)>=t.eMarks[a])return!1;if(r)return!0;const p=t.src.charCodeAt(h-1),m=t.tokens.length;f?(u=t.push("ordered_list_open","ol",1),d!==1&&(u.attrs=[["start",d]])):u=t.push("bullet_list_open","ul",1);const g=[a,0];u.map=g,u.markup=String.fromCharCode(p);let y=!1;const x=t.md.block.ruler.getRules("list"),k=t.parentType;for(t.parentType="list";a<n;){o=h,i=t.eMarks[a];const b=t.sCount[a]+h-(t.bMarks[a]+t.tShift[a]);let E=b;for(;o<i;){const U=t.src.charCodeAt(o);if(U===9)E+=4-(E+t.bsCount[a])%4;else if(U===32)E++;else break;o++}const C=o;let S;C>=i?S=1:S=E-b,S>4&&(S=1);const M=b+S;u=t.push("list_item_open","li",1),u.markup=String.fromCharCode(p);const O=[a,0];u.map=O,f&&(u.info=t.src.slice(s,h-1));const P=t.tight,j=t.tShift[a],q=t.sCount[a],H=t.listIndent;if(t.listIndent=t.blkIndent,t.blkIndent=M,t.tight=!0,t.tShift[a]=C-t.bMarks[a],t.sCount[a]=E,C>=i&&t.isEmpty(a+1)?t.line=Math.min(t.line+2,n):t.md.block.tokenize(t,a,n,!0),(!t.tight||y)&&(l=!1),y=t.line-a>1&&t.isEmpty(t.line-1),t.blkIndent=t.listIndent,t.listIndent=H,t.tShift[a]=j,t.sCount[a]=q,t.tight=P,u=t.push("list_item_close","li",-1),u.markup=String.fromCharCode(p),a=t.line,O[1]=a,a>=n||t.sCount[a]<t.blkIndent||t.sCount[a]-t.blkIndent>=4)break;let le=!1;for(let U=0,Z=x.length;U<Z;U++)if(x[U](t,a,n,!0)){le=!0;break}if(le)break;if(f){if(h=ha(t,a),h<0)break;s=t.bMarks[a]+t.tShift[a]}else if(h=da(t,a),h<0)break;if(p!==t.src.charCodeAt(h-1))break}return f?u=t.push("ordered_list_close","ol",-1):u=t.push("bullet_list_close","ul",-1),u.markup=String.fromCharCode(p),g[1]=a,t.line=a,t.parentType=k,l&&Zg(t,m),!0}function Xg(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],o=t.eMarks[e],s=e+1;if(t.sCount[e]-t.blkIndent>=4||t.src.charCodeAt(i)!==91)return!1;function u(x){const k=t.lineMax;if(x>=k||t.isEmpty(x))return null;let b=!1;if(t.sCount[x]-t.blkIndent>3&&(b=!0),t.sCount[x]<0&&(b=!0),!b){const S=t.md.block.ruler.getRules("reference"),M=t.parentType;t.parentType="reference";let O=!1;for(let P=0,j=S.length;P<j;P++)if(S[P](t,x,k,!0)){O=!0;break}if(t.parentType=M,O)return null}const E=t.bMarks[x]+t.tShift[x],C=t.eMarks[x];return t.src.slice(E,C+1)}let a=t.src.slice(i,o+1);o=a.length;let l=-1;for(i=1;i<o;i++){const x=a.charCodeAt(i);if(x===91)return!1;if(x===93){l=i;break}else if(x===10){const k=u(s);k!==null&&(a+=k,o=a.length,s++)}else if(x===92&&(i++,i<o&&a.charCodeAt(i)===10)){const k=u(s);k!==null&&(a+=k,o=a.length,s++)}}if(l<0||a.charCodeAt(l+1)!==58)return!1;for(i=l+2;i<o;i++){const x=a.charCodeAt(i);if(x===10){const k=u(s);k!==null&&(a+=k,o=a.length,s++)}else if(!$(x))break}const c=t.md.helpers.parseLinkDestination(a,i,o);if(!c.ok)return!1;const f=t.md.normalizeLink(c.str);if(!t.md.validateLink(f))return!1;i=c.pos;const d=i,h=s,p=i;for(;i<o;i++){const x=a.charCodeAt(i);if(x===10){const k=u(s);k!==null&&(a+=k,o=a.length,s++)}else if(!$(x))break}let m=t.md.helpers.parseLinkTitle(a,i,o);for(;m.can_continue;){const x=u(s);if(x===null)break;a+=x,i=o,o=a.length,s++,m=t.md.helpers.parseLinkTitle(a,i,o,m)}let g;for(i<o&&p!==i&&m.ok?(g=m.str,i=m.pos):(g="",i=d,s=h);i<o;){const x=a.charCodeAt(i);if(!$(x))break;i++}if(i<o&&a.charCodeAt(i)!==10&&g)for(g="",i=d,s=h;i<o;){const x=a.charCodeAt(i);if(!$(x))break;i++}if(i<o&&a.charCodeAt(i)!==10)return!1;const y=Bi(a.slice(1,l));return y?(r||(typeof t.env.references>"u"&&(t.env.references={}),typeof t.env.references[y]>"u"&&(t.env.references[y]={title:g,href:f}),t.line=s),!0):!1}const Qg=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],eb="[a-zA-Z_:][a-zA-Z0-9:._-]*",tb="[^\"'=<>`\\x00-\\x20]+",nb="'[^']*'",rb='"[^"]*"',ib="(?:"+tb+"|"+nb+"|"+rb+")",ob="(?:\\s+"+eb+"(?:\\s*=\\s*"+ib+")?)",Xc="<[A-Za-z][A-Za-z0-9\\-]*"+ob+"*\\s*\\/?>",Qc="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",sb="<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->",ub="<[?][\\s\\S]*?[?]>",ab="<![A-Za-z][^>]*>",lb="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",cb=new RegExp("^(?:"+Xc+"|"+Qc+"|"+sb+"|"+ub+"|"+ab+"|"+lb+")"),fb=new RegExp("^(?:"+Xc+"|"+Qc+")"),pn=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+Qg.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(fb.source+"\\s*$"),/^$/,!1]];function db(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],o=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||!t.md.options.html||t.src.charCodeAt(i)!==60)return!1;let s=t.src.slice(i,o),u=0;for(;u<pn.length&&!pn[u][0].test(s);u++);if(u===pn.length)return!1;if(r)return pn[u][2];let a=e+1;if(!pn[u][1].test(s)){for(;a<n&&!(t.sCount[a]<t.blkIndent);a++)if(i=t.bMarks[a]+t.tShift[a],o=t.eMarks[a],s=t.src.slice(i,o),pn[u][1].test(s)){s.length!==0&&a++;break}}t.line=a;const l=t.push("html_block","",0);return l.map=[e,a],l.content=t.getLines(e,a,t.blkIndent,!0),!0}function hb(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],o=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;let s=t.src.charCodeAt(i);if(s!==35||i>=o)return!1;let u=1;for(s=t.src.charCodeAt(++i);s===35&&i<o&&u<=6;)u++,s=t.src.charCodeAt(++i);if(u>6||i<o&&!$(s))return!1;if(r)return!0;o=t.skipSpacesBack(o,i);const a=t.skipCharsBack(o,35,i);a>i&&$(t.src.charCodeAt(a-1))&&(o=a),t.line=e+1;const l=t.push("heading_open","h"+String(u),1);l.markup="########".slice(0,u),l.map=[e,t.line];const c=t.push("inline","",0);c.content=t.src.slice(i,o).trim(),c.map=[e,t.line],c.children=[];const f=t.push("heading_close","h"+String(u),-1);return f.markup="########".slice(0,u),!0}function pb(t,e,n){const r=t.md.block.ruler.getRules("paragraph");if(t.sCount[e]-t.blkIndent>=4)return!1;const i=t.parentType;t.parentType="paragraph";let o=0,s,u=e+1;for(;u<n&&!t.isEmpty(u);u++){if(t.sCount[u]-t.blkIndent>3)continue;if(t.sCount[u]>=t.blkIndent){let h=t.bMarks[u]+t.tShift[u];const p=t.eMarks[u];if(h<p&&(s=t.src.charCodeAt(h),(s===45||s===61)&&(h=t.skipChars(h,s),h=t.skipSpaces(h),h>=p))){o=s===61?1:2;break}}if(t.sCount[u]<0)continue;let d=!1;for(let h=0,p=r.length;h<p;h++)if(r[h](t,u,n,!0)){d=!0;break}if(d)break}if(!o)return!1;const a=t.getLines(e,u,t.blkIndent,!1).trim();t.line=u+1;const l=t.push("heading_open","h"+String(o),1);l.markup=String.fromCharCode(s),l.map=[e,t.line];const c=t.push("inline","",0);c.content=a,c.map=[e,t.line-1],c.children=[];const f=t.push("heading_close","h"+String(o),-1);return f.markup=String.fromCharCode(s),t.parentType=i,!0}function mb(t,e,n){const r=t.md.block.ruler.getRules("paragraph"),i=t.parentType;let o=e+1;for(t.parentType="paragraph";o<n&&!t.isEmpty(o);o++){if(t.sCount[o]-t.blkIndent>3||t.sCount[o]<0)continue;let l=!1;for(let c=0,f=r.length;c<f;c++)if(r[c](t,o,n,!0)){l=!0;break}if(l)break}const s=t.getLines(e,o,t.blkIndent,!1).trim();t.line=o;const u=t.push("paragraph_open","p",1);u.map=[e,t.line];const a=t.push("inline","",0);return a.content=s,a.map=[e,t.line],a.children=[],t.push("paragraph_close","p",-1),t.parentType=i,!0}const Jr=[["table",Wg,["paragraph","reference"]],["code",Ug],["fence",Jg,["paragraph","reference","blockquote","list"]],["blockquote",Kg,["paragraph","reference","blockquote","list"]],["hr",Gg,["paragraph","reference","blockquote","list"]],["list",Yg,["paragraph","reference","blockquote"]],["reference",Xg],["html_block",db,["paragraph","reference","blockquote"]],["heading",hb,["paragraph","reference","blockquote"]],["lheading",pb],["paragraph",mb]];function Pi(){this.ruler=new ve;for(let t=0;t<Jr.length;t++)this.ruler.push(Jr[t][0],Jr[t][1],{alt:(Jr[t][2]||[]).slice()})}Pi.prototype.tokenize=function(t,e,n){const r=this.ruler.getRules(""),i=r.length,o=t.md.options.maxNesting;let s=e,u=!1;for(;s<n&&(t.line=s=t.skipEmptyLines(s),!(s>=n||t.sCount[s]<t.blkIndent));){if(t.level>=o){t.line=n;break}const a=t.line;let l=!1;for(let c=0;c<i;c++)if(l=r[c](t,s,n,!1),l){if(a>=t.line)throw new Error("block rule didn't increment state.line");break}if(!l)throw new Error("none of the block rules matched");t.tight=!u,t.isEmpty(t.line-1)&&(u=!0),s=t.line,s<n&&t.isEmpty(s)&&(u=!0,s++,t.line=s)}};Pi.prototype.parse=function(t,e,n,r){if(!t)return;const i=new this.State(t,e,n,r);this.tokenize(i,i.line,i.lineMax)};Pi.prototype.State=nt;function vr(t,e,n,r){this.src=t,this.env=n,this.md=e,this.tokens=r,this.tokens_meta=Array(r.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}vr.prototype.pushPending=function(){const t=new Ve("text","",0);return t.content=this.pending,t.level=this.pendingLevel,this.tokens.push(t),this.pending="",t};vr.prototype.push=function(t,e,n){this.pending&&this.pushPending();const r=new Ve(t,e,n);let i=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r};vr.prototype.scanDelims=function(t,e){const n=this.posMax,r=this.src.charCodeAt(t),i=t>0?this.src.charCodeAt(t-1):32;let o=t;for(;o<n&&this.src.charCodeAt(o)===r;)o++;const s=o-t,u=o<n?this.src.charCodeAt(o):32,a=hr(i)||dr(String.fromCharCode(i)),l=hr(u)||dr(String.fromCharCode(u)),c=fr(i),f=fr(u),d=!f&&(!l||c||a),h=!c&&(!a||f||l);return{can_open:d&&(e||!h||a),can_close:h&&(e||!d||l),length:s}};vr.prototype.Token=Ve;function gb(t){switch(t){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function bb(t,e){let n=t.pos;for(;n<t.posMax&&!gb(t.src.charCodeAt(n));)n++;return n===t.pos?!1:(e||(t.pending+=t.src.slice(t.pos,n)),t.pos=n,!0)}const yb=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function xb(t,e){if(!t.md.options.linkify||t.linkLevel>0)return!1;const n=t.pos,r=t.posMax;if(n+3>r||t.src.charCodeAt(n)!==58||t.src.charCodeAt(n+1)!==47||t.src.charCodeAt(n+2)!==47)return!1;const i=t.pending.match(yb);if(!i)return!1;const o=i[1],s=t.md.linkify.matchAtStart(t.src.slice(n-o.length));if(!s)return!1;let u=s.url;if(u.length<=o.length)return!1;u=u.replace(/\*+$/,"");const a=t.md.normalizeLink(u);if(!t.md.validateLink(a))return!1;if(!e){t.pending=t.pending.slice(0,-o.length);const l=t.push("link_open","a",1);l.attrs=[["href",a]],l.markup="linkify",l.info="auto";const c=t.push("text","",0);c.content=t.md.normalizeLinkText(u);const f=t.push("link_close","a",-1);f.markup="linkify",f.info="auto"}return t.pos+=u.length-o.length,!0}function kb(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==10)return!1;const r=t.pending.length-1,i=t.posMax;if(!e)if(r>=0&&t.pending.charCodeAt(r)===32)if(r>=1&&t.pending.charCodeAt(r-1)===32){let o=r-1;for(;o>=1&&t.pending.charCodeAt(o-1)===32;)o--;t.pending=t.pending.slice(0,o),t.push("hardbreak","br",0)}else t.pending=t.pending.slice(0,-1),t.push("softbreak","br",0);else t.push("softbreak","br",0);for(n++;n<i&&$(t.src.charCodeAt(n));)n++;return t.pos=n,!0}const Ns=[];for(let t=0;t<256;t++)Ns.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(t){Ns[t.charCodeAt(0)]=1});function Cb(t,e){let n=t.pos;const r=t.posMax;if(t.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let i=t.src.charCodeAt(n);if(i===10){for(e||t.push("hardbreak","br",0),n++;n<r&&(i=t.src.charCodeAt(n),!!$(i));)n++;return t.pos=n,!0}let o=t.src[n];if(i>=55296&&i<=56319&&n+1<r){const u=t.src.charCodeAt(n+1);u>=56320&&u<=57343&&(o+=t.src[n+1],n++)}const s="\\"+o;if(!e){const u=t.push("text_special","",0);i<256&&Ns[i]!==0?u.content=o:u.content=s,u.markup=s,u.info="escape"}return t.pos=n+1,!0}function vb(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==96)return!1;const i=n;n++;const o=t.posMax;for(;n<o&&t.src.charCodeAt(n)===96;)n++;const s=t.src.slice(i,n),u=s.length;if(t.backticksScanned&&(t.backticks[u]||0)<=i)return e||(t.pending+=s),t.pos+=u,!0;let a=n,l;for(;(l=t.src.indexOf("`",a))!==-1;){for(a=l+1;a<o&&t.src.charCodeAt(a)===96;)a++;const c=a-l;if(c===u){if(!e){const f=t.push("code_inline","code",0);f.markup=s,f.content=t.src.slice(n,l).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return t.pos=a,!0}t.backticks[c]=l}return t.backticksScanned=!0,e||(t.pending+=s),t.pos+=u,!0}function wb(t,e){const n=t.pos,r=t.src.charCodeAt(n);if(e||r!==126)return!1;const i=t.scanDelims(t.pos,!0);let o=i.length;const s=String.fromCharCode(r);if(o<2)return!1;let u;o%2&&(u=t.push("text","",0),u.content=s,o--);for(let a=0;a<o;a+=2)u=t.push("text","",0),u.content=s+s,t.delimiters.push({marker:r,length:0,token:t.tokens.length-1,end:-1,open:i.can_open,close:i.can_close});return t.pos+=i.length,!0}function pa(t,e){let n;const r=[],i=e.length;for(let o=0;o<i;o++){const s=e[o];if(s.marker!==126||s.end===-1)continue;const u=e[s.end];n=t.tokens[s.token],n.type="s_open",n.tag="s",n.nesting=1,n.markup="~~",n.content="",n=t.tokens[u.token],n.type="s_close",n.tag="s",n.nesting=-1,n.markup="~~",n.content="",t.tokens[u.token-1].type==="text"&&t.tokens[u.token-1].content==="~"&&r.push(u.token-1)}for(;r.length;){const o=r.pop();let s=o+1;for(;s<t.tokens.length&&t.tokens[s].type==="s_close";)s++;s--,o!==s&&(n=t.tokens[s],t.tokens[s]=t.tokens[o],t.tokens[o]=n)}}function Eb(t){const e=t.tokens_meta,n=t.tokens_meta.length;pa(t,t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&pa(t,e[r].delimiters)}const ef={tokenize:wb,postProcess:Eb};function Sb(t,e){const n=t.pos,r=t.src.charCodeAt(n);if(e||r!==95&&r!==42)return!1;const i=t.scanDelims(t.pos,r===42);for(let o=0;o<i.length;o++){const s=t.push("text","",0);s.content=String.fromCharCode(r),t.delimiters.push({marker:r,length:i.length,token:t.tokens.length-1,end:-1,open:i.can_open,close:i.can_close})}return t.pos+=i.length,!0}function ma(t,e){const n=e.length;for(let r=n-1;r>=0;r--){const i=e[r];if(i.marker!==95&&i.marker!==42||i.end===-1)continue;const o=e[i.end],s=r>0&&e[r-1].end===i.end+1&&e[r-1].marker===i.marker&&e[r-1].token===i.token-1&&e[i.end+1].token===o.token+1,u=String.fromCharCode(i.marker),a=t.tokens[i.token];a.type=s?"strong_open":"em_open",a.tag=s?"strong":"em",a.nesting=1,a.markup=s?u+u:u,a.content="";const l=t.tokens[o.token];l.type=s?"strong_close":"em_close",l.tag=s?"strong":"em",l.nesting=-1,l.markup=s?u+u:u,l.content="",s&&(t.tokens[e[r-1].token].content="",t.tokens[e[i.end+1].token].content="",r--)}}function Db(t){const e=t.tokens_meta,n=t.tokens_meta.length;ma(t,t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&ma(t,e[r].delimiters)}const tf={tokenize:Sb,postProcess:Db};function Ab(t,e){let n,r,i,o,s="",u="",a=t.pos,l=!0;if(t.src.charCodeAt(t.pos)!==91)return!1;const c=t.pos,f=t.posMax,d=t.pos+1,h=t.md.helpers.parseLinkLabel(t,t.pos,!0);if(h<0)return!1;let p=h+1;if(p<f&&t.src.charCodeAt(p)===40){for(l=!1,p++;p<f&&(n=t.src.charCodeAt(p),!(!$(n)&&n!==10));p++);if(p>=f)return!1;if(a=p,i=t.md.helpers.parseLinkDestination(t.src,p,t.posMax),i.ok){for(s=t.md.normalizeLink(i.str),t.md.validateLink(s)?p=i.pos:s="",a=p;p<f&&(n=t.src.charCodeAt(p),!(!$(n)&&n!==10));p++);if(i=t.md.helpers.parseLinkTitle(t.src,p,t.posMax),p<f&&a!==p&&i.ok)for(u=i.str,p=i.pos;p<f&&(n=t.src.charCodeAt(p),!(!$(n)&&n!==10));p++);}(p>=f||t.src.charCodeAt(p)!==41)&&(l=!0),p++}if(l){if(typeof t.env.references>"u")return!1;if(p<f&&t.src.charCodeAt(p)===91?(a=p+1,p=t.md.helpers.parseLinkLabel(t,p),p>=0?r=t.src.slice(a,p++):p=h+1):p=h+1,r||(r=t.src.slice(d,h)),o=t.env.references[Bi(r)],!o)return t.pos=c,!1;s=o.href,u=o.title}if(!e){t.pos=d,t.posMax=h;const m=t.push("link_open","a",1),g=[["href",s]];m.attrs=g,u&&g.push(["title",u]),t.linkLevel++,t.md.inline.tokenize(t),t.linkLevel--,t.push("link_close","a",-1)}return t.pos=p,t.posMax=f,!0}function Mb(t,e){let n,r,i,o,s,u,a,l,c="";const f=t.pos,d=t.posMax;if(t.src.charCodeAt(t.pos)!==33||t.src.charCodeAt(t.pos+1)!==91)return!1;const h=t.pos+2,p=t.md.helpers.parseLinkLabel(t,t.pos+1,!1);if(p<0)return!1;if(o=p+1,o<d&&t.src.charCodeAt(o)===40){for(o++;o<d&&(n=t.src.charCodeAt(o),!(!$(n)&&n!==10));o++);if(o>=d)return!1;for(l=o,u=t.md.helpers.parseLinkDestination(t.src,o,t.posMax),u.ok&&(c=t.md.normalizeLink(u.str),t.md.validateLink(c)?o=u.pos:c=""),l=o;o<d&&(n=t.src.charCodeAt(o),!(!$(n)&&n!==10));o++);if(u=t.md.helpers.parseLinkTitle(t.src,o,t.posMax),o<d&&l!==o&&u.ok)for(a=u.str,o=u.pos;o<d&&(n=t.src.charCodeAt(o),!(!$(n)&&n!==10));o++);else a="";if(o>=d||t.src.charCodeAt(o)!==41)return t.pos=f,!1;o++}else{if(typeof t.env.references>"u")return!1;if(o<d&&t.src.charCodeAt(o)===91?(l=o+1,o=t.md.helpers.parseLinkLabel(t,o),o>=0?i=t.src.slice(l,o++):o=p+1):o=p+1,i||(i=t.src.slice(h,p)),s=t.env.references[Bi(i)],!s)return t.pos=f,!1;c=s.href,a=s.title}if(!e){r=t.src.slice(h,p);const m=[];t.md.inline.parse(r,t.md,t.env,m);const g=t.push("image","img",0),y=[["src",c],["alt",""]];g.attrs=y,g.children=m,g.content=r,a&&y.push(["title",a])}return t.pos=o,t.posMax=d,!0}const Tb=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,_b=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function Ob(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==60)return!1;const r=t.pos,i=t.posMax;for(;;){if(++n>=i)return!1;const s=t.src.charCodeAt(n);if(s===60)return!1;if(s===62)break}const o=t.src.slice(r+1,n);if(_b.test(o)){const s=t.md.normalizeLink(o);if(!t.md.validateLink(s))return!1;if(!e){const u=t.push("link_open","a",1);u.attrs=[["href",s]],u.markup="autolink",u.info="auto";const a=t.push("text","",0);a.content=t.md.normalizeLinkText(o);const l=t.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return t.pos+=o.length+2,!0}if(Tb.test(o)){const s=t.md.normalizeLink("mailto:"+o);if(!t.md.validateLink(s))return!1;if(!e){const u=t.push("link_open","a",1);u.attrs=[["href",s]],u.markup="autolink",u.info="auto";const a=t.push("text","",0);a.content=t.md.normalizeLinkText(o);const l=t.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return t.pos+=o.length+2,!0}return!1}function Nb(t){return/^<a[>\s]/i.test(t)}function Fb(t){return/^<\/a\s*>/i.test(t)}function Ib(t){const e=t|32;return e>=97&&e<=122}function Rb(t,e){if(!t.md.options.html)return!1;const n=t.posMax,r=t.pos;if(t.src.charCodeAt(r)!==60||r+2>=n)return!1;const i=t.src.charCodeAt(r+1);if(i!==33&&i!==63&&i!==47&&!Ib(i))return!1;const o=t.src.slice(r).match(cb);if(!o)return!1;if(!e){const s=t.push("html_inline","",0);s.content=o[0],Nb(s.content)&&t.linkLevel++,Fb(s.content)&&t.linkLevel--}return t.pos+=o[0].length,!0}const Bb=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,Pb=/^&([a-z][a-z0-9]{1,31});/i;function Lb(t,e){const n=t.pos,r=t.posMax;if(t.src.charCodeAt(n)!==38||n+1>=r)return!1;if(t.src.charCodeAt(n+1)===35){const o=t.src.slice(n).match(Bb);if(o){if(!e){const s=o[1][0].toLowerCase()==="x"?parseInt(o[1].slice(1),16):parseInt(o[1],10),u=t.push("text_special","",0);u.content=_s(s)?mi(s):mi(65533),u.markup=o[0],u.info="entity"}return t.pos+=o[0].length,!0}}else{const o=t.src.slice(n).match(Pb);if(o){const s=Jc(o[0]);if(s!==o[0]){if(!e){const u=t.push("text_special","",0);u.content=s,u.markup=o[0],u.info="entity"}return t.pos+=o[0].length,!0}}}return!1}function ga(t){const e={},n=t.length;if(!n)return;let r=0,i=-2;const o=[];for(let s=0;s<n;s++){const u=t[s];if(o.push(0),(t[r].marker!==u.marker||i!==u.token-1)&&(r=s),i=u.token,u.length=u.length||0,!u.close)continue;e.hasOwnProperty(u.marker)||(e[u.marker]=[-1,-1,-1,-1,-1,-1]);const a=e[u.marker][(u.open?3:0)+u.length%3];let l=r-o[r]-1,c=l;for(;l>a;l-=o[l]+1){const f=t[l];if(f.marker===u.marker&&f.open&&f.end<0){let d=!1;if((f.close||u.open)&&(f.length+u.length)%3===0&&(f.length%3!==0||u.length%3!==0)&&(d=!0),!d){const h=l>0&&!t[l-1].open?o[l-1]+1:0;o[s]=s-l+h,o[l]=h,u.open=!1,f.end=s,f.close=!1,c=-1,i=-2;break}}}c!==-1&&(e[u.marker][(u.open?3:0)+(u.length||0)%3]=c)}}function zb(t){const e=t.tokens_meta,n=t.tokens_meta.length;ga(t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&ga(e[r].delimiters)}function $b(t){let e,n,r=0;const i=t.tokens,o=t.tokens.length;for(e=n=0;e<o;e++)i[e].nesting<0&&r--,i[e].level=r,i[e].nesting>0&&r++,i[e].type==="text"&&e+1<o&&i[e+1].type==="text"?i[e+1].content=i[e].content+i[e+1].content:(e!==n&&(i[n]=i[e]),n++);e!==n&&(i.length=n)}const po=[["text",bb],["linkify",xb],["newline",kb],["escape",Cb],["backticks",vb],["strikethrough",ef.tokenize],["emphasis",tf.tokenize],["link",Ab],["image",Mb],["autolink",Ob],["html_inline",Rb],["entity",Lb]],mo=[["balance_pairs",zb],["strikethrough",ef.postProcess],["emphasis",tf.postProcess],["fragments_join",$b]];function wr(){this.ruler=new ve;for(let t=0;t<po.length;t++)this.ruler.push(po[t][0],po[t][1]);this.ruler2=new ve;for(let t=0;t<mo.length;t++)this.ruler2.push(mo[t][0],mo[t][1])}wr.prototype.skipToken=function(t){const e=t.pos,n=this.ruler.getRules(""),r=n.length,i=t.md.options.maxNesting,o=t.cache;if(typeof o[e]<"u"){t.pos=o[e];return}let s=!1;if(t.level<i){for(let u=0;u<r;u++)if(t.level++,s=n[u](t,!0),t.level--,s){if(e>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}else t.pos=t.posMax;s||t.pos++,o[e]=t.pos};wr.prototype.tokenize=function(t){const e=this.ruler.getRules(""),n=e.length,r=t.posMax,i=t.md.options.maxNesting;for(;t.pos<r;){const o=t.pos;let s=!1;if(t.level<i){for(let u=0;u<n;u++)if(s=e[u](t,!1),s){if(o>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}if(s){if(t.pos>=r)break;continue}t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()};wr.prototype.parse=function(t,e,n,r){const i=new this.State(t,e,n,r);this.tokenize(i);const o=this.ruler2.getRules(""),s=o.length;for(let u=0;u<s;u++)o[u](i)};wr.prototype.State=vr;function Vb(t){const e={};t=t||{},e.src_Any=Hc.source,e.src_Cc=qc.source,e.src_Z=Wc.source,e.src_P=Ms.source,e.src_ZPCc=[e.src_Z,e.src_P,e.src_Cc].join("|"),e.src_ZCc=[e.src_Z,e.src_Cc].join("|");const n="[><]";return e.src_pseudo_letter="(?:(?!"+n+"|"+e.src_ZPCc+")"+e.src_Any+")",e.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",e.src_auth="(?:(?:(?!"+e.src_ZCc+"|[@/\\[\\]()]).)+@)?",e.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",e.src_host_terminator="(?=$|"+n+"|"+e.src_ZPCc+")(?!"+(t["---"]?"-(?!--)|":"-|")+"_|:\\d|\\.-|\\.(?!$|"+e.src_ZPCc+"))",e.src_path="(?:[/?#](?:(?!"+e.src_ZCc+"|"+n+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+e.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+e.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+e.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+e.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+e.src_ZCc+"|[']).)+\\'|\\'(?="+e.src_pseudo_letter+"|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+e.src_ZCc+"|[.]|$)|"+(t["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+e.src_ZCc+"|$)|;(?!"+e.src_ZCc+"|$)|\\!+(?!"+e.src_ZCc+"|[!]|$)|\\?(?!"+e.src_ZCc+"|[?]|$))+|\\/)?",e.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',e.src_xn="xn--[a-z0-9\\-]{1,59}",e.src_domain_root="(?:"+e.src_xn+"|"+e.src_pseudo_letter+"{1,63})",e.src_domain="(?:"+e.src_xn+"|(?:"+e.src_pseudo_letter+")|(?:"+e.src_pseudo_letter+"(?:-|"+e.src_pseudo_letter+"){0,61}"+e.src_pseudo_letter+"))",e.src_host="(?:(?:(?:(?:"+e.src_domain+")\\.)*"+e.src_domain+"))",e.tpl_host_fuzzy="(?:"+e.src_ip4+"|(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%)))",e.tpl_host_no_ip_fuzzy="(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%))",e.src_host_strict=e.src_host+e.src_host_terminator,e.tpl_host_fuzzy_strict=e.tpl_host_fuzzy+e.src_host_terminator,e.src_host_port_strict=e.src_host+e.src_port+e.src_host_terminator,e.tpl_host_port_fuzzy_strict=e.tpl_host_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_port_no_ip_fuzzy_strict=e.tpl_host_no_ip_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+e.src_ZPCc+"|>|$))",e.tpl_email_fuzzy="(^|"+n+'|"|\\(|'+e.src_ZCc+")("+e.src_email_name+"@"+e.tpl_host_fuzzy_strict+")",e.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|]|"+e.src_ZPCc+"))((?![$+<=>^`|])"+e.tpl_host_port_fuzzy_strict+e.src_path+")",e.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|]|"+e.src_ZPCc+"))((?![$+<=>^`|])"+e.tpl_host_port_no_ip_fuzzy_strict+e.src_path+")",e}function Ko(t){return Array.prototype.slice.call(arguments,1).forEach(function(n){n&&Object.keys(n).forEach(function(r){t[r]=n[r]})}),t}function Li(t){return Object.prototype.toString.call(t)}function Hb(t){return Li(t)==="[object String]"}function qb(t){return Li(t)==="[object Object]"}function jb(t){return Li(t)==="[object RegExp]"}function ba(t){return Li(t)==="[object Function]"}function Wb(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const nf={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function Ub(t){return Object.keys(t||{}).reduce(function(e,n){return e||nf.hasOwnProperty(n)},!1)}const Jb={"http:":{validate:function(t,e,n){const r=t.slice(e);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(t,e,n){const r=t.slice(e);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(r)?e>=3&&t[e-3]===":"||e>=3&&t[e-3]==="/"?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(t,e,n){const r=t.slice(e);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},Kb="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",Gb="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function Zb(t){t.__index__=-1,t.__text_cache__=""}function Yb(t){return function(e,n){const r=e.slice(n);return t.test(r)?r.match(t)[0].length:0}}function ya(){return function(t,e){e.normalize(t)}}function gi(t){const e=t.re=Vb(t.__opts__),n=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||n.push(Kb),n.push(e.src_xn),e.src_tlds=n.join("|");function r(u){return u.replace("%TLDS%",e.src_tlds)}e.email_fuzzy=RegExp(r(e.tpl_email_fuzzy),"i"),e.link_fuzzy=RegExp(r(e.tpl_link_fuzzy),"i"),e.link_no_ip_fuzzy=RegExp(r(e.tpl_link_no_ip_fuzzy),"i"),e.host_fuzzy_test=RegExp(r(e.tpl_host_fuzzy_test),"i");const i=[];t.__compiled__={};function o(u,a){throw new Error('(LinkifyIt) Invalid schema "'+u+'": '+a)}Object.keys(t.__schemas__).forEach(function(u){const a=t.__schemas__[u];if(a===null)return;const l={validate:null,link:null};if(t.__compiled__[u]=l,qb(a)){jb(a.validate)?l.validate=Yb(a.validate):ba(a.validate)?l.validate=a.validate:o(u,a),ba(a.normalize)?l.normalize=a.normalize:a.normalize?o(u,a):l.normalize=ya();return}if(Hb(a)){i.push(u);return}o(u,a)}),i.forEach(function(u){t.__compiled__[t.__schemas__[u]]&&(t.__compiled__[u].validate=t.__compiled__[t.__schemas__[u]].validate,t.__compiled__[u].normalize=t.__compiled__[t.__schemas__[u]].normalize)}),t.__compiled__[""]={validate:null,normalize:ya()};const s=Object.keys(t.__compiled__).filter(function(u){return u.length>0&&t.__compiled__[u]}).map(Wb).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><]|"+e.src_ZPCc+"))("+s+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><]|"+e.src_ZPCc+"))("+s+")","ig"),t.re.schema_at_start=RegExp("^"+t.re.schema_search.source,"i"),t.re.pretest=RegExp("("+t.re.schema_test.source+")|("+t.re.host_fuzzy_test.source+")|@","i"),Zb(t)}function Xb(t,e){const n=t.__index__,r=t.__last_index__,i=t.__text_cache__.slice(n,r);this.schema=t.__schema__.toLowerCase(),this.index=n+e,this.lastIndex=r+e,this.raw=i,this.text=i,this.url=i}function Go(t,e){const n=new Xb(t,e);return t.__compiled__[n.schema].normalize(n,t),n}function Ae(t,e){if(!(this instanceof Ae))return new Ae(t,e);e||Ub(t)&&(e=t,t={}),this.__opts__=Ko({},nf,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=Ko({},Jb,t),this.__compiled__={},this.__tlds__=Gb,this.__tlds_replaced__=!1,this.re={},gi(this)}Ae.prototype.add=function(e,n){return this.__schemas__[e]=n,gi(this),this};Ae.prototype.set=function(e){return this.__opts__=Ko(this.__opts__,e),this};Ae.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;let n,r,i,o,s,u,a,l,c;if(this.re.schema_test.test(e)){for(a=this.re.schema_search,a.lastIndex=0;(n=a.exec(e))!==null;)if(o=this.testSchemaAt(e,n[2],a.lastIndex),o){this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+o;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(l=e.search(this.re.host_fuzzy_test),l>=0&&(this.__index__<0||l<this.__index__)&&(r=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(s=r.index+r[1].length,(this.__index__<0||s<this.__index__)&&(this.__schema__="",this.__index__=s,this.__last_index__=r.index+r[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(c=e.indexOf("@"),c>=0&&(i=e.match(this.re.email_fuzzy))!==null&&(s=i.index+i[1].length,u=i.index+i[0].length,(this.__index__<0||s<this.__index__||s===this.__index__&&u>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=s,this.__last_index__=u))),this.__index__>=0};Ae.prototype.pretest=function(e){return this.re.pretest.test(e)};Ae.prototype.testSchemaAt=function(e,n,r){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(e,r,this):0};Ae.prototype.match=function(e){const n=[];let r=0;this.__index__>=0&&this.__text_cache__===e&&(n.push(Go(this,r)),r=this.__last_index__);let i=r?e.slice(r):e;for(;this.test(i);)n.push(Go(this,r)),i=i.slice(this.__last_index__),r+=this.__last_index__;return n.length?n:null};Ae.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;const n=this.re.schema_at_start.exec(e);if(!n)return null;const r=this.testSchemaAt(e,n[2],n[0].length);return r?(this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+r,Go(this,0)):null};Ae.prototype.tlds=function(e,n){return e=Array.isArray(e)?e:[e],n?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(r,i,o){return r!==o[i-1]}).reverse(),gi(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,gi(this),this)};Ae.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url="mailto:"+e.url)};Ae.prototype.onCompile=function(){};const vn=2147483647,Ge=36,Fs=1,pr=26,Qb=38,e2=700,rf=72,of=128,sf="-",t2=/^xn--/,n2=/[^\0-\x7F]/,r2=/[\x2E\u3002\uFF0E\uFF61]/g,i2={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},go=Ge-Fs,Ze=Math.floor,bo=String.fromCharCode;function vt(t){throw new RangeError(i2[t])}function o2(t,e){const n=[];let r=t.length;for(;r--;)n[r]=e(t[r]);return n}function uf(t,e){const n=t.split("@");let r="";n.length>1&&(r=n[0]+"@",t=n[1]),t=t.replace(r2,".");const i=t.split("."),o=o2(i,e).join(".");return r+o}function af(t){const e=[];let n=0;const r=t.length;for(;n<r;){const i=t.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){const o=t.charCodeAt(n++);(o&64512)==56320?e.push(((i&1023)<<10)+(o&1023)+65536):(e.push(i),n--)}else e.push(i)}return e}const s2=t=>String.fromCodePoint(...t),u2=function(t){return t>=48&&t<58?26+(t-48):t>=65&&t<91?t-65:t>=97&&t<123?t-97:Ge},xa=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},lf=function(t,e,n){let r=0;for(t=n?Ze(t/e2):t>>1,t+=Ze(t/e);t>go*pr>>1;r+=Ge)t=Ze(t/go);return Ze(r+(go+1)*t/(t+Qb))},cf=function(t){const e=[],n=t.length;let r=0,i=of,o=rf,s=t.lastIndexOf(sf);s<0&&(s=0);for(let u=0;u<s;++u)t.charCodeAt(u)>=128&&vt("not-basic"),e.push(t.charCodeAt(u));for(let u=s>0?s+1:0;u<n;){const a=r;for(let c=1,f=Ge;;f+=Ge){u>=n&&vt("invalid-input");const d=u2(t.charCodeAt(u++));d>=Ge&&vt("invalid-input"),d>Ze((vn-r)/c)&&vt("overflow"),r+=d*c;const h=f<=o?Fs:f>=o+pr?pr:f-o;if(d<h)break;const p=Ge-h;c>Ze(vn/p)&&vt("overflow"),c*=p}const l=e.length+1;o=lf(r-a,l,a==0),Ze(r/l)>vn-i&&vt("overflow"),i+=Ze(r/l),r%=l,e.splice(r++,0,i)}return String.fromCodePoint(...e)},ff=function(t){const e=[];t=af(t);const n=t.length;let r=of,i=0,o=rf;for(const a of t)a<128&&e.push(bo(a));const s=e.length;let u=s;for(s&&e.push(sf);u<n;){let a=vn;for(const c of t)c>=r&&c<a&&(a=c);const l=u+1;a-r>Ze((vn-i)/l)&&vt("overflow"),i+=(a-r)*l,r=a;for(const c of t)if(c<r&&++i>vn&&vt("overflow"),c===r){let f=i;for(let d=Ge;;d+=Ge){const h=d<=o?Fs:d>=o+pr?pr:d-o;if(f<h)break;const p=f-h,m=Ge-h;e.push(bo(xa(h+p%m,0))),f=Ze(p/m)}e.push(bo(xa(f,0))),o=lf(i,l,u===s),i=0,++u}++i,++r}return e.join("")},a2=function(t){return uf(t,function(e){return t2.test(e)?cf(e.slice(4).toLowerCase()):e})},l2=function(t){return uf(t,function(e){return n2.test(e)?"xn--"+ff(e):e})},df={version:"2.3.1",ucs2:{decode:af,encode:s2},decode:cf,encode:ff,toASCII:l2,toUnicode:a2},c2={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},f2={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},d2={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}},h2={default:c2,zero:f2,commonmark:d2},p2=/^(vbscript|javascript|file|data):/,m2=/^data:image\/(gif|png|jpeg|webp);/;function g2(t){const e=t.trim().toLowerCase();return p2.test(e)?m2.test(e):!0}const hf=["http:","https:","mailto:"];function b2(t){const e=As(t,!0);if(e.hostname&&(!e.protocol||hf.indexOf(e.protocol)>=0))try{e.hostname=df.toASCII(e.hostname)}catch{}return Cr(Ds(e))}function y2(t){const e=As(t,!0);if(e.hostname&&(!e.protocol||hf.indexOf(e.protocol)>=0))try{e.hostname=df.toUnicode(e.hostname)}catch{}return Tn(Ds(e),Tn.defaultChars+"%")}function we(t,e){if(!(this instanceof we))return new we(t,e);e||Ts(t)||(e=t||{},t="default"),this.inline=new wr,this.block=new Pi,this.core=new Os,this.renderer=new Bn,this.linkify=new Ae,this.validateLink=g2,this.normalizeLink=b2,this.normalizeLinkText=y2,this.utils=kg,this.helpers=Ri({},Eg),this.options={},this.configure(t),e&&this.set(e)}we.prototype.set=function(t){return Ri(this.options,t),this};we.prototype.configure=function(t){const e=this;if(Ts(t)){const n=t;if(t=h2[n],!t)throw new Error('Wrong `markdown-it` preset "'+n+'", check name')}if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");return t.options&&e.set(t.options),t.components&&Object.keys(t.components).forEach(function(n){t.components[n].rules&&e[n].ruler.enableOnly(t.components[n].rules),t.components[n].rules2&&e[n].ruler2.enableOnly(t.components[n].rules2)}),this};we.prototype.enable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.enable(t,!0))},this),n=n.concat(this.inline.ruler2.enable(t,!0));const r=t.filter(function(i){return n.indexOf(i)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+r);return this};we.prototype.disable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.disable(t,!0))},this),n=n.concat(this.inline.ruler2.disable(t,!0));const r=t.filter(function(i){return n.indexOf(i)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+r);return this};we.prototype.use=function(t){const e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this};we.prototype.parse=function(t,e){if(typeof t!="string")throw new Error("Input data should be a String");const n=new this.core.State(t,this,e);return this.core.process(n),n.tokens};we.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)};we.prototype.parseInline=function(t,e){const n=new this.core.State(t,this,e);return n.inlineMode=!0,this.core.process(n),n.tokens};we.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};const x2=new es({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return["p",0]}},blockquote:{content:"block+",group:"block",parseDOM:[{tag:"blockquote"}],toDOM(){return["blockquote",0]}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM(){return["div",["hr"]]}},heading:{attrs:{level:{default:1}},content:"(text | image)*",group:"block",defining:!0,parseDOM:[{tag:"h1",attrs:{level:1}},{tag:"h2",attrs:{level:2}},{tag:"h3",attrs:{level:3}},{tag:"h4",attrs:{level:4}},{tag:"h5",attrs:{level:5}},{tag:"h6",attrs:{level:6}}],toDOM(t){return["h"+t.attrs.level,0]}},code_block:{content:"text*",group:"block",code:!0,defining:!0,marks:"",attrs:{params:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>({params:t.getAttribute("data-params")||""})}],toDOM(t){return["pre",t.attrs.params?{"data-params":t.attrs.params}:{},["code",0]]}},ordered_list:{content:"list_item+",group:"block",attrs:{order:{default:1},tight:{default:!1}},parseDOM:[{tag:"ol",getAttrs(t){return{order:t.hasAttribute("start")?+t.getAttribute("start"):1,tight:t.hasAttribute("data-tight")}}}],toDOM(t){return["ol",{start:t.attrs.order==1?null:t.attrs.order,"data-tight":t.attrs.tight?"true":null},0]}},bullet_list:{content:"list_item+",group:"block",attrs:{tight:{default:!1}},parseDOM:[{tag:"ul",getAttrs:t=>({tight:t.hasAttribute("data-tight")})}],toDOM(t){return["ul",{"data-tight":t.attrs.tight?"true":null},0]}},list_item:{content:"block+",defining:!0,parseDOM:[{tag:"li"}],toDOM(){return["li",0]}},text:{group:"inline"},image:{inline:!0,attrs:{src:{},alt:{default:null},title:{default:null}},group:"inline",draggable:!0,parseDOM:[{tag:"img[src]",getAttrs(t){return{src:t.getAttribute("src"),title:t.getAttribute("title"),alt:t.getAttribute("alt")}}}],toDOM(t){return["img",t.attrs]}},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM(){return["br"]}}},marks:{em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"},{style:"font-style=normal",clearMark:t=>t.type.name=="em"}],toDOM(){return["em"]}},strong:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name=="strong"},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],toDOM(){return["strong"]}},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs(t){return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM(t){return["a",t.attrs]}},code:{code:!0,parseDOM:[{tag:"code"}],toDOM(){return["code"]}}}});function k2(t,e){if(t.isText&&e.isText&&L.sameSet(t.marks,e.marks))return t.withText(t.text+e.text)}class C2{constructor(e,n){this.schema=e,this.tokenHandlers=n,this.stack=[{type:e.topNodeType,attrs:null,content:[],marks:L.none}]}top(){return this.stack[this.stack.length-1]}push(e){this.stack.length&&this.top().content.push(e)}addText(e){if(!e)return;let n=this.top(),r=n.content,i=r[r.length-1],o=this.schema.text(e,n.marks),s;i&&(s=k2(i,o))?r[r.length-1]=s:r.push(o)}openMark(e){let n=this.top();n.marks=e.addToSet(n.marks)}closeMark(e){let n=this.top();n.marks=e.removeFromSet(n.marks)}parseTokens(e){for(let n=0;n<e.length;n++){let r=e[n],i=this.tokenHandlers[r.type];if(!i)throw new Error("Token type `"+r.type+"` not supported by Markdown parser");i(this,r,e,n)}}addNode(e,n,r){let i=this.top(),o=e.createAndFill(n,r,i?i.marks:[]);return o?(this.push(o),o):null}openNode(e,n){this.stack.push({type:e,attrs:n,content:[],marks:L.none})}closeNode(){let e=this.stack.pop();return this.addNode(e.type,e.attrs,e.content)}}function qn(t,e,n,r){return t.getAttrs?t.getAttrs(e,n,r):t.attrs instanceof Function?t.attrs(e):t.attrs}function yo(t,e){return t.noCloseToken||e=="code_inline"||e=="code_block"||e=="fence"}function ka(t){return t[t.length-1]==`
`?t.slice(0,t.length-1):t}function xo(){}function v2(t,e){let n=Object.create(null);for(let r in e){let i=e[r];if(i.block){let o=t.nodeType(i.block);yo(i,r)?n[r]=(s,u,a,l)=>{s.openNode(o,qn(i,u,a,l)),s.addText(ka(u.content)),s.closeNode()}:(n[r+"_open"]=(s,u,a,l)=>s.openNode(o,qn(i,u,a,l)),n[r+"_close"]=s=>s.closeNode())}else if(i.node){let o=t.nodeType(i.node);n[r]=(s,u,a,l)=>s.addNode(o,qn(i,u,a,l))}else if(i.mark){let o=t.marks[i.mark];yo(i,r)?n[r]=(s,u,a,l)=>{s.openMark(o.create(qn(i,u,a,l))),s.addText(ka(u.content)),s.closeMark(o)}:(n[r+"_open"]=(s,u,a,l)=>s.openMark(o.create(qn(i,u,a,l))),n[r+"_close"]=s=>s.closeMark(o))}else if(i.ignore)yo(i,r)?n[r]=xo:(n[r+"_open"]=xo,n[r+"_close"]=xo);else throw new RangeError("Unrecognized parsing spec "+JSON.stringify(i))}return n.text=(r,i)=>r.addText(i.content),n.inline=(r,i)=>r.parseTokens(i.children),n.softbreak=n.softbreak||(r=>r.addText(" ")),n}let w2=class{constructor(e,n,r){this.schema=e,this.tokenizer=n,this.tokens=r,this.tokenHandlers=v2(e,r)}parse(e,n={}){let r=new C2(this.schema,this.tokenHandlers),i;r.parseTokens(this.tokenizer.parse(e,n));do i=r.closeNode();while(r.stack.length);return i||this.schema.topNodeType.createAndFill()}};function Ca(t,e){for(;++e<t.length;)if(t[e].type!="list_item_open")return t[e].hidden;return!1}new w2(x2,we("commonmark",{html:!1}),{blockquote:{block:"blockquote"},paragraph:{block:"paragraph"},list_item:{block:"list_item"},bullet_list:{block:"bullet_list",getAttrs:(t,e,n)=>({tight:Ca(e,n)})},ordered_list:{block:"ordered_list",getAttrs:(t,e,n)=>({order:+t.attrGet("start")||1,tight:Ca(e,n)})},heading:{block:"heading",getAttrs:t=>({level:+t.tag.slice(1)})},code_block:{block:"code_block",noCloseToken:!0},fence:{block:"code_block",getAttrs:t=>({params:t.info||""}),noCloseToken:!0},hr:{node:"horizontal_rule"},image:{node:"image",getAttrs:t=>({src:t.attrGet("src"),title:t.attrGet("title")||null,alt:t.children[0]&&t.children[0].content||null})},hardbreak:{node:"hard_break"},em:{mark:"em"},strong:{mark:"strong"},link:{mark:"link",getAttrs:t=>({href:t.attrGet("href"),title:t.attrGet("title")||null})},code_inline:{mark:"code",noCloseToken:!0}});const E2={open:"",close:"",mixable:!0};let S2=class{constructor(e,n,r={}){this.nodes=e,this.marks=n,this.options=r}serialize(e,n={}){n=Object.assign({},this.options,n);let r=new pf(this.nodes,this.marks,n);return r.renderContent(e),r.out}};const rt=new S2({blockquote(t,e){t.wrapBlock("> ",null,e,()=>t.renderContent(e))},code_block(t,e){const n=e.textContent.match(/`{3,}/gm),r=n?n.sort().slice(-1)[0]+"`":"```";t.write(r+(e.attrs.params||"")+`
`),t.text(e.textContent,!1),t.write(`
`),t.write(r),t.closeBlock(e)},heading(t,e){t.write(t.repeat("#",e.attrs.level)+" "),t.renderInline(e,!1),t.closeBlock(e)},horizontal_rule(t,e){t.write(e.attrs.markup||"---"),t.closeBlock(e)},bullet_list(t,e){t.renderList(e," ",()=>(e.attrs.bullet||"*")+" ")},ordered_list(t,e){let n=e.attrs.order||1,r=String(n+e.childCount-1).length,i=t.repeat(" ",r+2);t.renderList(e,i,o=>{let s=String(n+o);return t.repeat(" ",r-s.length)+s+". "})},list_item(t,e){t.renderContent(e)},paragraph(t,e){t.renderInline(e),t.closeBlock(e)},image(t,e){t.write("!["+t.esc(e.attrs.alt||"")+"]("+e.attrs.src.replace(/[\(\)]/g,"\\$&")+(e.attrs.title?' "'+e.attrs.title.replace(/"/g,'\\"')+'"':"")+")")},hard_break(t,e,n,r){for(let i=r+1;i<n.childCount;i++)if(n.child(i).type!=e.type){t.write(`\\
`);return}},text(t,e){t.text(e.text,!t.inAutolink)}},{em:{open:"*",close:"*",mixable:!0,expelEnclosingWhitespace:!0},strong:{open:"**",close:"**",mixable:!0,expelEnclosingWhitespace:!0},link:{open(t,e,n,r){return t.inAutolink=D2(e,n,r),t.inAutolink?"<":"["},close(t,e,n,r){let{inAutolink:i}=t;return t.inAutolink=void 0,i?">":"]("+e.attrs.href.replace(/[\(\)"]/g,"\\$&")+(e.attrs.title?` "${e.attrs.title.replace(/"/g,'\\"')}"`:"")+")"},mixable:!0},code:{open(t,e,n,r){return va(n.child(r),-1)},close(t,e,n,r){return va(n.child(r-1),1)},escape:!1}});function va(t,e){let n=/`+/g,r,i=0;if(t.isText)for(;r=n.exec(t.text);)i=Math.max(i,r[0].length);let o=i>0&&e>0?" `":"`";for(let s=0;s<i;s++)o+="`";return i>0&&e<0&&(o+=" "),o}function D2(t,e,n){if(t.attrs.title||!/^\w+:/.test(t.attrs.href))return!1;let r=e.child(n);return!r.isText||r.text!=t.attrs.href||r.marks[r.marks.length-1]!=t?!1:n==e.childCount-1||!t.isInSet(e.child(n+1).marks)}let pf=class{constructor(e,n,r){this.nodes=e,this.marks=n,this.options=r,this.delim="",this.out="",this.closed=null,this.inAutolink=void 0,this.atBlockStart=!1,this.inTightList=!1,typeof this.options.tightLists>"u"&&(this.options.tightLists=!1),typeof this.options.hardBreakNodeName>"u"&&(this.options.hardBreakNodeName="hard_break")}flushClose(e=2){if(this.closed){if(this.atBlank()||(this.out+=`
`),e>1){let n=this.delim,r=/\s+$/.exec(n);r&&(n=n.slice(0,n.length-r[0].length));for(let i=1;i<e;i++)this.out+=n+`
`}this.closed=null}}getMark(e){let n=this.marks[e];if(!n){if(this.options.strict!==!1)throw new Error(`Mark type \`${e}\` not supported by Markdown renderer`);n=E2}return n}wrapBlock(e,n,r,i){let o=this.delim;this.write(n??e),this.delim+=e,i(),this.delim=o,this.closeBlock(r)}atBlank(){return/(^|\n)$/.test(this.out)}ensureNewLine(){this.atBlank()||(this.out+=`
`)}write(e){this.flushClose(),this.delim&&this.atBlank()&&(this.out+=this.delim),e&&(this.out+=e)}closeBlock(e){this.closed=e}text(e,n=!0){let r=e.split(`
`);for(let i=0;i<r.length;i++)this.write(),!n&&r[i][0]=="["&&/(^|[^\\])\!$/.test(this.out)&&(this.out=this.out.slice(0,this.out.length-1)+"\\!"),this.out+=n?this.esc(r[i],this.atBlockStart):r[i],i!=r.length-1&&(this.out+=`
`)}render(e,n,r){if(this.nodes[e.type.name])this.nodes[e.type.name](this,e,n,r);else{if(this.options.strict!==!1)throw new Error("Token type `"+e.type.name+"` not supported by Markdown renderer");e.type.isLeaf||(e.type.inlineContent?this.renderInline(e):this.renderContent(e),e.isBlock&&this.closeBlock(e))}}renderContent(e){e.forEach((n,r,i)=>this.render(n,e,i))}renderInline(e,n=!0){this.atBlockStart=n;let r=[],i="",o=(s,u,a)=>{let l=s?s.marks:[];s&&s.type.name===this.options.hardBreakNodeName&&(l=l.filter(m=>{if(a+1==e.childCount)return!1;let g=e.child(a+1);return m.isInSet(g.marks)&&(!g.isText||/\S/.test(g.text))}));let c=i;if(i="",s&&s.isText&&l.some(m=>{let g=this.getMark(m.type.name);return g&&g.expelEnclosingWhitespace&&!m.isInSet(r)})){let[m,g,y]=/^(\s*)(.*)$/m.exec(s.text);g&&(c+=g,s=y?s.withText(y):null,s||(l=r))}if(s&&s.isText&&l.some(m=>{let g=this.getMark(m.type.name);return g&&g.expelEnclosingWhitespace&&(a==e.childCount-1||!m.isInSet(e.child(a+1).marks))})){let[m,g,y]=/^(.*?)(\s*)$/m.exec(s.text);y&&(i=y,s=g?s.withText(g):null,s||(l=r))}let f=l.length?l[l.length-1]:null,d=f&&this.getMark(f.type.name).escape===!1,h=l.length-(d?1:0);e:for(let m=0;m<h;m++){let g=l[m];if(!this.getMark(g.type.name).mixable)break;for(let y=0;y<r.length;y++){let x=r[y];if(!this.getMark(x.type.name).mixable)break;if(g.eq(x)){m>y?l=l.slice(0,y).concat(g).concat(l.slice(y,m)).concat(l.slice(m+1,h)):y>m&&(l=l.slice(0,m).concat(l.slice(m+1,y)).concat(g).concat(l.slice(y,h)));continue e}}}let p=0;for(;p<Math.min(r.length,h)&&l[p].eq(r[p]);)++p;for(;p<r.length;)this.text(this.markString(r.pop(),!1,e,a),!1);if(c&&this.text(c),s){for(;r.length<h;){let m=l[r.length];r.push(m),this.text(this.markString(m,!0,e,a),!1),this.atBlockStart=!1}d&&s.isText?this.text(this.markString(f,!0,e,a)+s.text+this.markString(f,!1,e,a+1),!1):this.render(s,e,a),this.atBlockStart=!1}s!=null&&s.isText&&s.nodeSize>0&&(this.atBlockStart=!1)};e.forEach(o),o(null,0,e.childCount),this.atBlockStart=!1}renderList(e,n,r){this.closed&&this.closed.type==e.type?this.flushClose(3):this.inTightList&&this.flushClose(1);let i=typeof e.attrs.tight<"u"?e.attrs.tight:this.options.tightLists,o=this.inTightList;this.inTightList=i,e.forEach((s,u,a)=>{a&&i&&this.flushClose(1),this.wrapBlock(n,r(a),e,()=>this.render(s,e,a))}),this.inTightList=o}esc(e,n=!1){return e=e.replace(/[`*\\~\[\]_]/g,(r,i)=>r=="_"&&i>0&&i+1<e.length&&e[i-1].match(/\w/)&&e[i+1].match(/\w/)?r:"\\"+r),n&&(e=e.replace(/^(\+[ ]|[\-*>])/,"\\$&").replace(/^(\s*)(#{1,6})(\s|$)/,"$1\\$2$3").replace(/^(\s*\d+)\.\s/,"$1\\. ")),this.options.escapeExtraCharacters&&(e=e.replace(this.options.escapeExtraCharacters,"\\$&")),e}quote(e){let n=e.indexOf('"')==-1?'""':e.indexOf("'")==-1?"''":"()";return n[0]+e+n[1]}repeat(e,n){let r="";for(let i=0;i<n;i++)r+=e;return r}markString(e,n,r,i){let o=this.getMark(e.type.name),s=n?o.open:o.close;return typeof s=="string"?s:s(this,e,r,i)}getEnclosingWhitespace(e){return{leading:(e.match(/^(\s+)/)||[void 0])[0],trailing:(e.match(/(\s+)$/)||[void 0])[0]}}};function A2(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ko,wa;function M2(){if(wa)return ko;wa=1;var t=!0,e=!1,n=!1;ko=function(m,g){g&&(t=!g.enabled,e=!!g.label,n=!!g.labelAfter),m.core.ruler.after("inline","github-task-lists",function(y){for(var x=y.tokens,k=2;k<x.length;k++)o(x,k)&&(s(x[k],y.Token),r(x[k-2],"class","task-list-item"+(t?"":" enabled")),r(x[i(x,k-2)],"class","contains-task-list"))})};function r(m,g,y){var x=m.attrIndex(g),k=[g,y];x<0?m.attrPush(k):m.attrs[x]=k}function i(m,g){for(var y=m[g].level-1,x=g-1;x>=0;x--)if(m[x].level===y)return x;return-1}function o(m,g){return f(m[g])&&d(m[g-1])&&h(m[g-2])&&p(m[g])}function s(m,g){if(m.children.unshift(u(m,g)),m.children[1].content=m.children[1].content.slice(3),m.content=m.content.slice(3),e)if(n){m.children.pop();var y="task-item-"+Math.ceil(Math.random()*(1e4*1e3)-1e3);m.children[0].content=m.children[0].content.slice(0,-1)+' id="'+y+'">',m.children.push(c(m.content,y,g))}else m.children.unshift(a(g)),m.children.push(l(g))}function u(m,g){var y=new g("html_inline","",0),x=t?' disabled="" ':"";return m.content.indexOf("[ ] ")===0?y.content='<input class="task-list-item-checkbox"'+x+'type="checkbox">':(m.content.indexOf("[x] ")===0||m.content.indexOf("[X] ")===0)&&(y.content='<input class="task-list-item-checkbox" checked=""'+x+'type="checkbox">'),y}function a(m){var g=new m("html_inline","",0);return g.content="<label>",g}function l(m){var g=new m("html_inline","",0);return g.content="</label>",g}function c(m,g,y){var x=new y("html_inline","",0);return x.content='<label class="task-list-item-label" for="'+g+'">'+m+"</label>",x.attrs=[{for:g}],x}function f(m){return m.type==="inline"}function d(m){return m.type==="paragraph_open"}function h(m){return m.type==="list_item_open"}function p(m){return m.content.indexOf("[ ] ")===0||m.content.indexOf("[x] ")===0||m.content.indexOf("[X] ")===0}return ko}var T2=M2();const _2=A2(T2);var O2=Object.defineProperty,N2=(t,e,n)=>e in t?O2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,bi=(t,e,n)=>(N2(t,typeof e!="symbol"?e+"":e,n),n);const F2=G.create({name:"markdownTightLists",addOptions:()=>({tight:!0,tightClass:"tight",listTypes:["bulletList","orderedList"]}),addGlobalAttributes(){return[{types:this.options.listTypes,attributes:{tight:{default:this.options.tight,parseHTML:t=>t.getAttribute("data-tight")==="true"||!t.querySelector("p"),renderHTML:t=>({class:t.tight?this.options.tightClass:null,"data-tight":t.tight?"true":null})}}}]},addCommands(){var t=this;return{toggleTight:function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return n=>{let{editor:r,commands:i}=n;function o(s){if(!r.isActive(s))return!1;const u=r.getAttributes(s);return i.updateAttributes(s,{tight:e??!(u!=null&&u.tight)})}return t.options.listTypes.some(s=>o(s))}}}}}),Ea=we();function mf(t,e){return Ea.inline.State.prototype.scanDelims.call({src:t,posMax:t.length}),new Ea.inline.State(t,null,null,[]).scanDelims(e,!0)}function gf(t,e,n,r){let i=t.substring(0,n)+t.substring(n+e.length);return i=i.substring(0,n+r)+e+i.substring(n+r),i}function I2(t,e,n,r){let i=n,o=t;for(;i<r&&!mf(o,i).can_open;)o=gf(o,e,i,1),i++;return{text:o,from:i,to:r}}function R2(t,e,n,r){let i=r,o=t;for(;i>n&&!mf(o,i).can_close;)o=gf(o,e,i,-1),i--;return{text:o,from:n,to:i}}function B2(t,e,n,r){let i={text:t,from:n,to:r};return i=I2(i.text,e,i.from,i.to),i=R2(i.text,e,i.from,i.to),i.to-i.from<e.length+1&&(i.text=i.text.substring(0,i.from)+i.text.substring(i.to+e.length)),i.text}class P2 extends pf{constructor(e,n,r){super(e,n,r??{}),bi(this,"inTable",!1),this.inlines=[]}render(e,n,r){super.render(e,n,r);const i=this.inlines[this.inlines.length-1];if(i!=null&&i.start&&i!==null&&i!==void 0&&i.end){const{delimiter:o,start:s,end:u}=this.normalizeInline(i);this.out=B2(this.out,o,s,u),this.inlines.pop()}}markString(e,n,r,i){const o=this.marks[e.type.name];if(o.expelEnclosingWhitespace)if(n)this.inlines.push({start:this.out.length,delimiter:o.open});else{const s=this.inlines.pop();this.inlines.push({...s,end:this.out.length})}return super.markString(e,n,r,i)}normalizeInline(e){let{start:n,end:r}=e;for(;this.out.charAt(n).match(/\s/);)n++;return{...e,start:n}}}const bf=Ce.create({name:"markdownHTMLMark",addStorage(){return{markdown:{serialize:{open(t,e){var n,r;return this.editor.storage.markdown.options.html?(n=(r=Sa(e))===null||r===void 0?void 0:r[0])!==null&&n!==void 0?n:"":(console.warn(`Tiptap Markdown: "${e.type.name}" mark is only available in html mode`),"")},close(t,e){var n,r;return this.editor.storage.markdown.options.html&&(n=(r=Sa(e))===null||r===void 0?void 0:r[1])!==null&&n!==void 0?n:""}},parse:{}}}}});function Sa(t){const e=t.type.schema,n=e.text(" ",[t]),i=kr(w.from(n),e).match(/^(<.*?>) (<\/.*?>)$/);return i?[i[1],i[2]]:null}function Is(t){const e=`<body>${t}</body>`;return new window.DOMParser().parseFromString(e,"text/html").body}function L2(t){return t==null?void 0:t.replace(/</g,"&lt;").replace(/>/g,"&gt;")}function z2(t){const e=t.parentElement,n=e.cloneNode();for(;e.firstChild&&e.firstChild!==t;)n.appendChild(e.firstChild);n.childNodes.length>0&&e.parentElement.insertBefore(n,e),e.parentElement.insertBefore(t,e),e.childNodes.length===0&&e.remove()}function $2(t){const e=t.parentNode;for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}const zi=V.create({name:"markdownHTMLNode",addStorage(){return{markdown:{serialize(t,e,n){this.editor.storage.markdown.options.html?t.write(V2(e,n)):(console.warn(`Tiptap Markdown: "${e.type.name}" node is only available in html mode`),t.write(`[${e.type.name}]`)),e.isBlock&&t.closeBlock(e)},parse:{}}}}});function V2(t,e){const n=t.type.schema,r=kr(w.from(t),n);return t.isBlock&&(e instanceof w||e.type.name===n.topNodeType.name)?H2(r):r}function H2(t){const n=Is(t).firstElementChild;return n.innerHTML=n.innerHTML.trim()?`
${n.innerHTML}
`:`
`,n.outerHTML}const q2=V.create({name:"blockquote"}),j2=q2.extend({addStorage(){return{markdown:{serialize:rt.nodes.blockquote,parse:{}}}}}),W2=V.create({name:"bulletList"}),yf=W2.extend({addStorage(){return{markdown:{serialize(t,e){return t.renderList(e," ",()=>(this.editor.storage.markdown.options.bulletListMarker||"-")+" ")},parse:{}}}}}),U2=V.create({name:"codeBlock"}),J2=U2.extend({addStorage(){return{markdown:{serialize(t,e){t.write("```"+(e.attrs.language||"")+`
`),t.text(e.textContent,!1),t.ensureNewLine(),t.write("```"),t.closeBlock(e)},parse:{setup(t){var e;t.set({langPrefix:(e=this.options.languageClassPrefix)!==null&&e!==void 0?e:"language-"})},updateDOM(t){t.innerHTML=t.innerHTML.replace(/\n<\/code><\/pre>/g,"</code></pre>")}}}}}}),K2=V.create({name:"hardBreak"}),xf=K2.extend({addStorage(){return{markdown:{serialize(t,e,n,r){for(let i=r+1;i<n.childCount;i++)if(n.child(i).type!=e.type){t.write(t.inTable?zi.storage.markdown.serialize.call(this,t,e,n):`\\
`);return}},parse:{}}}}}),G2=V.create({name:"heading"}),Z2=G2.extend({addStorage(){return{markdown:{serialize:rt.nodes.heading,parse:{}}}}}),Y2=V.create({name:"horizontalRule"}),X2=Y2.extend({addStorage(){return{markdown:{serialize:rt.nodes.horizontal_rule,parse:{}}}}}),Q2=V.create({name:"image"}),ey=Q2.extend({addStorage(){return{markdown:{serialize:rt.nodes.image,parse:{}}}}}),ty=V.create({name:"listItem"}),ny=ty.extend({addStorage(){return{markdown:{serialize:rt.nodes.list_item,parse:{}}}}}),ry=V.create({name:"orderedList"});function iy(t,e,n){let r=0;for(;n-r>0&&e.child(n-r-1).type.name===t.type.name;r++);return r}const oy=ry.extend({addStorage(){return{markdown:{serialize(t,e,n,r){const i=e.attrs.start||1,o=String(i+e.childCount-1).length,s=t.repeat(" ",o+2),a=iy(e,n,r)%2?") ":". ";t.renderList(e,s,l=>{const c=String(i+l);return t.repeat(" ",o-c.length)+c+a})},parse:{}}}}}),sy=V.create({name:"paragraph"}),uy=sy.extend({addStorage(){return{markdown:{serialize:rt.nodes.paragraph,parse:{}}}}});function Co(t){var e,n;return(e=t==null||(n=t.content)===null||n===void 0?void 0:n.content)!==null&&e!==void 0?e:[]}const ay=V.create({name:"table"}),ly=ay.extend({addStorage(){return{markdown:{serialize(t,e,n){if(!cy(e)){zi.storage.markdown.serialize.call(this,t,e,n);return}t.inTable=!0,e.forEach((r,i,o)=>{if(t.write("| "),r.forEach((s,u,a)=>{a&&t.write(" | ");const l=s.firstChild;l.textContent.trim()&&t.renderInline(l)}),t.write(" |"),t.ensureNewLine(),!o){const s=Array.from({length:r.childCount}).map(()=>"---").join(" | ");t.write(`| ${s} |`),t.ensureNewLine()}}),t.closeBlock(e),t.inTable=!1},parse:{}}}}});function Da(t){return t.attrs.colspan>1||t.attrs.rowspan>1}function cy(t){const e=Co(t),n=e[0],r=e.slice(1);return!(Co(n).some(i=>i.type.name!=="tableHeader"||Da(i)||i.childCount>1)||r.some(i=>Co(i).some(o=>o.type.name==="tableHeader"||Da(o)||o.childCount>1)))}const fy=V.create({name:"taskItem"}),dy=fy.extend({addStorage(){return{markdown:{serialize(t,e){const n=e.attrs.checked?"[x]":"[ ]";t.write(`${n} `),t.renderContent(e)},parse:{updateDOM(t){[...t.querySelectorAll(".task-list-item")].forEach(e=>{const n=e.querySelector("input");e.setAttribute("data-type","taskItem"),n&&(e.setAttribute("data-checked",n.checked),n.remove())})}}}}}}),hy=V.create({name:"taskList"}),py=hy.extend({addStorage(){return{markdown:{serialize:yf.storage.markdown.serialize,parse:{setup(t){t.use(_2)},updateDOM(t){[...t.querySelectorAll(".contains-task-list")].forEach(e=>{e.setAttribute("data-type","taskList")})}}}}}}),my=V.create({name:"text"}),gy=my.extend({addStorage(){return{markdown:{serialize(t,e){t.text(L2(e.text))},parse:{}}}}}),by=Ce.create({name:"bold"}),yy=by.extend({addStorage(){return{markdown:{serialize:rt.marks.strong,parse:{}}}}}),xy=Ce.create({name:"code"}),ky=xy.extend({addStorage(){return{markdown:{serialize:rt.marks.code,parse:{}}}}}),Cy=Ce.create({name:"italic"}),vy=Cy.extend({addStorage(){return{markdown:{serialize:rt.marks.em,parse:{}}}}}),wy=Ce.create({name:"link"}),Ey=wy.extend({addStorage(){return{markdown:{serialize:rt.marks.link,parse:{}}}}}),Sy=Ce.create({name:"strike"}),Dy=Sy.extend({addStorage(){return{markdown:{serialize:{open:"~~",close:"~~",expelEnclosingWhitespace:!0},parse:{}}}}}),Ay=[j2,yf,J2,xf,Z2,X2,zi,ey,ny,oy,uy,ly,dy,py,gy,yy,ky,bf,vy,Ey,Dy];function yi(t){var e,n;const r=(e=t.storage)===null||e===void 0?void 0:e.markdown,i=(n=Ay.find(o=>o.name===t.name))===null||n===void 0?void 0:n.storage.markdown;return r||i?{...i,...r}:null}class My{constructor(e){bi(this,"editor",null),this.editor=e}serialize(e){const n=new P2(this.nodes,this.marks,{hardBreakNodeName:xf.name});return n.renderContent(e),n.out}get nodes(){var e;return{...Object.fromEntries(Object.keys(this.editor.schema.nodes).map(n=>[n,this.serializeNode(zi)])),...Object.fromEntries((e=this.editor.extensionManager.extensions.filter(n=>n.type==="node"&&this.serializeNode(n)).map(n=>[n.name,this.serializeNode(n)]))!==null&&e!==void 0?e:[])}}get marks(){var e;return{...Object.fromEntries(Object.keys(this.editor.schema.marks).map(n=>[n,this.serializeMark(bf)])),...Object.fromEntries((e=this.editor.extensionManager.extensions.filter(n=>n.type==="mark"&&this.serializeMark(n)).map(n=>[n.name,this.serializeMark(n)]))!==null&&e!==void 0?e:[])}}serializeNode(e){var n;return(n=yi(e))===null||n===void 0||(n=n.serialize)===null||n===void 0?void 0:n.bind({editor:this.editor,options:e.options})}serializeMark(e){var n;const r=(n=yi(e))===null||n===void 0?void 0:n.serialize;return r?{...r,open:typeof r.open=="function"?r.open.bind({editor:this.editor,options:e.options}):r.open,close:typeof r.close=="function"?r.close.bind({editor:this.editor,options:e.options}):r.close}:null}}class Ty{constructor(e,n){bi(this,"editor",null),bi(this,"md",null);let{html:r,linkify:i,breaks:o}=n;this.editor=e,this.md=this.withPatchedRenderer(we({html:r,linkify:i,breaks:o}))}parse(e){let{inline:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof e=="string"){this.editor.extensionManager.extensions.forEach(o=>{var s;return(s=yi(o))===null||s===void 0||(s=s.parse)===null||s===void 0||(s=s.setup)===null||s===void 0?void 0:s.call({editor:this.editor,options:o.options},this.md)});const r=this.md.render(e),i=Is(r);return this.editor.extensionManager.extensions.forEach(o=>{var s;return(s=yi(o))===null||s===void 0||(s=s.parse)===null||s===void 0||(s=s.updateDOM)===null||s===void 0?void 0:s.call({editor:this.editor,options:o.options},i)}),this.normalizeDOM(i,{inline:n,content:e}),i.innerHTML}return e}normalizeDOM(e,n){let{inline:r,content:i}=n;return this.normalizeBlocks(e),e.querySelectorAll("*").forEach(o=>{var s;((s=o.nextSibling)===null||s===void 0?void 0:s.nodeType)===Node.TEXT_NODE&&!o.closest("pre")&&(o.nextSibling.textContent=o.nextSibling.textContent.replace(/^\n/,""))}),r&&this.normalizeInline(e,i),e}normalizeBlocks(e){const r=Object.values(this.editor.schema.nodes).filter(i=>i.isBlock).map(i=>{var o;return(o=i.spec.parseDOM)===null||o===void 0?void 0:o.map(s=>s.tag)}).flat().filter(Boolean).join(",");r&&[...e.querySelectorAll(r)].forEach(i=>{i.parentElement.matches("p")&&z2(i)})}normalizeInline(e,n){var r;if((r=e.firstElementChild)!==null&&r!==void 0&&r.matches("p")){var i,o,s,u;const a=e.firstElementChild,{nextElementSibling:l}=a,c=(i=(o=n.match(/^\s+/))===null||o===void 0?void 0:o[0])!==null&&i!==void 0?i:"",f=l?"":(s=(u=n.match(/\s+$/))===null||u===void 0?void 0:u[0])!==null&&s!==void 0?s:"";if(n.match(/^\n\n/)){a.innerHTML=`${a.innerHTML}${f}`;return}$2(a),e.innerHTML=`${c}${e.innerHTML}${f}`}}withPatchedRenderer(e){const n=r=>function(){const i=r(...arguments);return i===`
`?i:i[i.length-1]===`
`?i.slice(0,-1):i};return e.renderer.rules.hardbreak=n(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=n(e.renderer.rules.softbreak),e.renderer.rules.fence=n(e.renderer.rules.fence),e.renderer.rules.code_block=n(e.renderer.rules.code_block),e.renderer.renderToken=n(e.renderer.renderToken.bind(e.renderer)),e}}const _y=G.create({name:"markdownClipboard",addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new ae({key:new Te("markdownClipboard"),props:{clipboardTextParser:(t,e,n)=>{if(n||!this.options.transformPastedText)return null;const r=this.editor.storage.markdown.parser.parse(t,{inline:!0});return dt.fromSchema(this.editor.schema).parseSlice(Is(r),{preserveWhitespace:!0,context:e})},clipboardTextSerializer:t=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(t.content):null}})]}}),Oy=G.create({name:"markdown",priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:"tight",bulletListMarker:"-",linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){const t=Mm.Commands.config.addCommands();return{setContent:(e,n,r)=>i=>t.setContent(i.editor.storage.markdown.parser.parse(e),n,r)(i),insertContentAt:(e,n,r)=>i=>t.insertContentAt(e,i.editor.storage.markdown.parser.parse(n,{inline:!0}),r)(i)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new Ty(this.editor,this.options),serializer:new My(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage(){return{}},addExtensions(){return[F2.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),_y.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}}),Ny=G.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new ae({key:new Te("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!n)return null;const o=this.editor.isEmpty;return t.descendants((s,u)=>{const a=r>=u&&r<=u+s.nodeSize,l=!s.isLeaf&&Ii(s);if((a||!this.options.showOnlyCurrent)&&l){const c=[this.options.emptyNodeClass];o&&c.push(this.options.emptyEditorClass);const f=Se.node(u,u+s.nodeSize,{class:c.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:u,hasAnchor:a}):this.options.placeholder});i.push(f)}return this.options.includeChildren}),J.create(t,i)}}})]}});var xe="top",Be="bottom",Pe="right",ke="left",Rs="auto",Er=[xe,Be,Pe,ke],On="start",mr="end",Fy="clippingParents",kf="viewport",jn="popper",Iy="reference",Aa=Er.reduce(function(t,e){return t.concat([e+"-"+On,e+"-"+mr])},[]),Cf=[].concat(Er,[Rs]).reduce(function(t,e){return t.concat([e,e+"-"+On,e+"-"+mr])},[]),Ry="beforeRead",By="read",Py="afterRead",Ly="beforeMain",zy="main",$y="afterMain",Vy="beforeWrite",Hy="write",qy="afterWrite",jy=[Ry,By,Py,Ly,zy,$y,Vy,Hy,qy];function et(t){return t?(t.nodeName||"").toLowerCase():null}function Me(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function on(t){var e=Me(t).Element;return t instanceof e||t instanceof Element}function Re(t){var e=Me(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Bs(t){if(typeof ShadowRoot>"u")return!1;var e=Me(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function Wy(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},i=e.attributes[n]||{},o=e.elements[n];!Re(o)||!et(o)||(Object.assign(o.style,r),Object.keys(i).forEach(function(s){var u=i[s];u===!1?o.removeAttribute(s):o.setAttribute(s,u===!0?"":u)}))})}function Uy(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],o=e.attributes[r]||{},s=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),u=s.reduce(function(a,l){return a[l]="",a},{});!Re(i)||!et(i)||(Object.assign(i.style,u),Object.keys(o).forEach(function(a){i.removeAttribute(a)}))})}}const vf={name:"applyStyles",enabled:!0,phase:"write",fn:Wy,effect:Uy,requires:["computeStyles"]};function Ye(t){return t.split("-")[0]}var Qt=Math.max,xi=Math.min,Nn=Math.round;function Zo(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function wf(){return!/^((?!chrome|android).)*safari/i.test(Zo())}function Fn(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),i=1,o=1;e&&Re(t)&&(i=t.offsetWidth>0&&Nn(r.width)/t.offsetWidth||1,o=t.offsetHeight>0&&Nn(r.height)/t.offsetHeight||1);var s=on(t)?Me(t):window,u=s.visualViewport,a=!wf()&&n,l=(r.left+(a&&u?u.offsetLeft:0))/i,c=(r.top+(a&&u?u.offsetTop:0))/o,f=r.width/i,d=r.height/o;return{width:f,height:d,top:c,right:l+f,bottom:c+d,left:l,x:l,y:c}}function Ps(t){var e=Fn(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function Ef(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&Bs(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function mt(t){return Me(t).getComputedStyle(t)}function Jy(t){return["table","td","th"].indexOf(et(t))>=0}function Lt(t){return((on(t)?t.ownerDocument:t.document)||window.document).documentElement}function $i(t){return et(t)==="html"?t:t.assignedSlot||t.parentNode||(Bs(t)?t.host:null)||Lt(t)}function Ma(t){return!Re(t)||mt(t).position==="fixed"?null:t.offsetParent}function Ky(t){var e=/firefox/i.test(Zo()),n=/Trident/i.test(Zo());if(n&&Re(t)){var r=mt(t);if(r.position==="fixed")return null}var i=$i(t);for(Bs(i)&&(i=i.host);Re(i)&&["html","body"].indexOf(et(i))<0;){var o=mt(i);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||e&&o.willChange==="filter"||e&&o.filter&&o.filter!=="none")return i;i=i.parentNode}return null}function Sr(t){for(var e=Me(t),n=Ma(t);n&&Jy(n)&&mt(n).position==="static";)n=Ma(n);return n&&(et(n)==="html"||et(n)==="body"&&mt(n).position==="static")?e:n||Ky(t)||e}function Ls(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Xn(t,e,n){return Qt(t,xi(e,n))}function Gy(t,e,n){var r=Xn(t,e,n);return r>n?n:r}function Sf(){return{top:0,right:0,bottom:0,left:0}}function Df(t){return Object.assign({},Sf(),t)}function Af(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var Zy=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,Df(typeof e!="number"?e:Af(e,Er))};function Yy(t){var e,n=t.state,r=t.name,i=t.options,o=n.elements.arrow,s=n.modifiersData.popperOffsets,u=Ye(n.placement),a=Ls(u),l=[ke,Pe].indexOf(u)>=0,c=l?"height":"width";if(!(!o||!s)){var f=Zy(i.padding,n),d=Ps(o),h=a==="y"?xe:ke,p=a==="y"?Be:Pe,m=n.rects.reference[c]+n.rects.reference[a]-s[a]-n.rects.popper[c],g=s[a]-n.rects.reference[a],y=Sr(o),x=y?a==="y"?y.clientHeight||0:y.clientWidth||0:0,k=m/2-g/2,b=f[h],E=x-d[c]-f[p],C=x/2-d[c]/2+k,S=Xn(b,C,E),M=a;n.modifiersData[r]=(e={},e[M]=S,e.centerOffset=S-C,e)}}function Xy(t){var e=t.state,n=t.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||Ef(e.elements.popper,i)&&(e.elements.arrow=i))}const Qy={name:"arrow",enabled:!0,phase:"main",fn:Yy,effect:Xy,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function In(t){return t.split("-")[1]}var ex={top:"auto",right:"auto",bottom:"auto",left:"auto"};function tx(t,e){var n=t.x,r=t.y,i=e.devicePixelRatio||1;return{x:Nn(n*i)/i||0,y:Nn(r*i)/i||0}}function Ta(t){var e,n=t.popper,r=t.popperRect,i=t.placement,o=t.variation,s=t.offsets,u=t.position,a=t.gpuAcceleration,l=t.adaptive,c=t.roundOffsets,f=t.isFixed,d=s.x,h=d===void 0?0:d,p=s.y,m=p===void 0?0:p,g=typeof c=="function"?c({x:h,y:m}):{x:h,y:m};h=g.x,m=g.y;var y=s.hasOwnProperty("x"),x=s.hasOwnProperty("y"),k=ke,b=xe,E=window;if(l){var C=Sr(n),S="clientHeight",M="clientWidth";if(C===Me(n)&&(C=Lt(n),mt(C).position!=="static"&&u==="absolute"&&(S="scrollHeight",M="scrollWidth")),C=C,i===xe||(i===ke||i===Pe)&&o===mr){b=Be;var O=f&&C===E&&E.visualViewport?E.visualViewport.height:C[S];m-=O-r.height,m*=a?1:-1}if(i===ke||(i===xe||i===Be)&&o===mr){k=Pe;var P=f&&C===E&&E.visualViewport?E.visualViewport.width:C[M];h-=P-r.width,h*=a?1:-1}}var j=Object.assign({position:u},l&&ex),q=c===!0?tx({x:h,y:m},Me(n)):{x:h,y:m};if(h=q.x,m=q.y,a){var H;return Object.assign({},j,(H={},H[b]=x?"0":"",H[k]=y?"0":"",H.transform=(E.devicePixelRatio||1)<=1?"translate("+h+"px, "+m+"px)":"translate3d("+h+"px, "+m+"px, 0)",H))}return Object.assign({},j,(e={},e[b]=x?m+"px":"",e[k]=y?h+"px":"",e.transform="",e))}function nx(t){var e=t.state,n=t.options,r=n.gpuAcceleration,i=r===void 0?!0:r,o=n.adaptive,s=o===void 0?!0:o,u=n.roundOffsets,a=u===void 0?!0:u,l={placement:Ye(e.placement),variation:In(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Ta(Object.assign({},l,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:a})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Ta(Object.assign({},l,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:a})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const rx={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:nx,data:{}};var Kr={passive:!0};function ix(t){var e=t.state,n=t.instance,r=t.options,i=r.scroll,o=i===void 0?!0:i,s=r.resize,u=s===void 0?!0:s,a=Me(e.elements.popper),l=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&l.forEach(function(c){c.addEventListener("scroll",n.update,Kr)}),u&&a.addEventListener("resize",n.update,Kr),function(){o&&l.forEach(function(c){c.removeEventListener("scroll",n.update,Kr)}),u&&a.removeEventListener("resize",n.update,Kr)}}const ox={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:ix,data:{}};var sx={left:"right",right:"left",bottom:"top",top:"bottom"};function ei(t){return t.replace(/left|right|bottom|top/g,function(e){return sx[e]})}var ux={start:"end",end:"start"};function _a(t){return t.replace(/start|end/g,function(e){return ux[e]})}function zs(t){var e=Me(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function $s(t){return Fn(Lt(t)).left+zs(t).scrollLeft}function ax(t,e){var n=Me(t),r=Lt(t),i=n.visualViewport,o=r.clientWidth,s=r.clientHeight,u=0,a=0;if(i){o=i.width,s=i.height;var l=wf();(l||!l&&e==="fixed")&&(u=i.offsetLeft,a=i.offsetTop)}return{width:o,height:s,x:u+$s(t),y:a}}function lx(t){var e,n=Lt(t),r=zs(t),i=(e=t.ownerDocument)==null?void 0:e.body,o=Qt(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=Qt(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),u=-r.scrollLeft+$s(t),a=-r.scrollTop;return mt(i||n).direction==="rtl"&&(u+=Qt(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:s,x:u,y:a}}function Vs(t){var e=mt(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function Mf(t){return["html","body","#document"].indexOf(et(t))>=0?t.ownerDocument.body:Re(t)&&Vs(t)?t:Mf($i(t))}function Qn(t,e){var n;e===void 0&&(e=[]);var r=Mf(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),o=Me(r),s=i?[o].concat(o.visualViewport||[],Vs(r)?r:[]):r,u=e.concat(s);return i?u:u.concat(Qn($i(s)))}function Yo(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function cx(t,e){var n=Fn(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function Oa(t,e,n){return e===kf?Yo(ax(t,n)):on(e)?cx(e,n):Yo(lx(Lt(t)))}function fx(t){var e=Qn($i(t)),n=["absolute","fixed"].indexOf(mt(t).position)>=0,r=n&&Re(t)?Sr(t):t;return on(r)?e.filter(function(i){return on(i)&&Ef(i,r)&&et(i)!=="body"}):[]}function dx(t,e,n,r){var i=e==="clippingParents"?fx(t):[].concat(e),o=[].concat(i,[n]),s=o[0],u=o.reduce(function(a,l){var c=Oa(t,l,r);return a.top=Qt(c.top,a.top),a.right=xi(c.right,a.right),a.bottom=xi(c.bottom,a.bottom),a.left=Qt(c.left,a.left),a},Oa(t,s,r));return u.width=u.right-u.left,u.height=u.bottom-u.top,u.x=u.left,u.y=u.top,u}function Tf(t){var e=t.reference,n=t.element,r=t.placement,i=r?Ye(r):null,o=r?In(r):null,s=e.x+e.width/2-n.width/2,u=e.y+e.height/2-n.height/2,a;switch(i){case xe:a={x:s,y:e.y-n.height};break;case Be:a={x:s,y:e.y+e.height};break;case Pe:a={x:e.x+e.width,y:u};break;case ke:a={x:e.x-n.width,y:u};break;default:a={x:e.x,y:e.y}}var l=i?Ls(i):null;if(l!=null){var c=l==="y"?"height":"width";switch(o){case On:a[l]=a[l]-(e[c]/2-n[c]/2);break;case mr:a[l]=a[l]+(e[c]/2-n[c]/2);break}}return a}function gr(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=r===void 0?t.placement:r,o=n.strategy,s=o===void 0?t.strategy:o,u=n.boundary,a=u===void 0?Fy:u,l=n.rootBoundary,c=l===void 0?kf:l,f=n.elementContext,d=f===void 0?jn:f,h=n.altBoundary,p=h===void 0?!1:h,m=n.padding,g=m===void 0?0:m,y=Df(typeof g!="number"?g:Af(g,Er)),x=d===jn?Iy:jn,k=t.rects.popper,b=t.elements[p?x:d],E=dx(on(b)?b:b.contextElement||Lt(t.elements.popper),a,c,s),C=Fn(t.elements.reference),S=Tf({reference:C,element:k,placement:i}),M=Yo(Object.assign({},k,S)),O=d===jn?M:C,P={top:E.top-O.top+y.top,bottom:O.bottom-E.bottom+y.bottom,left:E.left-O.left+y.left,right:O.right-E.right+y.right},j=t.modifiersData.offset;if(d===jn&&j){var q=j[i];Object.keys(P).forEach(function(H){var le=[Pe,Be].indexOf(H)>=0?1:-1,U=[xe,Be].indexOf(H)>=0?"y":"x";P[H]+=q[U]*le})}return P}function hx(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=n.boundary,o=n.rootBoundary,s=n.padding,u=n.flipVariations,a=n.allowedAutoPlacements,l=a===void 0?Cf:a,c=In(r),f=c?u?Aa:Aa.filter(function(p){return In(p)===c}):Er,d=f.filter(function(p){return l.indexOf(p)>=0});d.length===0&&(d=f);var h=d.reduce(function(p,m){return p[m]=gr(t,{placement:m,boundary:i,rootBoundary:o,padding:s})[Ye(m)],p},{});return Object.keys(h).sort(function(p,m){return h[p]-h[m]})}function px(t){if(Ye(t)===Rs)return[];var e=ei(t);return[_a(t),e,_a(e)]}function mx(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var i=n.mainAxis,o=i===void 0?!0:i,s=n.altAxis,u=s===void 0?!0:s,a=n.fallbackPlacements,l=n.padding,c=n.boundary,f=n.rootBoundary,d=n.altBoundary,h=n.flipVariations,p=h===void 0?!0:h,m=n.allowedAutoPlacements,g=e.options.placement,y=Ye(g),x=y===g,k=a||(x||!p?[ei(g)]:px(g)),b=[g].concat(k).reduce(function(it,Le){return it.concat(Ye(Le)===Rs?hx(e,{placement:Le,boundary:c,rootBoundary:f,padding:l,flipVariations:p,allowedAutoPlacements:m}):Le)},[]),E=e.rects.reference,C=e.rects.popper,S=new Map,M=!0,O=b[0],P=0;P<b.length;P++){var j=b[P],q=Ye(j),H=In(j)===On,le=[xe,Be].indexOf(q)>=0,U=le?"width":"height",Z=gr(e,{placement:j,boundary:c,rootBoundary:f,altBoundary:d,padding:l}),ce=le?H?Pe:ke:H?Be:xe;E[U]>C[U]&&(ce=ei(ce));var ie=ei(ce),He=[];if(o&&He.push(Z[q]<=0),u&&He.push(Z[ce]<=0,Z[ie]<=0),He.every(function(it){return it})){O=j,M=!1;break}S.set(j,He)}if(M)for(var qe=p?3:1,zt=function(Le){var ot=b.find(function(un){var st=S.get(un);if(st)return st.slice(0,Le).every(function(an){return an})});if(ot)return O=ot,"break"},je=qe;je>0;je--){var $t=zt(je);if($t==="break")break}e.placement!==O&&(e.modifiersData[r]._skip=!0,e.placement=O,e.reset=!0)}}const gx={name:"flip",enabled:!0,phase:"main",fn:mx,requiresIfExists:["offset"],data:{_skip:!1}};function Na(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function Fa(t){return[xe,Pe,Be,ke].some(function(e){return t[e]>=0})}function bx(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,o=e.modifiersData.preventOverflow,s=gr(e,{elementContext:"reference"}),u=gr(e,{altBoundary:!0}),a=Na(s,r),l=Na(u,i,o),c=Fa(a),f=Fa(l);e.modifiersData[n]={referenceClippingOffsets:a,popperEscapeOffsets:l,isReferenceHidden:c,hasPopperEscaped:f},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":f})}const yx={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:bx};function xx(t,e,n){var r=Ye(t),i=[ke,xe].indexOf(r)>=0?-1:1,o=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,s=o[0],u=o[1];return s=s||0,u=(u||0)*i,[ke,Pe].indexOf(r)>=0?{x:u,y:s}:{x:s,y:u}}function kx(t){var e=t.state,n=t.options,r=t.name,i=n.offset,o=i===void 0?[0,0]:i,s=Cf.reduce(function(c,f){return c[f]=xx(f,e.rects,o),c},{}),u=s[e.placement],a=u.x,l=u.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=a,e.modifiersData.popperOffsets.y+=l),e.modifiersData[r]=s}const Cx={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:kx};function vx(t){var e=t.state,n=t.name;e.modifiersData[n]=Tf({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const wx={name:"popperOffsets",enabled:!0,phase:"read",fn:vx,data:{}};function Ex(t){return t==="x"?"y":"x"}function Sx(t){var e=t.state,n=t.options,r=t.name,i=n.mainAxis,o=i===void 0?!0:i,s=n.altAxis,u=s===void 0?!1:s,a=n.boundary,l=n.rootBoundary,c=n.altBoundary,f=n.padding,d=n.tether,h=d===void 0?!0:d,p=n.tetherOffset,m=p===void 0?0:p,g=gr(e,{boundary:a,rootBoundary:l,padding:f,altBoundary:c}),y=Ye(e.placement),x=In(e.placement),k=!x,b=Ls(y),E=Ex(b),C=e.modifiersData.popperOffsets,S=e.rects.reference,M=e.rects.popper,O=typeof m=="function"?m(Object.assign({},e.rects,{placement:e.placement})):m,P=typeof O=="number"?{mainAxis:O,altAxis:O}:Object.assign({mainAxis:0,altAxis:0},O),j=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,q={x:0,y:0};if(C){if(o){var H,le=b==="y"?xe:ke,U=b==="y"?Be:Pe,Z=b==="y"?"height":"width",ce=C[b],ie=ce+g[le],He=ce-g[U],qe=h?-M[Z]/2:0,zt=x===On?S[Z]:M[Z],je=x===On?-M[Z]:-S[Z],$t=e.elements.arrow,it=h&&$t?Ps($t):{width:0,height:0},Le=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Sf(),ot=Le[le],un=Le[U],st=Xn(0,S[Z],it[Z]),an=k?S[Z]/2-qe-st-ot-P.mainAxis:zt-st-ot-P.mainAxis,gt=k?-S[Z]/2+qe+st+un+P.mainAxis:je+st+un+P.mainAxis,ln=e.elements.arrow&&Sr(e.elements.arrow),Ar=ln?b==="y"?ln.clientTop||0:ln.clientLeft||0:0,Pn=(H=j==null?void 0:j[b])!=null?H:0,Mr=ce+an-Pn-Ar,Tr=ce+gt-Pn,Ln=Xn(h?xi(ie,Mr):ie,ce,h?Qt(He,Tr):He);C[b]=Ln,q[b]=Ln-ce}if(u){var zn,_r=b==="x"?xe:ke,Or=b==="x"?Be:Pe,ut=C[E],bt=E==="y"?"height":"width",$n=ut+g[_r],Vt=ut-g[Or],Vn=[xe,ke].indexOf(y)!==-1,Nr=(zn=j==null?void 0:j[E])!=null?zn:0,Fr=Vn?$n:ut-S[bt]-M[bt]-Nr+P.altAxis,Ir=Vn?ut+S[bt]+M[bt]-Nr-P.altAxis:Vt,Rr=h&&Vn?Gy(Fr,ut,Ir):Xn(h?Fr:$n,ut,h?Ir:Vt);C[E]=Rr,q[E]=Rr-ut}e.modifiersData[r]=q}}const Dx={name:"preventOverflow",enabled:!0,phase:"main",fn:Sx,requiresIfExists:["offset"]};function Ax(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function Mx(t){return t===Me(t)||!Re(t)?zs(t):Ax(t)}function Tx(t){var e=t.getBoundingClientRect(),n=Nn(e.width)/t.offsetWidth||1,r=Nn(e.height)/t.offsetHeight||1;return n!==1||r!==1}function _x(t,e,n){n===void 0&&(n=!1);var r=Re(e),i=Re(e)&&Tx(e),o=Lt(e),s=Fn(t,i,n),u={scrollLeft:0,scrollTop:0},a={x:0,y:0};return(r||!r&&!n)&&((et(e)!=="body"||Vs(o))&&(u=Mx(e)),Re(e)?(a=Fn(e,!0),a.x+=e.clientLeft,a.y+=e.clientTop):o&&(a.x=$s(o))),{x:s.left+u.scrollLeft-a.x,y:s.top+u.scrollTop-a.y,width:s.width,height:s.height}}function Ox(t){var e=new Map,n=new Set,r=[];t.forEach(function(o){e.set(o.name,o)});function i(o){n.add(o.name);var s=[].concat(o.requires||[],o.requiresIfExists||[]);s.forEach(function(u){if(!n.has(u)){var a=e.get(u);a&&i(a)}}),r.push(o)}return t.forEach(function(o){n.has(o.name)||i(o)}),r}function Nx(t){var e=Ox(t);return jy.reduce(function(n,r){return n.concat(e.filter(function(i){return i.phase===r}))},[])}function Fx(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function Ix(t){var e=t.reduce(function(n,r){var i=n[r.name];return n[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var Ia={placement:"bottom",modifiers:[],strategy:"absolute"};function Ra(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function Rx(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,i=e.defaultOptions,o=i===void 0?Ia:i;return function(u,a,l){l===void 0&&(l=o);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},Ia,o),modifiersData:{},elements:{reference:u,popper:a},attributes:{},styles:{}},f=[],d=!1,h={state:c,setOptions:function(y){var x=typeof y=="function"?y(c.options):y;m(),c.options=Object.assign({},o,c.options,x),c.scrollParents={reference:on(u)?Qn(u):u.contextElement?Qn(u.contextElement):[],popper:Qn(a)};var k=Nx(Ix([].concat(r,c.options.modifiers)));return c.orderedModifiers=k.filter(function(b){return b.enabled}),p(),h.update()},forceUpdate:function(){if(!d){var y=c.elements,x=y.reference,k=y.popper;if(Ra(x,k)){c.rects={reference:_x(x,Sr(k),c.options.strategy==="fixed"),popper:Ps(k)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(P){return c.modifiersData[P.name]=Object.assign({},P.data)});for(var b=0;b<c.orderedModifiers.length;b++){if(c.reset===!0){c.reset=!1,b=-1;continue}var E=c.orderedModifiers[b],C=E.fn,S=E.options,M=S===void 0?{}:S,O=E.name;typeof C=="function"&&(c=C({state:c,options:M,name:O,instance:h})||c)}}}},update:Fx(function(){return new Promise(function(g){h.forceUpdate(),g(c)})}),destroy:function(){m(),d=!0}};if(!Ra(u,a))return h;h.setOptions(l).then(function(g){!d&&l.onFirstUpdate&&l.onFirstUpdate(g)});function p(){c.orderedModifiers.forEach(function(g){var y=g.name,x=g.options,k=x===void 0?{}:x,b=g.effect;if(typeof b=="function"){var E=b({state:c,name:y,instance:h,options:k}),C=function(){};f.push(E||C)}})}function m(){f.forEach(function(g){return g()}),f=[]}return h}}var Bx=[ox,wx,rx,vf,Cx,gx,Dx,Qy,yx],Px=Rx({defaultModifiers:Bx}),Lx="tippy-box",_f="tippy-content",zx="tippy-backdrop",Of="tippy-arrow",Nf="tippy-svg-arrow",qt={passive:!0,capture:!0},Ff=function(){return document.body};function vo(t,e,n){if(Array.isArray(t)){var r=t[e];return r??(Array.isArray(n)?n[e]:n)}return t}function Hs(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function If(t,e){return typeof t=="function"?t.apply(void 0,e):t}function Ba(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function $x(t){return t.split(/\s+/).filter(Boolean)}function bn(t){return[].concat(t)}function Pa(t,e){t.indexOf(e)===-1&&t.push(e)}function Vx(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function Hx(t){return t.split("-")[0]}function ki(t){return[].slice.call(t)}function La(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function er(){return document.createElement("div")}function Vi(t){return["Element","Fragment"].some(function(e){return Hs(t,e)})}function qx(t){return Hs(t,"NodeList")}function jx(t){return Hs(t,"MouseEvent")}function Wx(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function Ux(t){return Vi(t)?[t]:qx(t)?ki(t):Array.isArray(t)?t:ki(document.querySelectorAll(t))}function wo(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function za(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function Jx(t){var e,n=bn(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function Kx(t,e){var n=e.clientX,r=e.clientY;return t.every(function(i){var o=i.popperRect,s=i.popperState,u=i.props,a=u.interactiveBorder,l=Hx(s.placement),c=s.modifiersData.offset;if(!c)return!0;var f=l==="bottom"?c.top.y:0,d=l==="top"?c.bottom.y:0,h=l==="right"?c.left.x:0,p=l==="left"?c.right.x:0,m=o.top-r+f>a,g=r-o.bottom-d>a,y=o.left-n+h>a,x=n-o.right-p>a;return m||g||y||x})}function Eo(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){t[r](i,n)})}function $a(t,e){for(var n=e;n;){var r;if(t.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var Je={isTouch:!1},Va=0;function Gx(){Je.isTouch||(Je.isTouch=!0,window.performance&&document.addEventListener("mousemove",Rf))}function Rf(){var t=performance.now();t-Va<20&&(Je.isTouch=!1,document.removeEventListener("mousemove",Rf)),Va=t}function Zx(){var t=document.activeElement;if(Wx(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function Yx(){document.addEventListener("touchstart",Gx,qt),window.addEventListener("blur",Zx)}var Xx=typeof window<"u"&&typeof document<"u",Qx=Xx?!!window.msCrypto:!1,e3={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},t3={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},$e=Object.assign({appendTo:Ff,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},e3,t3),n3=Object.keys($e),r3=function(e){var n=Object.keys(e);n.forEach(function(r){$e[r]=e[r]})};function Bf(t){var e=t.plugins||[],n=e.reduce(function(r,i){var o=i.name,s=i.defaultValue;if(o){var u;r[o]=t[o]!==void 0?t[o]:(u=$e[o])!=null?u:s}return r},{});return Object.assign({},t,n)}function i3(t,e){var n=e?Object.keys(Bf(Object.assign({},$e,{plugins:e}))):n3,r=n.reduce(function(i,o){var s=(t.getAttribute("data-tippy-"+o)||"").trim();if(!s)return i;if(o==="content")i[o]=s;else try{i[o]=JSON.parse(s)}catch{i[o]=s}return i},{});return r}function Ha(t,e){var n=Object.assign({},e,{content:If(e.content,[t])},e.ignoreAttributes?{}:i3(t,e.plugins));return n.aria=Object.assign({},$e.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?e.interactive:n.aria.expanded,content:n.aria.content==="auto"?e.interactive?null:"describedby":n.aria.content},n}var o3=function(){return"innerHTML"};function Xo(t,e){t[o3()]=e}function qa(t){var e=er();return t===!0?e.className=Of:(e.className=Nf,Vi(t)?e.appendChild(t):Xo(e,t)),e}function ja(t,e){Vi(e.content)?(Xo(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Xo(t,e.content):t.textContent=e.content)}function Qo(t){var e=t.firstElementChild,n=ki(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(_f)}),arrow:n.find(function(r){return r.classList.contains(Of)||r.classList.contains(Nf)}),backdrop:n.find(function(r){return r.classList.contains(zx)})}}function Pf(t){var e=er(),n=er();n.className=Lx,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=er();r.className=_f,r.setAttribute("data-state","hidden"),ja(r,t.props),e.appendChild(n),n.appendChild(r),i(t.props,t.props);function i(o,s){var u=Qo(e),a=u.box,l=u.content,c=u.arrow;s.theme?a.setAttribute("data-theme",s.theme):a.removeAttribute("data-theme"),typeof s.animation=="string"?a.setAttribute("data-animation",s.animation):a.removeAttribute("data-animation"),s.inertia?a.setAttribute("data-inertia",""):a.removeAttribute("data-inertia"),a.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?a.setAttribute("role",s.role):a.removeAttribute("role"),(o.content!==s.content||o.allowHTML!==s.allowHTML)&&ja(l,t.props),s.arrow?c?o.arrow!==s.arrow&&(a.removeChild(c),a.appendChild(qa(s.arrow))):a.appendChild(qa(s.arrow)):c&&a.removeChild(c)}return{popper:e,onUpdate:i}}Pf.$$tippy=!0;var s3=1,Gr=[],So=[];function u3(t,e){var n=Ha(t,Object.assign({},$e,Bf(La(e)))),r,i,o,s=!1,u=!1,a=!1,l=!1,c,f,d,h=[],p=Ba(Mr,n.interactiveDebounce),m,g=s3++,y=null,x=Vx(n.plugins),k={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},b={id:g,reference:t,popper:er(),popperInstance:y,props:n,state:k,plugins:x,clearDelayTimeouts:Fr,setProps:Ir,setContent:Rr,show:zf,hide:$f,hideWithInteractivity:Vf,enable:Vn,disable:Nr,unmount:Hf,destroy:qf};if(!n.render)return b;var E=n.render(b),C=E.popper,S=E.onUpdate;C.setAttribute("data-tippy-root",""),C.id="tippy-"+b.id,b.popper=C,t._tippy=b,C._tippy=b;var M=x.map(function(v){return v.fn(b)}),O=t.hasAttribute("aria-expanded");return ln(),qe(),ce(),ie("onCreate",[b]),n.showOnCreate&&$n(),C.addEventListener("mouseenter",function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),C.addEventListener("mouseleave",function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&le().addEventListener("mousemove",p)}),b;function P(){var v=b.props.touch;return Array.isArray(v)?v:[v,0]}function j(){return P()[0]==="hold"}function q(){var v;return!!((v=b.props.render)!=null&&v.$$tippy)}function H(){return m||t}function le(){var v=H().parentNode;return v?Jx(v):document}function U(){return Qo(C)}function Z(v){return b.state.isMounted&&!b.state.isVisible||Je.isTouch||c&&c.type==="focus"?0:vo(b.props.delay,v?0:1,$e.delay)}function ce(v){v===void 0&&(v=!1),C.style.pointerEvents=b.props.interactive&&!v?"":"none",C.style.zIndex=""+b.props.zIndex}function ie(v,T,N){if(N===void 0&&(N=!0),M.forEach(function(B){B[v]&&B[v].apply(B,T)}),N){var z;(z=b.props)[v].apply(z,T)}}function He(){var v=b.props.aria;if(v.content){var T="aria-"+v.content,N=C.id,z=bn(b.props.triggerTarget||t);z.forEach(function(B){var pe=B.getAttribute(T);if(b.state.isVisible)B.setAttribute(T,pe?pe+" "+N:N);else{var _e=pe&&pe.replace(N,"").trim();_e?B.setAttribute(T,_e):B.removeAttribute(T)}})}}function qe(){if(!(O||!b.props.aria.expanded)){var v=bn(b.props.triggerTarget||t);v.forEach(function(T){b.props.interactive?T.setAttribute("aria-expanded",b.state.isVisible&&T===H()?"true":"false"):T.removeAttribute("aria-expanded")})}}function zt(){le().removeEventListener("mousemove",p),Gr=Gr.filter(function(v){return v!==p})}function je(v){if(!(Je.isTouch&&(a||v.type==="mousedown"))){var T=v.composedPath&&v.composedPath()[0]||v.target;if(!(b.props.interactive&&$a(C,T))){if(bn(b.props.triggerTarget||t).some(function(N){return $a(N,T)})){if(Je.isTouch||b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else ie("onClickOutside",[b,v]);b.props.hideOnClick===!0&&(b.clearDelayTimeouts(),b.hide(),u=!0,setTimeout(function(){u=!1}),b.state.isMounted||ot())}}}function $t(){a=!0}function it(){a=!1}function Le(){var v=le();v.addEventListener("mousedown",je,!0),v.addEventListener("touchend",je,qt),v.addEventListener("touchstart",it,qt),v.addEventListener("touchmove",$t,qt)}function ot(){var v=le();v.removeEventListener("mousedown",je,!0),v.removeEventListener("touchend",je,qt),v.removeEventListener("touchstart",it,qt),v.removeEventListener("touchmove",$t,qt)}function un(v,T){an(v,function(){!b.state.isVisible&&C.parentNode&&C.parentNode.contains(C)&&T()})}function st(v,T){an(v,T)}function an(v,T){var N=U().box;function z(B){B.target===N&&(Eo(N,"remove",z),T())}if(v===0)return T();Eo(N,"remove",f),Eo(N,"add",z),f=z}function gt(v,T,N){N===void 0&&(N=!1);var z=bn(b.props.triggerTarget||t);z.forEach(function(B){B.addEventListener(v,T,N),h.push({node:B,eventType:v,handler:T,options:N})})}function ln(){j()&&(gt("touchstart",Pn,{passive:!0}),gt("touchend",Tr,{passive:!0})),$x(b.props.trigger).forEach(function(v){if(v!=="manual")switch(gt(v,Pn),v){case"mouseenter":gt("mouseleave",Tr);break;case"focus":gt(Qx?"focusout":"blur",Ln);break;case"focusin":gt("focusout",Ln);break}})}function Ar(){h.forEach(function(v){var T=v.node,N=v.eventType,z=v.handler,B=v.options;T.removeEventListener(N,z,B)}),h=[]}function Pn(v){var T,N=!1;if(!(!b.state.isEnabled||zn(v)||u)){var z=((T=c)==null?void 0:T.type)==="focus";c=v,m=v.currentTarget,qe(),!b.state.isVisible&&jx(v)&&Gr.forEach(function(B){return B(v)}),v.type==="click"&&(b.props.trigger.indexOf("mouseenter")<0||s)&&b.props.hideOnClick!==!1&&b.state.isVisible?N=!0:$n(v),v.type==="click"&&(s=!N),N&&!z&&Vt(v)}}function Mr(v){var T=v.target,N=H().contains(T)||C.contains(T);if(!(v.type==="mousemove"&&N)){var z=bt().concat(C).map(function(B){var pe,_e=B._tippy,cn=(pe=_e.popperInstance)==null?void 0:pe.state;return cn?{popperRect:B.getBoundingClientRect(),popperState:cn,props:n}:null}).filter(Boolean);Kx(z,v)&&(zt(),Vt(v))}}function Tr(v){var T=zn(v)||b.props.trigger.indexOf("click")>=0&&s;if(!T){if(b.props.interactive){b.hideWithInteractivity(v);return}Vt(v)}}function Ln(v){b.props.trigger.indexOf("focusin")<0&&v.target!==H()||b.props.interactive&&v.relatedTarget&&C.contains(v.relatedTarget)||Vt(v)}function zn(v){return Je.isTouch?j()!==v.type.indexOf("touch")>=0:!1}function _r(){Or();var v=b.props,T=v.popperOptions,N=v.placement,z=v.offset,B=v.getReferenceClientRect,pe=v.moveTransition,_e=q()?Qo(C).arrow:null,cn=B?{getBoundingClientRect:B,contextElement:B.contextElement||H()}:t,qs={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Br){var fn=Br.state;if(q()){var jf=U(),qi=jf.box;["placement","reference-hidden","escaped"].forEach(function(Pr){Pr==="placement"?qi.setAttribute("data-placement",fn.placement):fn.attributes.popper["data-popper-"+Pr]?qi.setAttribute("data-"+Pr,""):qi.removeAttribute("data-"+Pr)}),fn.attributes.popper={}}}},Ht=[{name:"offset",options:{offset:z}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!pe}},qs];q()&&_e&&Ht.push({name:"arrow",options:{element:_e,padding:3}}),Ht.push.apply(Ht,(T==null?void 0:T.modifiers)||[]),b.popperInstance=Px(cn,C,Object.assign({},T,{placement:N,onFirstUpdate:d,modifiers:Ht}))}function Or(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function ut(){var v=b.props.appendTo,T,N=H();b.props.interactive&&v===Ff||v==="parent"?T=N.parentNode:T=If(v,[N]),T.contains(C)||T.appendChild(C),b.state.isMounted=!0,_r()}function bt(){return ki(C.querySelectorAll("[data-tippy-root]"))}function $n(v){b.clearDelayTimeouts(),v&&ie("onTrigger",[b,v]),Le();var T=Z(!0),N=P(),z=N[0],B=N[1];Je.isTouch&&z==="hold"&&B&&(T=B),T?r=setTimeout(function(){b.show()},T):b.show()}function Vt(v){if(b.clearDelayTimeouts(),ie("onUntrigger",[b,v]),!b.state.isVisible){ot();return}if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(v.type)>=0&&s)){var T=Z(!1);T?i=setTimeout(function(){b.state.isVisible&&b.hide()},T):o=requestAnimationFrame(function(){b.hide()})}}function Vn(){b.state.isEnabled=!0}function Nr(){b.hide(),b.state.isEnabled=!1}function Fr(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(o)}function Ir(v){if(!b.state.isDestroyed){ie("onBeforeUpdate",[b,v]),Ar();var T=b.props,N=Ha(t,Object.assign({},T,La(v),{ignoreAttributes:!0}));b.props=N,ln(),T.interactiveDebounce!==N.interactiveDebounce&&(zt(),p=Ba(Mr,N.interactiveDebounce)),T.triggerTarget&&!N.triggerTarget?bn(T.triggerTarget).forEach(function(z){z.removeAttribute("aria-expanded")}):N.triggerTarget&&t.removeAttribute("aria-expanded"),qe(),ce(),S&&S(T,N),b.popperInstance&&(_r(),bt().forEach(function(z){requestAnimationFrame(z._tippy.popperInstance.forceUpdate)})),ie("onAfterUpdate",[b,v])}}function Rr(v){b.setProps({content:v})}function zf(){var v=b.state.isVisible,T=b.state.isDestroyed,N=!b.state.isEnabled,z=Je.isTouch&&!b.props.touch,B=vo(b.props.duration,0,$e.duration);if(!(v||T||N||z)&&!H().hasAttribute("disabled")&&(ie("onShow",[b],!1),b.props.onShow(b)!==!1)){if(b.state.isVisible=!0,q()&&(C.style.visibility="visible"),ce(),Le(),b.state.isMounted||(C.style.transition="none"),q()){var pe=U(),_e=pe.box,cn=pe.content;wo([_e,cn],0)}d=function(){var Ht;if(!(!b.state.isVisible||l)){if(l=!0,C.offsetHeight,C.style.transition=b.props.moveTransition,q()&&b.props.animation){var Hi=U(),Br=Hi.box,fn=Hi.content;wo([Br,fn],B),za([Br,fn],"visible")}He(),qe(),Pa(So,b),(Ht=b.popperInstance)==null||Ht.forceUpdate(),ie("onMount",[b]),b.props.animation&&q()&&st(B,function(){b.state.isShown=!0,ie("onShown",[b])})}},ut()}}function $f(){var v=!b.state.isVisible,T=b.state.isDestroyed,N=!b.state.isEnabled,z=vo(b.props.duration,1,$e.duration);if(!(v||T||N)&&(ie("onHide",[b],!1),b.props.onHide(b)!==!1)){if(b.state.isVisible=!1,b.state.isShown=!1,l=!1,s=!1,q()&&(C.style.visibility="hidden"),zt(),ot(),ce(!0),q()){var B=U(),pe=B.box,_e=B.content;b.props.animation&&(wo([pe,_e],z),za([pe,_e],"hidden"))}He(),qe(),b.props.animation?q()&&un(z,b.unmount):b.unmount()}}function Vf(v){le().addEventListener("mousemove",p),Pa(Gr,p),p(v)}function Hf(){b.state.isVisible&&b.hide(),b.state.isMounted&&(Or(),bt().forEach(function(v){v._tippy.unmount()}),C.parentNode&&C.parentNode.removeChild(C),So=So.filter(function(v){return v!==b}),b.state.isMounted=!1,ie("onHidden",[b]))}function qf(){b.state.isDestroyed||(b.clearDelayTimeouts(),b.unmount(),Ar(),delete t._tippy,b.state.isDestroyed=!0,ie("onDestroy",[b]))}}function Dr(t,e){e===void 0&&(e={});var n=$e.plugins.concat(e.plugins||[]);Yx();var r=Object.assign({},e,{plugins:n}),i=Ux(t),o=i.reduce(function(s,u){var a=u&&u3(u,r);return a&&s.push(a),s},[]);return Vi(t)?o[0]:o}Dr.defaultProps=$e;Dr.setDefaultProps=r3;Dr.currentInput=Je;Object.assign({},vf,{effect:function(e){var n=e.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}});Dr.setDefaultProps({render:Pf});class a3{constructor({editor:e,element:n,view:r,tippyOptions:i={},updateDelay:o=250,shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:u,state:a,from:l,to:c})=>{const{doc:f,selection:d}=a,{empty:h}=d,p=!f.textBetween(l,c).length&&vs(a.selection),m=this.element.contains(document.activeElement);return!(!(u.hasFocus()||m)||h||p||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var a;if(this.preventHide){this.preventHide=!1;return}u!=null&&u.relatedTarget&&(!((a=this.element.parentNode)===null||a===void 0)&&a.contains(u.relatedTarget))||(u==null?void 0:u.relatedTarget)!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=u=>{this.blurHandler({event:u})},this.handleDebouncedUpdate=(u,a)=>{const l=!(a!=null&&a.selection.eq(u.state.selection)),c=!(a!=null&&a.doc.eq(u.state.doc));!l&&!c||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(u,l,c,a)},this.updateDelay))},this.updateHandler=(u,a,l,c)=>{var f,d,h;const{state:p,composing:m}=u,{selection:g}=p;if(m||!a&&!l)return;this.createTooltip();const{ranges:x}=g,k=Math.min(...x.map(C=>C.$from.pos)),b=Math.max(...x.map(C=>C.$to.pos));if(!((f=this.shouldShow)===null||f===void 0?void 0:f.call(this,{editor:this.editor,element:this.element,view:u,state:p,oldState:c,from:k,to:b}))){this.hide();return}(d=this.tippy)===null||d===void 0||d.setProps({getReferenceClientRect:((h=this.tippyOptions)===null||h===void 0?void 0:h.getReferenceClientRect)||(()=>{if(Mc(p.selection)){let C=u.nodeDOM(k);if(C){const S=C.dataset.nodeViewWrapper?C:C.querySelector("[data-node-view-wrapper]");if(S&&(C=S.firstChild),C)return C.getBoundingClientRect()}}return um(u,k,b)})}),this.show()},this.editor=e,this.element=n,this.view=r,this.updateDelay=o,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.element.tabIndex=0,!(this.tippy||!n)&&(this.tippy=Dr(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){const{state:r}=e,i=r.selection.from!==r.selection.to;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(e,n);return}const o=!(n!=null&&n.selection.eq(e.state.selection)),s=!(n!=null&&n.doc.eq(e.state.doc));this.updateHandler(e,o,s,n)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const l3=t=>new ae({key:typeof t.pluginKey=="string"?new Te(t.pluginKey):t.pluginKey,view:e=>new a3({view:e,...t})}),c3=G.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[l3({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}}),f3=document.getElementById("editor-config"),yt=document.getElementById("save-btn"),d3=document.getElementById("editor-container"),h3=document.getElementById("bubble-menu"),Lf=f3.dataset,p3=Lf.getUrl,m3=Lf.saveUrl;let Ue;function g3(t){let e=null;if(document.cookie&&document.cookie!==""){const n=document.cookie.split(";");for(let r=0;r<n.length;r++){const i=n[r].trim();if(i.substring(0,t.length+1)===t+"="){e=decodeURIComponent(i.substring(t.length+1));break}}}return e}function b3(t){const e=document.getElementById("btn-bold"),n=document.getElementById("btn-italic"),r=document.getElementById("btn-strike"),i=document.getElementById("btn-code");Ue=new Om({element:document.querySelector("#editor"),extensions:[F1,Oy,Ny.configure({placeholder:"Type '/' for commands..."}),c3.configure({element:h3,tippyOptions:{duration:100}})],content:t,editorProps:{attributes:{class:"prose prose-sm sm:prose lg:prose-lg max-w-none focus:outline-none"}},onSelectionUpdate({editor:o}){e.classList.toggle("is-active",o.isActive("bold")),n.classList.toggle("is-active",o.isActive("italic")),r.classList.toggle("is-active",o.isActive("strike")),i.classList.toggle("is-active",o.isActive("code"))}}),e.addEventListener("click",()=>Ue.chain().focus().toggleBold().run()),n.addEventListener("click",()=>Ue.chain().focus().toggleItalic().run()),r.addEventListener("click",()=>Ue.chain().focus().toggleStrike().run()),i.addEventListener("click",()=>Ue.chain().focus().toggleCode().run()),d3.addEventListener("click",()=>{Ue&&!Ue.isFocused&&Ue.chain().focus().run()})}async function y3(){try{const e=await(await fetch(p3)).json();b3(e.content||"")}catch(t){console.error("Error loading file:",t),document.getElementById("editor").innerHTML='<div class="p-4 text-red-500">Error loading content</div>'}}yt.addEventListener("click",async()=>{if(!Ue)return;yt.disabled=!0,yt.textContent="Saving...";const t=Ue.storage.markdown.getMarkdown();try{if((await fetch(m3,{method:"POST",headers:{"Content-Type":"application/json","X-CSRFToken":g3("csrftoken")},body:JSON.stringify({content:t})})).ok)yt.textContent="Saved!",setTimeout(()=>{yt.textContent="Save Changes",yt.disabled=!1},1e3);else throw new Error("Save failed")}catch{alert("Failed to save file"),yt.textContent="Save Changes",yt.disabled=!1}});y3();